1 The agent paradigm shift
Agent systems represent a major shift from traditional software because the central decision-maker is no longer fully controlled by the developer. In conventional applications, control flow, inputs, state, errors, and tests are largely deterministic and explicitly designed ahead of time. In agent systems, an LLM interprets context, chooses tools, reasons, acts, reflects, and may take different paths for the same request. The engineer’s role therefore changes from writing every decision into code to designing boundaries, budgets, constraints, and verification mechanisms around probabilistic behavior.
The chapter explains that classical design patterns still matter, but they are insufficient on their own because they assume predictable state, fixed taxonomies, reliable delivery, and human-selected control flow. Patterns such as Singleton, Factory, Observer, and Strategy break when applied directly to agents, where memory is distributed across context and retrieval systems, tools may be discovered dynamically, attention must be actively managed, and strategies are chosen by the model at runtime. Agent design patterns inherit lessons from earlier generations of engineering, especially distributed systems patterns such as circuit breakers, sagas, reconciliation loops, sidecars, cache hierarchies, and bulkheads, but adapt them to a new operating condition: output, behavioral, and environmental uncertainty are normal rather than exceptional.
The chapter frames agent architecture as bounded resource allocation under uncertainty: the model spends context, compute, and action opportunities, while the surrounding harness budgets, constrains, routes, and verifies that spending. It introduces seven cognitive functions that organize agent design: perception, memory, reasoning, action, reflection, collaboration, and governance. Through the example of Argus, a code review agent, the chapter shows how these functions combine into a modular architecture that can triage context, retrieve past lessons, reason about complex code changes, run tools safely, critique its own output, delegate to specialist agents, and pass through approval and observability controls. The larger message is that effective agent engineering depends less on implementation alone and more on specification, pattern composition, and disciplined harness design.
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?
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. In traditional systems, the engineer writes the logic directly; in agent systems, the engineer designs constraints, budgets, tools, memory, and guardrails around a probabilistic decision-maker.
How are agent systems different from traditional software systems?
Traditional software follows predetermined control flow, uses structured inputs, produces deterministic behavior, and is tested with unit and integration tests. Agent systems use model-driven runtime control flow, accept unstructured inputs such as natural language or images, produce stochastic outputs, and require evaluation suites, traces, and often human-in-the-loop review.
What are agent design patterns?
Agent design patterns are reusable architectural solutions for systems where an AI model makes runtime decisions. They help engineers build reliable and maintainable systems around probabilistic models whose reasoning can be opaque and whose failure modes include hallucination, drift, misinterpretation, and unbounded looping.
What does “the model spends; the harness budgets” mean?
It means the language model consumes scarce resources such as tokens, context window space, compute, and action opportunities, while the surrounding agent harness controls how those resources are allocated. The harness budgets by deciding what context to load, which tools to expose, when to route tasks, how to verify outputs, and when to stop or escalate.
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 may choose different tools, plans, or loop lengths at runtime. Environmental uncertainty means the outside world can change between observations, such as a web page layout changing or a codebase being updated.
Why do classical GoF patterns break when applied directly to agents?
Classical GoF patterns assume that a human architect makes structural decisions at design time. Agent systems violate that assumption because the model makes many decisions at runtime. For example, Singleton breaks because agent state is distributed across context and memory, Factory breaks because actions and tools may be discovered dynamically, Observer breaks because agents must manage attention, and Strategy changes because the model selects strategies autonomously.
How do agent patterns relate to distributed systems patterns?
Agent patterns inherit many ideas from distributed systems patterns but adapt them to probabilistic model-driven systems. For example, circuit breakers become loop detection and halting mechanisms, saga transactions become plan-and-execute workflows, cache hierarchies become tiered memory, reconciliation loops become perception-reasoning-action loops, and bulkhead isolation becomes sandboxing and minimal permissions.
What are the seven cognitive functions of agents?
The seven cognitive functions are perception, memory, reasoning, action, reflection, collaboration, and governance. They describe what an agent needs to do: perceive relevant context, remember useful information, reason about tasks, act through tools, reflect on outputs, collaborate with other agents or humans, and operate within safety and approval constraints.
How does Argus demonstrate the seven cognitive functions?
Argus is the book’s code review agent. When reviewing a pull request, it uses perception to triage relevant files, memory to retrieve prior failures and team preferences, reasoning to evaluate complexity, action to run tests and tools, reflection to improve its comments, collaboration to delegate specialized checks, and governance to enforce permissions, approvals, and observability.
What is the gardener’s mindset in agent engineering?
The gardener’s mindset says that agent engineers do not directly control every decision an agent makes. Instead, they engineer the environment in which decisions happen. They choose models, tools, prompts, memory systems, context boundaries, guardrails, sandboxes, and approval gates. Like gardeners, they cannot control every growth path, but they can design the conditions that make reliable behavior more likely.
Designing AI Agents ebook for free