Learn how to use your own FastAPI app in your AgentOS
AgentOS is built on FastAPI, which means you can easily integrate your existing FastAPI applications or add custom routes and routers to extend your agent’s capabilities.
The simplest way to bring your own FastAPI app is to pass it to the AgentOS constructor:
Copy
Ask AI
from fastapi import FastAPIfrom agno.agent import Agentfrom agno.models.openai import OpenAIChatfrom agno.os import AgentOS# Create your custom FastAPI appapp = FastAPI(title="My Custom App")# Add your custom routes@app.get("/status")async def status_check(): return {"status": "healthy"}# Pass your app to AgentOSagent_os = AgentOS( agents=[Agent(id="basic-agent", model=OpenAIChat(id="gpt-5-mini"))], fastapi_app=app # Your custom FastAPI app)# Get the combined app with both AgentOS and your routesapp = agent_os.get_app()
You can programmatically access and inspect the routes added by AgentOS:
Copy
Ask AI
agent_os = AgentOS(agents=[agent])app = agent_os.get_app()# Get all routesroutes = agent_os.get_routes()for route in routes: print(f"Route: {route.path}") if hasattr(route, 'methods'): print(f"Methods: {route.methods}")