An agent design pattern is a reusable architectural solution for a system in which an AI model makes decisions at runtime. It places boundaries around a probabilistic component whose failures can include hallucination, drift, and unbounded looping. The aim is not to prescribe every decision, but to make the surrounding system reliable and maintainable. section 1.0
Unlike a conventional pattern in which a developer selects a strategy, an agent pattern must account for a model selecting actions during execution. Prompts require semantic interpretation, and volatile context, task records, retrieved evidence, and tool outputs can disagree. Persistence, provenance, attention policies, and limits on tool use therefore become architectural concerns. section 1.3.1 section 1.3
Organize a design along two dimensions:
- Cognitive function: choose a pattern for perception, memory, reasoning, action, reflection, collaboration, or governance. section 1.4
- Execution topology: decide how the work runs, such as a chain, route, parallel fan-out, loop, hierarchy, or orchestration. section 1.1
Code review in an existing system
A coding agent asked to add a controlled rollout might create a new utility even though the repository already has one. Preventing that duplication requires more than writing down a rule: the architecture must determine what project knowledge the agent retrieves, what it may change, how its work is reviewed, and what evidence counts as completion. section 1.0
Patterns inherit engineering pressures without copying their mechanisms. Isolation limits blast radius, durable state supports recovery, reconciliation handles drift, and budgets constrain resources. In an agent, these controls must work with context, tools, and natural language as part of the runtime. section 1.3
Figure 1.3 Selected pattern lineages, from GoF through distributed systems to agent systems. The arrows trace recurring design pressures across distinct implementations.
Trace selected engineering pressures from object-oriented and distributed-systems patterns to agent patterns. section 1.3
Evaluate a pattern at a defined workload and operating point. More context can increase token use and latency; broader tool permissions increase risk; extra verification costs resources but can prevent errors. A fixed evaluation harness helps compare choices against the task’s reliability, latency, and cost requirements. section 1.4.2
