Skip to main content

Installation

Install the package into a virtual environment. On recent Debian, Ubuntu, and Homebrew Python installs, running pip install against system Python fails with error: externally-managed-environment.
For uv, Windows PowerShell, and API key setup, see Setup in the Agent SDK quickstart.

Choosing between query() and ClaudeSDKClient

The Python SDK provides two ways to interact with Claude Code: