Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.agno.com/llms.txt

Use this file to discover all available pages before exploring further.

AgentOS serves your agents as a FastAPI application. Every agent gets run, session, and memory endpoints. Your product surfaces call those endpoints.
from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.openai import OpenAIResponses
from agno.os import AgentOS

db = PostgresDb(db_url="postgresql+psycopg://ai:ai@localhost:5532/ai")

agent = Agent(
    id="copilot",
    model=OpenAIResponses(id="gpt-5.5"),
    db=db,
    add_history_to_context=True,
    enable_agentic_memory=True,
)

agent_os = AgentOS(agents=[agent])
app = agent_os.get_app()

if __name__ == "__main__":
    agent_os.serve(app="copilot:app", port=7777)

Calling it from a surface

Every run endpoint takes the same shape, whether the caller is a browser widget or a backend job.
curl -X POST http://localhost:7777/agents/copilot/runs \
  -F 'message=Summarize this thread' \
  -F 'user_id=sarah@acme.com' \
  -F 'session_id=thread-42' \
  -F 'stream=false'
{
  "run_id": "run_abc123",
  "session_id": "thread-42",
  "user_id": "sarah@acme.com",
  "agent_id": "copilot",
  "status": "completed",
  "content": "..."
}
From a browser widget with streaming and a JWT:
async function askCopilot(message, userId, threadId) {
  const res = await fetch("https://os.yourproduct.com/agents/copilot/runs", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Authorization": `Bearer ${jwt}`,
    },
    body: JSON.stringify({
      message,
      user_id: userId,
      session_id: threadId,
      stream: true,
    }),
  });
  return res.body; // SSE stream into the UI
}
WantPass
Token stream for a live UIstream=true (Server-Sent Events)
Long job, poll laterbackground=true
Per-user isolationuser_id and a per-thread session_id

What you get without building it

Endpoint groupCovers
RunsCreate, stream, cancel, run in background, resume disconnected streams
SessionsCreate, list, rename, delete, pull every run in a session, scoped per user
MemoryCreate, update, delete, search user memories
Traces and metricsPer-run spans, token usage, model breakdown
Browse the live OpenAPI spec at the /docs endpoint of your running AgentOS.

Custom routes

AgentOS is a FastAPI app. Add routes for webhooks, dashboards, or product-specific endpoints. The agent is a regular Python object you can call from anywhere.
app = agent_os.get_app()


@app.post("/webhooks/stripe")
async def handle_stripe(event: dict):
    response = await agent.arun(f"Process Stripe event: {event}", user_id="system")
    return {"ok": True, "response": response.content}

Auth

Set authorization=True and every endpoint except /health and /openapi.json requires a valid JWT.
agent_os = AgentOS(agents=[agent], authorization=True)
AgentOS validates the token before any agent code runs and injects user_id, session_id, and scope claims into the run. RBAC scopes are enforced per endpoint.

Next steps

TaskGuide
Add Slack or browser surfacesInterfaces
Lock down endpointsSecurity and auth

Developer Resources