Claude Agent SDK
Anthropic's library for embedding the Claude Code agent loop in Python and TypeScript apps
Facts
- Runs on
- Python 3.10 or laterTypeScript (npm package @anthropic-ai/claude-agent-sdk)
- Needs
- Bundled Claude Code CLI (installed with the package)Anthropic API key
- License
- Anthropic Commercial Terms of Service
- Category
- AI
- Facts checked
Our verdict
#10 of 10 in AI agent frameworks
Claude Code's agent loop in your app
What it does
- Claude Code's built-in tools for files, shell, and web
- Hooks before and after each tool call
- Permission rules for what the agent may do
- Sessions you can resume or fork
- Subagents for delegated tasks
Pros
- Strong built-in tools with no setup
- Fine-grained permission control
- Telemetry off by default, with OpenTelemetry export when you want it
Cons
- Claude models only
- Not under a standard open source license
- Sessions stay on the machine that ran them
- No workflow engine or crash recovery
- Choose if:
- You're building on Claude and your agent's job is working with files, code, and shell commands
About Claude Agent SDK
The Claude Agent SDK (formerly the Claude Code SDK) is Anthropic’s library for running the Claude Code agent loop, built-in tools, hooks, permissions, subagents, MCP and sessions from your own Python or TypeScript application. It drives a bundled Claude Code binary as a child process, so agents run in your own process against your own filesystem. It is governed by Anthropic’s Commercial Terms of Service rather than a standard open-source license, and it is built around Claude models. OpenTelemetry export is available through the bundled CLI, and Anthropic’s Managed Agents is the separate hosted option.
What users say
The one practitioner account read, a single developer on DEV Community, praises the SDK for non-coding automations (syndication, inventory alerts, release notes) that needed little glue code, but finds the file permission policy verbose and the docs behind the API. A vendor guide warns that permissions and subagent inheritance are where production agents surprise their authors. This is a small sample, not a consensus.
3 quotes from users and reviewers
I spent one weekend building with the Claude Agent SDK and shipped three agents I actually use. Not demos. Real agents, running in production, replacing scripts I was tired of maintaining.
RAXXO Studios, independent developer on DEV Community · dev.to/raxxostudios/i-built-3-production-agents-with-the-claude-agent-sdk-in-one-weekend-2ck7 · checked Docs are still catching up to the API surface. I read the Claude Code source a few times to confirm behavior.
RAXXO Studios, independent developer on DEV Community · dev.to/raxxostudios/i-built-3-production-agents-with-the-claude-agent-sdk-in-one-weekend-2ck7 · checked Permission behavior is where production agents most often surprise their authors.
inference.net/content/claude-agent-sdk-production-guide · published · checked
Ranked in
-
#10 of 10 AI agent frameworks Claude Code's agent loop in your app 2.7/5
How it scored
-
Control over flow and state , counts double 3/5
An agent loop with hooks, permission callbacks (canUseTool) and sessions that can be resumed or forked, but no workflow engine; sessions are local JSONL files and crash recovery or multi-host resume is your own work.
3/5 means: An agent loop that can pause for human approval and save sessions, but multi-step flows are your own code and crash recovery needs an outside engine
A library that runs the Claude Code binary, with Claude Code’s capabilities, such as built-in tools, permissions, sessions, and hooks.
code.claude.com/docs/en/agent-sdk/overview · checked Maintain context across exchanges, resume or fork later
code.claude.com/docs/en/agent-sdk/overview · checked Two production caveats. Sessions persist the conversation, not the filesystem, so reverting an agent's file edits is a separate concern (file checkpointing). And session files are local to the machine that created them: to resume on another host you either ship the JSONL file to the same encoded path or use a SessionStore adapter, though capturing results as application state and starting fresh is usually more reliable.
inference.net/content/claude-agent-sdk-production-guide · published · checked Permission behavior is where production agents most often surprise their authors.
inference.net/content/claude-agent-sdk-production-guide · published · checked Hooks are callback functions the SDK runs at lifecycle points: PreToolUse, PostToolUse, Stop, SessionStart, SessionEnd, UserPromptSubmit, and others.
inference.net/content/claude-agent-sdk-production-guide · published · checked
Show all 5
-
Production track record and API stability 3/5
Actively maintained by Anthropic and built on the Claude Code harness, but renamed from the Claude Code SDK, with a 0.x-style version number and a practitioner noting docs lag the API.
3/5 means: Usable in production, but upgrades break things often, through pre-1.0 releases, a recent major rewrite, or a maker whose focus has moved elsewhere
Docs are still catching up to the API surface. I read the Claude Code source a few times to confirm behavior.
RAXXO Studios, independent developer on DEV Community · dev.to/raxxostudios/i-built-3-production-agents-with-the-claude-agent-sdk-in-one-weekend-2ck7 · checked
-
Tracing and debugging 3/5
Built-in OpenTelemetry traces, metrics and events exported over OTLP to any backend, off by default; traces are beta and there is no first-party viewer or debugger.
3/5 means: Built-in tracing that exports to the backend you choose, but no visual debugger or trace viewer of its own
The Agent SDK runs the Claude Code CLI as a child process and communicates with it over a local pipe. The CLI has OpenTelemetry instrumentation built in: it records spans around each model request and tool execution, emits metrics for token and cost counters, and emits structured log events for prompts and tool results. The SDK does not produce telemetry of its own.
code.claude.com/docs/en/agent-sdk/observability · checked Telemetry is off until you set CLAUDE_CODE_ENABLE_TELEMETRY=1 and choose at least one exporter.
code.claude.com/docs/en/agent-sdk/observability · checked Telemetry is structural by default. Durations, model names, and tool names are recorded on every span; token counts are recorded when the underlying API request returns usage data, so spans for failed or aborted requests may omit them. The content your agent reads and writes is not recorded by default.
code.claude.com/docs/en/agent-sdk/observability · checked
-
Freedom to switch model providers 1/5
Runs Claude models only. Anthropic's API and, by Claude Code's settings, the Claude models on Bedrock, Vertex and Foundry change where the model is billed, not which maker's model runs.
1/5 means: Works with one maker's models only
Unless previously approved, Anthropic does not allow third party developers to offer claude.ai login or rate limits for their products, including agents built on the Claude Agent SDK.
code.claude.com/docs/en/agent-sdk/overview · checked
-
Multi-agent support 3/5
Built-in subagent delegation with per-subagent model, tools and prompts, but subagents cannot spawn subagents and no supervisor, handoff or group patterns or A2A support were found.
3/5 means: Built-in delegation such as handoffs or subagents, in one or two patterns
Subagents also can't spawn their own subagents, so don't put Agent in a subagent's tool list.
inference.net/content/claude-agent-sdk-production-guide · published · checked
-
Learning curve and everyday developer experience 3/5
Quick to get a working agent because the file, shell and web tools are built in, but the one practitioner account reports docs lagging the API and blunt errors, and permission rules surprise production authors. Quick to start but surprises later is the level-3 description.
3/5 means: Takes days to learn, or is quick to start but harder to change and debug as the agent grows; practitioners' reports are mixed
I spent one weekend building with the Claude Agent SDK and shipped three agents I actually use. Not demos. Real agents, running in production, replacing scripts I was tired of maintaining.
RAXXO Studios, independent developer on DEV Community · dev.to/raxxostudios/i-built-3-production-agents-with-the-claude-agent-sdk-in-one-weekend-2ck7 · checked Docs are still catching up to the API surface. I read the Claude Code source a few times to confirm behavior.
RAXXO Studios, independent developer on DEV Community · dev.to/raxxostudios/i-built-3-production-agents-with-the-claude-agent-sdk-in-one-weekend-2ck7 · checked Permission behavior is where production agents most often surprise their authors.
inference.net/content/claude-agent-sdk-production-guide · published · checked
-
Integrations and community help , counts half 3/5
MCP support, in-process custom tools, plugins and skills, and 8.6k stars on the Python repo; the community is moderate and no broad integration library of its own was found.
3/5 means: MCP support and the common integrations, with a moderate community
A library that runs the Claude Code binary, with Claude Code’s capabilities, such as built-in tools, permissions, sessions, and hooks.
code.claude.com/docs/en/agent-sdk/overview · checked 8.6k stars
github.com/anthropics/claude-agent-sdk-python · checked
Top of this ranking
- LangGraph #1
- Pydantic AI #2
- Mastra #3
-
Sources
17 quotes from 5 pages; the 12 most useful are below.
-
Limits and known issues 3
Unless previously approved, Anthropic does not allow third party developers to offer claude.ai login or rate limits for their products, including agents built on the Claude Agent SDK.
code.claude.com/docs/en/agent-sdk/overview · checked Two production caveats. Sessions persist the conversation, not the filesystem, so reverting an agent's file edits is a separate concern (file checkpointing). And session files are local to the machine that created them: to resume on another host you either ship the JSONL file to the same encoded path or use a SessionStore adapter, though capturing results as application state and starting fresh is usually more reliable.
inference.net/content/claude-agent-sdk-production-guide · published · checked Permission behavior is where production agents most often surprise their authors.
inference.net/content/claude-agent-sdk-production-guide · published · checked
-
What users say 2
I spent one weekend building with the Claude Agent SDK and shipped three agents I actually use. Not demos. Real agents, running in production, replacing scripts I was tired of maintaining.
RAXXO Studios, independent developer on DEV Community · dev.to/raxxostudios/i-built-3-production-agents-with-the-claude-agent-sdk-in-one-weekend-2ck7 · checked Docs are still catching up to the API surface. I read the Claude Code source a few times to confirm behavior.
RAXXO Studios, independent developer on DEV Community · dev.to/raxxostudios/i-built-3-production-agents-with-the-claude-agent-sdk-in-one-weekend-2ck7 · checked
-
Features 4
A library that runs the Claude Code binary, with Claude Code’s capabilities, such as built-in tools, permissions, sessions, and hooks.
code.claude.com/docs/en/agent-sdk/overview · checked The Agent SDK runs the Claude Code CLI as a child process and communicates with it over a local pipe. The CLI has OpenTelemetry instrumentation built in: it records spans around each model request and tool execution, emits metrics for token and cost counters, and emits structured log events for prompts and tool results. The SDK does not produce telemetry of its own.
code.claude.com/docs/en/agent-sdk/observability · checked Telemetry is off until you set CLAUDE_CODE_ENABLE_TELEMETRY=1 and choose at least one exporter.
code.claude.com/docs/en/agent-sdk/observability · checked Telemetry is structural by default. Durations, model names, and tool names are recorded on every span; token counts are recorded when the underlying API request returns usage data, so spans for failed or aborted requests may omit them. The content your agent reads and writes is not recorded by default.
code.claude.com/docs/en/agent-sdk/observability · checked
-
Platforms and requirements 2
Note: The Claude Code CLI is automatically bundled with the package - no separate installation required! The SDK will use the bundled CLI by default.
github.com/anthropics/claude-agent-sdk-python · checked Install is one line per language: pip install claude-agent-sdk for Python 3.10+, or npm install @anthropic-ai/claude-agent-sdk for TypeScript, which bundles a native Claude Code binary so there's nothing else to install.
inference.net/content/claude-agent-sdk-production-guide · published · checked
-
License 1
Use of the Claude Agent SDK is governed by Anthropic’s Commercial Terms of Service, including when you use it to power products and services that you make available to your own customers and end users, except to the extent a specific component or dependency is covered by a different license as indicated in that component’s LICENSE file.
code.claude.com/docs/en/agent-sdk/overview · checked