Skip to content

CCAR-F · Domain 1: Agentic Architecture & Orchestration · 27% of the exam

Task 1.3: Configure subagent invocation, context passing, and spawning

Spawning subagents through the Agent tool (formerly Task), writing their definitions, handing them everything they need in the prompt because they start with a fresh context, keeping attribution in structured hand-offs, and running several at once.

Study it

  • Spawning subagents with the Agent tool: AgentDefinition, explicit context and parallel calls

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the Anthropic documentation page that proves it.

Question 1 · choose 1

Your coordinator, built with the Claude Agent SDK, runs the web-search and document-analysis subagents, then spawns the synthesis subagent through the Agent tool with the prompt "Synthesize the findings so far into a report." The report cites none of the sources the earlier subagents found. What is the most direct fix?

  1. ARaise the synthesis subagent's maxTurns so that it has enough turns to go and locate the earlier subagents' results itself
  2. BSpawn the synthesis subagent in the same turn as the search subagents so that it receives their results as they arrive
  3. CGive the synthesis subagent the same system prompt as the coordinator so that it shares the coordinator's knowledge
  4. DPass the search and analysis findings, with their source URLs, in the prompt of the Agent tool call that starts synthesis
Show the answer and why
  • ARaise the synthesis subagent's maxTurns so that it has enough turns to go and locate the earlier subagents' results itself

    Incorrect

    More turns do not give a subagent access to the parent's history or the other subagents' transcripts.

  • BSpawn the synthesis subagent in the same turn as the search subagents so that it receives their results as they arrive

    Incorrect

    Subagents launched together run independently; synthesis would start before any findings exist and would not receive them.

  • CGive the synthesis subagent the same system prompt as the coordinator so that it shares the coordinator's knowledge

    Incorrect

    A system prompt carries instructions, not the coordinator's conversation, so the earlier findings would still be missing.

  • DPass the search and analysis findings, with their source URLs, in the prompt of the Agent tool call that starts synthesis

    Correct

    A subagent starts with a fresh context; the Agent tool's prompt string is the only content passed from the parent, so the findings must be in it.

Subagents do not inherit the coordinator's conversation or share memory between invocations. Pass prior agents' complete findings explicitly in the delegation prompt, ideally in a structured form that keeps sources attached.

Question 2 · choose 2

You are defining the subagents of a research coordinator with the agents option of the Claude Agent SDK. Three search subagents should run at the same time on independent subtopics. Which TWO statements about the configuration are correct? (Choose TWO.)

  1. AA subagent receives only the tools that also appear in the coordinator's allowedTools list
  2. BSubagents running at the same time share one context window, so their findings combine automatically
  3. CIndependent searches run in parallel when the coordinator issues several Agent tool calls in a single response
  4. DSubagents start with the coordinator's system prompt, so their own prompt needs to contain only the task
  5. EEach AgentDefinition gets a description of when to use it, a prompt that serves as its system prompt, and a tools list limited to its role
Show the answer and why
  • AA subagent receives only the tools that also appear in the coordinator's allowedTools list

    Incorrect

    allowedTools pre-approves tools for permission checks; a subagent's tool set comes from its own tools field, or from the inherited defaults when that field is omitted.

  • BSubagents running at the same time share one context window, so their findings combine automatically

    Incorrect

    Each subagent has its own context window; only its final message returns to the coordinator.

  • CIndependent searches run in parallel when the coordinator issues several Agent tool calls in a single response

    Correct

    Multiple Agent tool calls in one response launch the subagents together, so the work takes about as long as the slowest one.

  • DSubagents start with the coordinator's system prompt, so their own prompt needs to contain only the task

    Incorrect

    A subagent's system prompt is its AgentDefinition prompt; the parent's system prompt is not passed down.

  • EEach AgentDefinition gets a description of when to use it, a prompt that serves as its system prompt, and a tools list limited to its role

    Correct

    description, prompt and tools are the core AgentDefinition fields; the description is what Claude matches tasks against.

Define each subagent type with a description, a system prompt and a scoped tool list, and spawn independent work with several Agent tool calls in one coordinator response. Subagents keep separate contexts and report back individually.

Question 3 · choose 1

Your Agent SDK application shows a live transcript, and the UI must mark which assistant and user messages come from inside a subagent rather than from the main agent. Several subagents can run in one query. How should your code tell them apart?

  1. ALook for phrases such as "As the research subagent" in each message's text
  2. BGive each subagent a prompt that tells it to prefix every message with its name
  3. CCompare each message's model with the model field of the subagent definitions
  4. DCheck each message's parent_tool_use_id, which is set on messages from inside a subagent
