Dev & Engineering ✓ Anthropic · Official python-sdkmcpcustom-toolshooksasync-api

Claude Agent SDK for Python

Call Claude Code from Python to build asynchronous and interactive agent workflows with extensible tools.

Stars
★ 8.7k
Last updated
1d ago v0.2.189
FARS reviewed
Nov 08, 2026 +10 new
License
MIT
Primary language
Python

At a glance

How it runs
Library / SDK
Works with
Platform-specificClaude CodeClaude API (Partial support)
Setup effort
Low · running in minutes
You'll need
Python 3.10+Claude Code CLIShell / CLINetwork accessLocal filesystemMCP Server
Typical use
Python application developers adding Claude Code queries to an existing application.
Not a fit if
  • Teams needing a provider-agnostic SDK
  • Teams that cannot run the Claude Code CLI
Maintenance
Commits in the last 30 dayslast commit 2026-12-03latest release v0.2.189 (2026-11-25)+7.3 ★/day over 7 days
Source review
61/100 · Some gaps

What does this agent do, and when should you use it?

This SDK provides an async Python interface for calling Claude Code and requires Python 3.10 or later. query() returns an asynchronous iterator of response messages for one-off requests, while ClaudeSDKClient supports bidirectional conversations and Python-defined custom tools and hooks. The package bundles the Claude Code CLI by default, with options to use a system installation or set a custom path. Claude can use the Claude Code toolset, and applications process the resulting messages and content blocks. The SDK is tied to the Claude Code ecosystem; the README does not state model usage prices or credential requirements.

After installing claude-agent-sdk, a Python program can send a prompt to Claude Code with query(prompt=...) and asynchronously read response messages. ClaudeAgentOptions configures the working directory, system prompt, turn limit, tool approvals, and permission mode. For interactive sessions, ClaudeSDKClient sends queries and receives responses; @tool and create_sdk_mcp_server register in-process Python tools, while hooks run deterministic logic at specific points in the agent loop. Applications can inspect types such as AssistantMessage and TextBlock, and catch CLI connection, process, result, or JSON decoding errors.

  1. Python application developers adding Claude Code queries to an existing application.
  2. Teams processing response messages in interactive Claude Code sessions.
  3. Teams exposing existing Python functions as in-process MCP tools for Claude to call.
  4. Engineering teams applying deterministic checks or blocking logic before tools such as Bash run.

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Install / run
  • pip install claude-agent-sdk
Runtime
Python 3.10+

How do you install or deploy this agent?

Requires Python 3.10+. The package bundles the Claude Code CLI automatically. If you prefer a system installation or a specific version, install the CLI separately or set its path with ClaudeAgentOptions(cli_path=...).

How do you use this agent?

Minimal async invocation:

pip install claude-agent-sdk
import anyio
from claude_agent_sdk import query

async def main():
    async for message in query(prompt="What is 2 + 2?"):
        print(message)

anyio.run(main)

Safety boundaries, hardening & integrations

Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.

Declared capability surface (blast radius)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

External MCP tool bridge

Inherits capabilities of connected MCP servers; audit third-party servers before enabling.

What are this agent's strengths and limitations?

Pros
  • query() provides a straightforward async message stream for embedding in Python programs.
  • ClaudeSDKClient supports bidirectional conversations, Python-defined custom tools, and hooks.
  • The Claude Code CLI is bundled by default, and a custom CLI path can be configured.
Limitations
  • Core calls depend on the Claude Code CLI and ecosystem, limiting provider portability.
  • Requires Python 3.10 or later.
  • The README does not specify model usage costs, credentials, or offline operation, so adopters need to verify those conditions.

How does this agent compare with similar options?

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
Claude Agent SDK for Python This agent 61 · Some gaps Library / SDK ★ 8.7k 1d ago Python Claude Code
Agno Agent Platform 55 · Major gaps FrameworkFree + model costs ★ 43k today Python —
Promptise Foundry 81 · Good Library / SDKFree + model costs ★ 898 1d ago Python Claude.ai · OpenAI API · Claude API
OpenAI Agents SDK 76 · Good Library / SDKFree + model costs ★ 31k today Python OpenAI API

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Some gaps
61/ 100 5-point scale 3.1 / 5
This review covers the source as of Nov 08, 2026. The project has shipped 10 stable release(s) since, which have not been re-reviewed. The score and verdict describe the reviewed version only. Recent releases ↓
Trust 13/29
Reliability 9/14
Adaptability 12/18
Convention 13/18
Effectiveness 9/13
Verifiability 5/8
Why each dimension lost points
Trust13 / 29 · 2.2/5

