--- id: claude-agent-sdk version: "0.2.137" license: MIT license_treatment: permissive maintenance: active --- # claude-agent-sdk — Python SDK for Claude Code License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install claude-agent-sdk uv add claude-agent-sdk poetry add claude-agent-sdk ## Description # Claude Agent SDK for Python Python SDK for Claude Agent. See the [Claude Agent SDK documentation](https://platform.claude.com/docs/en/agent-sdk/python) for more information. ## Installation ```bash 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 ```python 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](src/claude_agent_sdk/query.py). ```python from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, TextBlock # Simple query async for message in... ## AI interpretation — verify before relying 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. 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. [View on SkillFed](https://skillfed.io/packages/claude-agent-sdk) · [View on PyPI](https://pypi.org/project/claude-agent-sdk/)