Back to Agno

AgentOS Cookbook

cookbook/05_agent_os/README.md

2.8.28.8 KB
Original Source

AgentOS Cookbook

AgentOS is a FastAPI-based runtime that turns agents, teams, workflows, and knowledge into roughly 80 REST endpoints and makes them available to the AgentOS control plane. The same runtime can also expose MCP, A2A, AG-UI, Slack, Telegram, and WhatsApp interfaces.

Start here

Run the smallest useful AgentOS:

bash
.venvs/demo/bin/python cookbook/05_agent_os/basic.py

Then open http://localhost:7777/config. GET /config is the payoff: it describes the registered agent, model, database, domains, and enabled interfaces that clients and the control plane can use. Open /openapi.json or /docs to inspect the complete REST route surface.

Files

FileDescription
basic.pyServes the canonical one-agent AgentOS with SQLite persistence and the Agno documentation MCP tools.
TEST_PROMPT.mdDefines the repeatable live-testing workflow for this cookbook.
TEST_LOG.mdRecords dated, observed results for the root example.

Learning path

LessonWhat it teaches
01_getting_startedMount every core primitive, inspect the generated API, and run an agent over raw HTTP and SSE.
02_databasesSet one default AgentOS database, choose a production backend, and manage schema migrations.
03_python_clientUse AgentOSClient for configuration, runs, sessions, memory, knowledge, evals, and authentication.
04_run_lifecycleTreat runs as durable objects that can execute in the background, be cancelled, resumed, and checkpointed.
05_human_in_the_loopPause runs for confirmation, user input, external execution, or persistent approval records, then resume them correctly.
06_customizeExtend the FastAPI app with base apps, route policies, lifespans, middleware, events, dependencies, CORS, and a security key.
07_securitySecure AgentOS with JWTs, RBAC scopes, cookies, user isolation, service accounts, and a bring-your-own issuer.
08_os_configShape the control-plane manifest in Python or YAML and inspect the rendered /config.
09_serving_workflowsServe workflows over REST, SSE, and the workflow-only WebSocket surface.
10_knowledgeServe one knowledge base and manage its content through the AgentOS REST API.
11_learningsPersist user profiles and memories, then read and manage them through the learnings API.
12_schedulerRun scheduled agents through AgentOS, REST, Python, and SchedulerTools with production-safe claiming.
13_observabilityCapture, read, filter, and route traces, then refresh and inspect AgentOS metrics.
14_mcpExpose AgentOS as a scoped MCP server, drive its run lifecycle, and secure it with PAT or OAuth authorization.
15_a2aServe agents and teams over A2A, use the first-party client, inspect agent cards, and compose remote agents.
16_aguiServe standalone AG-UI agents and teams with tools, media, shared state, structured output, and backend HITL.
17_slackConnect agents, teams, and workflows to Slack with streaming UX, workspace tools, threaded sessions, peer bots, and HITL.
18_telegramServe Telegram bots with streaming replies, group mention filtering, media, commands, and multiple prefixes.
19_whatsappServe WhatsApp assistants with interactive messages, media, reasoning, webhook verification, and multiple numbers.
20_remoteCompose AgentOS, Agno A2A, and Google ADK services through RemoteAgent, RemoteTeam, and RemoteWorkflow.
21_factoriesConstruct request-scoped agents, teams, and workflows from validated input and trusted identity.
22_studioCompose, version, inspect, and approve AgentOS components with the Registry, StudioTools, and components API.
23_skillsServe local skills through an Agent and execute checked-in skill scripts through the AgentOS run API.
24_showcaseRun the secure, traced capstone with RAG, web and finance research, a Team, and a real evaluation.

Canonical ports

PortOwner
7777Every standalone example
777803_python_client/_server.py and other in-folder _server.py files
7779Standalone 15_a2a server examples
778020_remote/servers/agentos_server.py
778120_remote/servers/a2a_server.py
778215_a2a/multi_agent/weather_agent.py
778315_a2a/multi_agent/airbnb_agent.py
800120_remote/servers/adk_server.py

Environment and runtime requirements

