If you have ever wished you could take the autonomous engine behind Claude Code — the part that reads your files, runs your commands, edits code, and decides what to do next — and drop it straight into your own application, that is exactly what the Claude Agent SDK is for. It packages Claude Code's agent loop, built-in tools, and context management as a library you call from Python or TypeScript.
There are two reasons to care about it right now. First, it is genuinely the fastest way to build a production agent that works directly on your filesystem and services. Second, the economics changed: starting June 15, 2026, Agent SDK usage on Claude subscription plans is billed from a new, separate credit pool. If you run anything automated on a Pro or Max plan, that date matters. This guide covers both.
What the Agent SDK actually is (and the rename)
The Agent SDK is Anthropic's official library for building agents that autonomously read files, run commands, search the web, and edit code. It gives you "the same tools, agent loop, and context management that power Claude Code, programmable in Python and TypeScript," in Anthropic's words.
It used to be called the Claude Code SDK. On September 29, 2025, alongside the stable 1.0 release, Anthropic renamed it to the Claude Agent SDK. The rename reflects reality: the harness built for coding agents turned out to be just as good for deep research, data synthesis, legal assistants, finance advisors, SRE bots, and security reviewers. The package names changed with it — claude-code-sdk became claude-agent-sdk (Python), and @anthropic-ai/claude-code became @anthropic-ai/claude-agent-sdk (TypeScript).
Why use it instead of the raw API
The Anthropic Client SDK gives you direct API access: you send prompts and implement tool execution yourself. That means writing and maintaining the loop that detects a tool call, runs it, feeds the result back, and repeats until the model is done:
# Client SDK: you implement the tool loop
response = client.messages.create(...)
while response.stop_reason == "tool_use":
result = your_tool_executor(response.tool_use)
response = client.messages.create(tool_result=result, **params)
The Agent SDK hands you that loop already built, plus a working set of tools (Read, Write, Edit, Bash, Glob, Grep, WebSearch, WebFetch, and more). You describe the task; Claude handles execution:
# Agent SDK: Claude handles tools autonomously
async for message in query(prompt="Fix the bug in auth.py"):
print(message)
If your agent's value is in what it accomplishes on your machine rather than in a custom tool runtime you have built, the Agent SDK removes most of the boilerplate.
Who it's for, where it runs, and how you authenticate
The SDK ships in Python (3.10+) and TypeScript. The TypeScript package bundles a native Claude Code binary for your platform as an optional dependency, so you do not install Claude Code separately.
You authenticate with an Anthropic API key from the Console, or route through Amazon Bedrock, Claude Platform on AWS, Google Vertex AI, or Microsoft Azure AI Foundry via environment variables. One important constraint for anyone shipping a product: Anthropic does not, unless previously approved, allow third-party developers to offer claude.ai login or subscription rate limits to their own end users — build customer-facing products on API-key authentication.
For surface comparison: the Claude Code CLI is best for interactive development and one-off tasks, while the SDK is the right tool for CI/CD pipelines, custom applications, and production automation. And if you would rather Anthropic run the agent loop and the sandbox for you, Managed Agents is a hosted REST alternative — many teams prototype with the Agent SDK locally, then graduate to Managed Agents for production.
How to use it: install, run, extend
Install:
# TypeScript
npm install @anthropic-ai/claude-agent-sdk
# Python
pip install claude-agent-sdk
export ANTHROPIC_API_KEY=your-api-key
A minimal TypeScript agent that uses built-in tools:
import { query } from "@anthropic-ai/claude-agent-sdk";
for await (const message of query({
prompt: "Find all TODO comments and create a summary",
options: { allowedTools: ["Read", "Glob", "Grep"] }
})) {
if ("result" in message) console.log(message.result);
}
From there, the same capabilities that make Claude Code powerful are available:
- Subagents — spawn specialized agents to handle focused subtasks. You define them with their own instructions and tool set; the main agent delegates and they report back. Invocations run through the
Agenttool, so addAgentto your allowed tools to auto-approve them. - MCP — connect external systems (databases, browsers, APIs) via the Model Context Protocol. Point the SDK at an MCP server like Playwright and your agent gains browser automation.
- Sessions — maintain context across exchanges. Capture a session ID, then resume later or fork it to explore different approaches without losing the conversation history.
- Hooks — run your own code at lifecycle points (
PreToolUse,PostToolUse,SessionStart,Stop, and others) to validate, log, block, or transform behavior. - Permissions — pre-approve safe tools, block dangerous ones, or require approval for sensitive actions.
It also reads Claude Code's filesystem configuration — CLAUDE.md project memory, .claude/skills/, slash commands, and plugins — so workflows you already use in the CLI translate directly.
What the June 15 billing change means
Here is the part to act on. Anthropic announced on May 14, 2026 that, effective June 15, 2026, programmatic Claude usage on subscription plans moves out of your interactive usage pool and into a separate Agent SDK credit.
What draws from the new credit pool:
- The Claude Agent SDK (direct calls)
- The
claude -pheadless command - Claude Code GitHub Actions
- Third-party apps authenticated through the Agent SDK (including Agent Client Protocol integrations such as Zed and JetBrains)
The monthly credit amounts, billed at standard API rates:
| Plan | Monthly Agent SDK credit |
|---|---|
| Pro | $20 |
| Max 5x | $100 |
| Max 20x | $200 |
| Team (per user) | $20 |
Three things to internalize. Credits do not roll over — they refresh each billing cycle and unused balance is lost. Interactive usage is unaffected — terminal Claude Code sessions and claude.ai chat stay on your existing plan limits; only automated workloads move. And there is no automatic fallback: when the credit runs out, additional Agent SDK usage only continues if you have explicitly enabled usage credits (overflow billing). Otherwise automated requests simply stop until the next cycle.
The reasoning is straightforward. Programmatic loops could previously run at interactive subscription pricing — an effective subsidy of roughly 15–30x against API rates. Separating the pools prices automation at what it actually costs. If you have been running agents, GitHub Actions, or scheduled claude -p jobs against your Pro or Max subscription, estimate your monthly token spend now (our Claude Code pricing breakdown and guide to AI coding rate limits help), and decide before June 15 whether the bundled credit covers you or whether a dedicated API key on pay-as-you-go is the cleaner path.
The bottom line
The Claude Agent SDK is the most direct way to put Claude Code's autonomous engine inside your own software — built-in tools, subagents, sessions, MCP, and hooks, in Python or TypeScript, with no tool loop to maintain. It is the same product as the old Claude Code SDK, renamed in September 2025 to match how broadly teams use it. The thing that genuinely changes on June 15, 2026 is the bill: Agent SDK and claude -p usage on subscription plans now spends a separate, non-rolling monthly credit ($20 Pro, $100 Max 5x, $200 Max 20x). Interactive work is untouched. If automation is part of your workflow, map your usage to that credit before the date arrives so nothing stops mid-pipeline.