claude-code-sdk
Python SDK for Claude Code
Decision gist · record as of 2026-08-14
No—the package is officially deprecated and no longer maintained. Install claude-agent-sdk instead. If you have an existing codebase using claude-code-sdk, plan a migration to the successor package rather than starting new projects with this one.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10+, Node.js, and Claude Code installed via npm (npm install -g @anthropic-ai/claude-code).
- Low install friction with a pure-wheel distribution.
- Active maintenance as of the latest release, though the package is officially deprecated and no longer maintained—users should migrate to claude-agent-sdk.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal obligations, making it suitable for both open-source and commercial projects.
last release 2025-09-29 (319 days) · last repo commit 2026-08-14 · 7,891 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 624,903 downloads/mo, #5,698 on PyPI
Alternatives
Verify before relying
pip install claude-code-sdk
import anyio
from claude_code_sdk import query
async def main():
async for message in query(prompt="What is 2 + 2?"):
print(message)
anyio.run(main())- Whether claude-agent-sdk is a direct drop-in replacement or requires code changes.
- Current status of the Claude Code CLI and whether it remains actively maintained.
What it is and what it does
Claude Code SDK is a Python wrapper for querying Claude Code, an AI agent that can read, write, and execute code. It provides both a simple async query interface and a more advanced client for bidirectional conversations with custom tools and lifecycle hooks. The package depends on anyio for async I/O, mcp for Model Context Protocol support, and typing-extensions for type hints.
The SDK is officially deprecated and no longer maintained; Anthropic recommends migrating to claude-agent-sdk. It supports Python 3.10 through 3.13 and is distributed as a pure wheel with low install friction. While the repository remains active and has accumulated significant GitHub stars, new projects should use the successor package.
Use it for
- Query Claude Code for code generation or analysis tasks via a simple async interface.
- Build interactive agents that maintain bidirectional conversation state with Claude Code.
- Define custom tools as Python functions and expose them to Claude via in-process MCP servers.
- Implement hooks to intercept and validate tool use (e.g., blocking unsafe bash commands before execution).
- Migrate from external MCP server processes to in-process tool definitions for simpler deployment.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
No—the package is officially deprecated and no longer maintained.
Install claude-agent-sdk instead. If you have an existing codebase using claude-code-sdk, plan a migration to the successor package rather than starting new projects with this one.
Install
claude-code-sdk on PyPI
Before you install
Low install friction with a pure-wheel distribution. Active maintenance as of the latest release, though the package is officially deprecated and no longer maintained—users should migrate to claude-agent-sdk.
Requires Python 3.10+, Node.js, and Claude Code installed via npm (npm install -g @anthropic-ai/claude-code).
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal obligations, making it suitable for both open-source and commercial projects.
Quickstart
pip install claude-code-sdk
import anyio
from claude_code_sdk import query
async def main():
async for message in query(prompt="What is 2 + 2?"):
print(message)
anyio.run(main())
Verify before relying
- Whether claude-agent-sdk is a direct drop-in replacement or requires code changes.
- Current status of the Claude Code CLI and whether it remains actively maintained.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesanyiomcptyping-extensions |
| Maintenance | Actively maintained 319 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 624,903 / month, #5,698 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Typing :: Typed |
Evidence: claude_code_sdk-0.0.25-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “claude code python sdk”
- claude-code-sdkPython SDK for querying Claude Code and building interactive agents…
- claude-agent-sdkPython SDK for building and interacting with Claude Code agents,…
- lmnr-claude-code-proxyA thin proxy server that routes Claude Code requests through Laminar…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also claude-agent-sdk · anthropic · openinference-instrumentation-claude-agent-sdk · llm-anthropic · claude-tap · pydantic-deep · livekit-plugins-anthropic · langchain-anthropic · agent-framework-claude · trinity-agent