Skip to content

1.3 Subagent Invocation and Context Passing

Task Statement 1.3 is about the mechanics of how a coordinator actually invokes subagents and passes information between them. If 1.2 taught you the architecture, 1.3 teaches you the wiring.

The Task tool is how a coordinator spawns subagents (the exam guide v0.2 uses this name). It’s the actual API mechanism that makes multi-agent orchestration work in the Claude Agent SDK, not a naming convention you can skip past. Current Claude Code (v2.1.63, February 2026) renamed it to Agent; the name Task still works as an alias, and the Agent SDK emits Agent in tool-use blocks. Answer “Task tool” on the exam, and expect to see “Agent” in current code.

There is a critical configuration requirement: the coordinator’s allowedTools must include "Task" (or "Agent", its current name in Claude Code). Without it, the coordinator physically can’t spawn subagents. It’s a binary gate, not a soft preference. If neither Task nor Agent is in allowedTools, the coordinator has no way to invoke subagents at all.

Each subagent is defined by an AgentDefinition that specifies three things:

  1. Description — what the subagent does (used by the coordinator to decide when to invoke it).
  2. System prompt — the instructions the subagent follows.
  3. Tool restrictions — which tools the subagent can access (scoped to its role).

Context passing is where most multi-agent systems fall over. The principle from 1.2 carries straight across: subagents have isolated context. They get only what the coordinator writes into their prompt. Nothing else.

There are three rules for effective context passing:

Rule 1: Include complete findings from prior agents. If the synthesis subagent needs web search results and document analysis output, the coordinator must pass both — in full — in the synthesis subagent’s prompt. Do not assume the synthesis agent can “look up” prior results. It cannot.

Rule 2: Use structured data formats that separate content from metadata. When passing research findings between agents, the data must include both the content (the claim, the fact, the analysis) and the metadata (source URL, document name, page number). If you pass content without metadata, the downstream agent cannot attribute claims to sources.

This is a specific exam pattern: a synthesis agent produces a report with unsourced claims. The web search and document analysis subagents are working correctly. The root cause is that the coordinator passed content without structured metadata — the synthesis agent literally had no source information to include.

Rule 3: Design coordinator prompts that specify goals, not procedures. The coordinator prompt should tell subagents what to achieve and what quality criteria to meet, not step-by-step instructions for how to do it. Goal-oriented prompts enable subagent adaptability. Procedural instructions constrain subagents and prevent them from adjusting their approach when they encounter unexpected situations.

The structured data format for inter-agent context passing should separate content from metadata cleanly. A practical format looks like this:

{
"findings": [
{
"claim": "Solar panel efficiency has increased 25% in the last decade",
"source_url": "https://example.com/solar-report",
"document_name": "Annual Solar Industry Report 2024",
"page_number": 14,
"confidence": "high",
"retrieved_by": "web_search_agent"
}
]
}

Each finding carries its source attribution as metadata. When the synthesis agent receives this structured data, it has everything it needs to produce a properly cited report.

When a coordinator needs to invoke multiple subagents for independent tasks, it should emit multiple Task tool calls in a single response rather than invoking them one at a time across separate turns.

Sequential spawning — one subagent per coordinator turn — adds latency for nothing. If the web search agent and document analysis agent work independently, there’s no reason to make one wait for the other.

The exam tests latency awareness. When presented with independent subagent tasks, the correct answer involves parallel spawning. Look for answer options that mention “in a single response” or “simultaneously” — these signal the parallel pattern.

fork_session creates independent branches from a shared analysis baseline. After a coordinator has completed an initial analysis (reading a codebase, understanding a problem), it can fork the session to explore divergent approaches.

Example: after analysing a codebase, the coordinator forks to compare two testing strategies. Each fork operates independently after the branching point — they do not see each other’s results, and changes in one fork do not affect the other.

