A state-of-the-art agentic runtime built on the Agno framework with portable model providers, configurable sandbox execution, MCP support, RAG, multi-agent teams, and more.
- Agentic Coding - File operations, code search, and git integration for autonomous coding tasks
- Portable Model Providers - Switch between OpenRouter, OpenAI, Anthropic, Google, Ollama, Groq, DeepSeek, Moonshot, Mistral, and xAI via policy
- Code Execution - Configurable sandbox policy with Daytona support today and explicit local or Docker modes
- Multi-Agent Teams - Coordinate multiple specialized agents with leader delegation
- Workflows - Orchestrate complex multi-step tasks with dependencies
- Knowledge Base (RAG) - Vector database integration with LanceDB, PgVector, Chroma, Qdrant
- Structured Output - Pydantic-validated responses with JSON mode
- Reasoning - Chain-of-thought (basic, extended, tools modes)
- MCP Integration - Model Context Protocol tools with multi-server support
- Observability - Tool hooks, event streaming, logging, and metrics
# Clone and install
cp .env.example .env
# Fill in the keys for the provider/sandbox you plan to use
# Basic installation
uv sync
# With knowledge/RAG support
uv sync --extra knowledge
# Full installation (all vector DBs)
uv sync --extra full
# Development (includes pytest, ruff)
uv sync --extra devfrom core import build_agent, AgentSpec
# Defaults: OpenRouter provider + google/gemini-3.6-flash model
agent = build_agent(AgentSpec())
agent.print_response("What is the capital of France?", stream=True)from core import AgentSpec, build_agent
from core.policies import ModelProviderPolicy
# Direct OpenAI
openai_agent = build_agent(
AgentSpec(
model_id="gpt-5.6-terra",
model_provider=ModelProviderPolicy(provider="openai"),
)
)
# Local Ollama
ollama_agent = build_agent(
AgentSpec(
model_id="llama3.1",
model_provider=ModelProviderPolicy(
provider="ollama",
base_url="http://localhost:11434",
),
)
)from core import build_agent, AgentSpec, CodeActPolicy
spec = AgentSpec(
codeact=CodeActPolicy(enabled=True, max_iterations=10)
)
agent = build_agent(spec)
agent.print_response("Calculate the first 10 Fibonacci numbers", stream=True)from pydantic import BaseModel
from core import build_agent, AgentSpec
class Analysis(BaseModel):
summary: str
sentiment: str
confidence: float
spec = AgentSpec().with_output_schema(Analysis)
agent = build_agent(spec)
response = agent.run("Analyze: 'This product is amazing!'")
print(response.content) # Validated Analysis objectfrom core import build_team, AgentSpec, AgentRole, TeamPolicy
members = [
AgentRole(name="researcher", role="Research topics"),
AgentRole(name="writer", role="Write content"),
]
spec = AgentSpec(
team=TeamPolicy(
enabled=True,
members=members,
leader_instructions=["Coordinate research and writing"],
)
)
team = build_team(spec)
team.print_response("Research and write about quantum computing", stream=True)from core import build_agent, AgentSpec, ReasoningPolicy
spec = AgentSpec(
reasoning=ReasoningPolicy(enabled=True, mode="extended")
)
agent = build_agent(spec)
agent.print_response("Solve this step by step: ...", stream=True)from core import AgentSpec, build_agent
from core.policies import CodeActPolicy, ModelProviderPolicy, SystemPromptPolicy
agent = build_agent(
AgentSpec(
name="coding_agent",
model_id="anthropic/claude-sonnet-5",
model_provider=ModelProviderPolicy(provider="openrouter"),
codeact=CodeActPolicy(
enabled=True,
sandbox="daytona",
sandbox_timeout_minutes=60,
),
system_prompt=SystemPromptPolicy(
template="custom",
custom_template="You work in a sandbox at /home/daytona. Clone repos with: git clone <url> /home/daytona/repo",
),
)
)
agent.print_response(
"Clone https://github.com/user/repo.git, list the structure, and analyze the README",
stream=True,
)Conversation compaction is enabled by default for agents and team leaders. Use
ContextPolicy(enable_compaction=False) to opt out. Full session history search is a separate opt-in:
from core import AgentSpec, CodeActPolicy, ContextPolicy, build_agent
agent = build_agent(AgentSpec(
session_id="project-notes",
codeact=CodeActPolicy(enabled=False),
context=ContextPolicy(
search_chat_history=True,
enable_session_summaries=False,
),
))- Compaction summarizes older turns when the provider reports a context overflow, or when
you call
agent.compact()orteam.compact()on a session with enough history. SQLite and PostgreSQL preserve the original transcript. Agno exposessearch_compacted_historyfor folded turns. Summarization uses the configured model and can add a model call. Disable session summaries if you don't want a separate rolling summary. - History search gives the model a read-only
search_chat_historytool for earlier turns in the current session, including turns outside the recent-history window. It doesn't search other sessions. Reuse the samesession_id,user_id, and database to resume a conversation. - Teams apply these settings to the leader, not to individual members. Teams use the spec's
session identity and replay the last three runs by default. Set
add_history_to_context=Falseto disable replay, ornum_history_runsto change the window. If you disable both compaction and history search, the factory leaves replay to Agno's team defaults.
On Agno 3.3, ReasoningPolicy uses ReasoningTools unless a native reasoning_model is
configured for basic or extended mode. Choose a reasoning model supported by the spec's provider.
Skills. SkillsPolicy(enabled=True, paths=["skills"]) gives agents, team leaders, and team
members Agno's native skill tools. The model sees skill descriptions up front and can load the
full instructions and references on demand. Relative paths resolve from coding.workspace_root
when coding is enabled. Load only trusted skill directories: Agno can run their scripts locally,
outside the Daytona sandbox.
MCP. Use McpPolicy(enabled=True, transport="stdio", command="python server.py") for a trusted
local server, or set url for Streamable HTTP or SSE. Configure servers=[McpServerConfig(...)]
for multiple endpoints. include_tools limits the published tools; auth_token supplies an HTTP
bearer token and is omitted from serialized specs. In standalone apps, use
async with mcp_tools_lifespan(agent.tools or []) from core.tools around await agent.arun(...).
See examples/04_mcp_agent.py for a complete example.
Memory and learning. ContextPolicy(agentic_memory=True) lets the model choose when to update
native Agno memory instead of extracting it automatically after each standalone agent run.
LearningPolicy(user_profile="agentic", user_memory="agentic", session_context=True) uses Agno's
LearningMachine for structured user profiles, long-term user memories, and per-session context.
Learning is opt-in for agents and team leaders. Profiles and memories can use "always" or
"agentic"; session context uses automatic extraction. Enabling LearningMachine user memory
replaces legacy memory updates so the runtime does not write both. Set an application-specific
user_id for each user; use a distinct session_id per conversation.
Storage and workflows. SQLite remains the default. Install uv sync --extra postgres and
use StoragePolicy(backend="postgres", db_url=os.environ["DATABASE_URL"]) for PostgreSQL. The DSN
is not serialized. If using this runtime's durable agent journal with PostgreSQL, configure a
separate SQLite durability.journal_db_file. Workflow steps can run an agent, team, or named
function. depends_on orders steps, and max_retries counts retries after the first attempt.
parallel_execution=True groups independent steps into Agno Parallel blocks. Use
stop_on_failure=False for those blocks: Agno reports each failed branch without aborting the
group. Downstream steps can retrieve named branch outputs with StepInput.get_step_content(name).
Tracing and evals. Run a credential-free eval that checks tool execution and answer content:
uv run python examples/11_offline_eval_harness.py
HARNESS_DEMO_FAILURE=1 uv run python examples/11_offline_eval_harness.py
HARNESS_TRACE_DB=./traces.db uv run --extra tracing python examples/11_offline_eval_harness.pyThe intentional failure exits nonzero. The third command uses Agno's process-wide OpenTelemetry setup at application startup and writes traces to SQLite. Traces can include model inputs and tool data; choose a destination with appropriate access controls. Building agents does not initialize tracing.
Set AgentSpec.tools to ToolPolicy(require_confirmation_for=["write_file", "edit_file", "git_add", "git_commit"]) to pause before the named tools run. The list is empty by default.
For built-in file and Git writes, CodingPolicy(require_confirmation_for_destructive=True) is
an opt-in shortcut for the same four tools.
Use exact tool names; add any enabled tools that can perform the same sensitive action, such as
run_code, run_shell_command, get_skill_script, or a mutating MCP tool. Unlisted tools are
unchanged. The policy applies to tools configured by this runtime, including tools on team
members and skills on team leaders. For tools you add yourself, use Agno's
@tool(requires_confirmation=True) directly.
Agno returns a paused run with the tool name and arguments. Show those details to an authorized
human, and resume the same run with their decision. For example, with a factory-built agent:
result = agent.run("Update notes.txt with the reviewed text.")
while result.is_paused:
requirements = result.requirements or []
if not requirements or not all(req.needs_confirmation for req in requirements):
raise RuntimeError("This run needs a different kind of human input")
for req in requirements:
call = req.tool_execution
print(call.tool_name, call.tool_args)
if input("Approve this call? [y/N] ").strip().lower() == "y":
req.confirm()
else:
req.reject("Declined by reviewer")
result = agent.continue_run(
run_id=result.run_id, session_id=result.session_id, requirements=requirements
)In an async app, use arun() and acontinue_run(). The application is responsible for
authenticating the reviewer and applying their decision to the original stored call. Do not
accept replacement tool names or arguments from the client. This policy is not supported with
the runtime's separate durable runner; use native Agno run continuation instead.
All configuration is done through AgentSpec and its policies:
from core import (
AgentSpec,
ContextPolicy,
ToolPolicy,
CodeActPolicy,
CodingPolicy,
McpPolicy,
ModelProviderPolicy,
KnowledgePolicy,
ReasoningPolicy,
StoragePolicy,
TeamPolicy,
WorkflowPolicy,
ObservabilityPolicy,
SystemPromptPolicy,
)
spec = AgentSpec(
name="my_agent",
model_id="google/gemini-3.6-flash",
# Model provider
model_provider=ModelProviderPolicy(
provider="openrouter",
),
# Runtime storage
storage=StoragePolicy(
db_file="tmp/agents.db",
),
# Context and memory
context=ContextPolicy(
enable_user_memories=True,
num_history_runs=5,
),
# Code execution
codeact=CodeActPolicy(
enabled=True,
sandbox="daytona", # daytona, local, docker
max_iterations=10,
extract_charts=True,
),
# Knowledge base (RAG)
knowledge=KnowledgePolicy(
enabled=True,
vector_db="lancedb", # lancedb, pgvector, chroma, qdrant
search_type="hybrid",
),
# Reasoning
reasoning=ReasoningPolicy(
enabled=True,
mode="extended", # basic, extended, tools
),
# Agentic coding (local file ops)
coding=CodingPolicy(
enabled=True,
workspace_root="/path/to/project",
allow_write=True,
enable_git=True,
),
# Observability
observability=ObservabilityPolicy(
log_tool_calls=True,
debug_mode=True,
),
)model_provider.providerdefaults toopenrouterfor backward compatibilitycodeact.sandboxdefaults todaytona;localdisables sandbox tools anddockeris reserved for future implementationstorage.db_filedefaults totmp/agents.dbstorage.db_urlis required whenstorage.backend="postgres"
Portable aliases map to provider-specific IDs when the agent is built:
| Alias | OpenRouter ID | Native provider |
|---|---|---|
kimi-k3 |
moonshotai/kimi-k3 |
moonshot / kimi-k3 |
deepseek-v4-flash |
deepseek/deepseek-v4-flash-0731 |
deepseek / deepseek-v4-flash |
from core import AgentSpec, ModelProviderPolicy, build_agent
# Uses moonshotai/kimi-k3 through the default OpenRouter provider.
kimi = build_agent(AgentSpec(model_id="kimi-k3"))
# Uses DeepSeek's native API and model ID.
deepseek = build_agent(
AgentSpec(
model_id="deepseek-v4-flash",
model_provider=ModelProviderPolicy(provider="deepseek"),
)
)Use convenience functions for common configurations:
from core import (
create_basic_spec,
create_codeact_spec,
create_research_spec,
create_coding_spec,
create_team_spec,
)
# Basic agent (no code execution)
spec = create_basic_spec()
# Code execution agent (Daytona by default)
spec = create_codeact_spec(max_iterations=10)
# Research agent with RAG and extended reasoning
spec = create_research_spec(
knowledge_sources=["https://docs.example.com"]
)
# Agentic coding agent (file ops + git + code execution)
spec = create_coding_spec(
workspace_root=".",
enable_codeact=True,
allow_write=True,
allow_git_write=False,
)
# Multi-agent team
from core import AgentRole
spec = create_team_spec(
members=[
AgentRole(name="analyst", role="Analyze data"),
AgentRole(name="reporter", role="Write reports"),
]
)See the examples/ directory for complete examples:
| Example | Description |
|---|---|
01_basic_agent.py |
Simple Q&A agent |
02_code_execution_agent.py |
Code execution with policy-driven sandbox config |
03_data_analysis_agent.py |
Data analysis and charts |
04_mcp_agent.py |
MCP tool integration |
05_full_featured_agent.py |
All features combined |
06_conversational_session.py |
Interactive chat |
07_structured_output.py |
Pydantic-validated responses |
08_multi_agent_team.py |
Multi-agent coordination |
09_agentic_coding_agent.py |
Agentic coding through AgentSpec + Daytona sandbox |
10_xlsx_skill_agent.py |
Validate a workbook with the xlsx skill |
12_compaction_and_approval.py |
Live conversation compaction and interactive approval over OpenRouter |
# Run basic example
uv run python examples/01_basic_agent.py
# Run agentic coding agent (uses the runtime's policy-driven Daytona path)
uv run python examples/09_agentic_coding_agent.py --mode analyze
uv run python examples/09_agentic_coding_agent.py --mode refactor
uv run python examples/09_agentic_coding_agent.py --mode test
uv run python examples/09_agentic_coding_agent.py --mode feature
uv run python examples/09_agentic_coding_agent.py --mode interactive
# Use a custom GitHub repository
uv run python examples/09_agentic_coding_agent.py --repo https://github.com/owner/repo.git --branch main
# Prepare and run the xlsx skill example
uv run python examples/10_xlsx_skill_agent.py --prepare-only
uv run python examples/10_xlsx_skill_agent.pyThe xlsx skill example expects the skill at ~/.agents/skills/xlsx by default and looks for LibreOffice via soffice, SOFFICE_BIN, or --soffice-path.
The coding and conversational CLIs stream plain answer text instead of redrawing panels. For a programmatic client, the coding example also exposes Agno's native AgentOS FastAPI routes, including JSON responses, Server-Sent Events (SSE), and OpenAPI docs.
On your machine, configure DAYTONA_API_KEY and OPENROUTER_API_KEY as for the coding CLI. Start the API with a separate bearer token:
export OS_SECURITY_KEY="$(openssl rand -hex 32)"
uv run --locked --extra api python examples/09_agentic_coding_agent.py --mode api --port 7777In a second local terminal with the same OS_SECURITY_KEY, send a message:
curl --no-buffer --fail-with-body http://127.0.0.1:7777/agents/agentic-coding-agent/runs \
-H "Authorization: Bearer $OS_SECURITY_KEY" \
-F 'message=What can you help with?' \
-F 'session_id=local-demo' \
-F 'stream=true'Use stream=false for JSON or visit http://127.0.0.1:7777/docs for the API reference. Reuse a session ID to continue a conversation. API sessions are stored separately in tmp/coding-api.db. This is a single-user, loopback-only development server with sandbox tools; do not expose it through a public proxy. --repo and --branch configure the CLI prompts, not the API: specify the repository in your API message if needed.
# Run the offline suite
uv run pytest
# Run with verbose output
uv run pytest -v
# Run specific test file
uv run pytest tests/test_policies.pyThe live Daytona conformance test is opt-in. With DAYTONA_API_KEY and OPENROUTER_API_KEY
configured, run RUN_DAYTONA_CONFORMANCE=1 uv run pytest tests/test_tool_call_conformance.py.
core/
├── __init__.py # Public API exports
├── factory.py # build_agent, build_team, build_workflow, provider/storage resolution
├── policies.py # All configuration policies & presets
├── context_manager.py # Context management utilities
├── settings.py # Environment settings
├── tool_runtime.py # Tool runtime utilities
├── prompts/
│ └── system.py # System prompt templates with backend-aware code execution text
└── tools/
├── local.py # Local utility tools
├── daytona.py # Daytona sandbox integration
├── sandbox.py # Sandbox backend dispatcher
├── coding.py # File operations & code search
├── git.py # Git integration tools
├── mcp.py # MCP tool integration
├── knowledge.py # RAG/knowledge tools
├── reasoning.py # Reasoning tools
└── hooks.py # Observability hooks
| Tool | Description |
|---|---|
read_file |
Read file contents with optional line range |
write_file |
Create or overwrite files |
edit_file |
Edit files by replacing text (single or all occurrences) |
list_directory |
List directory contents |
find_files |
Find files matching glob patterns |
grep |
Regex-based code search with context |
get_file_info |
Get file metadata (size, type, etc.) |
| Tool | Description |
|---|---|
git_status |
Show working tree status |
git_diff |
Show changes between commits or working tree |
git_log |
Show commit history |
git_branch |
List branches |
git_show |
Show commit details |
git_blame |
Show line-by-line authorship |
git_add |
Stage files (if allow_git_write=True) |
git_commit |
Create commits (if allow_git_write=True) |
| Tool | Description |
|---|---|
run_shell_command |
Execute bash commands (git, ls, grep, etc.) |
run_code |
Execute Python code in sandbox |
create_file |
Create or update files in sandbox |
read_file |
Read file contents from sandbox |
list_files |
List directory contents in sandbox |
delete_file |
Delete files in sandbox |
These tools are available when codeact.enabled=True and codeact.sandbox="daytona".
OPENROUTER_API_KEY=... # Use when model_provider.provider="openrouter"
OPENAI_API_KEY=... # Use when model_provider.provider="openai"
ANTHROPIC_API_KEY=... # Use when model_provider.provider="anthropic"
GOOGLE_API_KEY=... # Use when model_provider.provider="google"
DEEPSEEK_API_KEY=... # Use when model_provider.provider="deepseek"
MOONSHOT_API_KEY=... # Use when model_provider.provider="moonshot"
DAYTONA_API_KEY=... # Required when codeact.sandbox="daytona"
DAYTONA_API_URL=... # Optional custom Daytona endpointMIT