- 01Task + shared state
- 02Coordinated work
- 03Verification
A single LLM call can answer a question, summarize a document, or generate a first draft. But most real business processes are more complex than a single step. Multi-agent systems are how you build AI for these more complex workflows.
This post covers the architecture patterns we use in production multi-agent systems — not theoretical frameworks, but the patterns that hold up under real workloads.
Why Multi-Agent?
The fundamental argument for multi-agent systems is specialization. A single agent asked to do everything will do everything poorly. Dividing a complex task into subtasks, each handled by a specialized agent, produces better results than a single generalist agent.
Secondary reasons:
- Parallelism — independent subtasks can run in parallel, dramatically reducing end-to-end latency
- Context management — LLMs have context windows; complex workflows that require holding too much information can be split across agents with focused contexts
- Error isolation — a failure in one agent doesn't necessarily fail the whole workflow
- Replaceability — you can swap the model powering one agent without touching the rest of the system
Pattern 1: The Orchestrator-Worker Pattern
The most common multi-agent pattern. An orchestrator agent breaks down a complex task, assigns subtasks to specialized worker agents, and synthesizes the results.
User Request
↓
Orchestrator (plans and coordinates)
↓
┌────┬────┬────┐
│ │ │ │
W1 W2 W3 W4 (specialized workers)
│ │ │ │
└────┴────┴────┘
↓
Orchestrator (synthesizes results)
↓
Final Output
When to use: Tasks that have clear, decomposable subtasks with a defined synthesis step. Research tasks, complex document generation, multi-step analysis.
Implementation considerations:
- The orchestrator needs to handle partial failures — what happens if W2 fails?
- Worker outputs need to be in a format the orchestrator can synthesize
- Consider whether workers should be stateless (simpler) or maintain state between calls
Pattern 2: The Pipeline Pattern
A sequential chain of agents where each agent's output becomes the next agent's input. Appropriate when the task has a natural linear flow.
Input → Agent A → Agent B → Agent C → Output
(parse) (enrich) (generate)
When to use: Processing workflows where each step transforms the data for the next step. Document processing, data transformation, multi-stage content generation.
When NOT to use: When steps are independent and could run in parallel. Running a pipeline when you could parallelize is slow.
Implementation considerations:
- Validate output schemas between agents — a type error from Agent A will propagate through the entire pipeline
- Add retry logic at each stage
- Log the intermediate outputs for debugging
In our hardware design co-pilot, we used a pipeline pattern: intent parsing → constraint resolution → script generation → validation. Each stage had a clear input/output schema and failure behavior.
Pattern 3: The Debate Pattern
Two or more agents argue opposing positions; a judge agent evaluates the arguments and produces a final answer.
Input
↓
Agent A (advocate) Agent B (critic)
\ /
→ Judge Agent ←
↓
Final Answer
When to use: High-stakes decisions where you want to surface objections and alternatives before committing. Investment analysis, risk assessment, architectural decisions.
Limitation: Expensive (multiple LLM calls) and slow. Use only when decision quality justifies the cost.
Pattern 4: The Verifier Pattern
A generation agent produces output; a separate verifier agent checks it for errors, hallucinations, or constraint violations.
Input → Generator → Output → Verifier → Verified Output
(if fails, loop back to Generator)
When to use: Whenever you're generating content that needs to meet specific criteria: code that needs to compile, structured data that needs schema compliance, factual claims that need grounding.
We use this pattern extensively in code generation agents. The generator produces code; the verifier runs syntax checks and test cases; if they fail, the generator gets specific feedback and tries again (up to a maximum retry count).
Critical: Set a maximum retry limit. Without it, a hard constraint failure will loop forever.
Pattern 5: The Human-in-the-Loop Pattern
Agents handle routine cases automatically; ambiguous or high-stakes cases are routed to a human.
Input → Classification Agent → Low confidence → Human Queue
↓
High confidence
↓
Worker Agent → Output
When to use: Almost always, for business-critical AI workflows. The question is not whether to have human review, but which cases should trigger it.
Define the routing logic explicitly:
- Model confidence below threshold → human review
- Specific categories of request → always human review
- Output exceeds value threshold → human approval before action
This is the pattern that makes enterprise AI deployments trustworthy. Fully autonomous agents in business contexts are usually premature and risky.
State Management in Multi-Agent Systems
Multi-agent workflows need shared state — a place where agents can read context and write results that other agents will consume.
Common approaches:
Shared memory object: A dictionary or object passed between agents. Simple, but doesn't scale to distributed architectures.
Message queue: Agents communicate by publishing and consuming messages (Kafka, RabbitMQ, AWS SQS). Enables parallelism and resilience; adds operational complexity.
Database-backed state: Each agent reads from and writes to a shared database. Enables persistence, audit logging, and recovery from failures.
For most production systems, we use a database-backed approach: each workflow has a record in the database with status and intermediate outputs. This provides observability and enables resumable workflows.
Failure Handling
Multi-agent systems fail in complex ways. Design for failure from the start:
- Timeouts on every agent call — don't let one slow agent block the whole workflow
- Retry with exponential backoff — transient LLM API failures are common
- Circuit breakers — if an agent is failing consistently, stop calling it and alert
- Dead letter queues — route permanently failed tasks somewhere for human inspection
- Idempotency — design agents so that calling them twice with the same input is safe (in case of retry after partial success)
When Multi-Agent is Overkill
Multi-agent systems add real complexity. Don't use them when:
- A single well-crafted prompt solves the problem
- The workflow has only one meaningful step
- Latency requirements are tight and parallelization doesn't help enough
- The team can't operate the added complexity
Start simple. Add agents when you hit a real limit of single-agent approaches.
We build multi-agent systems across a variety of domains. If you're architecting an AI workflow and want to talk through the right pattern for your use case, get in touch.