Embed bounded Claude Code sessions into Python automation with the Claude Agent SDK
Use the Claude Agent SDK for Python when an existing script or service needs to delegate scoped repo work to Claude Code and consume structured responses programmatically.
Prerequisites
Python 3.10+, pip, Claude Agent SDK package, Claude Code compatible credentials
Installation
Install or set up from the source-backed instructions:
Install the Python package with pip install claude-agent-sdk, configure any ClaudeAgentOptions you need such as cwd and permission handling, then call the SDK from your Python automation to run bounded agent queries.