Both are Claude Code session controls. --resume is a CLI flag, with a matching resume option in the Agent SDK; fork_session is the SDK option (forkSession in TypeScript) and is also on the CLI as --fork-session next to --resume.

fork_session is not the same as –resume. Resume continues a specific named session. Fork creates a new independent branch. The exam tests this distinction. Use fork when you need divergent exploration from a shared starting point. Use resume when you want to continue the same line of investigation.

A multi-agent research system has three agents: web search, document analysis, and synthesis. The web search agent returns well-sourced results with URLs and titles. The document analysis agent returns detailed analysis with page references.

The coordinator passes the content from both agents to the synthesis agent but strips the metadata — it sends the claims and analysis text without source URLs, document names, or page numbers. The synthesis agent produces an excellent summary with no source attribution.

The fix is not to modify the synthesis agent’s prompt (it cannot cite sources it does not have). The fix is to require the coordinator to pass structured metadata alongside content, preserving the source URL, document name, and page number for every finding.

A synthesis agent produces a report where several claims have no source attribution. The web search subagent correctly returns results with URLs, titles, and snippets. The document analysis subagent correctly returns analysis with page references. Both subagents are verified to be working properly. What is the most likely root cause?

  • A. The synthesis agent system prompt lacks explicit instructions to cite sources, so it summarises the research without carrying any attribution into the report
  • B. The coordinator passes content to the synthesis agent without structured metadata — source URLs, document names, and page numbers are not included
  • C. The web search subagent returns its results in a format the synthesis agent cannot parse, so the source URLs and document titles are dropped during synthesis
  • D. The synthesis agent should be given direct access to the web search tool so it can re-run the queries and verify sources itself
Answer & explanation

Correct: B

  • A — Even with citation instructions, the synthesis agent cannot cite sources it was never given. If the coordinator strips metadata before passing content, no prompt instruction can recover the missing information.
  • B — Context passing must include structured data that separates content from metadata. Without source URLs and document names in the data passed to the synthesis agent, it has no attribution information to include regardless of its instructions.
  • C — The web search subagent is returning well-structured results. The issue is not the source format — it is that the coordinator does not pass the metadata through to the synthesis agent.
  • D — Giving the synthesis agent web search tools violates the principle of scoped tool access and breaks the hub-and-spoke architecture. The fix is proper context passing, not giving agents tools outside their role.

Five exam-style multiple-choice questions on Subagent Invocation and Context Passing. Pick an answer, then open the explanation.

A synthesis agent produces a report where several claims have no source attribution. The web search subagent correctly returns results with URLs, titles, and snippets. The document analysis subagent correctly returns analysis with page references. Both subagents are verified to be working properly. What is the most likely root cause?

  • A. The synthesis agent’s system prompt does not include instructions to cite sources
  • B. The synthesis agent should be given direct access to the web search tool so it can verify sources itself
  • C. The web search subagent needs to return results in a different format that the synthesis agent can parse
  • D. The coordinator passes on content stripped of its structured source metadata
Answer & explanation

Correct: D

  • D is correct because context passing must include structured data that separates content from metadata. Without source URLs and document names in the data passed to the synthesis agent, it has no attribution information to include regardless of its instructions.
  • A is wrong because even with citation instructions, the synthesis agent cannot cite sources it was never given. If the coordinator strips metadata before passing content, no prompt instruction can recover the missing information.
  • B is wrong because giving the synthesis agent web search tools violates the principle of scoped tool access and breaks the hub-and-spoke architecture. The fix is proper context passing, not giving agents tools outside their role.
  • C is wrong because the web search subagent is returning well-structured results. The issue is not the source format — it is that the coordinator does not pass the metadata through to the synthesis agent.

A coordinator needs to spawn a web search subagent and a document analysis subagent for independent research tasks. What is the most efficient spawning approach?

  • A. Invoke the web search subagent first, wait for results, then invoke the document analysis subagent
  • B. Emit multiple Task tool calls in a single coordinator response to spawn both subagents in parallel
  • C. Create a shared message queue that both subagents can read from simultaneously
  • D. Invoke both subagents with identical prompts so they can cross-verify each other’s results
