Anthropic · Claude Agent SDK · Orchestration

One agent is a worker.
Managed agents are a team.

A managed agent is an isolated, single-purpose LLM agent that a parent "orchestrator" spawns like a function call — with its own brief, its own tools, its own model — and that returns a result when done. This is the visual field guide.

10chapters
1mental model
0shared memory (by design)
start reading
orchestrator
researcher
writer
critic
verifier
01
Definition

What is a managed agent?

Start with what an agent is: an LLM running in a loop — think, call a tool, read the result, think again — until a task is done. A managed agent is that same loop, but spawned and supervised by another agent.

animated · the manager delegates
parent
breaks task down
──▶
child spawned
with a brief
──▶
child runs its
own agent loop
──▶
result returns
to parent
The parent never does the specialist's work. It writes a brief, hands over scoped tools, and collects the result like a function return value.

Like a manager, not a monolith

A manager doesn't research, write, and review everything personally. They brief a researcher, a writer, and a reviewer — then synthesize. The parent agent works exactly this way.

Like a function call, not a chat

A child agent is not a persistent session. It spawns, runs to completion, returns a string, and is gone. No state survives unless the parent explicitly carries it forward.

The one-sentence mental model: a parent agent writes a fully self-contained brief for a child, hands it specific tools, and calls it like a function. The child runs its own loop, returns a result, and the parent decides what happens next.
02
Motivation

Why do managed agents exist?

Because tasks outgrow their containers, twice. First a single LLM call isn't enough. Then a single agent loop isn't enough.

animated · two escalations
single call
prompt → answer
breaks ▶
agent loop
tools + iteration
breaks ▶
orchestration
agents managing agents
Each jump solves the previous stage's failure mode — and introduces a new ceiling. Managed agents are the answer to the agent loop's ceiling.

Why a single call breaks

Multi-step work needs tools, intermediate results, and decisions that depend on earlier steps. One completion can't search the web, read the results, and revise its plan.

Why a single loop breaks

Context fills up with noisy tool output. One agent juggling five concerns produces mediocre results at each. Nothing runs in parallel. And every tool is exposed to every step.

The four pressures that force orchestration

Context pressure

Read 10 web pages and your context window is full of raw HTML. Subagents absorb the noise and return only the distilled answer.

window limits

Quality pressure

An agent that is a researcher AND writer AND reviewer in one loop context-switches constantly. Specialists produce sharper output.

focus

Time pressure

Independent subtasks shouldn't wait in line. Only separate agents can truly run at the same time.

parallelism

Safety pressure

The agent that reads untrusted data shouldn't hold the keys to sending email. Separate agents give you hard tool boundaries.

least privilege
03
The core rule

The isolation model

The single most important thing to understand: a child agent knows only what the parent writes into its prompt. No inherited conversation. No shared memory. No access to the parent's tool results.

animated · context does not cross the wall

Parent context

task: competitive brief
found: "X raised $50M"
searched 6 pages
decided to spawn child ↓

Child context

prompt: "write analysis of X"
$50M fact — never arrives
tools: [write_file]
writes confidently anyway…
The parent found the funding news but didn't put it in the brief. The child doesn't know what it doesn't know — it writes a confident analysis with a hole in it.

No "missing context" signal

The child never says "I need more info." It works with what it has — confidently. There is no way for it to ask the parent for clarification mid-run.

The brief is the interface

Write subagent prompts a stranger could execute: goal, constraints, relevant facts, expected output format. If it's not in the brief, it doesn't exist.

Isolation is a feature

Fresh context means a critic agent reviews work with genuinely fresh eyes, and one task's noise never pollutes another's reasoning.

The classic bug: the parent learns something crucial, spawns a child, and forgets to pass it along. The child can't fail loudly — it fails silently and confidently. Review your briefs like you review interfaces.
04
Implementation

Anatomy of a spawn

In the Claude Agent SDK, spawning a managed agent is a tool call. Here's the shape, and what each part is really doing.

# Parent agent decides to delegate
result = Agent(
    description="Competitive pricing researcher",   # short label
    prompt="""
    Research Competitor X's pricing tiers.

    Context you need:
    - We already know they raised $50M in March (TechCrunch)  ← pass facts explicitly!
    - Focus on their enterprise tier changes

    Return a structured JSON summary: { tiers: [...], changes: [...] }
    """,
    subagent_type="researcher",   # which agent definition to use
    model="haiku",                # can be cheaper than the parent
)
# result is a plain string — the child's final message

The prompt is a brief

Goal, context, constraints, output format. Self-contained. This is where most of the engineering effort belongs.

most important field

The model is a lever

The parent can run a powerful model while children run cheaper ones matched to their task difficulty. More in chapter 06.

cost control

The result is a string

No magic return type. If you need JSON downstream, say so in the brief — and validate it when it comes back.

validate outputs

Lifecycle

animated · spawn → run → return → gone
spawn
think
tool call
final answer
context
destroyed
The think ⇄ tool loop repeats as many times as the child needs. When it writes a final answer, that string goes to the parent and the child's context is gone.
05
The speed win

Parallelism

Independent subtasks shouldn't queue. Spawning multiple children at once turns total time from the sum of task times into the max of task times.

