[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
SEQ. 4
SEQ. 5
SEQ. 6
SEQ. 7
SEQ. 8
Building a Multi-Agent Pipeline
Hands-On: Research-Write-Review Pipeline
Let's build a practical 3-agent pipeline: Researcher gathers information, Writer drafts content, Reviewer provides feedback. The loop continues until quality is sufficient.
System Architecture
┌─────────────────────────────────────┐ │ ORCHESTRATOR │ │ (manages handoffs, tracks quality) │ ├──────┬──────────┬──────────┬────────┤ │ Step │ Agent │ Input │ Output │ ├──────┼──────────┼──────────┼────────┤ │ 1 │Researcher│ Topic │ Notes │ │ 2 │ Writer │ Notes │ Draft │ │ 3 │ Reviewer │ Draft │ Score │ │ 4 │ Writer │ Feedback │ v2 │ │ ...repeat until score >= 8/10... │ └─────────────────────────────────────┘
Agent Definitions
const agents = {
researcher: {
system: "You are a research specialist. Given a topic, search the web and compile a structured research brief with key facts, statistics, and expert opinions. Output JSON.",
tools: ["web_search", "read_url"],
model: "claude-sonnet-5"
},
writer: {
system: "You are a technical writer. Given research notes (and optional reviewer feedback), write a clear, engaging blog post. Use examples and code snippets.",
tools: [],
model: "claude-sonnet-5"
},
reviewer: {
system: "You are an editor. Score the draft 1-10 on accuracy, clarity, and engagement. Provide specific, actionable feedback. Output JSON: {score, feedback[]}",
tools: [],
model: "claude-haiku-4-5" // Cheap model for review
}
};
Key Implementation Tips
| Tip | Why |
|---|---|
| Use a cheap model for the reviewer | Review doesn't need creativity, saves 5-10x on tokens |
| Cap iterations at 3 | Diminishing returns after 2-3 revision cycles |
| Pass summaries, not full outputs | Writer only needs the feedback, not the full review analysis |
| Log every handoff | Essential for debugging - you need to see what each agent received |
💡 Key Insight: The orchestrator is the most important component. It decides when to move to the next agent, when to loop, and when to stop. A well-designed orchestrator with mediocre agents outperforms mediocre orchestration with perfect agents.
SYNAPSE VERIFICATION
QUERY 1 // 2
In a multi-agent pipeline, which component is most critical to overall quality?
The writer agent's prompt
The orchestrator that manages handoffs, quality gates, and iteration
The most expensive model
The number of agents