Skip to content

1.3 Subagent Invocation and Context Passing

A coordinator is the agent that runs a multi-agent task and gives parts of it to subagents. Invocation is how the coordinator starts a subagent. Context passing is how the coordinator gives that subagent the information it needs. Task Statement 1.3 covers these mechanics. If 1.2 taught you the architecture, 1.3 teaches you how the parts connect.

This lesson uses one made-up example throughout: a landscaping firm that uses a multi-agent system to draft planting proposals for clients. Its coordinator spawns three subagents. A web search subagent finds plant and supplier information online and returns results with URLs and titles. A document analysis subagent reads the firm’s supplier catalogues and returns analysis with page references. A synthesis subagent writes the proposal from the results of both, and every claim in it should name its source.

The Task tool is how a coordinator spawns subagents. It is the API mechanism that makes multi-agent orchestration work in the Claude Agent SDK, so it is more than a naming convention. Current state (checked 6 October 2026): Claude Code renamed it Agent in v2.1.63. The name Task still works as an alias, and the Agent SDK emits Agent in tool-use blocks.

The coordinator’s allowedTools must include "Task" (or "Agent", its name in Claude Code since v2.1.63). This is a yes-or-no requirement. With neither name on the list, the coordinator has no way to invoke subagents at all. The firm’s coordinator could have three well-defined subagents and invoke none of them.

An AgentDefinition defines each subagent. It specifies three things:

  1. Description: what the subagent does. The coordinator reads it to decide when to invoke the subagent.
  2. System prompt: the instructions the subagent follows.
  3. Tool restrictions: which tools the subagent can access, scoped to its role.

At the firm, the web search subagent’s description says it finds plant and supplier information online. Its tools are limited to search, which is its whole role.

Subagents have isolated context, the principle from 1.2. A subagent receives only what the coordinator writes into the subagent’s prompt. It does not see the coordinator’s history or another subagent’s output. Most multi-agent systems fail at this point. Three rules follow.

Rule 1: Include complete findings from prior agents. A synthesis subagent cannot find earlier results, because its prompt is its only input. If it needs web search results and document analysis output, the coordinator must pass both in full. At the firm, the coordinator puts both in the synthesis subagent’s prompt.

Rule 2: Use structured data that separates content from metadata. Content is the claim, the fact or the analysis. Metadata says where the content came from: source URL, document name, page number. A downstream agent can attribute a claim to a source only if the coordinator passes that metadata with the claim. When a coordinator compresses findings for the next agent and removes the link between each claim and its source, the attribution is lost.

Rule 3: Specify goals, not procedures. A coordinator prompt should tell a subagent what to achieve and which quality criteria to meet, not give step-by-step instructions. A fixed procedure gives the subagent no way to adjust its approach when it meets something unexpected. A goal lets it adjust its approach. The firm’s coordinator asks the web search subagent for suppliers on the planting list, each with a URL. The coordinator names no sites, so the subagent can search other sites when one site has nothing useful.

A practical format keeps content and metadata in separate fields, as in this example:

{
"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 contains its source attribution as metadata. A synthesis subagent that receives findings in this format has everything it needs to produce a properly cited report.

At the firm, both research subagents return well-sourced work: URLs and titles from web search, page references from the catalogue analysis. The coordinator passes the content of both to the synthesis subagent but removes the metadata: no source URLs, document names or page numbers. The synthesis subagent writes an excellent proposal with no source attribution.

A change to the synthesis subagent’s prompt does not fix this problem, because the subagent cannot cite sources that it does not have. The coordinator must pass structured metadata with the content, and keep the source URL, document name and page number for every finding.

When a coordinator needs several subagents for independent tasks, it should emit multiple Task tool calls in a single response. Sequential spawning means one subagent per coordinator turn. The second subagent cannot start until the first has returned and the coordinator takes another turn. When the tasks are independent, that wait adds latency with no benefit. The firm’s web search and catalogue analysis tasks do not depend on each other, so the coordinator spawns both subagents in one response.

fork_session creates independent branches from a shared analysis baseline. After an initial analysis, such as reading a codebase or understanding a problem, a coordinator can fork the session to explore divergent approaches. After the branching point, each fork works independently. Neither sees the other’s results, and changes in one do not affect the other. A coordinator might fork after analysing a codebase to compare two testing strategies. The firm’s coordinator forks after analysing a client’s site survey to compare two planting plans.

--resume and fork_session are both 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). It 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. Use fork to explore divergent approaches from a shared starting point. Use resume to continue the same line of investigation, as the firm does to continue one proposal.

Exam guide v1.0 uses the name Task tool, so answer “Task tool” even where current code shows Agent. Exam guide v1.0 states the allowedTools rule as above, and that is the right answer.

One question: a synthesis agent’s report has unsourced claims, while the web search and document analysis subagents work correctly. The coordinator passed content without structured metadata, so the synthesis agent had no source information to include.

The exam tests whether you are aware of latency. For independent subagent tasks, the correct answer involves parallel spawning. Options that mention “in a single response” or “simultaneously” signal parallel spawning.

The exam also tests the difference between fork and resume. Exam guide v1.0 lists --resume and fork_session as two session controls, and that is how the exam frames them. Answer that way: resume to continue a session, fork to branch from it.

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.