Claude Agent SDK
Published
At a glance
- What it is
- The Claude Agent SDK is Anthropic's library for building agents on top of the same harness that runs Claude Code.
- Price from
- Usage-based pricing Details
- Best for
- Teams embedding a coding or file-working agent in their own app; Python or TypeScript developers who want Claude Code's tools as a library
- Official site
- code.claude.com
- Last checked
- November 2026
- Watch out for
- It only drives Claude models, through Anthropic's API or the supported cloud providers.
The Claude Agent SDK is Anthropic's library for building agents on top of the same harness that runs Claude Code. It ships for Python and TypeScript and gives your code the built-in tools, agent loop and context management that Claude Code uses. It was previously published as the Claude Code SDK, and Anthropic keeps a migration guide for the old packages.
Developers install `claude-agent-sdk` from PyPI or `@anthropic-ai/claude-agent-sdk` from npm, set an API key, and call `query()` with a prompt and options. The call returns an async stream of messages as Claude reads files, runs commands and edits code. Options cover the system prompt, which tools are pre-approved, the permission mode and the working directory. In Python, `ClaudeSDKClient` adds multi-turn sessions, custom tools and hooks. The quickstart walks through an agent that finds and fixes bugs in a small file.
The SDK connects to external systems through MCP servers, and custom tools can run as in-process MCP servers inside your own app. It also loads skills, commands, memory and plugins from `.claude/` folders, the same way Claude Code does. Both packages bundle a native Claude Code binary, though some installs (for example ARM64 Windows source builds, or npm installs that skip optional dependencies) need Claude Code installed separately. Anthropic does not allow third-party products to offer claude.ai login or rate limits unless approved, so you authenticate with API keys or a cloud provider.
Key features
- Built-in tools
- Agents can read, write and edit files, run shell commands and search the web without you implementing those tools.
- Hooks
- Your application runs code at points in the agent loop, such as before a tool call, and can deny a command deterministically.
- Subagents
- An agent can spawn specialised subagents for focused subtasks.
- MCP and custom tools
- Connect external MCP servers or expose your own functions as an in-process MCP server with no subprocess.
- Permissions
- Permission modes plus allow and deny rules decide which tools run automatically and which need approval.
- Sessions
- Keep context across exchanges, then resume or fork a session later.
- Skills and plugins
- Skills, commands, memory and plugins load from the project's and user's `.claude/` folders.
- Cloud providers
- Besides an Anthropic API key, it supports Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform and Microsoft Foundry via environment variables.
Pricing
As of November 2026, the Agent SDK packages are free to install from npm and PyPI, and Anthropic's docs list no separate fee for the SDK itself. You pay for model usage through the account behind your credentials: an Anthropic API key from the Claude Console, or Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform or Microsoft Foundry. The SDK docs do not publish token prices, so check your provider's pricing page. Use is governed by Anthropic's Commercial Terms of Service.
Best for
- Teams embedding a coding or file-working agent in their own app
- Python or TypeScript developers who want Claude Code's tools as a library
- Automation jobs in CI or backend services
- Builders who need hooks and permission rules around tool use
Limitations
- It only drives Claude models, through Anthropic's API or the supported cloud providers.
- It requires Python 3.10+ or Node.js 18.14+, and only Python and TypeScript have native SDKs; other languages must run the CLI as a subprocess.
- Third-party products may not offer claude.ai login or its rate limits without Anthropic's approval, so end users need API-key billing.
- Some installs, such as ARM64 Windows source builds or npm installs that omit optional dependencies, get no bundled Claude Code binary.
- Branding rules forbid calling your product "Claude Code" or copying Claude Code's visual style.
Verdict
The Claude Agent SDK is the most direct way to put Claude Code's agent loop, tools and permission model inside your own software. It fits well if you are already committed to Claude models. If you need several model vendors or a language other than Python or TypeScript, a provider-neutral framework will suit you better.
Sources
Written from the vendor's own site and documentation, checked November 2026. We have no paid relationship that affects what this page says.
- code.claude.com /docs/en/agent-sdk/overview
- code.claude.com /docs/en/agent-sdk/quickstart
- github.com /anthropics/claude-agent-sdk-python
How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.