Claude Agent SDK — Anthropic's Framework for Production AI Agents

Build autonomous AI agents with Claude's full tool stack, in Python or TypeScript
9.0 /10

The most capable agent framework available for Claude — built by Anthropic, using the same runtime that powers Claude Code. The complexity ceiling is high, but if you're building production agents on Claude, this is the right foundation.

🔓 Open Source⚡ Official Anthropic
Free
Price
linux, mac, windows, cli
Platforms
2025
Founded
US
HQ
Yes
Open Source
No
Self-Host

Claude has no persistent state between conversations. Every API call is stateless. The Claude Agent SDK solves this by giving Claude a proper agent runtime — a loop that keeps running, executes tools, manages context, spawns subagents, and connects to external systems via MCP.

The SDK exposes the same infrastructure that powers Claude Code. Not a simplified version — the actual runtime, made programmable.

History

The Claude Agent SDK started life as the Claude Code SDK, announced May 22, 2025 alongside Claude Opus 4. The original purpose was narrow: let developers run Claude Code headlessly in CI/CD pipelines. As usage expanded beyond coding — email assistants, research agents, monitoring bots — Anthropic renamed it to the Claude Agent SDK on September 29, 2025.

The name change reflects the broadened scope. The tooling is identical.

Installation

TypeScript:

npm install @anthropic-ai/claude-agent-sdk

Python:

pip install claude-agent-sdk

Set your API key:

export ANTHROPIC_API_KEY=your-api-key

Core Capabilities

Built-in Tools

The SDK ships with a full tool suite — no custom implementation required:

ToolWhat it does
ReadRead any file in the working directory
WriteCreate new files
EditMake precise edits to existing files
BashRun terminal commands, scripts, git operations
GlobFind files by pattern
GrepSearch file contents with regex
WebSearchSearch the web for current information
WebFetchFetch and parse web page content

You specify which tools the agent can access. Read-only agent? allowedTools: ["Read", "Glob", "Grep"]. The agent cannot use tools outside this list.

Sessions and State

By default, each query() call starts fresh. Capture the session ID and pass it back to resume where you left off — including full file-reading history, conversation context, and analysis already done.

This enables multi-step workflows where an agent reads a codebase in one session, then modifies it in another without re-reading everything from scratch.

Subagents

Pass Task in allowedTools and define named agent configurations in the agents option. The main agent can then spawn these specialized subagents via the Task tool — they run in isolated context windows and report back to the orchestrator.

This is how you build parallelized pipelines: a research subagent and a writing subagent working simultaneously, with a coordinator merging results.

MCP Integration

Any MCP server — database connectors, browser automation, file systems, APIs — integrates in five lines:

options: {
  mcpServers: {
    playwright: { command: "npx", args: ["@playwright/mcp@latest"] }
  }
}

The agent gets MCP tools added to its available toolset automatically.

Hooks

Hooks fire at key lifecycle points: PreToolUse, PostToolUse, Stop, SessionStart, SessionEnd. Use them to log file modifications to an audit trail, validate tool calls before execution, or send alerts when the agent stops.

Budget Controls

Set max_budget_usd in your agent options. When the running API cost exceeds this threshold, the agent stops. Essential for production deployments where runaway agents could generate unexpected API bills.

Pricing

The SDK itself is MIT-licensed and free. Costs come from Anthropic API usage per token:

  • Claude Haiku 4.5 — $1 input / $5 output per million tokens. Good for lightweight agents with simple tasks.
  • Claude Sonnet 4.6 — $3 input / $15 output per million tokens. The default choice for most agent work.
  • Claude Opus 4.6 — $5 input / $25 output per million tokens. For complex reasoning tasks where quality matters more than cost.

Prompt caching (for repeated context like system prompts or large documents) cuts input costs up to 90% on cache hits. For long-running agents that repeatedly reference the same codebase or documents, caching is significant.

Backend Options