animated · sequential vs parallel · three 30-second tasks
sequential — one agent does all three
research
pricing
risks
total ≈ 90s
parallel — three children spawned together
research
pricing
risks
total ≈ 30s — the slowest child sets the pace
Same work, one third of the wall-clock time. The parent waits once, then synthesizes all three results together.
The dependency test: can task B start without task A's output? If yes, they belong in parallel children. If no, chain them. Most real pipelines are a mix — gather sequentially, then fan out.
# Spawn all three in the same turn — they run concurrently
research = Agent(description="Research competitors", prompt="...")
pricing  = Agent(description="Analyze pricing",     prompt="...")
risks    = Agent(description="Identify risks",      prompt="...")
06
The cost win

Match the model to the task

Decomposition's quiet superpower: once tasks are separated, each one can run on the cheapest model that does it well. A monolithic agent pays flagship prices for every token.

animated · relative cost per subtask
orchestrator
Sonnet
keyword scan
Haiku
classification
Haiku
nuanced judgment
Sonnet
final synthesis
Sonnet
Pattern matching, extraction, and simple classification don't need frontier reasoning. Route them to a small model and the whole pipeline can cost less than the monolith did — while producing more auditable output.

Haiku-shaped work

Keyword detection, extraction, formatting, simple binary judgments, per-item classification at scale.

Sonnet-shaped work

Orchestration decisions, nuanced evaluation, synthesis across many inputs, anything requiring cross-inference.

How to decide

Run 50 samples through both. If the small model agrees with the big one ≳95% of the time on that subtask, downgrade it.

Rule of thumb: count LLM calls before you build. 1,000 items × 4 agents = 4,000 calls. Then ask which of those calls can be small-model calls. That question often decides whether the architecture is affordable.
07
Use cases

The five patterns that keep showing up

Nearly every production multi-agent system is one of these five shapes, or a combination of them.

① Research fan-out

Parent decomposes a big question into 5 sub-questions, spawns 5 researchers in parallel, synthesizes their focused summaries. Beats one agent drowning in 20 open tabs.

context relief + speed

② Writer + critic

One agent writes; a second agent — with no memory of writing it — critiques. Fresh context is what makes the second opinion genuine rather than self-serving.

isolation as quality tool

③ Generate + verify

A writes code. B writes tests from the spec (not from A's code — avoids circular validation). C runs them. Parent loops until green. Hard tool boundaries between roles.

separation of duties

④ Map-reduce

500 documents → 10 batches → 10 parallel children each summarize a batch → parent reduces to themes. The classic pattern for anything at scale.

throughput

⑤ Tool-isolated workflow

The file-reading agent physically cannot send messages; the messaging agent never sees raw files. Scoped tools enforce policy as architecture, not as a polite request in a prompt.

security boundary

+ Adaptive deep-dive

Evaluate everything cheaply; spawn an expensive analysis child only for flagged outliers. Pay for depth exactly where depth is deserved.

conditional spend
08
Judgment

When not to use managed agents

The most senior thing you can know about an architecture is when it's overkill. Subagents add latency, cost, and briefing overhead — they must earn their place.

Decomposition heuristic: split on independence, not on topic. Correlated judgments (was the issue resolved / was the customer satisfied) often belong in one context. Independent workloads (scan doc A / scan doc B) belong in separate ones.
09
Production reality

Failure modes and how to survive them

Treat every child agent like an external API: it can fail loudly, fail slowly, or — worst of all — succeed with the wrong answer.

The loud failure

Timeout, error, malformed output. Easiest to handle: validate the returned string, catch exceptions, retry or route to a review queue. Never let one child sink the batch.

try / validate / retry

The quiet failure

Output parses fine but the reasoning was wrong. Defenses: run ambiguous items twice and compare (self-reported confidence is unreliable; disagreement between runs is a real signal).

consistency checks

The propagated failure

50 of 1,000 children failed and the summary agent was never told. It summarizes 950 results as if they were 1,000 — confidently wrong. Always pass failure metadata downstream.

report the gaps
try:
    result = Agent(prompt=brief, ...)
    data = json.loads(result)              # structurally valid?
    assert required_fields <= data.keys()  # complete?
except Exception as e:
    flag_for_review(item, reason=str(e))   # degrade gracefully

# and when summarizing, always include the denominator:
summary = Agent(prompt=f"Evaluated: {ok_count}/{total}. Failed: {fail_count}. ...")
10
Security

Prompt injection crosses agent boundaries

Any agent that reads untrusted content — web pages, emails, user chats, documents — can be handed instructions by an attacker hiding them in that content.

animated · the injected instruction rides the data
untrusted data
"ignore your rules…"
──▶
reader child
sees it in context
──▶
parent receives
tainted summary
──▶
downstream agents
inherit the taint
Injection doesn't stop at the first agent — a poisoned summary propagates through the pipeline unless boundaries are designed for it.
Cheat sheet

Quick reference

The Agent call

description

Short human-readable label for the task.

prompt

The self-contained brief: goal, context, constraints, output format. Your most important code.

subagent_type

Which agent definition to use — its tools and defaults come from the definition.

model

Override the child's model. Small for mechanical work, large for judgment.

isolation: "worktree"

For code tasks — gives the child its own git worktree sandbox.

SendMessage

Continue a previously spawned agent with its context intact, instead of spawning cold.

Design checklist before you build

Single agent vs. managed agents

dimensionsingle agent loopmanaged agents
contextfills with tool noisechildren absorb noise, return distillate
speedstrictly sequentialindependent work runs in parallel
costone model prices all tokensmodel matched per subtask
qualitygeneralist jugglingfocused specialists + fresh-eyes review
securityall tools, all stepsleast-privilege tool scoping per child
overheadnonespawn latency + briefing discipline
best forsimple, fast, tightly-coupledlarge, parallel, mixed-difficulty