# Claude Agent SDK (/agent-os/multi-framework/claude-agent-sdk)



`ClaudeAgent` wraps the [Claude Agent SDK](https://github.com/anthropics/claude-agent-sdk-python) so Claude Code can be served through AgentOS.
Tool execution is handled by the SDK. You configure tool permission rules and the SDK permission mode.

Save the following as `claude_agent.py`. After the Install step, start it with `python claude_agent.py`. Later snippets are alternatives or fragments using the same imports.

```python
from agno.agents.claude import ClaudeAgent
from agno.db.sqlite import SqliteDb
from agno.os import AgentOS

agent = ClaudeAgent(
    name="Claude Code Agent",
    model="claude-sonnet-4-6",
    allowed_tools=["Read", "Edit", "Bash"],
    permission_mode="acceptEdits",
    max_turns=10,
)

agent_os = AgentOS(
    agents=[agent],
    tracing=True,
    db=SqliteDb(db_file="tmp/agentos.db"),
)
app = agent_os.get_app()

if __name__ == "__main__":
    agent_os.serve(app="claude_agent:app", reload=True)
```

## Install [#install]

```bash
uv pip install "agno[os]" claude-agent-sdk
export ANTHROPIC_API_KEY=sk-ant-...
```

## Parameters [#parameters]

| Parameter          | Type             | Default | Description                                                                                                                                                                           |
| ------------------ | ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`             | `str`            | `None`  | Display name for the agent.                                                                                                                                                           |
| `id`               | `str`            | `None`  | Unique identifier. Auto-generated from `name` if unset.                                                                                                                               |
| `system_prompt`    | `str`            | `None`  | Optional system prompt.                                                                                                                                                               |
| `model`            | `str`            | `None`  | Model id (e.g. `"claude-sonnet-4-6"`). Defaults to the SDK default.                                                                                                                   |
| `allowed_tools`    | `List[str]`      | `None`  | Tools to auto-approve (e.g. `["Read", "Bash", "WebSearch"]`), not an exclusive tool allowlist. Unlisted tools follow the SDK permission policy.                                       |
| `disallowed_tools` | `List[str]`      | `None`  | Tools to block.                                                                                                                                                                       |
| `permission_mode`  | `str`            | `None`  | Forwarded to the SDK; see its [current permission modes](https://code.claude.com/docs/en/agent-sdk/python#permissionmode).                                                            |
| `max_turns`        | `int`            | `None`  | Maximum number of turns per run.                                                                                                                                                      |
| `max_budget_usd`   | `float`          | `None`  | Stopping threshold for the SDK's client-side USD cost estimate; not a hard billing cap. See the [SDK reference](https://code.claude.com/docs/en/agent-sdk/python#claudeagentoptions). |
| `cwd`              | `str`            | `None`  | Working directory the agent runs in.                                                                                                                                                  |
| `mcp_servers`      | `Dict[str, Any]` | `None`  | MCP server configurations for custom tools.                                                                                                                                           |
| `options_kwargs`   | `Dict[str, Any]` | `{}`    | Extra kwargs forwarded to `ClaudeAgentOptions`.                                                                                                                                       |
| `db`               | `BaseDb`         | `None`  | Database for session persistence.                                                                                                                                                     |

## Session persistence [#session-persistence]

A configured `db` persists Agno session and run records. The adapter maps Agno sessions to Claude SDK session IDs in process memory and resumes through that map. After a restart or on another replica, stored Agno history alone does not restore the SDK conversation: the adapter does not replay that history into the SDK. Plan conversation routing and restart behavior accordingly.

## Examples [#examples]

<CardGroup cols="2">
  <Card title="AgentOS deployment" icon="server" href="https://github.com/agno-agi/agno/blob/main/cookbook/frameworks/00_quickstart/claude_agent.py">
    Serve a Claude Code agent through AgentOS.
  </Card>

  <Card title="Standalone usage" icon="play" href="https://github.com/agno-agi/agno/blob/main/cookbook/frameworks/claude-agent-sdk/claude_basic.py">
    Call the agent directly with `.run()` and `.print_response()`.
  </Card>

  <Card title="Custom MCP tools" icon="plug" href="https://github.com/agno-agi/agno/blob/main/cookbook/frameworks/claude-agent-sdk/claude_mcp_tools.py">
    Extend Claude Code with your own MCP servers.
  </Card>

  <Card title="Sessions" icon="comments" href="https://github.com/agno-agi/agno/blob/main/cookbook/frameworks/claude-agent-sdk/claude_session.py">
    Resume conversations across runs with `session_id`.
  </Card>
</CardGroup>

## Developer Resources [#developer-resources]

* [Cookbook examples](https://github.com/agno-agi/agno/tree/main/cookbook/frameworks/claude-agent-sdk)
* [Claude Agent SDK on GitHub](https://github.com/anthropics/claude-agent-sdk-python)
