claude-agent-sdk
Python SDK for Claude Code
Install
claude-agent-sdk on PyPI
pip
pip install claude-agent-sdkuv
uv add claude-agent-sdkpoetry
poetry add claude-agent-sdkPackage facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 4 — anyio, mcp, sniffio, typing-extensions |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: claude_agent_sdk-0.2.137-py3-none-macosx_11_0_arm64.whl; claude_agent_sdk-0.2.137-py3-none-macosx_11_0_x86_64.whl; claude_agent_sdk-0.2.137-py3-none-manylinux_2_17_aarch64.whl; claude_agent_sdk-0.2.137-py3-none-manylinux_2_17_x86_64.whl; claude_agent_sdk-0.2.137-py3-none-win_amd64.whl
Keywords: ai, anthropic, claude, sdk
About claude-agent-sdk
from the package's own PyPI description — quoted content, verbatim
Claude Agent SDK for Python
Python SDK for Claude Agent. See the Claude Agent SDK documentation for more information.
Installation
pip install claude-agent-sdk
Prerequisites:
- Python 3.10+
Note: The Claude Code CLI is automatically bundled with the package - no separate installation required! The SDK will use the bundled CLI by default. If you prefer to use a system-wide installation or a specific version, you can:
- Install Claude Code separately:
curl -fsSL https://claude.ai/install.sh | bash - Specify a custom path:
ClaudeAgentOptions(cli_path="/path/to/claude")
Quick Start
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)
Basic Usage: query()
query() is an async function for querying Claude Code. It returns an AsyncIterator of response messages. See src/claude_agent_sdk/query.py.
```python from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, TextBlock
Simple query
async for message in...
Read as markdown · JSON record · Source repository · Homepage · Docs
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
Python SDK for building and interacting with Claude Code agents, supporting async queries, custom tools via in-process MCP servers, and permission-controlled tool execution.
Medium install friction due to 4 runtime dependencies and platform-specific wheels (macOS, Linux, Windows). Active maintenance with recent release (1 day old) and strong community signal (7880 stars). Requires Python 3.10+.
MIT license permits commercial and private use with minimal restrictions; attribution required.
Usage
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)
Python 3.10 or higher required; Claude Code CLI is bundled but can be overridden with custom path via ClaudeAgentOptions.
Verdict: Well-maintained, actively developed SDK (released 1 day ago, 7880 stars) for Claude Code integration with permissive MIT licensing. Medium install friction from 4 dependencies and platform-specific wheels is offset by strong maintenance signal and no known vulnerabilities. Suitable for production use by developers building Claude agent applications.
Needs verification
- Whether bundled Claude Code CLI requires system dependencies or network access on first run
- Performance characteristics of in-process MCP servers vs. external subprocess servers under load
- Stability guarantees given Alpha classification (Development Status :: 3)
Similar packages
permissive · top 1,000 on PyPI
anthropicpermissive · top 1,000 on PyPI
fastmcppermissive · top 1,000 on PyPI
fastmcp-slimpermissive · top 1,000 on PyPI
agent-client-protocolunclear · top 1,000 on PyPI
langchain-anthropicpermissive · top 1,000 on PyPI
mcppermissive · top 1,000 on PyPI
huggingface-hubpermissive · top 100 on PyPI
litellmpermissive · top 100 on PyPI
websocketspermissive · top 100 on PyPI