Overview

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.

FAQ

What is the “agent paradigm shift” described in chapter 1?The agent paradigm shift is the move from deterministic software, where developers control every decision at design time, to agent systems, where an AI model makes decisions at runtime. The developer’s role changes from writing all logic directly to constraining, budgeting, routing, and verifying the model’s decisions.
How do traditional software systems differ from agent systems?Traditional software follows predetermined control flow, uses structured inputs, has explicit state, and usually produces the same output for the same input. Agent systems use runtime LLM decisions, accept unstructured inputs like natural language, maintain state across context windows, memory, and tools, and may produce different outputs for the same prompt.
What are agent design patterns?Agent design patterns are reusable architectural solutions for building systems where an AI model makes decisions at runtime. They help engineers design reliable and maintainable systems around probabilistic models whose behavior can include hallucination, drift, misinterpretation, and looping.
Why don’t classical design patterns fully explain agent systems?Classical patterns assume that a human architect makes structural decisions at design time. Agent systems require many decisions—such as which tool to use, what context to attend to, or when to stop—to be made dynamically by the system itself at runtime.
What does the chapter mean by “the model spends; the harness budgets”?The model spends scarce resources such as tokens, context window space, compute, and action opportunities. The harness is the engineered environment around the model that budgets those resources by constraining, routing, validating, and verifying the agent’s behavior.
What are the three uncertainties of agent systems?The three uncertainties are output uncertainty, behavioral uncertainty, and environmental uncertainty. Output uncertainty means the same prompt can produce different responses. Behavioral uncertainty means the agent’s runtime decisions cannot be fully predicted. Environmental uncertainty means the world the agent observes may change between actions.
How do GoF patterns such as Singleton, Factory, Observer, and Strategy break in agent systems?Singleton breaks because agent state is not globally consistent but distributed across context and memory. Factory breaks because possible actions may not be known at compile time. Observer breaks because attention must be actively managed instead of synchronously receiving every event. Strategy breaks because the agent, not the human developer, selects strategies at runtime.
How are agent patterns related to distributed systems patterns?Agent patterns inherit ideas from distributed systems patterns and adapt them to probabilistic language-model behavior. For example, circuit breakers become loop detection and halting, saga transactions become plan-and-execute workflows, cache hierarchies become tiered memory, and bulkhead isolation becomes sandboxing and minimal permissions.
What are the seven cognitive functions of agents introduced in the chapter?The seven cognitive functions are perception, memory, reasoning, action, reflection, collaboration, and governance. Together they describe what an agent needs to do: attend to relevant input, retain useful context, think through problems, use tools, critique itself, coordinate with other agents or humans, and operate within safety and permission boundaries.
What is Argus, and how is it used in the book?Argus is the code review agent built throughout the book. It starts as a simple perception-reasoning-action loop and gains one cognitive module per chapter, eventually becoming a complete governed agent capable of reviewing pull requests with memory, reasoning, tool use, reflection, collaboration, and governance.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Designing AI Agents ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Designing AI Agents ebook for free