AIAny
AI Agent2025
Icon for item

Claude Agent SDK for Python

Run Claude as a programmatic agent in Python: one-shot query() calls or a stateful ClaudeSDKClient for multi-turn loops. Define in-process tools, lifecycle hooks, and per-tool permissions; it bundles the Claude Code CLI and exposes its full toolset.

Introduction

When Anthropic renamed "Claude Code SDK" to the Claude Agent SDK, it signaled where the value really lives: not in the chat loop, but in turning Claude Code's agent harness — its tool execution, permission gating, and session management — into a library you call from your own code. You don't reimplement an agent; you drive the same one Claude Code runs, with deterministic hooks where it matters.

What Sets It Apart
  • Two interaction shapes, one engine. query() is a stateless async generator for fire-and-forget tasks; ClaudeSDKClient keeps a bidirectional session for interactive, multi-turn work with mid-stream control.
  • In-process MCP tools. Decorate a Python function with @tool and it becomes a callable tool with no separate process or transport — closing the latency and ops gap that external MCP servers impose.
  • Hooks make behavior deterministic. PreToolUse/PostToolUse callbacks let you inspect, rewrite, or block actions (e.g., veto a Bash command) instead of relying on the model to behave.
  • Real permission surface. allowed_tools allowlists, permission_mode, and a can_use_tool callback give code-level control over what the agent can touch.
Who It's For

Great fit if you want production agents that reuse Claude Code's battle-tested file/Bash/edit tools and need guardrails enforced in code rather than prompts. Look elsewhere if you only need plain text completions — the SDK bundles and manages the Claude Code CLI under the hood, which is overhead you don't need for a simple chat call. Note it targets Python 3.10+ and the agent runs through that bundled CLI.

More Items

GitHub
AI Client2026

Transforms unstructured documents into strongly-typed Knowledge Abstracts with one CLI command, extracting entities and relations into graphs, hypergraphs, and spatio‑temporal structures. Includes 80+ templates, multiple RAG engines, local vLLM support, Obsidian export and an MCP server.

GitHub
AI Agent2025

Autonomous Red Team agent that plans and executes realistic attack chains (reconnaissance, exploitation, pivoting, C2) while producing Rules of Engagement and an OPPLAN and running actions inside a hardened sandbox; intended for authorized red-team engagements and defensive verification.

GitHub
AI Agent2026

Provides modular, AI-optimized SKILL.md instructions that ground LLMs in Android development workflows and can be installed into agent environments via the Android CLI; focuses on tasks where LLMs underperform.