Skip to content

Configure and brief subagents

Configure a coordinator to spawn subagents (the Agent tool allowed, one AgentDefinition per type, parallel calls in one response) and write a subagent prompt that carries complete findings with their sources kept apart.

Scenario

In your Multi-Agent Research System, the search and analysis subagents have found 28 sources on hospital staffing shortages. The coordinator now calls the synthesis subagent with: "Write up the main themes from what we found."

The synthesis comes back fluent, general, and cites nothing. The subagent never saw a single finding: they were in the coordinator's conversation, not in its prompt.

Explanation

The spawning tool. A coordinator starts subagents through one tool. The exam guide calls it Task; the current Agent SDK docs call it the Agent tool (it still shows as "Task" in the session's init tool list, and older versions used "Task" in tool calls too).

Available versus approved. The guide says allowedTools must include Task. In the current SDK, allowedTools only auto-approves the tools it names; it doesn't restrict which tools exist. Availability is set by the tools option (an explicit list of built-in tools) and by bare names in disallowedTools. The docs' examples still list "Agent" in allowedTools, so on the exam, "allowedTools includes Task" is the expected answer. In your own code, check that an explicit tools list includes Agent and that disallowedTools doesn't remove it: a coordinator without the tool can't delegate and answers from its own knowledge instead.

One AgentDefinition per subagent type, passed in the agents option:

Field Purpose
description (required) When to use this subagent. Claude matches tasks to subagents by it, so make it specific
prompt (required) The subagent's system prompt: its role and how it works
tools The tools it may use; omit to inherit all. Restrict it: a document analyst needs reading tools, not web search
model Optional model override

Subagents start fresh. A subagent's context holds its own system prompt and the Agent tool's prompt string, not the coordinator's history or tool results. (A fork is the exception: it inherits the whole conversation, which suits exploring alternatives from one shared baseline.) So everything the subagent needs goes in the prompt: the full findings, not a reference to them.

Keep content and metadata apart. Pass each finding as a structured record, with the claim in one field and its source URL, document name, page and date in others, for example <source> and <document_content> tags or JSON. Prose with sources woven into sentences loses attribution on the way through.

Brief with goals, not procedures. Give the subagent an objective, the output format, guidance on sources, and boundaries, plus the quality bar ("every claim cites a source; flag conflicting figures"). A numbered click-by-click procedure breaks the moment the first source is unhelpful.

Spawn in parallel. Independent tasks go out as several Agent tool calls in one coordinator response, so they run at the same time. When each call waits for its result before the next one goes out, the research phase is as slow as the sum of its parts. (Current Claude Code and the Agent SDK run subagents in the background by default, so calls made in separate turns can overlap too; the exam's answer is still one response.)

Worked example

Before: the coordinator's call to synthesis.

Write up the main themes from what search and analysis found.

After:

Goal: a synthesis for hospital executives on causes of nurse shortages in 2023-2026, grouped into 3 to 6 themes.

Quality bar: every claim cites its finding id; where findings disagree, show both figures and their sources; say which themes have only one source.

Findings (28 records):
<finding id="F1"><source>Regional Workforce Survey 2025, p. 14</source><date>2025-03</date><content>Vacancy rate for registered nurses was 9.6%.</content></finding>
<finding id="F2"> ... </finding>

Return: themes, each with claims and finding ids, then a list of conflicts.

The "after" prompt carries the findings themselves, keeps each source next to (not inside) its claim, and states the goal and quality bar without dictating steps.

Configuration for the same system:

const options = {
  allowedTools: ["Agent"],
  agents: {
    synthesis: {
      description: "Merges findings into cited themes."
        + " Use after search and analysis.",
      prompt: "You synthesize research findings...",
      tools: ["Read"],
    },
  },
};