Claude Agent SDK for Python

Claude Agent SDK for Python

★ 4 🔖 2500 saves 💰 Free ChatbotsGitHub

The Claude Agent SDK for Python is Anthropic’s official open-source SDK for building AI agents with Claude, published on GitHub with around 8,300 stars. It packages the same agent loop and tool set that power Claude Code into a Python library, so you can embed a full coding-capable agent inside your own applications.

Overview

Installation is a single pip command, and the Claude Code CLI is bundled with the package, so there is nothing else to set up. The simplest entry point is the async query() function, which streams messages from an agent given a prompt and options. For interactive, bidirectional sessions you use ClaudeSDKClient, which unlocks two signature capabilities: custom tools defined as plain Python functions and exposed to Claude through in-process MCP servers — no separate server process needed — and hooks, Python callbacks that intercept points in the agent loop to enforce policies such as blocking unsafe shell commands. By default the agent can use the complete Claude Code toolset (Read, Write, Edit, Bash and more), with permission allowlists and permission modes giving you fine-grained control over what runs automatically. The SDK is under very active development, with frequent releases continuing through late 2026.

Key Features

  • Official Anthropic SDK — the Claude Code agent loop as a Python library
  • Simple async query() API plus a full bidirectional client
  • Custom tools as in-process MCP servers written in plain Python
  • Hooks for intercepting and governing agent behavior deterministically
  • Full built-in toolset with permission allowlists and modes
  • Bundled CLI, MIT licensed, with frequent releases

💳 Pricing

The SDK itself is free and open source under the MIT license. Running agents consumes Claude usage, so you pay Anthropic’s normal API or subscription pricing for the model calls your agents make.

Who Is It For

This SDK is for Python developers building agentic products on Claude — internal automation, coding assistants, data pipelines, and support tools — who want the proven Claude Code harness instead of assembling an agent loop from scratch.

🚀 Visit Claude Agent SDK for Python Official Site

🚩 Report an issue