claude-code-sdk-python  by anthropics

SDK for Claude Code interaction

created 1 month ago
744 stars

Top 47.6% on sourcepulse

GitHubView on GitHub
Project Summary

This Python SDK provides programmatic access to Claude Code, an AI assistant for code-related tasks. It enables developers to integrate Claude's code generation, explanation, and execution capabilities directly into their applications, streamlining workflows and automating coding processes.

How It Works

The SDK leverages an asynchronous client-server architecture. It communicates with the Claude Code CLI, which handles the actual interaction with the Claude AI model. The Python library acts as a wrapper, abstracting away the complexities of CLI commands and streaming responses. Users can send prompts, configure options like system prompts and tool permissions, and receive structured messages, including text and tool usage instructions.

Quick Start & Requirements

  • Primary install: pip install claude-code-sdk
  • Prerequisites: Python 3.10+, Node.js, and the Claude Code CLI (npm install -g @anthropic-ai/claude-code).
  • The SDK requires the Claude Code CLI to be installed and accessible in the system's PATH.

Highlighted Details

  • Supports streaming responses for interactive experiences.
  • Allows configuration of Claude Code options, including system prompts, maximum turns, and allowed tools (Read, Write, Bash).
  • Enables fine-grained control over tool usage permissions, including an acceptEdits mode for automatic file modification.
  • Provides robust error handling for common issues like missing CLI installations or process failures.

Maintenance & Community

The project appears to be an official SDK from Anthropic, indicated by the repository name. Further community or maintenance details are not present in the README.

Licensing & Compatibility

  • License: MIT
  • The MIT license permits commercial use and integration with closed-source projects.

Limitations & Caveats

The SDK's functionality is entirely dependent on the Claude Code CLI being installed and correctly configured. The README does not specify the underlying Claude model version or its capabilities.

Health Check
Last commit

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
19
Issues (30d)
20
Star History
763 stars in the last 90 days

Explore Similar Projects

Starred by Chris Van Pelt Chris Van Pelt(Cofounder of Weights & Biases), Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), and
15 more.

developer by smol-ai

0.1%
12k
Agent for embedding a developer in your app
created 2 years ago
updated 1 year ago
Feedback? Help us improve.