PART 3 โ Multi-Agent Design Patterns โ
The Intuition โ
Every engineering org has an org chart. Multi-agent systems are just org charts for AI. Pick the structure that matches your workflow.
SEQUENTIAL --> Assembly line. Step A must finish before Step B starts.
PARALLEL --> Multiple teams working on different tasks simultaneously.
LOOP --> Quality cycle. Run --> Check --> Repeat until good enough.
REVIEW --> Generator + Critic. Writer + Editor.
COORDINATOR --> Project manager dispatches work to specialists.
SWARM --> All agents collaborate peer-to-peer, refining together.
REACT --> Single agent, iterative think-->act-->observe loop.
HITL --> Human approval gates at critical decision points.When to Use Which Pattern โ
| Use Case | Pattern | Why |
|---|---|---|
| ETL pipeline: Extract โ Clean โ Load | Sequential | Order matters |
| Gather competitor data from 5 sources simultaneously | Parallel | Speed, independent tasks |
| Code generation that must pass tests | Loop | Quality gate |
| Content generation with quality control | Review/Critique | Generator + critic |
| Complex project with many subtasks | Coordinator/Hierarchical | Delegation at scale |
| Research synthesis from many specialists | Swarm | Collective refinement |
| Any standard chat agent | ReAct | Default pattern |
| Financial transactions, medical decisions | HITL | Legal/compliance requirement |
In Google ADK โ
# Sequential โ runs agents in order
SequentialAgent(sub_agents=[ResearchAgent, DraftAgent, ReviewAgent])
# Parallel โ runs agents simultaneously
ParallelAgent(sub_agents=[Source1Agent, Source2Agent, Source3Agent])
# Loop โ runs until condition met
LoopAgent(sub_agent=RefineAgent, max_iterations=5)
# Dynamic routing โ LLM decides next agent
RouterAgent(sub_agents=[BillingAgent, SupportAgent, SalesAgent])Pattern Details โ
Sequential (Assembly Line) โ
Each agent's output becomes the next agent's input. State flows through session.state.
When: Tasks where order is non-negotiable. Document pipelines, data transformation, research-then-draft flows.
Cost: Total latency = sum of all agent latencies. Not suitable for time-sensitive workflows with many steps.
Parallel (Fan-Out) โ
All sub-agents run simultaneously. Results are merged into session state.
When: Gathering data from independent sources (competitor analysis, multi-source research). All inputs are independent โ no agent needs another's output.
Cost: Total latency = latency of the slowest agent (not the sum). Major win for data-gathering steps.
Loop (Quality Cycle) โ
Same agent runs repeatedly until a quality condition is met or max_iterations is hit.
When: Code that must pass tests. Content that must hit a readability score. Any task with a measurable quality gate.
WARNING
Always set max_iterations. An unconstrained loop is a runaway cost bug.
Coordinator / Hierarchical โ
An orchestrator LlmAgent dynamically decides which specialist to call based on the current state.
When: Projects with genuinely varied subtasks that can't be predicted upfront. The coordinator handles routing decisions; specialists handle execution.
Human-in-the-Loop (HITL) โ
The agent pauses at a defined checkpoint and waits for a human to approve before continuing.
When: Irreversible actions (send email, execute payment, delete record), compliance requirements, low-confidence decisions.
Implementation in ADK: Agent calls a tool that blocks on human input. The session is paused and resumed when approval arrives.
Recall Hook โ
Assembly line โ Parallel teams โ Quality loop โ Manager โ Peer network โ match the pattern to the workflow shape.
Sources โ
- Google ADK Whitepaper: Introduction to Agents
- Google ADK Documentation: SequentialAgent, ParallelAgent, LoopAgent
Have a pattern that is not listed here? Add it โ production-validated patterns only.