Agent SDK (Python / TypeScript)
The Claude Agent SDK is a programmatic framework for building autonomous AI agents in Python and TypeScript. It wraps the iterative tool-use loop that would otherwise require developers to manually write and manage while-loops for API requests and function executions, exposing instead a clean async interface via a `query()` function and session client. Agents built with the SDK can read files, run shell commands, search codebases, call external APIs, and delegate to sub-agents — the same capabilities that power Claude Code internally.
The SDK was renamed from 'Claude Code SDK' to 'Claude Agent SDK' in late 2025 to reflect its broader applicability beyond coding tasks. It ships with built-in tools (Read, Edit, Bash, Glob, Grep) that execute on the host machine, and supports custom tools via a decorator/schema pattern or Model Context Protocol (MCP) servers. Both Python (3.10+) and TypeScript runtimes are supported with near-feature-parity APIs.
Usage is billed at standard Anthropic API token rates per the model selected. Starting June 15, 2026, subscribers on Pro, Max, Team, and Enterprise plans receive a separate monthly Agent SDK credit distinct from their interactive Claude usage limits. API-key-only (platform) accounts continue on pay-as-you-go billing.
When you’d use it
- ◆Automated Codebase Auditing — A developer wants to scan a large monorepo for all TODO comments, deprecated function calls, or security anti-patterns and receive a structured report without writing custom search scripts.
- ◆CI/CD Pipeline Agent — An engineering team embeds the SDK in a headless CI job so that after tests fail, an agent automatically reads the failing test output, locates the relevant source files, proposes patches, and opens a draft pull request.
- ◆Financial Analysis Workflow — A fintech team builds an agent that pulls portfolio data from an internal API, runs Python calculations in a sandboxed Bash environment, cross-references market data from an MCP-connected external tool, and produces an investment brief.
- ◆Customer Support Ticket Triage — A support platform uses the SDK to build an agent that reads incoming tickets, queries a CRM via a custom tool, drafts a response, and escalates to a human queue when confidence is low — all within a single orchestrated loop.
- ◆Deep Research Synthesis — A research team points the agent at a directory of hundreds of PDFs and asks it to find contradictions across sources, extract citations, and produce a literature-review outline — tasks that would take a human analyst days.
What changed recently
- ◆2025-09 — Library renamed from 'Claude Code SDK' to 'Claude Agent SDK'. Python package renamed to `claude-agent-sdk`; npm package renamed to `@anthropic-ai/claude-agent-sdk`. Breaking change: `ClaudeCodeOptions` type renamed to `ClaudeAgentOptions`.
- ◆2025-12-18 — Agent Skills published as an open standard for cross-platform portability, enabling skills built with the SDK to work across multiple AI platforms.
- ◆2026-01-28 — Anthropic published the official engineering blog post 'Building agents with the Claude Agent SDK', formalising documentation and migration guidance.
- ◆2026-02-20 — Enhanced CLI initialisation tools (`/new-sdk-app`) released to bootstrap boilerplate agent projects for both Python and TypeScript, including dependency management.
This is the short version
The full chapter has three worked examples, the common pitfalls, and the workflow that makes it pay — plus the other 84 features, kept current.
Get Claude Master — $97 →