Agent Pattern Catalog and Diagram Gallery

One page to find a pattern, draw it, document it and practice it, one week at a time.

BeginnerIntermediateExpert · 13 min read · Last updated:

In short

A pattern is a reusable solution with known trade-offs. Start from the need, pick the simplest pattern that meets it, add controls such as state, retrieval or approval only where required, then draw and document the result. The gallery below shows common shapes; each is a starting point to test, not a guarantee.

What you will learn: a catalog of agent patterns, how to choose and combine them, a diagram gallery and templates, a design document template and a one-pattern-a-week study plan.
Prerequisites: The Agent Loop: Observe, Reason, Plan, Act, Reflect. The other architecture pages add detail.

Beginner The catalog

Anatomy of a catalog entry

Every pattern worth reusing answers the same questions. Use them to read the table below and any pattern you meet elsewhere.

  • Problem: which need does it meet, in what setting?
  • Control: does code or the model decide the next step?
  • Cost: how many calls, how much waiting and how much to operate?
  • Failure: how does it go wrong, and how would you notice?
  • Controls: which limits, checks and approvals does it need?
  • Test: which case would prove it is working, or not?

Pattern catalog

PatternUse whenWatch forLearn more
Single model callOne transformation or classificationNo facts beyond the inputAgent Tools, Function Calling and Tool Registries
Prompt chainFixed stages with checks betweenErrors passing downstreamOrchestration
RouterDistinct request typesMisroutingSingle-Agent, Router and Retrieval Patterns
RetrievalAnswers need documentsWeak or forbidden evidenceRAG Explained and Agentic RAG
Tool-calling agentNext step depends on resultsLoops and wrong actionsReAct Agents: Reasoning and Acting
Plan and executeLonger tasks that benefit from a planStale plansPlan-and-Execute and Dynamic Planning
Parallel workersIndependent partsCost and merging conflictsTopologies, Specialist Teams and Debate
Evaluator and improverA clear quality test existsEndless revisionAgent Decisions: Confidence, Stopping, Loops and Budgets
Supervisor and workersSpecialists with separate toolsCoordination overheadSupervisor and Orchestrator-Worker Patterns
Durable workflowWaiting and recoveryUnsafe repeated effectsStateful and Long-Running Agent Architecture
Approval gateConsequential actionsReviewer overloadHuman-in-the-Loop and Approval Gates
Event-driven agentWork starts from eventsDuplicates and stormsEvent-Driven and Background Agents

Five questions before picking

  1. Can ordinary code do it? If rules are known and inputs structured, write the code.
  2. Is one model call enough? Try it on real examples before adding anything.
  3. What is missing: knowledge, live data, the ability to act or the ability to plan?
  4. What could go wrong if each step misbehaved, and can it be undone?
  5. Who will operate it at night and after the people who built it move on?

The answers usually narrow the table to two candidates. Build the smaller one first and keep its test cases to judge the other.

Choose by need

This small function encodes the idea of adding only what a requirement justifies.

"""Suggest the simplest pattern that satisfies stated needs."""

def suggest(needs):
    plan = []
    if needs.get("steps_known"):
        plan.append("fixed workflow")
    elif needs.get("next_step_depends_on_results"):
        plan.append("single agent with tools")
    else:
        plan.append("single model call")
    if needs.get("distinct_request_types"):
        plan.insert(0, "router")
    if needs.get("private_knowledge"):
        plan.append("retrieval")
    if needs.get("longer_than_one_request"):
        plan.append("durable state")
    if needs.get("consequential_actions"):
        plan.append("approval gate")
    if needs.get("separate_permissions") and needs.get("independent_parts"):
        plan.append("split into multiple agents")
    return " + ".join(plan)

examples = {
    "classify an email": {},
    "nightly invoice matching": {"steps_known": True,
                                 "longer_than_one_request": True},
    "policy questions": {"private_knowledge": True},
    "support desk": {"next_step_depends_on_results": True,
                     "distinct_request_types": True,
                     "private_knowledge": True,
                     "consequential_actions": True},
    "vendor onboarding": {"next_step_depends_on_results": True,
                          "longer_than_one_request": True,
                          "consequential_actions": True,
                          "separate_permissions": True,
                          "independent_parts": True},
}
for name, needs in examples.items():
    print(f"{name}:\n  {suggest(needs)}")

Output:

classify an email:
  single model call
nightly invoice matching:
  fixed workflow + durable state
policy questions:
  single model call + retrieval
support desk:
  router + single agent with tools + retrieval + approval gate
vendor onboarding:
  single agent with tools + durable state + approval gate + split into multiple agents

Classification needs nothing more than a call, nightly matching becomes a durable workflow and the support desk collects three additions around its agent. Vendor onboarding suggests splitting because it declares both separate permissions and independent parts. The function is a conversation starter with deliberately crude rules; real choices need evaluation results, constraints and judgment.

Who controls the flow?

The quickest way to compare patterns is to ask how much freedom the model has. More freedom handles more variety and needs stronger limits and testing.

ControlExamplesTest emphasis
Code decides every stepSingle call, prompt chain, durable workflowEach step's output and checks
Model picks among fixed routesRouterRoute accuracy and fallback
Model picks steps within limitsTool-calling agent, plan and executeTask outcomes, stop rules, forbidden actions
Models delegate to modelsSupervisor and workersHandoffs, permissions, total cost

Approval gates, state and retrieval are additions that can sit on any row. Move down a row only when cases from your own work show that the row above cannot handle them.

Intermediate Diagram gallery

Prompt chain

Draft
Checkcode or model
Refine
Output
Stop or branch when a check fails.

Router

Request
Router
Path A
Path B
Person
Always include a fallback.

Tool-calling agent

Context
Model
Policy
Tool
↺ Result updates context until a stop rule applies
Policy sits between the model and the tool.

Parallel workers

Split
Worker 1
Worker 2
Worker 3
Merge and verifyhandle missing results
Decide what happens when one worker fails.

Evaluator and improver

Generate
Evaluateexplicit criteria
Accept or hand over
↺ Revise with feedback, a limited number of times
Prefer tests that code can run.

Supervisor and workers

Supervisorplans, delegates, checks
Researchread tools
Analysissandbox
Actiongated writes
Each worker holds only its own permissions.

Event-driven agent

Event
Verify and deduplicate
Queue
Worker agent
Result or review
Failed events go to a place where someone looks.

Published descriptions use somewhat different names for these shapes. When you discuss one, describe what controls the flow, since that matters more than the label.

Anti-patterns to recognize

Anti-patternSymptomBetter shape
Everything agentOne prompt, dozens of tools, unpredictable resultsRouter with small paths
CommitteeAgents repeat and approve one anotherOne agent with a code-based check
Endless polisherRevision continues without measurable gainFixed criteria and a round limit
Paper gateApproval requested in text but not enforcedExecution service verifies approval
Amnesiac workerRestart repeats actionsDurable state and operation keys
Shared master keyEvery agent can do everythingSeparate, narrow identities
Hidden fallbackQuality drops silently when a service failsVisible degraded mode

An anti-pattern often begins as a reasonable shortcut. Reviews and traces help you notice when it has outlived its purpose.

Diagram templates

Draw a few views, each answering one question. The C4 model suggests levels of context, containers, components and code; for most agent designs the first two plus a sequence view are enough.

ViewAnswersInclude
ContextWho and what interacts with the system?Users, external systems, trust edges
ContainerWhat runs and stores data?Services, queues, stores, gateways
SequenceWhat happens in one task?Calls, approvals, failures
StateHow does a task progress?Statuses and allowed moves
Data flowWhere does sensitive data go?Classes, boundaries, retention
  • Label every arrow with what moves.
  • Mark trust boundaries and outside content.
  • Show where policy, approval and logging happen.
  • Do not rely on color alone, and describe the diagram in text.
  • Date it and name its maintainer.

Keeping diagrams as text makes changes reviewable. This program checks one list of nodes and edges, then prints it in Mermaid flowchart syntax.

"""Generate a Mermaid diagram from one list, and check the list first."""

NODES = {"user": "User", "api": "API", "agent": "Agent runtime",
         "policy": "Policy check", "tool": "Business tool",
         "audit": "Audit log"}
EDGES = [("user", "api", "request"), ("api", "agent", "task"),
         ("agent", "policy", "proposed action"),
         ("policy", "tool", "allowed action"),
         ("policy", "audit", "decision")]

def problems():
    found = [f"unknown node in {a} -> {b}" for a, b, _ in EDGES
             if a not in NODES or b not in NODES]
    used = {n for a, b, _ in EDGES for n in (a, b)}
    found += [f"unconnected node {n}" for n in NODES if n not in used]
    if any(a == "agent" and b == "tool" for a, b, _ in EDGES):
        found.append("agent reaches the tool without a policy check")
    return found

assert not problems(), problems()
print("flowchart LR")
for key, label in NODES.items():
    print(f'  {key}["{label}"]')
for source, target, label in EDGES:
    print(f"  {source} -->|{label}| {target}")

EDGES.append(("agent", "tool", "shortcut"))
print("after adding a shortcut:", problems())

Output:

flowchart LR
  user["User"]
  api["API"]
  agent["Agent runtime"]
  policy["Policy check"]
  tool["Business tool"]
  audit["Audit log"]
  user -->|request| api
  api -->|task| agent
  agent -->|proposed action| policy
  policy -->|allowed action| tool
  policy -->|decision| audit
after adding a shortcut: ['agent reaches the tool without a policy check']

The added shortcut from agent to tool is reported. The check catches only what you declare and the rules you write; verify the real system separately.

A worked sequence view

A sequence view is easy to write as numbered steps, which also serves readers who cannot see a picture. Here is one for a refund request.

  1. The signed-in user asks for a refund on an order.
  2. The router sends the request to the refunds path.
  3. The agent reads the order and the policy, using the user's permissions.
  4. It proposes an amount with the evidence.
  5. The policy check requires approval because the amount exceeds a limit.
  6. An authorized reviewer approves the exact amount.
  7. The execution service rechecks the order and pays once, using an operation key.
  8. The agent confirms the recorded result, or reports that the outcome is unknown.

Add the failure branches beside it: order not found, reviewer rejects, order changed, payment timed out. Those branches become evaluation cases.

Expert Document and practice

Design document template

SectionContent
1. SummaryProblem, users, proposed pattern, decision needed
2. Goals and non-goalsMeasurable success and what is excluded
3. Task examplesNormal, edge, refusal and hostile cases
4. ArchitectureContext and container diagrams; pattern choice and alternatives
5. Model and contextModels, instructions, retrieval, memory
6. ToolsContract, permission, risk level, owner
7. State and failureStorage, retries, recovery, stop rules
8. Safety and privacyThreats, data classes, approvals, retention
9. EvaluationCases, measures, thresholds
10. OperationsTargets, tracing, alerts, cost, rollback, support
11. RolloutStages, exit criteria, fallback
12. Open questionsRisks, assumptions, owners and dates

Delete sections that truly do not apply and say why. Record significant choices separately, as in Architecture Decision Records and Reviews.

Review a design document quickly

CheckWarning sign
Success measureOnly words such as "helpful" or "smart"
AlternativesNo simpler option considered
Tool tableNo owner or risk level
Failure section"The model will handle it"
EvaluationA demonstration instead of cases and thresholds
RolloutNo way back

Combine with care

Patterns stack: router, then retrieval, then an agent with an approval gate. Each addition brings a new failure and a new test. Add one at a time, compare with the previous version on the same cases and remove it if the gain does not justify the cost.

One pattern every week

A twelve-week practice plan. Spend a few hours each week: draw the pattern, build a tiny version with a scripted model, break it on purpose and write one paragraph on when you would not use it.

WeekPatternBreak it by
1Single model callSending ambiguous input
2Prompt chainCorrupting the first stage
3RouterMixing two request types
4RetrievalRemoving the key document
5Tool-calling agentReturning errors from a tool
6Plan and executeChanging facts mid-plan
7Evaluator and improverMaking the test impossible
8Parallel workersDelaying one worker
9Durable workflowCrashing between effect and save
10Approval gateChanging the action after approval
11Event-driven agentDelivering an event twice
12Supervisor and workersAsking a worker to exceed its rights

Keep each week's diagram, code, failing case and notes together. After twelve weeks you have a personal catalog backed by experience. Multi-Agent Systems continues from there.

How to know a week was worthwhile

At the end of each week, answer three questions in writing. Could you draw the pattern from memory, including its failure path? Did your deliberately broken case get detected by code and not only by your own reading? Can you name a task where a simpler pattern would be better? If any answer is no, repeat the week with a smaller example. Share the notes with a colleague and ask them to find an input you did not try. Later, replace the scripted model with a real one, keep the same cases and run each several times to see how much behavior varies.

Add your own entry

When your team solves the same problem twice, write it down: name, problem, when to use, when not to, diagram, controls, failure modes, tests and a working example. Mark whether it is used in production, tried in a pilot or only proposed. Review entries periodically and retire those that mislead.

Using the catalog in a team

Bring the table to a design discussion and ask each person to name the pattern they would choose and the failure they fear most. Differences reveal hidden assumptions about users, data or risk. Agree on a first version, the cases that would show it is insufficient and the date you will look at the results. Record the choice and link the entry, the diagram and the tests together, so that the next team can start from your evidence instead of from a blank page.

How a design usually evolves

Many useful systems begin as one call with a good prompt and a person checking the result. Retrieval is added when answers need your documents, a read tool when facts change often and a write tool behind approval once the proposals prove dependable. Durable state arrives when waiting appears, and a second agent only when permissions or context truly need separating. Movement also goes the other way: after traces show a predictable path, replace the agent's choices on that path with plain code. Keep the test cases through every change, because they are what lets you simplify with confidence.

Common mistakes

  • Choosing a pattern because it is fashionable.
  • Stacking several at once.
  • Diagrams without trust boundaries or failure paths.
  • Documents that describe only the successful route.
  • Copying a pattern without tests.
  • Never removing a part that adds nothing.

Checklist

  • The need is stated before the pattern.
  • A simpler alternative was compared.
  • Controls sit on action and data paths.
  • Diagrams show boundaries, failures and a text description.
  • The design document covers evaluation and operations.
  • Each added part has a test and a reason.

Frequently asked questions

Which pattern should a beginner learn first?

A single model call, then one tool call inside a bounded loop. Most other patterns build on those ideas.

Are these official standard patterns?

No single standard defines them. Names and boundaries differ between authors and tools, so describe the behavior you mean.

May I reuse these diagrams in my documents?

Use them as ideas and redraw them for your system. Check the site's terms of use before copying content.

When is a multi-agent pattern justified?

When parts need different permissions or context, or can run independently, and measured results beat a simpler design.

References and further reading

Next steps