Answer & explanation

Correct: B

  • B is correct because emitting multiple Task tool calls in a single coordinator response spawns independent subagents simultaneously, reducing latency compared to sequential invocation across separate turns.
  • A is wrong because sequential invocation introduces unnecessary latency when the tasks are independent. Neither subagent needs the other’s results to begin its work.
  • C is wrong because shared message queues break the hub-and-spoke architecture. All communication must flow through the coordinator, not through shared infrastructure.
  • D is wrong because identical prompts waste resources and do not address the latency issue. Each subagent should receive a prompt tailored to its specific role and subtopic.

A coordinator’s allowedTools list contains [“WebSearch”, “Read”] but does NOT include “Task” (or “Agent”, its current name). What happens when the coordinator tries to spawn a subagent?

  • A. The coordinator spawns the subagent but with reduced capabilities
  • B. The coordinator automatically falls back to calling the subagent’s tools directly
  • C. The coordinator cannot spawn any subagents — Task must be in allowedTools
  • D. The coordinator spawns the subagent but it inherits the coordinator’s tools instead of its own
Answer & explanation

Correct: C

  • C is correct because Task is the hard gate for subagent spawning. Without Task in allowedTools, the coordinator physically cannot invoke any subagent. There is no fallback or workaround.
  • A is wrong because without Task, no subagent is spawned at all — it is not a degraded mode, it is a complete inability to invoke subagents.
  • B is wrong because there is no automatic fallback. The coordinator can only use the tools in its allowedTools list. Without Task, it has no mechanism for subagent invocation.
  • D is wrong because no subagent is created. The Task tool is required to spawn any subagent; tool inheritance is not relevant when spawning itself is impossible.

A developer uses fork_session after analysing a codebase to explore two different refactoring strategies. Which statement correctly describes how forks behave?

  • A. Each fork operates independently after the branching point — changes in one fork do not affect the other
  • B. Both forks share memory and can see each other’s results in real time
  • C. The second fork automatically receives a summary of everything the first fork found after the branching point
  • D. Forks are identical to –resume sessions and can be used interchangeably
Answer & explanation

Correct: A

  • A is correct because fork_session creates independent branches from a shared analysis baseline. After the fork, each branch operates independently. They do not see each other’s results and changes in one do not affect the other.
  • B is wrong because forks are explicitly isolated. They share the baseline context up to the branching point but are completely independent afterward. No shared memory exists.
  • C is wrong because forks are independent. The second fork has no knowledge of the first fork’s activity after the branching point.
  • D is wrong because fork_session and –resume serve entirely different purposes. Fork creates divergent branches for exploring alternatives. Resume continues the same conversation.

When designing a coordinator prompt for subagents, which approach leads to better subagent performance?

  • A. Provide detailed step-by-step procedural instructions for how the subagent should complete the task
  • B. Include the coordinator’s full conversation history so the subagent has maximum context
  • C. Specify research goals and quality criteria, allowing the subagent to adapt its approach
  • D. Keep the prompt minimal to avoid overwhelming the subagent with information
Answer & explanation

Correct: C

  • C is correct because goal-oriented prompts enable subagent adaptability. Specifying what to achieve and what quality criteria to meet allows subagents to adjust their approach when they encounter unexpected situations.
  • A is wrong because procedural instructions constrain subagents and prevent them from adjusting their approach. If the subagent encounters an unexpected situation, rigid procedures may lead to poor results.
  • B is wrong because subagents have isolated context by design. Including the full conversation history is wasteful and may confuse the subagent with irrelevant information. Pass only the specific context needed for the task.
  • D is wrong because minimal prompts may lack the context needed for the subagent to produce quality results. The prompt should include the specific goal, quality criteria, relevant findings from prior agents, and the expected output format.