Overview
The production runtime and control plane for your agentic systems.
AgentOS transforms your agents into a production-ready API.
A minimal application looks like this:
1from kern.os import AgentOS23agent_os = AgentOS(4 name="My AgentOS",5 agents=[my_agent],6 teams=[my_team],7 workflows=[my_workflow],8 tracing=True9)1011app = agent_os.get_app()1213if __name__ == "__main__":14 agent_os.serve(app="my_os:app", reload=True)Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | None | AgentOS name |
agents | List[Agent] | None | Agents to include |
teams | List[Team] | None | Teams to include |
workflows | List[Workflow] | None | Workflows to include |
db | BaseDb | None | Database used for the AgentOS |
tracing | bool | False | Enable tracing to AgentOS db |
knowledge | List[Knowledge] | None | Knowledge bases |
interfaces | List[BaseInterface] | None | Agent interfaces (docs) |
config | str or AgentOSConfig | None | Configuration path or object (docs) |
base_app | FastAPI | None | Custom FastAPI app (docs) |
lifespan | Any | None | Lifespan context manager (docs) |
authorization | bool | False | Enable RBAC (docs) |
authorization_config | AuthorizationConfig | None | JWT verification config |
enable_mcp_server | bool | False | Enable MCP server (docs) |
cors_allowed_origins | List[str] | None | Allowed CORS origins |
auto_provision_dbs | bool | True | Auto-provision databases |
run_hooks_in_background | bool | False | Run hooks in background |
See AgentOS class reference for details.
Methods
get_app()
Returns the configured FastAPI application.
serve()
Starts the AgentOS server.
| Parameter | Type | Default | Description |
|---|---|---|---|
app | str or FastAPI | Required | FastAPI app instance or module path |
host | str | localhost | Host to bind |
port | int | 7777 | Port to bind |
workers | int | None | Number of workers |
reload | bool | False | Enable auto-reload |
Environment variable fallbacks
When host or port are not passed explicitly, serve() reads from environment variables before using defaults.
| Environment Variable | Fallback For | Default |
|---|---|---|
AGENT_OS_HOST | host | localhost |
AGENT_OS_PORT | port | 7777 |
Precedence: explicit argument > environment variable > default value.
This is useful for containerized deployments where host and port are configured externally:
1# In your Dockerfile or orchestrator config2ENV AGENT_OS_HOST=0.0.0.03ENV AGENT_OS_PORT=80001# No host/port needed. serve() reads from AGENT_OS_HOST and AGENT_OS_PORT.2if __name__ == "__main__":3 agent_os.serve(app="my_os:app", reload=True)resync()
Reloads agents, teams, workflows, and resources.
Configuration
The config parameter accepts a YAML path or AgentOSConfig object. Use it to configure prompts, display names, and database settings.
1agent_os = AgentOS(2 name="My AgentOS",3 agents=[my_agent],4 config="config.yaml", # or AgentOSConfig(...)5)See Configuration for details.