When One Agent Isn't Enough
A single agent is powerful — but it has limits:
- Context window limits: A very long research task might generate more content than fits in one agent's context
- Specialization: A generalist agent writing code, research, and marketing copy in one run will be mediocre at all three
- Speed: Sequential tool calls are slow; parallel agents can work simultaneously
- Quality control: A second agent reviewing the first's work catches more errors than self-review
Multi-agent systems address all of these by splitting work intelligently.
The Core Patterns
Pattern 1: Orchestrator + Sub-Agents
The most common multi-agent architecture. One orchestrator agent manages the overall goal; specialized sub-agents handle specific tasks.
User Goal: "Write a comprehensive market analysis report"
Orchestrator:
→ Research Agent: "Find recent news and data on the market"
→ Analyst Agent: "Identify trends and insights from the data"
→ Writer Agent: "Write the report sections"
→ Editor Agent: "Review and polish the full draft"
← Compile final report
The orchestrator doesn't do research or writing — it coordinates and sequences.
Pattern 2: Parallel Agents
For tasks where sub-tasks are independent, run multiple agents simultaneously.
Goal: Analyze 5 competitor websites
Run in parallel:
Agent A → Analyze competitor 1
Agent B → Analyze competitor 2
Agent C → Analyze competitor 3
Agent D → Analyze competitor 4
Agent E → Analyze competitor 5
Orchestrator collects results → writes comparison report
5x faster than running sequentially.
Pattern 3: Agent Pipeline
Agents in a fixed sequence, where each agent's output is the next agent's input.
Raw data → Extraction Agent → Cleaned data
Cleaned data → Analysis Agent → Insights
Insights → Writer Agent → Report
Report → Editor Agent → Final output
Similar to a workflow but each step has agent flexibility.
Pattern 4: Critic / Verifier Pattern
A second agent reviews the first agent's output for quality, accuracy, or safety.
Task Agent → Draft output
↓
Critic Agent → Review draft against criteria
↓
[Pass] → Final output
[Fail] → Feedback to Task Agent → Revised draft
This pattern significantly improves output quality at the cost of additional compute.
Pattern 5: Debate / Consensus
Multiple agents independently produce answers; a final agent synthesizes or picks the best.
Agent A → Answer 1
Agent B → Answer 2
Agent C → Answer 3
Synthesis Agent → Compare, evaluate, produce final answer
Useful when accuracy is critical and you want multiple independent perspectives.
Designing Good Orchestrators
The orchestrator's system prompt is critical. It needs to:
Define the goal clearly:
Your job is to coordinate a research report. You have access to three sub-agents:
research_agent, analyst_agent, and writer_agent. Break the user's request into
clear subtasks, delegate them to the appropriate agents, and assemble the final output.
Specify how to delegate:
When delegating to a sub-agent, provide:
1. A clear, specific task description
2. The relevant context the sub-agent needs
3. The expected output format
Specify stopping conditions:
The task is complete when:
- All required sections have been written and reviewed
- The report is at least 1,500 words
- All claims are supported by sources
Handle failures:
If a sub-agent returns an error or incomplete result:
1. Try the task again with a more specific request
2. If it fails twice, proceed with what you have and note the gap in the output
Designing Good Sub-Agents
Sub-agents should be specialized and focused. Their system prompts should:
- Define a narrow scope — what this agent does and doesn't do
- Specify expected input format
- Specify required output format
- Include relevant domain knowledge or tools
Research agent system prompt:
You are a research specialist. Your job is to find accurate, current information
on any topic given to you.
For each research task:
1. Search for recent, authoritative sources
2. Verify key facts with multiple sources when possible
3. Return findings as a structured list with source citations
You have access to: web_search, fetch_page
You do NOT write analysis or opinions — only provide raw findings.
Output format: Bullet list of findings, each with a source citation.
Communication Between Agents
Agents communicate through structured messages. Clear contracts between agents prevent confusion.
Poor agent communication:
Orchestrator to Writer: "Write the competitive analysis section"
Writer receives: nothing useful, produces generic content
Good agent communication:
Orchestrator to Writer:
Task: Write the "Competitive Landscape" section of the report
Data provided: [structured JSON of competitor analysis from Research Agent]
Word count: 400-600 words
Format: Narrative paragraphs, no bullet points
Tone: Professional, analytical
Include: Key differentiators, market position, recent moves
The writer agent now has everything it needs to produce high-quality output.
Trust and Safety in Multi-Agent Systems
Multi-agent systems introduce security considerations single agents don't have.
Prompt injection through agents: A malicious tool result could contain instructions that manipulate a sub-agent into taking unintended actions. Design sub-agents to be skeptical of instructions embedded in data (vs. their system prompt).
Privilege escalation: A sub-agent shouldn't have access to tools or data it doesn't need for its specific task. Apply the principle of least privilege.
Verification before critical actions: For any irreversible action (deleting data, sending emails, making payments), add a verification step — either human approval or a dedicated verifier agent.
Tracing and logging: In production, log every agent call, tool use, and inter-agent message. This is essential for debugging and auditing.
When NOT to Use Multi-Agent Systems
Multi-agent systems add complexity. Don't reach for them unless you have a genuine need:
| If you... | Consider instead |
|---|---|
| Have a task that fits in one context window | Single agent or workflow |
| Want parallel execution | Batch API calls, not multiple agents |
| Are experimenting or prototyping | Start with a single agent, add more only when you hit limits |
| Need simple quality improvement | Better prompting, self-reflection in the same agent |
Build the simplest system that solves your problem. Add agents when you hit real limits.
Key Takeaways
- Multi-agent systems split work across specialized agents with an orchestrator coordinating
- Core patterns: Orchestrator + Sub-agents, Parallel, Pipeline, Critic/Verifier, Debate
- Orchestrator prompts need clear delegation instructions, stopping conditions, and failure handling
- Sub-agent prompts should be narrow, specialized, and specify exact output formats
- Agent communication must be structured and explicit — don't assume sub-agents will infer what you need
- Trust and safety: apply least privilege, add verification for critical actions, log everything
- Next lesson: evaluating agents — how to know if your agent is working well