The SDK supports Anthropic’s API directly, but also works through:

  • Amazon Bedrock — set CLAUDE_CODE_USE_BEDROCK=1
  • Google Vertex AI — set CLAUDE_CODE_USE_VERTEX=1
  • Microsoft Azure AI Foundry — set CLAUDE_CODE_USE_FOUNDRY=1

Teams already in AWS or Google Cloud infrastructure can route API calls through their existing cloud accounts rather than direct Anthropic billing.

What It Doesn’t Include

No container isolation. The agent has access to your filesystem unless you sandbox it externally. If you’re running untrusted prompts or want production safety, you need to add Docker or similar yourself. NanoClaw wraps the Agent SDK with OS-level container isolation — if that’s a concern, start there.

No managed hosting. You deploy, you manage. There’s no Anthropic-hosted endpoint that runs your agents for you.

No built-in multi-LLM support. The Agent SDK is Claude-only. For workflows that mix Claude with other models, you’d build that routing layer yourself.

Our Take

The Claude Agent SDK is the serious option for Claude-based agents. It’s not a wrapper or a convenience layer — it’s the actual runtime, open-sourced. The built-in tools, the subagent architecture, the MCP integration, and the budget controls are all production-grade.

The tradeoff: you bring the infrastructure. Sandboxing, hosting, monitoring, deployment — that’s your problem. The SDK gives you the agent engine; everything around it is yours to build.

Best for: Developers building automated pipelines, research agents, coding automation, and multi-agent systems where Claude is the core AI engine.

Skip if: You want a ready-to-run platform — look at NanoClaw (container isolation + messaging integration out of the box) or OpenClaw (simpler self-hosted agent runtime with a large community).

Rating: 9.0/10

## Pricing

Free
$0
  • SDK is MIT licensed
  • Open source, no seat fees
  • Pay only for Anthropic API usage
Best Value
API Usage
Auf Anfrage
  • Claude Haiku 4.5: $1/$5 per MTok
  • Claude Sonnet 4.6: $3/$15 per MTok
  • Claude Opus 4.6: $5/$25 per MTok
  • Prompt caching reduces repeat costs up to 90%

Last verified: 2026-03-03.

## The Good and the Not-So-Good

+ Strengths

  • Official Anthropic SDK — built by the same team as Claude Code
  • Full built-in tool suite: Read, Write, Edit, Bash, Glob, Grep, WebSearch, WebFetch
  • Native subagent support for parallelized multi-agent workflows
  • First-class MCP integration — connect any MCP server in a few lines
  • Session persistence — resume agents across multiple runs with full context
  • Hooks system for observability, auditing, and custom control flow
  • Supports Amazon Bedrock, Google Vertex AI, and Azure AI Foundry as backends
  • Python and TypeScript both fully supported
  • max_budget_usd parameter to cap agent spend per run

− Weaknesses

  • Requires Anthropic API key — not usable without API access
  • No built-in UI — production deployment requires custom infrastructure
  • Steeper learning curve than chat-based Claude usage
  • No built-in container isolation — you manage sandboxing
  • Not for beginners: assumes understanding of async programming and agent patterns

## Security & Privacy

YES API Authentication — ANTHROPIC_API_KEY environment variable; no hardcoded credentials in SDK
YES Permissions System — Fine-grained tool allow/deny lists; permission modes: default, acceptEdits, bypassPermissions, dontAsk
NO Sandboxing — No built-in container isolation — agent has full access to host filesystem unless you sandbox externally
YES Budget Controls — max_budget_usd option stops execution when API cost threshold is exceeded
YES Hooks for Auditing — PostToolUse hooks log every file modification or command execution

## Who It's For

Best for: Developers building production agent systems on Claude: CI/CD automation, research pipelines, autonomous coding agents, multi-agent orchestration

Not ideal for: Beginners wanting a simple chatbot, teams needing a managed agent hosting platform, or non-Claude LLM integrations