Claude Agent SDK: reuse the engine behind Claude Code
The Claude Agent SDK is Anthropic's library that exposes Claude Code's agent loop, tools and context management in Python and TypeScript. It's for developers who want an agent that can already read files, run commands and search the web.
Data as of October 22, 2026
Key figures
| Developer | Anthropic |
|---|---|
| Type | Code |
| Languages | Python, TypeScript |
| Open source | No |
| License | proprietary |
| First release | September 2025 |
| Suggested level | Intermediate |
| Use cases | coding, automation, workflows |
| Self-hostable | Yes |
| Business model | Free |
| Cloud offering | No |
| Multi-agent | Yes |
| MCP support | Yes |
| Bring your own model | No |
| Official site | Official site · Documentation · Repository |
GitHub
| Repository | anthropics/claude-agent-sdk-python |
|---|---|
| GitHub stars | 8,330 |
| Forks | 1,368 |
| Latest code activity | October 22, 2026 |
| Latest release | v0.2.172 (October 22, 2026) |
GitHub activity checked on October 22, 2026.
From a terminal tool to a library
It all starts with Claude Code, Anthropic’s coding assistant that works in the terminal. Its internals were first offered to developers as the Claude Code SDK, then renamed Claude Agent SDK in September 2025 to signal that it isn’t only for coding. The idea: instead of writing your own AI agent loop and tools from scratch, you reuse Claude Code’s.
Out of the box, the agent can read, write and edit files, run shell commands and search the web. On top of that you get specialized subagents, hooks (your own code triggered at key moments), a permission system that decides which actions need your approval, resumable sessions, and connections to MCP servers to plug in databases, browsers or APIs.
What it’s good for
The SDK shines when an agent has to act on a real environment: fixing bugs, writing and running tests (agentic coding), sorting documents, producing reports, or automating a step in a CI pipeline. Anthropic publishes sample agents on GitHub, such as an email assistant and a research agent.
Getting started
You need Node.js 18+ or Python 3.10+ and an Anthropic account. Install claude-agent-sdk (pip) or @anthropic-ai/claude-agent-sdk (npm), set your API key, then call the query function with a prompt and the list of allowed tools. The official quickstart walks you through an agent that finds and fixes bugs in a file.
Strengths and limits
Strengths: a heavily equipped agent from the first line of code, the same machinery as Claude Code, and fine-grained control over permissions and context.
Limits: it only works with Claude models; its use is subject to Anthropic’s Commercial Terms; and every run consumes billed tokens, which can add up on long tasks. An agent that can run commands needs tight boundaries: sandboxing and our can I trust an agent with this? tool help you scope the risks. If you’d rather have Anthropic host the agent than run it on your own servers, the company offers a separate product called Managed Agents.
Alternatives
The OpenAI Agents SDK and Google ADK play a similar role for other vendors, while smolagents and Pydantic AI are model-agnostic.
Frameworks of the same type
- Amazon Bedrock Agents / AgentCore · multi-agent, RAG, workflows
- Atomic Agents · workflows, chatbot, automation
- CrewAI · multi-agent, automation, workflows
- Letta · chatbot, coding, automation
- OpenHands · coding, automation
- Strands Agents · multi-agent, workflows, automation
Frequently asked questions
Is the Claude Agent SDK open source?
Not fully. The Python repository shows an MIT license, but the documentation states that use of the SDK is governed by Anthropic's Commercial Terms, and the SDK bundles the proprietary Claude Code binary. It's best thought of as free to use but proprietary.
How is it different from Claude Code?
Claude Code is the command-line tool you use yourself day to day. The SDK exposes the same engine as a library so you can embed it in your own application or an automated pipeline.
Can my users log in with their Claude subscription?
No. Unless previously approved, Anthropic does not allow third-party developers to offer claude.ai login in their products. You need an Anthropic API key or access through Amazon Bedrock, Google Cloud or Microsoft Foundry, billed by usage.
Does it work with GPT or Gemini?
No, it is built for Claude models. If you want the freedom to switch vendors, a model-agnostic framework will be more flexible.
Data sources
- code.claude.com
- code.claude.com
- github.com
- github.com
- pypi.org
- GitHub — Repository metadata: GitHub
Data as of October 22, 2026
Report an error
Does a figure, a date or a fact look wrong? Tell us: every report is checked.