When Anthropic renamed "Claude Code SDK" to the Claude Agent SDK, it signaled where the value really lives: not in the chat loop, but in turning Claude Code's agent harness — its tool execution, permission gating, and session management — into a library you call from your own code. You don't reimplement an agent; you drive the same one Claude Code runs, with deterministic hooks where it matters.
What Sets It Apart
- Two interaction shapes, one engine.
query()is a stateless async generator for fire-and-forget tasks;ClaudeSDKClientkeeps a bidirectional session for interactive, multi-turn work with mid-stream control. - In-process MCP tools. Decorate a Python function with
@tooland it becomes a callable tool with no separate process or transport — closing the latency and ops gap that external MCP servers impose. - Hooks make behavior deterministic.
PreToolUse/PostToolUsecallbacks let you inspect, rewrite, or block actions (e.g., veto aBashcommand) instead of relying on the model to behave. - Real permission surface.
allowed_toolsallowlists,permission_mode, and acan_use_toolcallback give code-level control over what the agent can touch.
Who It's For
Great fit if you want production agents that reuse Claude Code's battle-tested file/Bash/edit tools and need guardrails enforced in code rather than prompts. Look elsewhere if you only need plain text completions — the SDK bundles and manages the Claude Code CLI under the hood, which is overhead you don't need for a simple chat call. Note it targets Python 3.10+ and the agent runs through that bundled CLI.