The Claude Agent SDK for Python is Anthropic’s official Python toolkit for interacting with Claude Agent (Claude Code). It offers async streaming interfaces, support for custom tools and hooks, and examples of in-process SDK MCP servers to expose tools safely and with low overhead.
Key features
- Async streaming API:
query()
returns an async iterator suitable for processing streaming responses. - Custom tools & MCP support: in-process SDK MCP servers simplify exposing Python functions as callable tools.
- Rich examples: quick_start, streaming_mode, hooks and other examples to speed up adoption.
- Engineering readiness: targets Python 3.10+, includes CLI, tests and packaging configuration.
Use cases
- Building interactive assistants or agentic apps that integrate with Claude from Python applications.
- Exposing custom tools to the model in-process to avoid IPC overhead and simplify deployment.
- Researching tool-use patterns and streaming interaction with Claude.
Technical details
- Implementation: pure Python with type definitions and examples; code lives under
src/claude_agent_sdk
. - Requirements & distribution: requires Python 3.10+ and distributed via PyPI/releases; see repository releases for versions.
- Docs & resources: official docs at https://docs.anthropic.com/en/docs/claude-code/sdk/sdk-python and repository examples for hands-on guides.