AI & Machine Learning

Scenario: Multi-Agent Research System

lex@lexgaines.com · · 4 min read
Design a coordinator-subagent research pipeline with parallel execution, structured output, error propagation, and provenance tracking across sources.

Scenario Description

You're building a multi-agent research system using the Claude Agent SDK that synthesizes information from multiple sources into comprehensive, cited reports. A coordinator agent orchestrates specialized subagents: one for web search, one for document analysis, and one for report synthesis. The system must handle conflicting sources gracefully, maintain information provenance (claim-source mappings), and produce output that readers can verify by tracing claims back to originating sources.

This scenario tests your ability to decompose complex research tasks into narrow, parallel subtasks while managing the risk of over-decomposition. The coordinator must know which research questions require multiple sources and which can be satisfied by a single well-scoped search. Each subagent operates with explicit context passing—they don't inherit the coordinator's reasoning state, so you must carefully package what information each subagent needs to succeed.

The system also requires designing scoped cross-role tools (e.g., a verify_fact tool available only to the synthesis agent) and implementing error propagation with structured context so that if a subagent fails, the coordinator can either retry, escalate, or synthesize with partial information.

Domains Tested

Key Concepts to Study

Agentic Architecture & Orchestration

  • Hub-and-spoke coordinator pattern: one coordinator agent spawning multiple specialized subagents
  • Task tool for spawning subagents with explicit context and constraints
  • Parallel subagent execution: making multiple Task calls in a single coordinator response for efficiency
  • Iterative refinement loops: when the coordinator should spawn a follow-up research subagent based on synthesis conflicts

Tool Design & MCP Integration

  • allowedTools configuration: restricting which tools each subagent can invoke (e.g., only the search subagent gets web search)
  • Designing narrow, composable research tools: avoid a "search_and_synthesize" megafunction; prefer separate "web_search" and "summarize_results" tools
  • Scoped cross-role tools: defining tools that only the synthesis agent can call (e.g., verify_fact, flag_contradiction)
  • Tool failure modes: what happens when a search subagent can't find a source, or a document analysis subagent encounters corrupted PDF data

Context Management & Reliability

  • Explicit context passing: subagents receive only what they need (research question, source URLs, previous findings); no implicit inheritance
  • Information provenance: maintaining claim-source mappings throughout the workflow so the final report includes citations
  • Handling conflicting sources: designing a conflict detection and resolution strategy (majority vote, source credibility weighting, flagging for human review)
  • Error propagation with structured context: if a subagent fails, pass error details and partial results to the coordinator for adaptive next steps

Study Tips for This Scenario

  1. Sketch the Decomposition Tree: Before writing agent code, draw out the research task, then decompose it into subquestions. For each subquestion, ask: "Does this really need a separate subagent, or can the coordinator handle it?" Over-decomposition adds latency and context overhead. Aim for 2–4 focused subagents, not 10.

  2. Design Explicit Context Passing Messages: Write out, word-for-word, what context you'll send to each subagent. Include the research goal, background info, and constraints. Avoid vague instructions like "search for information"; instead say "Search for peer-reviewed studies published 2020–2026 on climate tipping points, and list the source URL for each result."

  3. Implement Provenance Tracking from the Start: Define a simple data structure (e.g., a JSON array of {claim, source_url, subagent_id, confidence_score}) that flows through your system. Every tool call output should update this structure. By the time the synthesis agent writes the report, citations are automatic.

  4. Test Conflict Resolution Logic: Create a test case where two subagents return contradictory findings (e.g., one source says unemployment is 3%, another says 4%). Verify that your coordinator detects the conflict, optionally spawns a verification subagent, and produces a report that acknowledges and explains the discrepancy.

CCA scenario multi-agent research system orchestration