INNER CODE UNIT · Python
create_app
CronusL-1141/AI-company · src/aiteam/api/app.py:142
def create_app() -> FastAPI:
"""Create a FastAPI application instance."""
app = FastAPI(
title="AI Team OS",
description="通用可复用的AI Agent团队操作系统 API",
version=__version__,
lifespan=lifespan,
)
# Debug file logging
from aiteam.api.debug_log import setup_debug_log
setup_debug_log()
# L1 input guardrails. 后加的中间件包在外层;这里最先加,所以在最内层:实际顺序是
# Diagnostics -> CORS -> SQLite -> Ledger -> Guardrail,扫描发生在 DB 限流放行之后、路由之前。
from aiteam.api.middleware import InputGuardrailMiddleware, SQLiteConcurrencyMiddleware
app.add_middleware(InputGuardrailMiddleware)