Install
pip install claude-agent-sdk
$
The Claude Agent SDK for Python (Python 3.10+) lets you build agentic applications on Claude Code, bundling the CLI automatically. Use the simple query() async function for one-shot or stateless tasks, or ClaudeSDKClient for bidirectional interactive conversations with custom tools defined via the @tool decorator and hooks like PreToolUse for deterministic control. Agents get the full Claude Code toolset (Read, Write, Edit, Bash) plus support for in-process and external MCP servers and fine-grained tool permissions.