1 The agent paradigm shift
The text introduces agent design patterns as a necessary evolution in software architecture for systems where an AI model makes runtime decisions. Traditional software assumes deterministic control flow, structured inputs, explicit state, and predictable failures; agent systems instead operate through probabilistic perception, reasoning, action, and reflection loops. The central shift is that engineers no longer write every decision directly—they design constraints, budgets, tools, memory, and guardrails around a model whose behavior is uncertain.
The chapter explains why classical design patterns such as Singleton, Factory, Observer, and Strategy do not transfer cleanly to agents. These patterns assume that humans define structure and choices at design time, while agents make many of those choices dynamically at runtime. Agent systems must handle output uncertainty, behavioral uncertainty, and environmental uncertainty as normal operating conditions. The text also connects agent patterns to earlier engineering traditions, showing how distributed-systems ideas like circuit breakers, sagas, reconciliation loops, cache hierarchies, and bulkheads reappear in agent form as loop detection, plan execution, perception-action cycles, memory tiers, and sandboxing.
The book’s organizing framework is built around seven cognitive functions: perception, memory, reasoning, action, reflection, collaboration, and governance. These functions are illustrated through Argus, a code review agent that triages context, recalls prior failures, reasons about risk, uses tools, critiques its own output, delegates to specialist agents, and passes through approval and observability controls. The broader message is that successful agent engineering is “harness engineering”: the model spends context, compute, and action opportunities, while the surrounding harness budgets and constrains that spending. As a result, design, specification, and pattern composition become higher-leverage than implementation alone.
Deterministic pipeline vs. agent loop—fixed sequence on the top, model-driven cycle on the bottom.
How four GoF patterns break and what replaces them in agent systems.
The lineage of agent patterns, from GoF (1994) through distributed systems (2000s) to agents (2024+).
The seven cognitive functions for processing a pull request review.
The two creations in agent engineering: specification as mental creation, running agent as physical creation.
Summary
- Agent architecture is bounded resource allocation under uncertainty — the model spends; the harness budgets. The 27 patterns and seven cognitive functions in this book are different facets of that one premise. Each chapter is one class of allocation strategy.
- Agent systems introduce three fundamental uncertainties—output (same prompt, different responses), behavioral (agent selects its own strategy at runtime), and environmental (the world changes between observations)—that break the assumptions underlying classical design patterns. Treating uncertainty as the default operating condition, not an edge case, is the paradigm shift.
- Every agent design pattern has an engineering ancestor. Cache hierarchies became tiered memory. Circuit breakers became loop detectors. Saga transactions became plan-and-execute workflows. The medium changed from deterministic code to probabilistic language models; the engineering problems are isomorphic. Experienced engineers already have the right intuitions. This book gives them the vocabulary to design, review, and communicate about agent architectures within their teams.
- The seven cognitive functions (perception, memory, reasoning, action, reflection, collaboration, and governance) organize 27 named patterns across six execution topologies. This two-dimensional framework (what the agent does × how it does it) is the map for the rest of this book.
- Design inversion: in agent systems, the specification is the source code and the agent is the compiler. Past the implementation plateau, improving code yields diminishing returns. The constraint on output quality is design, not implementation. The developer's role shifts from writing code to designing specifications.
- Token leverage: the ratio of output quality to token cost is a first-class design criterion, because in agent engineering, good architecture is not just a quality decision; it is a financial one.
Designing AI Agents ebook for free