The Claude Agent SDK is the harness behind Claude Code, packaged as a library. It gives you the most complete agent out of the box of any major SDK, with built-in tools, hooks, permissions and spend caps, at the price of running only Claude.
Key Takeaways
- Claude Code, as a library. — The SDK runs the same loop, built-in tools and context compaction as Claude Code, in Python and TypeScript. Anthropic renamed it from the Claude Code SDK in September 2025.
- The best loop controls of the three main harnesses. — max_turns and max_budget_usd cap a run, the budget includes subagents, and hooks, rules and six permission modes decide which tool calls run.
- Claude only, and not a workflow engine. — It runs Claude models through the Anthropic API, Amazon Bedrock, Google Cloud or Microsoft Foundry. Crash-safe, multi-day runs need a durable layer around it.
What the Claude Agent SDK does
The SDK runs Claude Code's loop inside your application: Claude evaluates the prompt, calls tools, receives results and repeats until it answers with no tool calls. Built-in tools cover file reads and edits, shell commands, search, web fetches and subagents; MCP servers and custom tools add the rest. Anthropic renamed it from the Claude Code SDK in September 2025 because teams were using it far beyond coding.
The control surface is where it stands out. max_turns and max_budget_usd cap a run, and the budget counts subagent spend. Tool calls pass through hooks, deny rules, ask rules and a permission mode before reaching your canUseTool callback (permissions docs). When the context fills, the SDK compacts older history. Both caps default to no limit, so an unattended agent needs them set explicitly (agent loop docs).
Scorecard: 13/20
| Criterion | Score | Why |
|---|---|---|
| Loop control | 5/5 | Turn cap and dollar cap (including subagents), hooks on every tool call, layered permissions. |
| Human-in-the-loop and durability | 3/5 | canUseTool approvals and session resume or fork; no per-step durable checkpoints. |
| Observability | 3/5 | OpenTelemetry metrics and events; traces still in beta. |
| Portability | 2/5 | Claude models only, though through several cloud providers. |
Pricing, licensing and hosting
The library is free; the claude-agent-sdk package is MIT-licensed on PyPI (version 0.2.177 on November 3, 2026), and you pay for model usage. Anthropic's overview states that use is governed by its Commercial Terms and that products built on the SDK must authenticate with API keys, not claude.ai logins, unless approved. Models run through the Anthropic API, Amazon Bedrock, Google Cloud, Microsoft Foundry or Claude Platform on AWS (quickstart). Telemetry exports over OpenTelemetry; traces are in beta (observability docs).
Who it fits, and who should look elsewhere
- Fits: teams standardised on Claude that want a working agent with file, shell and web tools, layered permissions and a hard spend cap, without building a harness. Coding, research and operations agents that work on a filesystem are the natural use.
- Look elsewhere: if you need several model vendors, or runs that survive a crash or wait days for an approval with per-step checkpoints (LangGraph), or a multi-agent design built on handoffs (OpenAI Agents SDK).
Claude Agent SDK alternatives
- OpenAI Agents SDK: a lighter runner with handoffs, approval pauses and built-in tracing, OpenAI-first.
- LangGraph: model-agnostic state graphs with per-step checkpoints and interrupts.
- Mastra, Temporal, CrewAI and others: see the full ranking.
Related questions
- Claude Agent SDK, OpenAI Agents SDK or LangGraph: which harness fits?
- Which agent orchestration frameworks are production-ready in 2026?
- Which stop conditions and budgets should every agent loop have? (partner site CTAIO)
- What is the Ralph loop for coding agents? (partner site CTAIO)
Sources
- Anthropic, Building agents with the Claude Agent SDK (Sep 29, 2025).
- Claude Agent SDK docs: overview, agent loop, permissions, quickstart, observability (accessed Nov 3, 2026).
- PyPI package metadata for claude-agent-sdk (accessed Nov 3, 2026).
What is the Claude Agent SDK?
The Claude Agent SDK is Anthropic's library for building agents on the same loop, tools and context management that power Claude Code. It is available for Python (claude-agent-sdk) and TypeScript (@anthropic-ai/claude-agent-sdk) and runs a bundled Claude Code binary as a subprocess.
Is the Claude Agent SDK free?
The package is free and MIT-licensed on PyPI; you pay for Claude API usage. Anthropic states that use of the SDK is governed by its Commercial Terms, and that third-party products built on it must use API key authentication rather than claude.ai login unless previously approved.
How do you stop a Claude Agent SDK agent from running too long?
Set max_turns to cap tool-use round trips and max_budget_usd to cap spend. Both default to no limit. When a cap is hit, the result message carries the subtype error_max_turns or error_max_budget_usd, and the budget cap also covers subagents.
Can the Claude Agent SDK use OpenAI or other models?
No. It runs Claude models, through the Anthropic API, Amazon Bedrock, Google Cloud, Microsoft Foundry or Claude Platform on AWS. For a model-agnostic harness, look at LangGraph.
Ready to Find the Right AI Tools?
Browse our data-driven rankings to find the best AI tools for your team.