ScopeEnvironmentRuntime
Root basic.pyOPENAI_API_KEY for agent runsInternet access to https://docs.agno.com/mcp
01_getting_startedOPENAI_API_KEYLocal SQLite and Chroma; no external service
02_databases/basic.pyOPENAI_API_KEY for agent runsLocal SQLite
02_databases/postgres.pyOPENAI_API_KEY; optional AGENTOS_USE_ASYNC_POSTGRES=true./cookbook/scripts/run_pgvector.sh
02_databases/surreal.pyOPENAI_API_KEY; optional SURREALDB_* overridesagno[surrealdb] and ./cookbook/scripts/run_surrealdb.sh
03_python_clientOPENAI_API_KEY; optional OS_SECURITY_KEYIn-folder server on port 7778
04_run_lifecycleOPENAI_API_KEYLocal SQLite
05_human_in_the_loopOPENAI_API_KEYLocal SQLite for persistent approvals
06_customizeOPENAI_API_KEY; optional OS_SECURITY_KEYLocal FastAPI app on port 7777
07_securityOPENAI_API_KEY; WorkOS values only for workos_byot.pyLocal JWT keys and SQLite; WorkOS example may use construction smoke
08_os_configOPENAI_API_KEY for agent runsPython or YAML configuration on port 7777
09_serving_workflowsOPENAI_API_KEYLocal workflow server on port 7777
10_knowledgeOPENAI_API_KEYLocal SQLite and Chroma
11_learningsOPENAI_API_KEYLocal SQLite
12_schedulerOPENAI_API_KEYagno[scheduler] and ./cookbook/scripts/run_pgvector.sh
13_observabilityOPENAI_API_KEYLocal SQLite; Postgres and ClickHouse only for the split trace-store example
14_mcpOPENAI_API_KEY; OS_SECURITY_KEY for PAT security; provider values for AuthKit OAuthLocal SQLite and an MCP client
15_a2aOPENAI_API_KEY; OPENWEATHER_API_KEY for the weather specialistStandalone servers on ports 7779, 7782, and 7783; Node.js, npx, and internet access for OpenBNB
16_aguiOPENAI_API_KEY; GOOGLE_API_KEY for the media exampleLocal AG-UI servers; a CopilotKit frontend is optional for interactive UI testing
17_slackSlack bot tokens and signing secrets; provider keys used by each served entitySlack app configuration and a public HTTPS callback; construction smoke is valid without a live workspace
18_telegramTelegram bot tokens; provider keys used by each served entityagno[telegram] and a public HTTPS callback; construction smoke is valid without live bots
19_whatsappMeta access, phone-number, verify-token, and app-secret values; provider keys used by each served entityA Meta app and public HTTPS callback; construction smoke is valid without live phone numbers
20_remoteOPENAI_API_KEY; GOOGLE_API_KEY for ADK; OS_SECURITY_KEY for the auth exampleAgentOS on 7780, Agno A2A on 7781, Google ADK on 8001, and gateway on 7777
21_factoriesOPENAI_API_KEYLocal SQLite; no external service
22_studioOPENAI_API_KEY; ANTHROPIC_API_KEY for Claude-backed runsLocal synchronous SQLite for Registry and components CRUD
23_skillsOPENAI_API_KEYLocal sample-skill files with executable Python scripts
24_showcaseOPENAI_API_KEY, ANTHROPIC_API_KEY, OS_SECURITY_KEY./cookbook/scripts/run_pgvector.sh, internet access, and tracing

Run cookbook files with .venvs/demo/bin/python. Development checks use .venv.

One agent, several interfaces

An agent does not have to belong to only one protocol. The same object can be mounted on several interfaces without duplicating its instructions, tools, or state:

python
from agno.os.interfaces.a2a import A2A
from agno.os.interfaces.agui import AGUI
from agno.os.interfaces.slack import Slack

agent_os = AgentOS(
    agents=[agent],
    interfaces=[
        A2A(agents=[agent]),
        AGUI(agent=agent, prefix="/agui"),
        Slack(agent=agent),
    ],
)

The cookbook teaches those interfaces separately so each example has honest credentials and a focused test surface; it deliberately does not ship one all-credentials demo.