Claude Agent SDK
Also known as: Claude Code SDK, Anthropic Agent SDK, claude-agent-sdk
- Claude Agent SDK
- The Claude Agent SDK is Anthropic’s official framework for building agents powered by Claude. It provides a Python and TypeScript runtime with built-in tools for reading files, writing code, running shell commands, and connecting custom tools, originally released as the Claude Code SDK.
The Claude Agent SDK is Anthropic’s framework for building AI agents on top of Claude, with file editing, command execution, and code search tools available by default in Python and TypeScript.
What It Is
The Claude Agent SDK gives developers a packaged way to wrap Claude with the same toolset that powers Anthropic’s own coding assistant — without rebuilding tool plumbing from scratch. For teams comparing it against frameworks like LangGraph or CrewAI, the SDK takes a different angle: instead of orchestrating workflows across many models, it gives a single Claude agent batteries-included access to the local environment (files, shell, search) and lets you compose subagents from there.
Under the hood, the SDK exposes Claude through a runtime that already knows how to read files, edit them, run shell commands, and search code. According to Claude Code Docs, the default toolset includes Read, Write, Edit, and Bash, available without extra setup. You describe a task in plain English, and Claude decides which tools to call and in what order — the SDK handles the loop of tool call, tool result, next decision.
For anything the defaults do not cover, you reach for the ClaudeSDKClient. According to Claude Code Docs, custom tools and hooks are defined as Python or TypeScript functions and run as in-process MCP servers — meaning your tool definitions live inside your application process, not as separate services. A function with a docstring and a type signature becomes a callable tool. Hooks let you intercept events (before a tool call, after a result) to add logging, validation, or human approval gates.
Two safety features matter for production. According to Claude Code Docs, file checkpointing creates backups before file modifications so any change can be restored to a prior state, and sandbox execution runs commands in an isolated environment. Both are opt-in, for cases where the agent acts on input you do not fully control.
How It’s Used in Practice
The most common entry point is a developer who wants Claude to do real work on a real codebase — not just chat about it. They install the SDK, point it at a project, and ask Claude to refactor a module, write tests, or migrate a config format. Because Read, Write, Edit, and Bash are wired in by default, the agent can open files, propose edits, run the test suite, and iterate based on what failed — all in a single session.
The second wave of usage is teams embedding Claude into internal tools, wrapping the SDK with custom tools that query a ticketing system or call a deployment API. Compared with multi-agent frameworks that orchestrate roles across many different LLMs, the Agent SDK assumes Claude is the brain and focuses on giving that single agent a well-equipped local environment to act in.
Pro Tip: Before adding a custom tool, check whether the default Read/Write/Edit/Bash set already covers it. Most early agent bugs come from redundant tools confusing the model about which one to call. Trim before you grow.
When to Use / When Not
| Scenario | Use | Avoid |
|---|---|---|
| Building a coding agent that reads, edits, and tests files in a real repo | ✅ | |
| Routing the same task across GPT, Claude, and Gemini for cross-vendor comparison | ❌ | |
| Embedding Claude in an internal tool with a few custom domain APIs | ✅ | |
| Visual graph-based workflow with branching, loops, and state machines as first-class concepts | ❌ | |
| Quick prototype where the Read/Write/Edit/Bash defaults already cover the work | ✅ | |
| Multi-agent system where each agent runs a different LLM provider | ❌ |
Common Misconception
Myth: The Claude Agent SDK is only useful for coding tasks because it used to be called the Claude Code SDK. Reality: According to Anthropic Engineering, the rename reflects the opposite — the same runtime now powers both code-focused and general-purpose agents. Anything you can express as files, commands, and custom tools is fair game: documentation pipelines, data wrangling, internal automations, customer support flows. The “Code” in the old name described the toolset, not the use case.
One Sentence to Remember
If you already work with Claude and your task touches files or a shell, the Claude Agent SDK is usually the shortest path from “chatbot” to “agent that gets things done” — start with the defaults, add custom tools only when the gap is obvious.
FAQ
Q: Is the Claude Agent SDK the same as Claude Code? A: No. Claude Code is the end-user CLI; the Agent SDK is the framework underneath. The SDK lets you build your own agents on the same runtime Claude Code itself uses.
Q: What languages does the Claude Agent SDK support? A: According to Claude Code Docs, the SDK ships in both Python and TypeScript, with packages on PyPI and npm. Both have feature parity for tools, hooks, and the in-process MCP custom tool pattern.
Q: How does the Claude Agent SDK compare to LangGraph or CrewAI? A: LangGraph and CrewAI orchestrate workflows across many LLMs and roles. The Agent SDK assumes Claude is the brain and focuses on a strong local toolset and safe execution.
Sources
- Claude Code Docs: Agent SDK overview — Claude Code Docs - Official documentation covering default tools, custom tool definition, file checkpointing, and sandbox execution.
- Anthropic Engineering: Building agents with the Claude Agent SDK - Engineering post covering the rename from Claude Code SDK and the SDK’s positioning as a general agent runtime.
Expert Takes
The SDK’s interesting move is making the agent runtime itself a primitive. You stop reasoning about token budgets and tool-calling loops — those are abstracted. What is left is whether your task decomposition matches the model’s strengths. The SDK does not make Claude smarter; it removes the friction between Claude’s decisions and the local file system or shell, which is where most real software work actually lives.
Treat the SDK as a context-driven runtime, not a chat wrapper. The default tools work because they are documented in a system prompt the SDK ships — change the spec, and you change behavior. When custom tools start firing in unexpected orders, look at your tool descriptions before blaming the model. Clear, plain-text specs upstream of the SDK fix more bugs than retry logic ever will.
The renaming from Code SDK to Agent SDK is a signal. Anthropic is staking out the build-your-own-agent layer and positioning Claude as the runtime, not just a model. Teams choosing between LangGraph, CrewAI, and this are really choosing whose abstractions they want to inherit. If you are already paying for Claude and your workflow involves files or shell, the Agent SDK has the shortest path to production.
An agent that can read your files and run shell commands is a category of risk most software teams have not thought about carefully. Sandbox and file checkpointing options exist because Anthropic understands this. The harder question is organizational: who reviews what an autonomous agent did overnight? If the answer is “the logs, eventually,” you have moved faster than your accountability has.