Claude Agents, Explained
Four different things get called Claude agents, and they have almost nothing in common operationally. Sorting out which one you mean is most of the work of getting a straight answer.
Updated 27 July 2026
What people mean by “Claude agents”
The phrase is doing four jobs at once, which is why search results for it are a mess. Someone asking about Claude agents might be a developer configuring subagents in a terminal, an engineer wiring the Agent SDK into a service, a backend team writing a tool-use loop against the Messages API, or a product manager picking Claude as the model inside a no-code platform. Different tools, different failure modes, different bills.
| What it means | Where it runs | You write | Typical use |
|---|---|---|---|
| Claude Code subagents | Your machine or CI, inside Claude Code | A markdown file with frontmatter | Delegating scoped development tasks with their own context |
| Claude Agent SDK | Your infrastructure, as a library you host | TypeScript or Python calling the SDK | Embedding the Claude Code harness in your own product |
| API tool-use agents | Your infrastructure, against the Messages API | The agent loop yourself, or the SDK tool runner | Custom agents with your own tools and control flow |
| Claude inside an agent platform | The platform vendor | Configuration in a builder | Choosing Claude per step without owning orchestration |
The distinction that catches teams out is the second and third rows. The Agent SDK is a harness you host: it brings a full agent loop, built-in file and shell tools, MCP support, permissions, hooks, sessions, and subagents. A raw tool-use loop against the Messages API brings none of that, and you define every tool yourself. Both are “building on Claude,” and they are weeks apart in effort.
Claude Code agents (subagents)
Subagents are separate Claude instances that Claude Code spawns to handle a scoped task. The point is context isolation. A subagent that reads forty files to answer one question burns its own context window, not the main session’s, and returns a short report instead of the forty files.
They are configured as markdown files with YAML frontmatter, in .claude/agents/ for a project or ~/.claude/agents/ for everything you work on. The frontmatter names the agent, describes when it should be used, restricts which tools it may call, and can pin a model tier. The body is its system prompt.
# .claude/agents/test-runner.md
---
name: test-runner
description: >
Runs the test suite and diagnoses failures. Use proactively after
code changes. Reports the failing test and root cause, not a log dump.
tools: Read, Grep, Glob, Bash
model: sonnet
---
You are a test specialist. Run the suite, isolate the first genuine
failure, and report the file, the assertion, and the likely cause.
Do not fix the code. Do not summarise passing tests.The description field earns more attention than people give it. Claude Code uses it to decide when to delegate automatically, so a vague description produces an agent that never fires or one that fires constantly. You can also invoke a subagent explicitly when you want control rather than delegation.
Two practical notes. Restricting tools is a real control, not decoration: a review agent with read-only tools cannot edit files no matter what it concludes. And pinning a cheaper model on high-frequency subagents is the easiest cost lever in the whole setup, because those are the ones that run dozens of times a day.
Where subagents genuinely earn their keep is parallel work: several exploring different parts of a codebase at once, each reporting back a summary. Where they disappoint is tasks needing continuous back-and-forth with you, since the isolation that makes them cheap also means they cannot see the conversation you have been having.
Building custom agents on Claude
Below the products, the primitive is tool use. You send Claude a list of tools, each with a name, a description written for the model, and a JSON Schema for its arguments. Claude replies either with text or with one or more tool-use blocks. You run them, send the results back, and repeat.
// The Claude Messages API agent loop, stripped to essentials.
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic();
const res = await client.messages.create({
model: 'claude-sonnet-5',
max_tokens: 2048,
tools: [
{
name: 'search_orders',
description: 'Find orders by customer email. Read-only.',
input_schema: {
type: 'object',
properties: { email: { type: 'string' } },
required: ['email'],
},
},
],
messages,
});
// stop_reason 'tool_use' means the model wants a tool run.
// Each tool_use block carries an id; the result you send back must
// reference it as tool_use_id, inside a user turn.
if (res.stop_reason === 'tool_use') {
const calls = res.content.filter((b) => b.type === 'tool_use');
const results = await Promise.all(calls.map(runTool));
messages.push({ role: 'assistant', content: res.content });
messages.push({ role: 'user', content: results });
}Two details trip people up on the first attempt. Tool results go back in a user turn, not an assistant one. And the assistant message must be appended verbatim, because each result references the id of the tool-use block that requested it. Claude can also request several tools in a single turn, so handle the list rather than the first element.
The Anthropic SDKs ship a tool runner helper that drives this loop for you, with hooks for approval, error handling, and retries, so you do not have to hand-roll the plumbing. Whether you use it or write the loop yourself, the parts that decide quality are the same: tight tool descriptions, server-side validation of arguments, and a turn ceiling.
For tool access at scale, MCP is the mechanism worth knowing. It standardises how an agent connects to external tools and data, so you attach an existing catalogue rather than writing an adapter per system. Claude Code, the Agent SDK, and the API all speak it.
Memory is the other design decision. The conversation is working memory: expensive, volatile, and capped by the context window. Long agent runs outgrow it, and the fix is compaction plus a durable store for facts that must survive. Claude’s newest models carry very large context windows, which delays the problem without removing it, and a large window is not free to fill. Context windows explained covers the arithmetic. The general build sequence, framework-neutral, is in how to build an AI agent.
What Claude is good at in agent workloads
Claude models have a reputation among agent builders for two specific things, and it is worth being precise about them rather than repeating the marketing.
The first is instruction adherence under pressure. Tell a Claude model not to call a tool under certain conditions and it tends to honour that across a long run, which is exactly what a multi-step agent needs. The second is tool-call formatting. Schema conformance is generally reliable, which means fewer runs lost to malformed arguments and fewer defensive retries in your loop.
Long-horizon coherence is the other frequently cited strength: staying on task across many turns without drifting into a different problem. That is the property that makes Claude a common default for coding agents specifically, where a task can involve dozens of file reads and edits.
The limits are equally real. Being a single vendor, capacity and rate limits are a shared resource, and a busy period is felt by everyone at once. Model deprecations happen on Anthropic’s schedule rather than yours, and a deprecated model behind a production agent is an unplanned migration. Pricing sits at the higher end for frontier tiers, so an agent that runs every model call on the top model will cost considerably more than one that routes. And on narrow, high-volume classification work, a cheap model from any vendor is usually the right answer regardless of which one is smartest.
Head-to-head comparisons live in Claude vs ChatGPT, and the tier decision within the family is covered in Claude Opus vs Sonnet.
Running Claude agents in production
An agent with one model provider and no fallback is a single point of failure you chose on purpose.
Three operational realities separate a Claude agent that runs on a laptop from one a business depends on, and none of them are about prompt quality.
Availability. Providers have incidents. Providers also pull models: in 2026 a newly released frontier model was withdrawn days after launch, which we covered in the vendor fragility write-up. If your agent names one model in one SDK call, either event is an emergency. If fallbacks are declared in advance, it is a degradation.
Rate limits. Agent traffic is bursty by nature, since one triggered run becomes eight API calls in quick succession. Capacity that looks generous against average volume gets consumed by a queue draining after an outage. Overflow needs somewhere to go.
Attribution. Once several agents share a key, the invoice stops being diagnosable. Which agent, which step, which model, which team: without that breakdown the only available cost control is switching things off.
This is the layer Swfte Connect handles. Claude models sit alongside 50+ providers behind one API, with fallbacks declared per step, automatic failover when a provider degrades, and cost telemetry per call. Your agent keeps calling one endpoint while routing changes underneath it. For teams who would rather not write the orchestration at all, Studio builds agents visually on that same gateway, so choosing Claude for one step and something cheaper for the next is configuration.
What Claude agents cost
Agent economics differ from chat economics in one structural way: the conversation is resent on every turn. A ten-turn agent does not cost ten times a single call. It costs more, because turn ten carries the whole accumulated history as input. That quadratic-ish growth is the single most surprising line on a first agent invoice.
Three levers apply, in descending order of impact.
- 01
Route per step, not per agent
Classification, extraction, and formatting run on the smallest Claude tier that passes your evals. Planning and the one step carrying real judgement run on a frontier model. The gap between tiers is roughly an order of magnitude, and an agent multiplies it by turn count. - 02
Cache the stable prefix
System prompt and tool definitions barely change between turns, and prompt caching bills cached reads at a fraction of standard input rates. Because agent loops resend a growing prefix by design, this is worth more on agents than on any other workload. - 03
Cap the loop and batch what can wait
A turn ceiling converts a runaway agent into a failed run rather than a bill. Anything not needed in real time, such as overnight classification or backfills, belongs in the batch API, which is priced well below synchronous calls.
Current per-model rates change often enough that quoting them here would age badly. Claude API pricing tracks them, and the token cost calculator turns them into a per-run figure for your own volumes. The mechanics of caching, including where the breakpoints go, are in prompt caching.
One habit worth building early: track cost per completed task, not cost per token. Tokens tell you nothing about whether the agent is getting more expensive because volume grew or because it started retrying. Cost per task tells you immediately.
Common questions
- What are Claude agents?
- The term covers two things: agent features inside Anthropic's own products, such as Claude Code's subagents that work on tasks in parallel, and custom autonomous agents developers build on Claude models using tool use, the Claude Agent SDK, or agent platforms.
- What are Claude Code subagents?
- Subagents are separate Claude instances that Claude Code spawns to handle scoped tasks such as exploring a codebase, running tests, or working in parallel worktrees. Each has its own context window and reports results back to the main session. They are defined as markdown files with frontmatter in .claude/agents.
- Can I build an agent on Claude without code?
- Yes. Agent platforms with multi-provider support let you select Claude models per step in a visual builder. Swfte Studio does this through the Connect gateway, so you get Claude's reasoning without writing orchestration code.
- What happens to my agent if Claude has an outage or a model is deprecated?
- If you call Anthropic directly, your agent fails or needs emergency rework. Teams that route through a gateway define fallback models in advance, so traffic shifts automatically and the agent keeps operating while the primary model is unavailable.
- How much do Claude agents cost to run?
- Cost is token-driven: every planning step, tool call, and retry consumes input and output tokens at the chosen Claude model's rates. Multi-step agents multiply quickly, which is why per-step model routing and prompt caching are standard cost controls.
Related reading
- How to build an AI agentThe loop, tools, and evals in code
- MCP gatewayManaged tool access for agents
- Claude API pricingCurrent rates by model
- Claude vs ChatGPTWhere each one is stronger
- Claude Opus vs SonnetPicking a tier per step
- Prompt cachingThe biggest lever on agent bills
- Token cost calculatorModel your own volumes
- Swfte ConnectClaude alongside 50+ providers
- Context windows explainedWhy long agent runs need compaction