dataflow.api.app¶
Haive API Application Module.
This module defines and configures the FastAPI application for the Haive framework. It sets up middleware, routes, and the core API functionality.
The API provides RESTful and WebSocket endpoints for interacting with the Haive registry, agents, conversations, and LLM models. It includes authentication, request logging, and rate limiting middleware.
It also provides WebSocket endpoints for streaming game agent states, with dynamic discovery of available games from the haive-games package.
Typical usage example:
from haive.dataflow.api.app import app import uvicorn
- if __name__ == “__main__”:
uvicorn.run(app, host=”0.0.0.0”, port=8000)
Functions¶
Create and configure the FastAPI application. |
|
|
Validation Exception Handler. |
Module Contents¶
- dataflow.api.app.create_app()¶
Create and configure the FastAPI application.
This function creates a new FastAPI application instance, configures middleware for CORS, authentication, logging, and rate limiting, and registers the API routes for agents, conversations, LLM models, and game agents.
The application configuration is loaded from settings, allowing for environment-specific customization.
- Returns:
A configured FastAPI application instance ready to serve requests.
- Return type:
FastAPI
Examples
>>> app = create_app() >>> # Run the app with Uvicorn >>> import uvicorn >>> uvicorn.run(app, host="0.0.0.0", port=8000)
- async dataflow.api.app.validation_exception_handler(request, exc)¶
Validation Exception Handler.
- Parameters:
request – [TODO: Add description]
exc – [TODO: Add description]