from fastapi import FastAPI from app.api.routes import router from app.bootstrap.settings import ApiGatewaySettings from app.db.session import build_session_factory from app.infrastructure.request_context import GatewayRequestContextMiddleware def create_app() -> FastAPI: settings = ApiGatewaySettings() app = FastAPI( title="agent-platform api-gateway", version="0.1.0", ) app.state.settings = settings app.state.session_factory = build_session_factory(settings) app.add_middleware(GatewayRequestContextMiddleware) app.include_router(router) return app