Installation
Install the package into a virtual environment. On recent Debian, Ubuntu, and Homebrew Python installs, runningpip install against system Python fails with error: externally-managed-environment.
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Complete API reference for the Python Agent SDK, including all functions, types, and classes.
pip install against system Python fails with error: externally-managed-environment.
python3 -m venv .venv
source .venv/bin/activate
pip install claude-agent-sdk
query() and ClaudeSDKClient| Feature | query() | ClaudeSDKClient |
|---|---|---|
| Session | Creates a new session by default | Reuses same session |
| Conversation | Single exchange | Multiple exchanges in same context |
| Connection | Managed automatically | Manual control |
| Streaming Input | ✅ Supported | ✅ Supported |
| Interrupts | ❌ Not supported | ✅ Supported |
| Hooks | ✅ Supported |