Customize

Customize AgentOS application routes, middleware, dependencies, lifecycle, and response handling.

Customize the FastAPI application, lifecycle, routes, and response handling around AgentOS.

ExamplePurpose
BasicSupply a custom FastAPI application.
CORS and security keyConfigure browser origins and a shared security key.
Custom eventsEmit application events from a tool.
MiddlewareAdd request middleware.
DependenciesPass per-request values into agent instruction templates.
LifespanCombine application startup and shutdown with AgentOS.
Response middlewareObserve JSON and SSE response bodies.
Route conflictsChoose precedence for overlapping routes.