1.3 Subagent Invocation & Context Passing
1.3.1 The Problem: A Worker Who Remembers Nothing
Lesson 1.2 left us with a striking fact: a subagent starts completely blank. It inherits none of the coordinator's history, sees none of its peers' work, and remembers nothing between invocations. That isolation keeps each context clean — but it creates an obvious practical problem. If a worker remembers nothing, how do you actually get useful work out of them?
The answer is the whole subject of this lesson, and it comes down to one channel. Imagine sending a brand-new contractor into a locked room to do a job. You can't shout instructions through the wall, and there's no shared filing cabinet inside. The ONLY thing you can do is slide a single sheet of paper under the door before they start. Whatever is on that sheet is everything they'll have. If you forget to write down the customer's name, they'll never know it.
For a subagent, that sheet of paper is the prompt string you pass when you spawn it. It is the one and only channel from coordinator to subagent. Master what goes on that sheet — and what the subagent already has versus what it's missing — and you've mastered Task Statement 1.3.
The prompt string is the single sheet of paper slid under the door. It is the only way information reaches a subagent — so it must contain everything that subagent needs.
The one idea to hold onto
Because a subagent starts blank, the prompt string you hand it when spawning is the ONLY channel from parent to child. Everything it needs — file paths, prior findings, the goal — must be written into that brief.
1.3.2 How You Spawn a Subagent: the Agent Tool
Before we fill in the brief, how does a coordinator spawn a subagent at all? Through a special tool called the Agent tool. (You may see it called the Task tool — that was its name until Claude Code v2.1.63 renamed it to Agent; the old name still works, and the exam guide still says 'Task'. Treat them as the same thing.) Spawning a subagent is, mechanically, just the coordinator calling this tool — the same tool_use mechanism from Lesson 1.1, where the 'tool' happens to be 'start a subagent and give it this brief.'
There's one gate you must not forget: for a coordinator to use the Agent tool, its list of allowed tools must INCLUDE the Agent (or Task) tool. This is a simple on/off switch. Leave it out and the coordinator literally cannot spawn anyone — and the frustrating part is it fails silently: the coordinator just does the work itself or gives up, with no error telling you the door was locked. If a coordinator mysteriously refuses to delegate, this is the first thing to check.
# A coordinator that's ALLOWED to spawn subagents:
options = ClaudeAgentOptions(
allowed_tools=["Read", "Grep", "Glob", "Agent"], # <-- 'Agent' present = delegation enabled
agents={ "researcher": AgentDefinition(...) },
)
# Omit "Agent" from allowed_tools and the coordinator silently cannot delegate at all.One more rule that surprises people: a subagent cannot spawn its own subagents. The hierarchy is exactly one level deep — coordinator at the top, workers below, full stop. So you never put the Agent tool in a subagent's own tool list. This is a deliberate guard against runaway nesting where agents spawn agents spawn agents.
1.3.2 — Key Concept
Subagents are spawned via the Agent tool (formerly Task). The coordinator's allowed-tools MUST include Agent/Task or delegation silently never happens. Subagents cannot spawn subagents, so never give a subagent the Agent tool.
1.3.3 What Crosses the Boundary — and What Doesn't
"Starts blank" is the headline, but the precise truth is a little richer and worth getting exactly right, because the exam probes it. A subagent's context isn't literally empty — it just doesn't contain the PARENT's conversation. Let's lay out exactly what it does and doesn't receive.
| The subagent RECEIVES | The subagent does NOT receive |
|---|---|
| Its own system prompt (its defined role/instructions) | The parent's conversation history or tool results |
| The Agent tool's prompt string — the brief you wrote | The parent's system prompt |
| Project CLAUDE.md (shared project context) | Other subagents' results, or any shared memory |
| Its tool definitions (inherited, or the subset you grant) | Anything from its own previous invocations |
A subagent gets its role, the brief, project-level context, and tools — but never the parent's running conversation. So the brief is where the actual task context lives.
And what comes BACK? Only the subagent's final message. All the intermediate work — every tool call it made, every file it read, every dead end it explored — stays sealed inside the subagent's own context and never reaches the coordinator. This is precisely the point of subagents: a research subagent can read fifty files, and the coordinator receives only the tidy two-paragraph summary, not fifty files' worth of clutter. That's how subagents protect the coordinator's context from overflowing — the very benefit from Lesson 1.2, now you can see the mechanism.
Only the subagent's final message returns to the coordinator. All intermediate tool calls and file reads stay sealed inside the subagent — which is exactly how subagents keep the coordinator's context clean.
1.3.3 — Key Concept
A subagent receives its own system prompt + the Agent prompt + project CLAUDE.md + its tools — never the parent's history or system prompt. Only its final message returns to the parent (verbatim); all intermediate work stays isolated.
1.3.4 Writing a Brief That Keeps Citations Alive
Now the craft: what makes a GOOD brief? This matters most when you chain subagents — search feeds analysis feeds synthesis — because that's where information gets lost in transit. The exam tests the consequence directly, so let's understand it through a failure first.
Suppose your synthesis subagent produces a beautiful report, but none of its claims are cited. Your instinct says "the synthesis agent is broken." Almost always, it isn't. Remember: synthesis only knows what was written on its brief. If the coordinator passed it the raw claims but stripped away WHERE each came from — the source URL, the document name, the page — then synthesis literally has no citations to include. It's not a synthesis bug; it's a context-passing bug. You handed the contractor the conclusions but not the references.
Three rules prevent this. First, pass COMPLETE prior findings into the brief — don't make the subagent re-derive what an earlier stage already found. Second, use STRUCTURED data that keeps content and its metadata together, so the source travels alongside every claim through every hop. Third, write the brief around the GOAL and quality bar, not a rigid step-by-step procedure — that preserves the subagent's ability to adapt while still constraining the outcome.
# Findings carry their metadata so attribution survives every hop:
findings = [
{"claim": "AI adoption rose 40% in 2024",
"source_url": "https://...", "document_name": "State of AI 2024",
"page_number": 12, "confidence": 0.9},
]
synthesis = AgentDefinition(
description="Combines findings into a cited report. Use after search and analysis.",
prompt="Synthesize the findings below into a cited report. Preserve every "
"claim's source metadata.\n\nFINDINGS:\n" + json.dumps(findings),
tools=["Read"], # least privilege: synthesis doesn't need web access
)1.3.4 — Key Concept
Pass complete findings as STRUCTURED data so each claim carries its source metadata through every hop. Uncited synthesis output is usually a context-passing failure, not a synthesis failure — the coordinator stripped the metadata before passing it on.
1.3.5 Spawning in Parallel and the AgentDefinition
Two practical mechanics round out the picture. First, parallelism — the source of the speed-up from Lesson 1.2. If the coordinator emits SEVERAL Agent tool calls in a single response, those subagents run at the same time. If instead it spawns one, waits, then spawns the next on a later turn, they run sequentially and you lose the whole benefit. So for independent work, fire all the delegations in one response. (For coordinating dozens or hundreds of agents, there's a heavier-duty Workflow tool that moves orchestration into a script — but for a handful of subagents, parallel Agent calls are the tool.)
Second, how you actually DEFINE a subagent in code: the AgentDefinition. Two fields are required — description (a plain-language note on WHEN to use this subagent, which is what lets the coordinator auto-decide to delegate to it) and prompt (its system prompt — its role and instructions). Everything else is optional but useful: tools (omit and it inherits all; specify and it's restricted — least privilege), model (pick 'haiku' for cheap/fast, 'opus' for hard reasoning, or 'inherit'), and more.
| AgentDefinition field | Required? | What it does |
|---|---|---|
| description | Yes | Tells the coordinator WHEN to use this subagent (drives auto-delegation) |
| prompt | Yes | The subagent's system prompt — its role, expertise, and instructions |
| tools | No | Which tools it may use; omit → inherits all; specify → least privilege |
| model | No | 'haiku' / 'sonnet' / 'opus' / 'inherit' — match power to the task |
The two required fields are description and prompt; the rest tune cost, power, and safety. Note: a good description is what makes automatic delegation work.
1.3.5 — Key Concept
Spawn independent subagents in PARALLEL — multiple Agent calls in one response. Define them with AgentDefinition: description (when to use it — drives auto-delegation) and prompt are required; tools and model are optional levers for least privilege and cost.
1.3.6 The Exam Traps
Every 1.3 trap grows from one of two misconceptions: that context is somehow inherited, or that a downstream agent is to blame for data the coordinator never actually passed it. Once you internalise 'the brief is the only channel,' these become easy to spot.
- •Assuming inheritance. ✗ Believing a subagent can see the parent's history or another subagent's results. ✓ It can't — only what's in its brief; pass everything explicitly.
- •Blaming the synthesizer. ✗ Concluding the synthesis agent is broken when its report lacks citations. ✓ The coordinator stripped the source metadata in transit — fix the context passing, not the synthesizer.
- •Spawning sequentially. ✗ Delegating independent tasks across separate turns, one at a time. ✓ Emit multiple Agent calls in one response so they run in parallel.
- •Over-specifying the brief. ✗ Writing a rigid step-by-step procedure that kills the subagent's adaptability. ✓ Specify the goal and quality criteria; let the subagent choose how.
All four 1.3 traps reduce to two mistaken beliefs. Anchor on 'the brief is the only channel' and the correct fix is always to write a better brief — or send it in parallel.
1.3.6 — Exam Trap
When a downstream subagent's output is missing something (citations, context, a fact), the cause is almost always what the coordinator did or didn't put in the brief — not the subagent. The fix is structured, complete context passing, never 'give the downstream agent more tools' or 'use a bigger model.'
1.3.7 Put It Together: Build a Context-Passing Pipeline
You now know how spawning works (the Agent tool and its gate), exactly what crosses the boundary, how to write a brief that preserves attribution, how to parallelise, and the AgentDefinition shape. The exercise makes the citation failure vivid — once you've watched citations vanish and reappear, you'll never strip metadata again.
1.3.7 — Build Exercise (45 min)
Build a 3-stage pipeline: search → analysis → synthesis. (1) Define each subagent with a clear description and a least-privilege tools list (e.g. synthesis gets only Read). (2) Pass each stage's complete output to the next IN the brief, as structured JSON carrying source_url / document_name / page_number. (3) Spawn search and analysis in parallel from one coordinator response. (4) Verify the final report cites every claim — then strip the metadata from the brief and watch the citations disappear, proving the failure lives in context passing, not in synthesis.
This lesson completes the 'how' of multi-agent systems. Next, Lesson 1.4 shifts from coordinating agents to GUARANTEEING behaviour — using your code's control over the loop to make certain steps happen every single time, no matter how the model is prompted.
Where this shows up on the exam
1.3 questions describe a subagent producing incomplete or uncited output, or a coordinator that won't delegate. If your reflex is 'check the brief and the Agent-tool gate,' rather than blaming the worker, you'll pick the right answer.
Key Takeaways
- ✓Because a subagent starts blank, the Agent tool's prompt string (the brief) is the ONLY channel from coordinator to subagent — everything it needs must be written there.
- ✓Subagents are spawned via the Agent tool (formerly Task, renamed in Claude Code v2.1.63); the coordinator's allowed-tools MUST include Agent/Task or delegation silently never happens. Subagents can't spawn subagents.
- ✓A subagent receives its own system prompt + the brief + project CLAUDE.md + its tools — NOT the parent's history, tool results, or system prompt; only its final message returns (verbatim), keeping intermediate work isolated.
- ✓Preserve attribution by passing complete findings as STRUCTURED data (source_url, document_name, page_number) — uncited synthesis output is a context-passing bug, not a synthesis bug.
- ✓Spawn independent subagents in PARALLEL (multiple Agent calls in one response); write briefs around goals and quality criteria, not rigid step-by-step procedures.
- ✓AgentDefinition requires description (when to use it — drives auto-delegation) and prompt; tools (omit → inherits all) and model are optional levers for least privilege and cost.
- ✓Trap detector: when a downstream subagent's output is missing something, fix the brief/context passing — don't blame the worker, add tools, or upgrade the model.
Check Your Understanding
Test what you learned in this lesson.
Q1.A synthesis subagent produces a report with claims but no citations. The search and analysis subagents both returned correct, well-sourced data. What's the most likely cause?
Q2.A coordinator is defined but never delegates to its subagents. What's the most likely configuration error?
Q3.You have independent search and analysis subagents. How should the coordinator invoke them for best performance?
Q4.Which statement about what a subagent receives at startup is correct?
Practice This Lesson