git404hub

what is claude-agent-sdk-python fr?

anthropics/claude-agent-sdk-python — explained in plain English

Analysis updated 2026-06-24

6,844PythonAudience · developerComplexity · 3/5Setup · easy

tl;dr

A Python library that lets your code talk to Claude Code programmatically, send prompts, stream responses, define custom tools, and add hooks that control what the AI is allowed to do.

vibe map

mindmap
  root((Claude Agent SDK))
    Core API
      query function
      Async streaming
      ClaudeSDKClient
    Tools
      Built-in file tools
      Custom Python tools
    Hooks
      Pre-tool intercept
      Block or modify actions
    Setup
      pip install
      Python 3.10 plus

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Build a Python script that uses Claude to automatically review or refactor code files in a repository

VIBE 2

Define a custom tool so Claude can query your own database or call your API during a session

VIBE 3

Add a hook that blocks Claude from running certain shell commands in automated pipelines

VIBE 4

Run multi-turn conversations with Claude from a script without opening a browser

what's the stack?

Pythonasyncio

how it stacks up fr

anthropics/claude-agent-sdk-pythonautoscrape-labs/pydollgoogle-research/arxiv-latex-cleaner
Stars6,8446,8416,838
LanguagePythonPythonPython
Setup difficultyeasyeasyeasy
Complexity3/52/52/5
Audiencedeveloperdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · easy time til it works · 30min

Requires an active Claude Code installation, bundled in the package so no separate install needed.

in plain english

The Claude Agent SDK for Python is a library that lets developers write Python programs that talk to Claude Code, the AI coding tool from Anthropic. Instead of interacting with Claude through a web interface, this SDK allows a Python script to send prompts and receive responses automatically, making it possible to build tools that use Claude as a component. The simplest use is the query function, which sends a prompt and returns an asynchronous stream of response messages. You can set a system prompt, limit how many turns the conversation runs, and specify which of Claude's built-in tools (such as reading files, writing files, or running shell commands) are automatically approved versus which require confirmation. For longer interactive sessions, there is a client class called ClaudeSDKClient. The client supports custom tools, which are Python functions you define and offer to Claude. When Claude decides it needs to use one, it calls your function directly within the same running program rather than starting a separate process. This avoids the overhead and complexity of managing external tool servers. Hooks are another feature of the client. A hook is a Python function that runs at specific points in the agent loop, such as just before Claude uses a tool. Hooks can inspect what Claude is about to do, block certain actions, or inject feedback. The example in the README shows a hook that blocks any shell command containing a particular pattern. The SDK bundles the Claude Code command-line tool, so no separate installation is needed. The package requires Python 3.10 or newer and is installed through pip, the standard Python package manager. The full README is longer than what was shown.

prompts (copy fr)

prompt 1
Using the Claude Agent SDK for Python, write a script that sends a coding task to Claude, auto-approves file read and write tools, and streams the output to the console.
prompt 2
Show me how to define a custom Python tool for the Claude Agent SDK that queries a SQLite database and returns rows to Claude.
prompt 3
Write a hook for the Claude Agent SDK that intercepts any bash tool call containing 'rm -rf' and blocks it with an error message.
prompt 4
Using ClaudeSDKClient, create a Python script that runs a multi-turn session where Claude refactors a Python file step by step and asks for approval before each change.

Frequently asked questions

what is claude-agent-sdk-python fr?

A Python library that lets your code talk to Claude Code programmatically, send prompts, stream responses, define custom tools, and add hooks that control what the AI is allowed to do.

What language is claude-agent-sdk-python written in?

Mainly Python. The stack also includes Python, asyncio.

How hard is claude-agent-sdk-python to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is claude-agent-sdk-python for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.