Prompt & Context Engineering·Question 49 of 68Advanced

When should you split an agent into sub-agents, and what do you pass between them?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

The reason sub-agents exist is context isolation: each gets a clean window and returns a distilled result, so the orchestrator never sees the 40k tokens of search results that produced a two-line conclusion. That is a real and large win. But context does not compose, and that is what decides when to use them.

Full worked answer with diagram

The reason sub-agents exist is context isolation: each gets a clean window and returns a distilled result, so the orchestrator never sees the 40k tokens of search results that produced a two-line conclusion. That is a real and large win. But context does not compose, and that is what decides when to use them.

The rule: parallelise reads, serialise writes.

Sub-agents work well for exploration, search, and verification. Several agents reading different sources in parallel, each returning findings, with an orchestrator synthesising. The sub-tasks are independent, and being wrong is recoverable.

They work badly when the task requires shared, evolving state: writing a coherent codebase, drafting a single document. Each agent makes implicit decisions the others cannot see, and those decisions conflict. Cognition's argument against multi-agent systems is exactly this, and it is largely right for write-heavy work: you cannot cheaply share the full context that made the decision, so you get subtly incompatible outputs and an expensive reconciliation problem. Anthropic's multi-agent research system is the counterexample, and note that it is fundamentally a read-heavy fan-out.

What to pass down: a complete, self-contained task spec. The classic failure is the orchestrator holding context implicitly and the sub-agent inventing a decision to fill the gap. If two sub-agents need the same convention, the orchestrator must state it in both briefs.

What to pass up: a typed, structured summary, not the transcript. Treat the handoff as an RPC boundary with a schema. Returning the raw transcript just relocates the bloat and defeats the entire point.

The cost. Multi-agent burns dramatically more tokens than single-agent for the same task. Anthropic reported its research system using roughly 15 times the tokens of a plain chat interaction, since every sub-agent re-reads a system prompt and tool schemas and does its own exploration. It buys latency through parallelism and quality through isolation. If your task is not parallel and not context-starved, you are paying that multiple for nothing.

And tracing: unless you can see each agent's full context, multi-agent bugs are undebuggable.

Worth sketching. The two lanes side by side make the rule land: fan-out is safe for reads and falls apart the moment the work shares evolving state.

flowchart TD
    A["Orchestrator"] --> B["Self-contained brief 1"]
    A --> C["Self-contained brief 2"]
    B --> D["Sub-agent burns 40k tokens<br/>in its own window"]
    C --> E["Sub-agent, own window"]
    D --> F["Typed summary up,<br/>never the transcript"]
    E --> F
    F --> A
    G["Write-heavy shared state"] --> H["Stay in one loop:<br/>context does not compose"]

What a good answer covers

  • The reason sub-agents exist is context isolation
  • But context does not compose, and that is what decides when to use them
  • The rule: parallelise reads, serialise writes
  • Sub-agents work well for exploration, search, and verification
  • Several agents reading different sources in parallel, each returning findings, with an orchestrator…

Key terms: What to pass down · What to pass up · The cost

Interviewer follow-ups to expect

  1. How would you detect that two sub-agents made conflicting implicit decisions?

  2. What would make you collapse a multi-agent system back into a single loop?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep