Design patterns for AI agents
Fourteen ways to arrange language-model calls and agent loops, from a fixed chain of prompts to teams of agents that hand work to each other. Each page covers the problem, the structure, when to use it, how it fails, and a prompt generator to try it.
What is an agentic pattern?
An agent is a language model running in a loop: it reads the situation, picks an action (often a tool call), looks at the result, and repeats until the job is done. An agentic pattern is a reusable way to arrange one or more of those loops or model calls: who decides the next step, who talks to whom, and how results are combined.
The main question that separates them is who decides the flow. In a workflow, your code fixes the path in advance. In an agent, the model chooses the next step at run time. Like classic design patterns, these are not libraries. They are shapes you learn to recognize and adapt, and they nest: an orchestrator's worker is usually a ReAct loop, and human approval gates can sit anywhere.
Every pattern here costs more model calls, tokens and latency than a single well-prompted call. Anthropic measured its multi-agent research system at about 15 times the tokens of a chat interaction. Try one call with good context first, then a fixed workflow, and add agents only when you hit a measured limit: a context window that overflows, too many tools for one prompt, or work that could run in parallel.
Patterns
Grouped by family, from the most predictable to the most autonomous.
Workflows
The developer's code fixes the path. Cheapest, most predictable, easiest to test.
-
Prompt Chaining
A fixed sequence of model calls, each fed the previous output, with checks in code between steps.
-
Routing
Classify the input once, then send it to exactly one specialised path or model.
-
Parallelization
Run independent calls at the same time: different subtasks (sectioning) or the same task several times (voting).
-
Evaluator–Optimizer
Generate, evaluate against explicit criteria, revise, until the draft passes or the budget runs out.
Single agent
One model decides its own steps. The building block of every multi-agent pattern.
-
ReAct (tool-use loop)
One model alternates reasoning and tool calls, choosing each next step from the last observation.
-
Plan-and-Execute
A planner writes all the steps up front, an executor runs them, and a replanner checks and revises.
Centralized multi-agent
One agent coordinates the others and keeps control.
-
Orchestrator–Workers
A lead model invents the subtasks at run time, briefs workers with clean contexts, and merges their condensed results.
-
Supervisor
A central agent picks which worker acts at every step, and control always comes back to it.
-
Hierarchical teams
Managers of managers: a top agent delegates to team leads, who delegate to workers.
Decentralized multi-agent
No single boss: control passes between peers, or agents coordinate through a shared medium.
-
Swarm / Handoffs
Peer agents with no manager. The active one transfers control, and the conversation, to a better-suited peer.
-
Group Chat
Agents share one message thread, and a selector (rotation, a model, a graph or a person) picks the next speaker.
-
Blackboard
Specialists coordinate through a shared, structured workspace instead of messages; a control component picks who acts.
Consensus
Several minds on the same question.
-
Council / Debate
Several diverse agents answer the same question, critique each other, then a vote or a chair decides.
Cross-cutting
Added on top of any other pattern.
-
Human-in-the-Loop
Pause at risky or ambiguous points, save the state, let a person approve, edit, reject or answer, then resume.
How to choose
Start at the top and stop at the first answer that fits. Add structure only when you hit a measured limit.
- Can one well-prompted call do it, with retrieval or examples? Do that. Every pattern below costs more.
- Are the steps known in advance? Use a workflow.
- Always the same sequence: Prompt Chaining.
- The path depends on the kind of input: Routing.
- Independent parts, or several samples to compare: Parallelization.
- Quality must meet criteria you can check (tests, rubric, schema): add Evaluator–Optimizer.
- Are the steps unknown until you start? Use an agent.
- By default: ReAct.
- The structure can be guessed up front, or a person should approve the plan: Plan-and-Execute.
- Does one agent break down (context overflows, too many tools, parallel work)?
- Broad, read-heavy work that splits into independent pieces: Orchestrator–Workers.
- A central agent should pick a specialist at each step and keep one voice: Supervisor.
- A user-facing conversation whose topic drifts between specialists: Swarm / Handoffs.
- One supervisor or orchestrator is itself overloaded: Hierarchical teams, usually two levels at most.
- Roles must build on each other's messages: Group Chat, kept small.
- Many specialists, unknown order, coordinating through shared artifacts: Blackboard.
- Do you need a more reliable answer to one question? Try voting with Parallelization first. Use Council / Debate when members are truly different or the output is open-ended, and compare it with voting at the same cost.
- Is any action irreversible, costly or ambiguous? Add Human-in-the-Loop gates, along with sandboxing and least privilege.
Write-heavy, tightly coupled work, such as several agents editing the same code, is where multi-agent designs fail most often: the agents make conflicting decisions that nobody reconciles.