Appendix C — Agent Patterns: You’ve Built, Met, and Might Have Heard Of

Thirty chapters ago you wrote a node that returned a dictionary. Since then you have built, by hand and one piece at a time, a good part of what the literature calls agentic design patterns. This appendix lines the mechanisms you ran up against the names they go by elsewhere — and says, for each one, how much of the named pattern the chapter actually delivered.
A pattern is not a mechanism — it is a problem that keeps coming back, a solution shape that survives it, and the trade-offs of using that shape in its context. Each row below names a shape this book met — most of them run in full, some as a precursor or in part, as the row says — and the price that came with it, usually in that chapter’s Gotcha. What is new is the vocabulary: the name that lets you recognise the same problem, and the same bill, in someone else’s code, a paper, or the next framework.
Two catalogues supply the names, because they are the two a reader is most likely to have nearby: Gulli’s Agentic Design Patterns1 and Grootendorst and Alammar’s An Illustrated Guide to AI Agents2. A tag after each name says where it comes from — (G), (IG), or both; an untagged name is this book’s own. Where a catalogue name promises more than the chapter built, the row says so with one of four coverage marks:
- implemented — the chapter’s code is the pattern, small but whole;
- precursor — the chapter has the graph shape, with a stub or a rule where the pattern puts a model;
- partial — one component of the named pattern, and the row says which;
- discussed — described as a requirement, not built.
The patterns in this book
Read the last column as a set of return tickets.
| Pattern | What it is | When to reach for it | Where you built it |
|---|---|---|---|
| Prompt chaining (G) | A fixed sequence of model calls, each consuming the last one’s output, with a typed contract at every seam. | The steps are known in advance and each is easier than the whole. | precursor Chapter 4 — the same sequence with deterministic nodes; implemented Chapter 29 — the rewrite-then-generate flow, model calls with retrieval between them; the reranking example is a separate graph, not one combined four-call chain |
| Routing (G) | One decision point that sends the run down one of several paths — by a rule, or by asking the model. | The next step depends on the input, and the set of next steps is small and known. | implemented Chapter 5 (a rule); Section 12.3 (the model decides); Chapter 16 (routing between agents) |
| Bounded iteration | A loop that continues until a check says “enough,” with a hard ceiling that stops it regardless. | Any loop whose exit depends on the model’s judgment. Always pair the judgment with the fuse. | implemented Chapter 6 (recursion_limit); Section 19.4 (a cap on model calls). partial with respect to Gulli’s goal setting and monitoring: this is the fuse, not goal revision or progress tracking |
| Tool use (G, IG) | The model emits a structured call; your code runs it and hands the result back as a message. | The answer needs something the model does not have: a lookup, a computation, a side effect. | precursor Chapter 7 — tools as nodes, chosen by a rule; implemented Section 13.2 and Section 13.4 — the model chooses, ToolNode runs |
| ReAct (IG; G files it under reasoning) | Tool use inside a loop: decide, call a tool, read the result, decide again. | Multi-step problems where the next tool depends on the last result. | implemented Section 13.5; Section 13.7 on how much of the loop to hand over |
| Parallelization (G) | Run independent branches concurrently, merge their writes with a reducer where they touch the same key, and wire an explicit join when downstream work must wait for all of them. | Independent sub-tasks; the branch phase takes about as long as its slowest branch. | implemented Chapter 10 (the reducer, and why a join is not a barrier); Section 10.5 (Send, dynamic fan-out) |
| Task decomposition (G, IG: planning) | Break one question into sub-questions, answer each, combine. | The question is compound and each part is answerable on its own. | partial Section 10.5 — the split and the fan-out, with no re-planning when a part fails. Planning’s other half is in the next table |
| Evaluation / critique (a component of reflection — G, IG) | A second look at something — retrieved evidence, a candidate document, a finished answer — by a rule or a model, before it is accepted. | Whenever “the model produced it” is not the same as “it is right.” | partial: Chapter 6 checks whether the evidence is enough before generating; Section 29.2 has a model score each candidate; Section 32.4 has a model grade the answer. None feeds the verdict back into a rewrite — the loop that would make this reflection is in the next table |
| Multi-agent (G, IG) | Several graphs, each with its own state and tools, composed under one that dispatches to them and reads their results back through state. | Specialisation: different tools, prompts, or models per job, and a coordinator that picks. | implemented Chapter 11 (composition); Chapter 16 (dispatch) |
| Human-in-the-loop (G) | The run pauses at a named point, the state is saved, a person decides, the run resumes. | Irreversible or high-stakes actions. | implemented Chapter 9 (interrupt()); Section 19.2 (the same gate, one line). For the pause to outlive the process, the saver must — see the next row |
| Checkpointing (durable execution) | The state is saved as the run progresses, so a run can resume from the last saved step instead of from the start. What “saved” means depends on the saver and the durability mode. | Anything that runs longer than you are willing to lose. | implemented Chapter 8 — with InMemorySaver, resume within one process from a caught exception; a persistent saver (Chapter 26, Section 26.4) resumes after a restart from the last checkpoint that reached disk |
| Memory management (G, IG) | Keep what the run needs in reach: the conversation in the thread, a summary once it outgrows the window, facts in a store that outlives the thread. | The conversation outlives one context window, or facts must outlive one conversation. | implemented Section 17.3; Section 17.5; Section 17.7. CoALA’s four kinds of memory3 map onto these as possible homes — state for working, checkpoints for episodic, Store for semantic, the graph and its middleware for procedural — not as a one-to-one rule: a Store holds whatever the application puts in it |
| Exception handling and recovery (G) | Retry a node with backoff, route around a failure, or degrade to a weaker answer — chosen per failure shape, never one blanket try. |
Every call that crosses a process boundary. | implemented Section 21.2; Section 21.3; Section 21.4 |
| Resource-aware optimisation (G) | Spend the expensive call last: cache what does not change, filter cheaply before the model looks, cap how often it is called. | Anywhere a model call sits inside a loop or behind a fan-out. | partial: three separate knobs — Section 21.5, Section 29.2 (cut cheaply, then spend), Section 19.4 — with no budget the run can read and act on |
| Model Context Protocol (G, IG) | Tools that live in another process, discovered at runtime over a standard wire protocol. | Tools shared across agents, or written by someone else. | implemented Chapter 25; Section 25.6 on what the boundary does and does not buy |
| Knowledge retrieval (RAG — G, IG) | Embed documents, retrieve the nearest to the question, put them in the prompt — and everything that goes wrong between those three verbs. | The answer is in text the model was not trained on. | implemented Chapter 27; Chapter 28; Chapter 29; Chapter 30 |
| Cached vetted answers (the golden layer) | A curated set of known-good answers checked before retrieval, with a freshness guard so a stale answer cannot be served. | High-frequency, high-stakes questions where “as good as retrieval allows” is not good enough. | implemented Chapter 31; Section 31.3 — the guard reads the document store’s own version stamp |
| Guardrails (G) | Decide what is data and what is instruction; keep secrets out of state; never let a document’s content decide whether a tool runs. | Every input the model reads that you did not write. | implemented Section 14.8 (secrets never enter state); Section 27.3 (the boundary marked — and shown failing); discussed Section 25.6; Section 33.3 |
| Evaluation and monitoring (G; IG: evaluating agents) | A dataset, a score, a gate that fails the build — plus a trace of the path the run took, not only the answer it reached. | Before anything ships, and again every time the corpus or the prompt changes. | implemented Chapter 32; Section 32.5; Chapter 24; Section 33.1 |
Patterns not in this book
Some of these are outside the book’s declared scope; some are one step past where a chapter stopped; some belong to the next book, which is still being written. Each row says which, so that “not covered” is a decision you can see rather than a gap you have to discover.
| Pattern | What it is | When you would reach for it | Why it is not here |
|---|---|---|---|
| Reflexion4 (IG) | Reflection with a memory: each failed attempt’s critique is written down and read on the next try, so the agent improves across attempts at the same task. Distinct from a plain critique-and-rewrite loop, which has no memory across attempts — and that plainer loop is not here either. | Tasks with a checkable outcome and a budget for several tries — coding against tests, puzzles, constrained generation. | The book’s evaluations (previous table) render a verdict and stop. Neither the rewrite loop nor the critique memory is built; the Store from Section 17.7 is where the memory would go. |
| Model training and fine-tuning (G: learning and adaptation, narrowed; IG: tool learning) | The model itself changes: fine-tuned on trajectories, trained to call tools, rewarded for outcomes. | You own the weights and have thousands of labelled runs. | Out of scope by declaration: this is a book about the graph around the model. The broader “learning and adaptation” is not all training — Reflexion, above, adapts without touching a weight — which is why this row is narrowed to what is actually excluded. |
| Inter-agent communication (A2A — G) | Agents in different processes or organisations discovering and calling each other over a protocol, the way MCP does for tools. | Agents owned by different teams that must cooperate without sharing code. | The book crosses process boundaries for tools (Chapter 25 launches its server as a subprocess) and for clients (Chapter 22), never between agents; every multi-agent graph here shares one process and one state (Chapter 16). The next book compares against A2A where it is relevant; no chapter builds it. |
| Role-playing multi-agent (IG: CAMEL,5 MetaGPT6) | Agents assigned personas that talk to each other to advance a task — an AI user and an AI assistant negotiating (CAMEL), or a software-company cast handing structured documents down a fixed procedure (MetaGPT). | Open-ended tasks where the dialogue between roles is itself the search. | The supervisor pattern covers dispatch; conversation-as-mechanism is a different bet on the model. Two agents that each play a user and never exchange a message — the product under test being their only channel — look like this and are not; that contrast belongs to a planned chapter of the next book and is not built here. |
| Re-planning (plan-and-execute — G, IG) | Draft a plan, execute a step, compare the result to the plan, revise the plan. | Long tasks where the first plan is guaranteed to be wrong somewhere. | partial Chapter 16 — Chapter 14’s Silver investigation challenge, where the supervisor chooses another delegation from the accumulated findings under a hard budget; a fuller explicit plan-and-execute agent is not built in this book. |
| Prioritisation (G) | Many goals or tasks competing; the agent orders and re-orders them as new information lands. | Queues, triage, anything with more work than budget. | No chapter has more than one goal at a time. The likely parts — a reducer over a task list, a routing function — are yours already; there is no worked example. |
| Exploration and discovery (G) | Search with no fixed target: browse, hypothesise, follow leads, stop on a stopping rule rather than on an answer. | Research, auditing, “find what is wrong” without knowing what. | Not built here: it does not fit one chapter’s “smallest graph that shows one thing.” A hypothesis-driven debugging agent is the planned chapter of the next book closest to it. |
| Memory consolidation (IG: MemoryBank7) | Long-term memories are revised rather than only appended — strengthened when recalled, faded with age, summarized into events and a user portrait, which is MemoryBank’s mechanism — with the general aim of a store that stays current instead of growing forever. | Long-lived assistants whose memory would otherwise become a landfill. | Section 17.5 folds the conversation; nothing folds the long-term Store, which is written and read and never forgets. The nearest guard expires by version (Section 31.3), not by time. |
| Tool output processing (IG) | Parse, truncate, redact and reformat what a tool returned before the model sees it, and turn a failure into an observation the model can act on. | Every tool whose raw output is large, structured, failure-prone, or untrusted. | One piece is here: ToolNode turns a bad-arguments error into a ToolMessage the model can read (Section 13.4). Exceptions inside the tool body propagate instead (Section 21.2 retries the node; the model never sees the error), and nothing parses, truncates, or redacts a tool’s output on its way to the model. |
| Reasoning search (G: reasoning techniques — tree of thoughts,8 self-consistency) | Spend more model calls on one decision: sample several answers and vote, or search over partial thoughts with evaluation and backtracking. | Hard single decisions where one call is not reliable enough. | These are orchestration — candidates, scoring, backtracking are graph shapes — and the book does not take them up. ReAct is the one reasoning pattern here. |
| Multimodal agents, including computer use (IG) | Agents that read images and screens, and in the computer-use case act through a mouse and keyboard. | Software with no API; inputs that are not text. | Out of scope by declaration, and dependent on model capabilities that change faster than a printed book. |
Two of these, re-planning and exploration, are postponed rather than absent: the next book, LangGraph in the Wild, takes a real system apart, finds those shapes inside it, and rebuilds each as the smallest graph that reproduces it. A coding agent is the first, and the book is not finished. Two more, A2A and role-playing, are points of comparison rather than chapters. The rest are declared out of scope; the footnotes on this page are the places to start reading.
Antonio Gulli, Agentic Design Patterns: A Hands-On Guide to Building Intelligent Systems (Springer, 2025), twenty-one named patterns: https://link.springer.com/book/10.1007/978-3-032-01402-3.↩︎
Maarten Grootendorst and Jay Alammar, An Illustrated Guide to AI Agents (O’Reilly, 2026), organised by component — memory, tools, planning and reflection, multi-agent — rather than by named pattern: https://www.maartengrootendorst.com/book/.↩︎
Sumers, Yao, Narasimhan and Griffiths, “Cognitive Architectures for Language Agents” (2023), https://arxiv.org/abs/2309.02427. The four kinds — working, episodic, semantic, procedural — are distinguished by what the memory is for, not by where it is stored; procedural memory there includes the model’s weights.↩︎
Shinn et al., “Reflexion: Language Agents with Verbal Reinforcement Learning” (2023), https://arxiv.org/abs/2303.11366. LangChain’s write-up separates the basic reflection loop from Reflexion proper: https://www.langchain.com/blog/reflection-agents.↩︎
Li et al., “CAMEL: Communicative Agents for ‘Mind’ Exploration of Large Language Model Society” (2023), https://arxiv.org/abs/2303.17760.↩︎
Hong et al., “MetaGPT: Meta Programming for a Multi-Agent Collaborative Framework” (2023), https://arxiv.org/abs/2308.00352.↩︎
Zhong et al., “MemoryBank: Enhancing Large Language Models with Long-Term Memory” (2023), https://arxiv.org/abs/2305.10250.↩︎
Yao et al., “Tree of Thoughts: Deliberate Problem Solving with Large Language Models” (2023), https://arxiv.org/abs/2305.10601.↩︎