The README explains that allowed_tools auto-approves listed tools, while unlisted tools are decided by permission_mode and can_use_tool, and notes that the default toolset includes Bash and Write. This makes permissions and data flow more transparent, but the example enables acceptEdits and does not demonstrate default human confirmation or recovery, so least privilege, confirmation, external effects, and rollback are only partially addressed. The visible workflow guidance describes credential isolation, minimal permissions, and avoiding token output, but the packet lacks enough runtime product code to assess sensitive-data handling. Dependencies have version ranges; workflow build dependencies are hash-locked, but the material does not establish a complete dependency-security review. The README and project metadata clearly attribute the SDK and point to Anthropic documentation and issue tracking.

Reliability9 / 14 · 3.2/5

The README gives concrete descriptions of query, the client, error types, and CLI version requirements. pyproject lists runtime dependencies and Python versions, and the test samples cover build-script version pinning and platform tags, offering some corroboration. Scores are limited because the supplied source and tests are samples and cannot establish all implementation details or runtime outcomes; error types are described, but not every failure path is shown.

Adaptability12 / 18 · 3.3/5

The SDK targets Python developers and documents one-shot queries, interactive clients, custom tools, hooks, working directories, and custom prompts. It clarifies that allowed_tools is an auto-approval list rather than a way to remove tools, identifies disallowed_tools for blocking tools, and documents prompt snapshot behavior and CLI version requirements. The packet does not include enough product code to assess all capability boundaries, and environment support is mainly evidenced through Python versions, platform builds, and some CLI configuration.

Convention13 / 18 · 3.6/5

The README is organized around installation, quick start, tools, hooks, types, error handling, and development, with examples, migration notes, and prompt snapshot guidance. pyproject and LICENSE explicitly provide MIT terms, earning full marks for license. The package and CLI versions, release steps, and some build conventions are documented and sampled tests cover parts of them. The packet does not show a complete FAQ, limitations list, or full changelog; Anthropic authorship, the official repository, and the release workflow indicate maintenance responsibility, but no specific maintenance commitment is shown.

Effectiveness9 / 13 · 3.5/5

The SDK provides asynchronous message streaming, interactive sessions, hooks, and in-process custom tools. Its examples show usable interfaces and a clear role for integrating Claude Code into Python applications. The packet provides no quantitative cost, performance, or suitability comparisons, and the practical value and risk of its broad default tool capabilities depend on application configuration.

Verifiability5 / 8 · 3.1/5

The README links major interfaces to source files and documentation; pyproject supplies dependency, version, and project metadata; and the test samples contain readable assertions for some build behavior. This provides limited cross-file support. The evidence packet is a sample, this review did not execute code, and not every documented feature can be cross-checked against the supplied source or tests.

Risks and how to mitigate them
  • The default toolset includes capabilities such as Bash, Write, and Edit, and allowed_tools auto-approves listed tools. Integrators should carefully configure the approval list, permission_mode, can_use_tool, and disallowed_tools.
  • The evidence packet is a repository sample and this is a static review; runtime behavior and the complete dependency-security state were not established.
Evidence confidence: Low Reviewed Nov 08, 2026 Reviewed revision 2209f2c134fe New commits since this review; the score may not cover them
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/claude-agent-sdk-python.svg)](https://followagents.com/en/agents/claude-agent-sdk-python)
<a href="https://followagents.com/en/agents/claude-agent-sdk-python"><img src="https://followagents.com/badge/claude-agent-sdk-python.svg" alt="FARS review"></a>

Recent releases

Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.

  1. v0.2.189
    Release notes excerpt
    --- PyPI: https://pypi.org/project/claude-agent-sdk/0.2.189/ ```bash pip install claude-agent-sdk==0.2.189 ```
    View on GitHub ↗
  2. v0.2.188
    Release notes excerpt
    --- PyPI: https://pypi.org/project/claude-agent-sdk/0.2.188/ ```bash pip install claude-agent-sdk==0.2.188 ```
    View on GitHub ↗
  3. v0.2.187
    Release notes excerpt
    --- PyPI: https://pypi.org/project/claude-agent-sdk/0.2.187/ ```bash pip install claude-agent-sdk==0.2.187 ```
    View on GitHub ↗

FAQ

Do I need to install the Claude Code CLI separately?
No. The package bundles it by default. You can also install a system version or set a path with ClaudeAgentOptions(cli_path=...).
How do query() and ClaudeSDKClient differ?
query() returns an async iterator of response messages. ClaudeSDKClient supports bidirectional conversations and adds custom tools and hooks.
How can I control which tools Claude uses?
allowed_tools auto-approves listed tools; it does not remove other tools from the toolset. Unlisted tools are handled by permission_mode and can_use_tool. Use disallowed_tools to block specific tools.
Which errors can the SDK report?
It provides error types including CLINotFoundError, CLIConnectionError, ProcessError, ResultError, and CLIJSONDecodeError.
Was this page helpful?
View on GitHub ↗ Install ↓

Host ecosystems

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts