Claude Certified Architect - FoundationsCCAR-F Learning Guide
Domain 1 · Lesson 1.3 · 6 min read

Spawning Subagents and Passing Context

Exam taskConfigure subagent invocation, context passing, and spawning

Subagents are spawned through the Task tool, start with no memory of the coordinator's conversation, and only know what you put in their prompt, so pass complete findings, keep metadata structured, and spawn in parallel.

What you need to know

Spawning: the Task tool

A coordinator spawns a subagent by calling a tool: the Task tool. Two consequences follow:

  • If the coordinator's allowedTools does not include "Task", it cannot delegate, however clearly its system prompt tells it to. It will do the work itself.
  • Spawning is a tool call like any other, so it shows up in the loop and in hooks.

Defining subagents: AgentDefinition

Each subagent type is described by an AgentDefinition:

FieldPurpose
descriptionTells the coordinator when to use this subagent
promptThe subagent's own system prompt
toolsThe tools this subagent may use, restricted to its role
modelOptional model override
options = ClaudeAgentOptions(
    allowed_tools=["Task", "Read", "Grep"],   # "Agent" in current releases
    agents={
        "synthesis": AgentDefinition(
            description="Combines research findings into a structured draft.",
            prompt="You merge findings. Keep every claim's source.",
            tools=["Read"],
        ),
    },
)

Subagents inherit nothing you do not pass

A non-forked subagent starts with a fresh context. It does not receive the coordinator's conversation history, earlier tool results, or another subagent's output, and nothing is shared between one invocation and the next. The only bridge is the prompt the coordinator writes for it.

So when the synthesis subagent writes a generic report that cites none of the search results, the likeliest cause is simple: nobody put the search results in its prompt.

What to put in a subagent's prompt

  • Complete findings from earlier agents, not a one-line paraphrase. The synthesis subagent needs the search results and document analysis themselves.
  • Structure that separates content from metadata, so attribution survives: each finding with its source URL or document name, page, and date.
  • The goal and quality criteria, not a script. "Find evidence on recycling capacity in the EU since 2023; prefer primary sources; flag conflicts" lets the subagent adapt. "Run these five queries in order and summarise the top three results" breaks the moment the topic does not fit the script.
{"findings": [
  {"claim": "EU recycling capacity grew 40% in 2024",
   "source": "https://example.org/report-2025", "page": 12,
   "published": "2025-03-10"}
]}

Parallel spawning

To run independent subagents at the same time, the coordinator emits several Task calls in one response. Emitting one per turn makes them run one after another: two tasks of 15 and 20 seconds take 35 seconds in sequence and about 20 in parallel.

Fork-based sessions

For exploring two divergent approaches from the same analysis, a fork copies the conversation so far into a new, independent branch (lesson 1.7). A fork is the exception to "starts fresh": it inherits the history up to the fork point.

In the exam

Look for these symptoms: a coordinator that does all the work itself (missing Task tool), a synthesis that ignores earlier findings (findings not passed), lost citations (metadata not structured), slow runs (Task calls spread across turns), or rigid subagents (procedural prompts). Claims that subagents "automatically share memory" or "inherit the parent's history" are wrong.

Check your understanding

Question 1

A coordinator's system prompt tells it to delegate research, but it runs every search itself. What is the most likely cause?

Show answer

Answer: D. Spawning a subagent is a tool call. Without the Task tool in allowedTools, the coordinator has no way to delegate and does the work with the tools it has.

Question 2

Two independent subagents take 15 and 20 seconds and currently run one after the other. How do you get close to 20 seconds total?

Show answer

Answer: B. Multiple Task calls in a single response run in parallel. One call per turn forces sequential execution.

Question 3

The synthesis subagent's report never cites the search findings. What should you change first?

Show answer

Answer: C. Subagents start with a fresh context and share no memory. The synthesis subagent only knows what the coordinator writes into its task.

Apply it: Write Whitfield's synthesis task

Exercise · about 15 minCase: Whitfield Research Group

Whitfield's synthesis subagent writes generic drafts with no citations. Fix how it is configured and briefed.

  1. Write its AgentDefinition. Give the description, a two-line system prompt and its tool list, and justify the tools.
  2. Design the payload the coordinator sends it. Show the structure for findings so that every claim keeps its source, location and date.
  3. Write the task text. State the goal and quality criteria, not a step-by-step procedure.
  4. Say how the coordinator spawns search and document analysis before synthesis, and why the order matters.
Check your work
Show model answer

1. AgentDefinition

FieldValue
description"Combines findings from search and document analysis into a structured draft. Use after research is complete."
prompt"You merge research findings into a draft report. Never drop a claim's source; show conflicting figures side by side."
tools["Read"] only. Synthesis works on what it is given; it should not search the web or render reports.

2. Payload

{"question": "...", "findings": [
  {"claim": "...", "source": "URL or document name",
   "location": "page or section", "published": "YYYY-MM-DD",
   "from": "web_search | document_analysis"}],
 "gaps": ["subtopics with no findings"]}

3. Task text. "Write a draft answering the question for an investor audience. Every factual claim must cite a finding by its source. Where findings disagree, present both with their sources and dates. List subtopics in gaps in a coverage section. Prefer recent, primary sources when weighing evidence."

4. Spawning. Search and document analysis are independent, so the coordinator emits both Task calls in one response and they run in parallel. Synthesis depends on both, so it is spawned only after both return, with their complete outputs placed in the payload above.

Sources