1.2 Coordinator–subagent orchestration
Hub-and-spoke
The coordinator is the hub of a spoke–hub topology: every message crosses the centre. See Subagents in the SDK and how Anthropic built its multi-agent research system.
┌──────────────┐
┌────────►│ web search │
│ └──────────────┘
┌───────┴─────┐ ┌──────────────┐
│ COORDINATOR │──►│ doc analysis │
│ (hub) │ └──────────────┘
└───────┬─────┘ ┌──────────────┐
└────────►│ synthesis │
└──────────────┘
All inter-subagent traffic passes through the hub.
The coordinator owns:
- Task decomposition — splitting the topic into subtasks
- Delegation — deciding which subagents to invoke for this query, not always the full pipeline
- Result aggregation — merging subagent outputs
- Error handling and information routing — a single place for observability and consistent recovery
Subagents operate with isolated context. They do not inherit the coordinator's conversation history, and they do not share memory between invocations.
Why route everything through the hub
Direct subagent-to-subagent communication costs you observability, consistent error handling, and controlled information flow. The hub is the audit point.
Dynamic selection over fixed pipelines
Design coordinators that analyze query requirements and select subagents. A simple factual query should not pay for document analysis and a report generation pass.
Partitioning to avoid duplication
Assign distinct subtopics or source types per subagent (agent A: peer-reviewed sources; agent B: industry press) so parallel agents do not retrieve the same material.
Iterative refinement loops
delegate → synthesize → coordinator evaluates synthesis for gaps
↑ │
└──── re-delegate targeted queries ─┘ (until coverage is sufficient)
The coordinator evaluates synthesis output for gaps, re-delegates to search/analysis subagents with targeted queries, and re-invokes synthesis. This is the fix for shallow first-pass coverage.
Failure mode: overly narrow decomposition
Every subagent succeeds, yet the report covers only one slice of the topic. Read the coordinator's decomposition log. If it split "creative industries" into "digital art", "graphic design", and "photography", the subagents executed correctly — the assignments were wrong. Do not blame the search, analysis, or synthesis agent for a scope it was never given.
Preparation exercise 4 — Multi-agent research pipeline
Objective: subagent orchestration, context passing, error propagation, synthesis with provenance.
- Build a coordinator delegating to at least two subagents (web search, document analysis). Ensure the coordinator's
allowedToolsincludes"Task", and that each subagent receives findings directly in its prompt rather than relying on automatic context inheritance. - Implement parallel subagent execution by emitting multiple
Tasktool calls in a single response. Measure the latency improvement over sequential execution. - Design subagent output that separates content from metadata: every finding carries a claim, an evidence excerpt, a source URL or document name, and a publication date. Verify the synthesis subagent preserves attribution.
- Implement error propagation: simulate a subagent timeout and verify the coordinator receives structured error context (failure type, attempted query, partial results). Verify the coordinator can proceed with partial results and annotate coverage gaps.
- Test with conflicting source data — two credible sources with different statistics — and verify synthesis preserves both values with attribution rather than picking one, and separates well-established from contested findings.
Reinforces: Domain 1, Domain 2, Domain 5
Quiz
- Question 1
On the topic "impact of AI on creative industries" every subagent completes successfully, yet the final reports cover only visual arts, missing music, writing, and film. The coordinator’s logs show it decomposed the topic into "AI in digital art creation", "AI in graphic design", and "AI in photography". What is the most likely root cause?
- Question 2
To cut coordinator round trips, an engineer proposes letting the document-analysis subagent invoke the web-search subagent directly whenever it encounters a citation worth chasing, bypassing the coordinator. What is the strongest architectural objection?
- Question 3
Your coordinator always runs the full pipeline — search, analyse, synthesise, report — because that sequence produces excellent results on broad topics. For "What was Acme’s fiscal 2024 revenue?" it spends 90 seconds and four subagent invocations to deliver a number the first search returned verbatim. What should change?
- Question 4
Synthesis output on broad topics reads well but leaves whole subtopics unaddressed, and the omission is only noticed when a human reads the finished report. Each subagent performs its own assignment correctly. What should the coordinator do?