What it is
The Claude Agent SDK (renamed from the Claude Code SDK in September 2025) gives you the same agent loop, built-in tools and context management that power Claude Code, as a library you call from Python or TypeScript. Its core idea is to "give your agents a computer": the agent can read and write files, run shell commands, search the web and call MCP servers, rather than only calling functions you define. It runs the Claude Code binary under the hood, so it targets Claude models specifically, and its use is governed by Anthropic's Commercial Terms (only the thin Python wrapper is MIT).
How it works
You call query() (or open a client session) with a prompt and options such as a system prompt, allowed tools and a permission mode. The SDK runs an agent loop of gather context, take action, verify work, repeat: Claude picks a tool, the SDK executes it under your permission rules, and results stream back as messages until the task is done. Hooks let you run your own code at lifecycle points, subagents handle focused subtasks in their own context, and sessions can be resumed or forked later.
Key concepts
- Agent loop
- The repeated cycle of gathering context, taking an action with a tool, and verifying the result until the task is complete.
- Built-in tools
- Claude Code's ready-made tools (Read, Write, Edit, Bash, web search and others) available to your agent without writing them yourself.
- Permissions
- Rules (allowed/disallowed tools, permission mode, a can_use_tool callback) that decide which tool calls run automatically and which need approval.
- Hooks
- Your own code that runs at key points in the agent lifecycle, e.g. before a tool call or when the agent stops.
- Subagents
- Specialized agents spawned for focused subtasks, each with its own context window.
- Sessions
- Persisted conversation context that can be resumed or forked later.
Use it when
- You want a production-grade agent that works on files, code or a shell without building the tool loop and tools yourself.
- You are building on Claude models and want the same harness Anthropic uses in Claude Code.
- You need fine-grained control over what an autonomous agent may do (permissions, hooks).
Look elsewhere when
- You need to switch freely between model providers; the SDK is built around Claude.
- You only need a single model call or a simple tool loop; the Claude API client SDK (or its tool runner) is lighter.
- You want Anthropic to host the agent and sandbox for you; Claude Managed Agents covers that case.
Who uses it
- Spotify
Runs its background coding agent "Honk" on the Agent SDK inside its Fleet Management system to merge large-scale code migrations.
Evidence: claude.com
- StackBlitz (Bolt)
Built a design-system agent that lets PMs and designers produce on-brand prototypes.
Evidence: claude.com
- Zendesk
Used Claude Code and the Agent SDK to build its custom agent builder.
Evidence: claude.com
- Caylent
Rebuilt its Caylent Accelerate cloud-migration product on the Agent SDK.
Evidence: claude.com
Milestones
- Claude Code SDK renamed to Claude Agent SDK (packages claude-agent-sdk and @anthropic-ai/claude-agent-sdk) (claude.com)
- Claude Code SDK announced alongside Claude Code general availability and Claude 4 (x.com)
Start learning
code.claude.com
- Agent SDK quickstart ↗tutorial
code.claude.com
claude.com
github.com