The running FastAPI process that composes
analyst-modelandanalyst-agentbehind a single HTTP interface
participant client
participant server
database timescaledb
client -> server: GET /historical?start=2024-01-01&end=2024-12-31&metrics=solar_mw
server -> timescaledb: SELECT * FROM solar_generation WHERE timestamp BETWEEN...
timescaledb -> server: historical data
server -> client: JSON response with timeseries dataparticipant client
participant server
database mlflow
client -> server: POST /predictions {"horizon": "24h", "features": {...}}
server -> mlflow: load latest solar forecast model
mlflow -> server: model artifacts
server -> server: generate predictions
server -> client: JSON response with forecast dataparticipant client
participant server
participant agent
client -> server: POST /chat {"message": "What's the solar forecast?", "session_id": "123"}
server -> agent: chat_completion(message, session_id)
agent -> agent: RAG + knowledge graph + external APIs
agent -> server: AI response
server -> client: JSON response with chat completion├── pyproject.toml # Dependencies and build config
├── src/
│ ├── main.py # FastAPI application entry point
│ ├── app.py # Application factory and configuration
│ ├── models.py # Pydantic request/response models
│ ├── database.py # Database connections
│ ├── historical/
│ │ ├── historical_controller.py # Historical data endpoints
│ │ └── historical_service.py # TimescaleDB service
│ ├── predictions/
│ │ └── predictions_controller.py # Prediction endpoints (MLflow integration)
│ └── chat/
│ └── chat_controller.py # Chat completion endpoints (agent integration)
├── tests/
│ └── test_integration.py # FastAPI TestClient integration tests
└── README.md # This file
-
TIMESCALEDB_URL: TimescaleDB connection string -
MLFLOW_TRACKING_URI: MLflow server URL -
AGENT_CONFIG: Agent package configuration
-
energy-analyst-agent: Installed as Python package for chat completions
-
FastAPI: Web framework with automatic OpenAPI documentation
-
TimescaleDB: Time-series database for historical data
-
MLflow: Model registry and serving