The Claude Agent SDK for Python provides tools to build and interact with Claude-powered agents. It facilitates agent lifecycle management, tool execution, and advanced prompt configuration. As of version 0.1.58, it is under active development with frequent releases, often including updates to its bundled Claude CLI component.
pip install claude-agent-sdk==0.1.58Verified import paths — ran on the pinned version, not inferred.
Initializes the ClaudeSDKClient and performs a simple query. It demonstrates asynchronous event streaming and requires the ANTHROPIC_API_KEY environment variable.
Pin the version in your requirements (e.g., `claude-agent-sdk==0.1.58`) and carefully review release notes before updating. Keep an eye on the official GitHub repository for breaking change announcements.
Ensure `export ANTHROPIC_API_KEY='your_api_key'` is run in your shell or the key is provided programmatically. The key format typically starts with 'sk-ant-'.
Wrap your SDK interactions in `async def` functions and use `await` calls. For top-level execution, use `asyncio.run(your_async_function())`.
Rely on the SDK's internal CLI management where possible. If you are using external Claude CLI tools, ensure their versions are compatible with the SDK's bundled version, or be aware of potential behavioral differences.
No dependency data recorded yet.