Show the answer and why
  • ALook for phrases such as "As the research subagent" in each message's text

    Incorrect

    Text conventions are not guaranteed, so some subagent messages would go unmarked.

  • BGive each subagent a prompt that tells it to prefix every message with its name

    Incorrect

    A prompt instruction is followed only most of the time, and it does not cover tool calls and results.

  • CCompare each message's model with the model field of the subagent definitions

    Incorrect

    Subagents can run on the same model as the main agent, so the model does not identify where a message came from.

  • DCheck each message's parent_tool_use_id, which is set on messages from inside a subagent

    Correct

    Messages from within a subagent's context carry parent_tool_use_id, the ID of the Agent tool call that started it.

The SDK marks subagent messages structurally: messages produced inside a subagent carry parent_tool_use_id, and the subagent was started by an Agent tool_use block with that ID. Use those fields rather than text or prompt conventions.

Question 4 · choose 1

Your coordinator spawns a fact-checking subagent whose final report lists every verified claim with its source. The answer the user sees contains only a two-line paraphrase of that report. You want the full list passed through. What should you do?

  1. ARaise the subagent's maxTurns so that its report becomes longer
  2. BRun the fact-check in the main agent instead of a subagent
  3. CHave the subagent write its report into the coordinator's system prompt
  4. DTell the main agent to pass the report on verbatim
Show the answer and why
  • ARaise the subagent's maxTurns so that its report becomes longer

    Incorrect

    The report is already complete; the parent is condensing it.

  • BRun the fact-check in the main agent instead of a subagent

    Incorrect

    This gives up context isolation to fix a formatting instruction.

  • CHave the subagent write its report into the coordinator's system prompt

    Incorrect

    Subagents cannot rewrite the parent's system prompt.

  • DTell the main agent to pass the report on verbatim

    Correct

    The parent receives the full report but may summarize it unless told otherwise.

A subagent's final message returns to the parent, which may summarize it. To preserve it verbatim, instruct the main agent to do so.

Question 5 · choose 1

Your team wants a code-reviewer subagent definition, written as a markdown file, to be available to everyone who clones the repository. Where should the file go?

  1. AIn the repository's .claude/agents/ folder
  2. BIn ~/.claude/agents/ on each developer's machine
  3. CIn the project's CLAUDE.md, as a section named code-reviewer
  4. DIn .claude/skills/code-reviewer/SKILL.md
Show the answer and why
  • AIn the repository's .claude/agents/ folder

    Correct

    Project subagents live in .claude/agents/ and are shared through version control.

  • BIn ~/.claude/agents/ on each developer's machine

    Incorrect

    That location holds personal subagents for one user.

  • CIn the project's CLAUDE.md, as a section named code-reviewer

    Incorrect

    CLAUDE.md holds instructions, not subagent definitions.

  • DIn .claude/skills/code-reviewer/SKILL.md

    Incorrect

    That creates a skill, not a subagent.

Subagent files go in .claude/agents/ for a project (shared) or ~/.claude/agents/ for personal use.

Question 6 · choose 1

Your migration-planner subagent should always start with your team's database-migration skill loaded, instead of hoping it invokes the skill on its own. Which AgentDefinition field does this?

  1. Askills, naming the skill to preload at startup
  2. Bmemory, set to "project" so that skills are remembered
  3. Cprompt, pasting a reminder to run the skill first
  4. Dtools, listing "Skill" so that the subagent can call it
Show the answer and why
  • Askills, naming the skill to preload at startup

    Correct

    Listed skills are loaded into the subagent at startup.

  • Bmemory, set to "project" so that skills are remembered

    Incorrect

    memory configures persistent memory, not skill preloading.

  • Cprompt, pasting a reminder to run the skill first

    Incorrect

    A reminder relies on the subagent choosing to load it.

  • Dtools, listing "Skill" so that the subagent can call it

    Incorrect

    Access to the Skill tool lets it invoke skills, not preload them.

Use the skills field of an AgentDefinition to preload specific skills; unlisted skills are not preloaded into a subagent.

Question 7 · choose 1

Your Agent SDK app passes a test-runner subagent in the agents option, and the repository also has .claude/agents/test-runner.md with different instructions. Which definition does the session use?

  1. ANeither; the name clash disables the subagent
  2. BThe programmatic one from the agents option
  3. CThe file in .claude/agents/, because project files always win
  4. DBoth, merged field by field
Show the answer and why
  • ANeither; the name clash disables the subagent

    Incorrect

    A clash is resolved by precedence, not by disabling.

  • BThe programmatic one from the agents option

    Correct

    Programmatically defined agents take precedence over filesystem agents with the same name.

  • CThe file in .claude/agents/, because project files always win

    Incorrect

    The SDK's own definitions override same-named files.

  • DBoth, merged field by field

    Incorrect

    Definitions are not merged.

When a programmatic AgentDefinition and a filesystem agent share a name, the programmatic definition is used.

Practise domain 1 →Practise all domains →