
Claude Agent SDK
Anthropic's SDK for building agents on the same harness as Claude Code — tool use, file and shell access, subagents and context management — in Python and TypeScript.
Works with AI agents:llms.txtThe Claude Agent SDK is a library that puts the agent behind Claude Code inside your own program. Instead of writing the tool-calling loop yourself, you call one function and get an agent that reads and edits files, runs shell commands, searches the web and decides when it is done.
The model to understand: when your code calls query(), the SDK starts a claude CLI process and talks to it over stdio. That process owns a shell, a working directory and session transcripts on local disk, so each running session is a long-lived process with local state, not a stateless API call. The SDK ships for Python and TypeScript; other languages can run the CLI as a subprocess with JSON output.
What a small team gets: built-in file, shell and web tools; your own functions exposed as tools through an in-process MCP server, plus external MCP servers; permission rules for which tools run without approval; hooks at points in the agent lifecycle; subagents; and sessions you can resume or fork. It calls the Claude API with an API key, or Claude through Amazon Bedrock, Google Cloud or Microsoft Foundry. You host it yourself, usually in sandboxed containers.
The main limit is operational. Anthropic suggests about 1 GiB of RAM, 5 GiB of disk and one CPU per agent as a starting point, and transcripts and working files disappear with the container unless you persist them. For a few tool calls per request, the plain Claude client SDK is lighter.
Where it fits
Who uses it
No maker's live product on record yet, and 58 open-source projects that declare it in their code.
We haven't found a maker's live product that uses Claude Agent SDK yet — only the open-source projects below, which declare it in their code.
Open source: a project that declares Claude Agent SDK as a dependency in its public code — verifiable, but not necessarily a live product.
Loved and watch-outs
Themes that recur in makers' words and Hacker News comments, each linked to what it summarises.
- Exposes nearly everything Claude Code has, including subagents, plan mode, background tasks, plugins, shell and MCP tools, as a library. HNHN 2HN 3HN 4
- A headless Claude Code makes custom desktop and mobile front ends far easier to maintain than scraping terminal output. HNHN 2HN 3
- Teams stand up internal agents quickly, such as Slack helpers, grading tools and agent factories. HNHN 2HN 3HN 4
- Hooks and permission controls are unusually granular for an agent SDK. HN
- Rules on using it with a Claude subscription are confusing and keep changing, including an announced billing change that was later paused. HNHN 2HN 3HN 4
- It feels heavy and hard to customize, essentially a thin, closed wrapper around the CLI with incomplete docs. HNHN 2
- Automations, scheduling and security boundaries need separate infrastructure you build yourself. HN
- It ties you to Claude models, so some developers build vendor-agnostic replacements. HNHN 2
Reliability and open issues
- Feature Request: Go/Golang SDK Support for Claude Agent SDK👍 36 · opened Jan 2026 · active Jun 2026
- [FEATURE] Prompt Caching Support in Claude Agent SDK👍 17 · opened Mar 2026 · active Jul 2026
- Performance Issues with Server-side Multi-instance Deployment👍 16 · opened Nov 2025 · active Mar 2026
- `cwd` in ClaudeCodeOptions does not seem to be honored at all👍 14 · opened Jun 2025 · active Apr 2026
- Feature: Portable session snapshots (export/import across machines)👍 11 · opened Oct 2025 · active Oct 2025
Alternatives to Claude Agent SDK
All alternatives by situation →Questions makers ask about Claude Agent SDK
Can I run it in a serverless function?
It is built for a container rather than a stateless function. Each session is a long-lived claude subprocess with its own shell, working directory and transcripts on local disk, and Anthropic's hosting guide sizes containers at roughly 1 GiB RAM, 5 GiB disk and one CPU per agent. source ↗
Can I use it through Amazon Bedrock or Google Cloud instead of the Anthropic API?
Yes. Set an environment variable for Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry and configure that cloud's credentials; otherwise it uses an Anthropic API key. source ↗
Can my users sign in with their Claude.ai subscription?
No, not without prior approval from Anthropic. Third-party products built on the SDK are expected to authenticate with API keys, not claude.ai login or its rate limits. source ↗
Which languages are supported?
Python (3.10+) and TypeScript (Node.js 18+). Both packages bundle the native Claude Code binary; from other languages you can drive the same loop by running the CLI as a subprocess with JSON output. source ↗
How do I give the agent my own tools?
Define functions with a name, description and input schema, wrap them in the SDK's in-process MCP server, and pass it in the query options. You can also connect external MCP servers and restrict which built-in tools the agent sees. source ↗
Do sessions survive a container restart?
Not by default; transcripts, memory files and working-directory files live on the container's disk. A SessionStore adapter can persist transcripts across hosts, but other files need a mounted volume or your own sync. source ↗
Is it safe to serve several customers from one container?
Only with care. By default the SDK loads settings and memory files from the filesystem, so Anthropic's guide recommends a separate working directory and config directory per tenant and disabling auto memory, or one sandboxed container per agent. source ↗
Is Claude Agent SDK free?
No permanent free tier; paid use starts at Pay per token. source ↗
Is Claude Agent SDK open source or self-hostable?
Open source, and you can self-host it. source ↗
Can AI coding agents work with Claude Agent SDK?
It serves an llms.txt docs index.
Who uses Claude Agent SDK?
No maker's live product we track yet; 58 open-source projects declare it in their code. source ↗