The Claude Agent SDK: Building Production Agents (And When to Use It vs Claude Code)
Ampliflow
Advanced AI frontier lab and business growth agency. Helping UK businesses deploy agentic AI systems.

The Claude Agent SDK is Claude Code as a library — the same agent loop, the same tools, the same context management — that you can build into your own applications. If Claude Code is the finished product, the Agent SDK is the engine, and it is how you turn an idea for an autonomous agent into something running in production.
Last updated: May 2026 · Covers the Claude Agent SDK (Python & TypeScript)
TL;DR: The Claude Agent SDK (renamed from the Claude Code SDK in 2025) lets you build AI agents that read files, run commands, search the web, and edit code — using the exact agent loop that powers Claude Code. Install it with npm install @anthropic-ai/claude-agent-sdk or pip install claude-agent-sdk. It ships with built-in tools, hooks, subagents, MCP support, permissions, and session management out of the box, so you are not implementing a tool loop from scratch. Most UK businesses do not need it — they use Claude Code or a subscription. You reach for the SDK when you are building a product or automation on top of Claude. This guide explains what it does, shows the code, and gives you the framework for choosing between the SDK, the CLI, the Client SDK, and Managed Agents.
Contents
- What is the Claude Agent SDK?
- What you get out of the box
- What can you build with it?
- Agent SDK vs Claude Code vs Client SDK vs Managed Agents
- The June 2026 credit change you should know about
- How Ampliflow uses the Agent SDK in production
- Frequently asked questions
What is the Claude Agent SDK?
It is a library — for Python and TypeScript — that gives you Claude with built-in tool execution, autonomous action, and context management. Anthropic describes it plainly: the same tools, agent loop, and context management that power Claude Code, programmable in your own code.
The name matters, because it changed. It was originally the Claude Code SDK; Anthropic renamed it the Claude Agent SDK to reflect that it is for building agents of any kind, not only coding tools. If you read older tutorials referring to the "Claude Code SDK", this is the same thing.
Here is the entire idea in one block of TypeScript:
`typescript import { query } from "@anthropic-ai/claude-agent-sdk";
for await (const message of query({ prompt: "Find and fix the bug in auth.ts", options: { allowedTools: ["Read", "Edit", "Bash"] } })) { console.log(message); // Claude reads the file, finds the bug, edits it } `
That is a working autonomous agent. You did not write code to read the file, run the linter, or apply the edit — the SDK ships those tools, and Claude decides when to use them. The Python version is the same shape:
`python from claude_agent_sdk import query, ClaudeAgentOptions
async for message in query( prompt="Find and fix the bug in auth.py", options=ClaudeAgentOptions(allowed_tools=["Read", "Edit", "Bash"]), ): print(message) `
Installation is one line — npm install @anthropic-ai/claude-agent-sdk or pip install claude-agent-sdk — and you authenticate with an Anthropic API key set as ANTHROPIC_API_KEY. The TypeScript package even bundles a native Claude Code binary, so there is nothing else to install.
What you get out of the box
The SDK's whole point is that the hard parts are already built. Everything that makes Claude Code capable is exposed to you:
- Built-in tools.
Read,Write,Edit,Bash,Glob,Grep,WebSearch,WebFetchand more — your agent can act on files, run commands, and search the web immediately, with no tool-execution code on your side. - Hooks. Run your own callbacks at lifecycle points (
PreToolUse,PostToolUse,Stop,SessionStart, and others) to validate, log, block, or transform behaviour — the same enforcement pattern as the Claude Code CLI, in code. - Subagents. Define specialised agents with their own prompts and scoped tools, and let the main agent delegate to them — keeping context clean and routing focused work to cheaper models.
- MCP. Connect to external systems — databases, browsers, APIs, and hundreds of community servers — through the Model Context Protocol, with a few lines of config.
- Permissions. Control exactly which tools the agent may use. Build a read-only analysis agent by allowing only
Read,Glob, andGrep; require approval for anything sensitive. - Sessions. Maintain context across exchanges, resume a session later, or fork it to explore alternatives — Claude remembers the files it read and the analysis it did.
It also reads Claude Code's filesystem configuration — your CLAUDE.md, .claude/skills/, .claude/agents/ — so an agent you prototyped in the CLI carries its setup straight into the SDK.
What can you build with it?
Anything that needs Claude to act autonomously, on a schedule or inside another system, rather than in an interactive terminal session. The SDK is the bridge from "I used Claude Code to do this once" to "this now runs without me."
Concrete examples, several of which map directly onto work we ship for UK clients:
- A code-review bot that runs on every pull request, checks against your standards, and posts findings — exactly what the Claude Code GitHub Action is, since it is built on this SDK.
- An overnight operations agent that reconciles data between a CRM and an accounting system, flags anomalies, and produces a morning report.
- A research agent that takes a brief, searches the web, reads sources, and returns a structured synthesis.
- A customer-support agent that triages incoming messages, drafts replies, and escalates the hard cases — routing the volume work to Haiku and the judgement calls to Sonnet or Opus.
- A documentation agent that watches a codebase and keeps the docs in sync with the code.
The common thread: these run as part of a system, triggered by an event or a schedule, not by a person typing in a terminal. That is precisely the line between the CLI and the SDK.
Step back for a second. For most of software history, automating a knowledge task meant paying engineers to hard-code every rule it might ever meet. The Agent SDK collapses that into a paragraph of plain English and a model that works out the rest. That is not a faster way to build the old kind of software. It is a new kind.
Agent SDK vs Claude Code vs Client SDK vs Managed Agents
There are four ways to build with Claude, and choosing the wrong one wastes weeks. Match what you want to do to the right tool:
| You want to… | Use | Why |
|---|---|---|
| Work interactively in your terminal, day to day | Claude Code CLI | Built for hands-on development and one-off tasks |
| Build an agent into your own app or CI/CD | Agent SDK | Claude's agent loop and tools, running in your process |
| Call the model directly and write your own tool loop | Client SDK | Raw API access; you implement tool execution yourself |
| Run agents in production without operating infrastructure | Managed Agents | Anthropic hosts the agent loop and a sandbox per session |
Two distinctions are worth drawing out, because they catch people:
Agent SDK vs Client SDK. The Anthropic Client SDK gives you direct API access — you send prompts and implement the tool loop yourself (call the model, run the tool it asked for, send the result back, repeat). The Agent SDK does that loop for you. If you find yourself writing a while (stop_reason === "tool_use") loop, you probably want the Agent SDK instead.
Agent SDK vs Managed Agents. The Agent SDK runs the agent loop inside your own process, on your own infrastructure, against your own files. Managed Agents is a hosted REST API where Anthropic runs the agent and a sandbox for you. A common and sensible path: prototype locally with the Agent SDK, then move to Managed Agents for production when you would rather not operate the sandbox and session infrastructure yourself.
For most UK SMEs, the realistic answer is simpler still: use Claude Code for development, and reach for the Agent SDK only when you have a specific product or automation to build. You do not need the SDK to get value from Claude — you need it to build on Claude.
The June 2026 credit change you should know about
From 15 June 2026, Agent SDK usage on a Claude subscription draws from a separate monthly Agent SDK credit, distinct from your interactive usage. This is a billing detail with real planning implications.
Until now, running the SDK (and headless claude -p jobs) on a subscription plan consumed the same usage allowance as interactive Claude Code work. After 15 June, automated SDK usage gets its own credit pool. If you are planning to run agents at any volume on a subscription rather than the pay-as-you-go API, check the current terms before you build — the economics of "subscription vs API key" for automation shift on that date. For sustained production automation, the per-token API with prompt caching and batch discounts is usually the cleaner commercial footing anyway.
How Ampliflow uses the Agent SDK in production
The Agent SDK is one of the foundations under Amplex, our agentic orchestration framework — and the reason we can ship reliable autonomous systems rather than demos. Building on the SDK rather than the raw API means we inherit a battle-tested agent loop, structured tool use, and context management, and spend our engineering effort on the parts that are specific to a client's problem.
In practice, an Amplex system composes the SDK's primitives into something governed: subagents for specialisation, permissions to scope what each agent may touch, hooks to enforce guardrails deterministically, and MCP to connect to a client's real databases and services. On top of that we add reviewing-model verification — a more capable model checking another's output before it ships — and typed schemas on every interface.
This is the same lineage as our operational-automation work. Where Claude Code and the Agent SDK focus on engineering and product, Hermes Agent handles the always-on operational layer — scheduled jobs, messaging, server-side persistence. Different surfaces of the same idea: Claude's agent loop, wrapped in production discipline.
The honest summary for a business evaluating this: the Agent SDK lowers the cost of building a correct agent dramatically, but it does not remove the need for the discipline around it. The loop is solved. The guardrails, the routing, the verification, and the testing are still engineering — and they are where reliable systems are won or lost.
Frequently asked questions
What is the difference between Claude Code and the Claude Agent SDK?
Claude Code is the finished command-line product you use interactively. The Claude Agent SDK is the library underneath it — the same agent loop and tools — that you build into your own applications, CI/CD pipelines, and automations. Use the CLI for hands-on development; use the SDK when you are building a product or scheduled automation on top of Claude.
Was the Claude Agent SDK renamed?
Yes. It was originally called the Claude Code SDK and was renamed the Claude Agent SDK to reflect that it is for building agents of any kind, not only coding tools. Older tutorials referencing the "Claude Code SDK" describe the same library.
What languages does the Agent SDK support?
Python and TypeScript. Install with pip install claude-agent-sdk or npm install @anthropic-ai/claude-agent-sdk. The TypeScript package bundles a native Claude Code binary, so you do not need to install Claude Code separately.
Do I need the Agent SDK, or is Claude Code enough?
For most businesses, Claude Code is enough — it covers interactive development and one-off tasks. You only need the Agent SDK when you are building Claude into your own product, a CI/CD workflow, or a scheduled automation that runs without a person at the keyboard. If you are not building software on top of Claude, you do not need the SDK.
How does the Agent SDK relate to MCP?
MCP (the Model Context Protocol) is how an Agent SDK agent connects to external systems — databases, browsers, APIs. The SDK has built-in MCP support: you point it at an MCP server with a few lines of configuration and the agent can use that server's tools. MCP is the connectivity layer; the Agent SDK is the agent.
Is the Agent SDK free?
The library itself is free and open. You pay for the Claude model usage your agent consumes — via the API per token or, where eligible, a subscription credit (note the separate Agent SDK credit pool arriving 15 June 2026). Costs scale with how much your agent reads, reasons, and writes, which is why model routing and prompt caching matter for production agents.
Related reading
- ↔ How to Get an Anthropic API Key — And What It Really Costs — the key and the cost mechanics your agent will run on
- ↔ The Latest Claude Code Features: Plan Mode, Hooks, Subagents & GitHub Actions — the GitHub Action is the Agent SDK in action
- ↔ What Is MCP (Model Context Protocol)? — how your agent connects to real tools and data
- ↔ Claude Models Explained: Opus 4.7 vs Sonnet 4.6 vs Haiku 4.5 — routing the right model to each part of your agent
- ↔ What Is Hermes Agent? A UK Business Guide — the operational-automation companion to engineering-focused agents
What should you do next?
If you have a real automation in mind — a research agent, an overnight ops job, a support triage system — the Agent SDK is the fastest route from idea to production. But the loop is the easy part. The reliability comes from the guardrails, routing, and verification around it.
That is the work we do. We build production agents on the Claude Agent SDK and the Amplex framework — scoped, governed, tested, and cheap to run — for UK businesses that want the outcome without spending six months learning the failure modes the hard way.
See how Ampliflow builds production agents →
Or start with a free audit: tell us what you want to automate, and we will return a specific build plan within 48 hours. Book a free AI audit →
The barrier to a working autonomous agent has never been lower. The barrier to a reliable one is still engineering discipline — and that is exactly where the value sits.
Ampliflow is a UK AI frontier lab and growth agency based in Solihull, West Midlands. We ship production AI systems for UK SMEs and enterprises using Claude, the Claude Agent SDK, the Amplex orchestration framework, and reviewing-model verification. Our case studies are named, our methodology is published, and our team builds with Claude daily.