Debuly
Claude Agent SDK logo

Claude Agent SDK

Anthropic's Python SDK for building agents on the Claude Code runtime, with built-in tools, custom tools, hooks and MCP servers.

What is Claude Agent SDK?

The Claude Agent SDK for Python lets developers embed the Claude Code agent loop inside their own programs. You install it with pip, and the Claude Code CLI comes bundled in the package, so nothing else needs installing on Python 3.10 or newer. A simple query() call streams back messages from Claude, which by default can use the full Claude Code toolset, including Read, Write, Edit and Bash. For richer apps, ClaudeSDKClient supports two-way conversations, custom tools written as plain Python functions and served as in-process MCP servers, and hooks that run your code at points in the agent loop, such as blocking a risky shell command. Options control the working directory, system prompt, allowed tools and permission mode. The SDK is distributed free on PyPI and GitHub under Anthropic's Commercial Terms, and no separate price is listed, because running it requires access to Claude.

Use cases

  • Build a coding agent in Python
  • Automate file and shell tasks with Claude
  • Add custom tools as in-process MCP servers
  • Block risky commands with permission hooks
  • Run multi-turn agent conversations from code
  • Embed Claude Code in internal developer tools

Who it's for

  • Python developers
  • AI engineers
  • Platform teams

Why use Claude Agent SDK

  • The same agent loop that powers Claude Code runs inside your own application, so you skip building tool handling yourself.
  • Bundling the CLI means installation is a single pip command.
  • In-process custom tools avoid managing separate server processes and are easier to debug.
  • Hooks give deterministic control over what the agent may run.
  • Permission options let you decide which tool calls are auto-approved.

Claude Agent SDK features

  • query() function that streams messages from the Claude agent loop
  • ClaudeSDKClient for interactive, bidirectional conversations
  • Full Claude Code toolset available by default, including Read, Write, Edit and Bash
  • Custom tools written as Python functions with the @tool decorator
  • In-process SDK MCP servers, mixable with external MCP servers
  • Hooks such as PreToolUse to approve, deny or adjust tool calls
  • ClaudeAgentOptions for system prompt, working directory and permission mode
  • allowed_tools and disallowed_tools to control approvals
  • Typed error classes such as CLINotFoundError and ProcessError
  • Claude Code CLI bundled in the package, with an option to use your own

Claude Agent SDK integrations

  • Claude Code
  • MCP
  • PyPI
  • GitHub Actions

How to get started with Claude Agent SDK

  1. Install the package with pip install claude-agent-sdk on Python 3.10 or newer.
  2. Call query() with a prompt, or open a ClaudeSDKClient for a back-and-forth session.
  3. Set ClaudeAgentOptions for the working directory, system prompt, allowed tools and permission mode.
  4. Add custom tools or hooks as Python functions so Claude can call your code and you can govern its actions.
  5. Handle the streamed messages and catch SDK errors in your application.

Claude Agent SDK limitations

  • Requires Python 3.10 or later
  • Using it requires access to Claude, which is covered by Anthropic's own terms
  • allowed_tools only pre-approves tools; it does not remove them from Claude's toolset
  • Changing a custom system prompt has no effect on an existing session unless snapshotting is turned off

Claude Agent SDK pricing

We couldn't confirm pricing on the official site. Check github.com for current prices.

Prices can change and may vary by country or exclude tax. Check the official pricing page.

Claude Agent SDK alternatives

The main Claude Agent SDK alternatives listed on Debuly are OpenAI Agents SDK, LangGraph, CrewAI, Pydantic AI, AutoGen and LangChain Deep Agents. The table compares pricing and platforms; order is A–Z.

Claude Agent SDK compared with its alternatives
ToolPricingStarting pricePlatforms
Claude Agent SDKPricing unknown—Python, CLI, macOS, Linux
AutoGenOpen source—API, CLI
CrewAIOpen source—Web, API, CLI, Self-hosted
LangChain Deep AgentsOpen source—Python, TypeScript, CLI
LangGraphOpen source—Self-hosted, Web, API
OpenAI Agents SDKOpen source—Python, macOS, Linux, Windows
Pydantic AIOpen source—API, CLI, Self-hosted
  1. AutoGen

    Microsoft's MIT-licensed Python and .NET framework for multi-agent AI apps, now archived; new projects are pointed to Microsoft Agent Framework.

  2. CrewAI

    Multi-agent framework and platform for building AI agent crews in Python or a visual editor, then deploying and monitoring them.

  3. LangChain Deep Agents

    Open-source LangChain agent harness: long-term memory, a virtual filesystem, subagents and planning included

  4. LangGraph

    Low-level open-source orchestration framework and runtime for building stateful, long-running AI agents as graphs.

  5. OpenAI Agents SDK

    Open-source Python framework for building multi-agent workflows with tools, handoffs, guardrails, tracing, sandboxes and voice agents.

  6. Pydantic AI

    A type-safe, model-agnostic Python framework for building agents and LLM applications, from the team behind Pydantic.

Claude Agent SDK FAQ

What is the Claude Agent SDK?

It is Anthropic's Python SDK for building agents on top of Claude. It wraps the Claude Code agent loop so your code can run Claude with tools, custom tools and hooks.

How much does the Claude Agent SDK cost?

The README lists no price for the SDK. It is installed with pip and used under Anthropic's Commercial Terms of Service, and running it requires access to Claude, which is billed separately.

Is there a free plan for the Claude Agent SDK?

The SDK package itself has no listed fee and is available on PyPI. You still need Claude access, so check Anthropic's pricing for the usage that powers your agent.

Is the Claude Agent SDK open source?

The source is public on GitHub, but the README says use is governed by Anthropic's Commercial Terms of Service, so review those terms before relying on it.

Do I need to install Claude Code separately?

No. The Claude Code CLI is bundled with the package and used by default. You can still point to your own installation with the cli_path option.

Does it support custom tools and MCP?

Yes. You can define custom tools as Python functions and run them as in-process MCP servers, or combine them with external MCP servers.

What are alternatives to the Claude Agent SDK?

Alternatives include the OpenAI Agents SDK, LangGraph, CrewAI, the Vercel AI SDK and Pydantic AI.

Sources & verification

Facts on this page come from the official sources below, each with the date we read it. Written by Debuly; the vendor did not review this page.

SourceTypeAccessed
github.com/anthropics/claude-agent-sdk-pythonofficial

Image credits

  • Logo: from avatars.githubusercontent.com · fetched · Vendor trademark, used only to identify the product; removed on request
  • Cover: none collected yet, so a generated tile is shown.

Spot an error? Report an issue with this listing. We also remove a logo or image on the owner's request.