Overview

2 Turn a task into an agent architecture

The chapter explains how to turn a vague “agent” idea into a concrete architecture by starting from the task, its constraints, and the kinds of failures that matter. Rather than treating an LLM plus tools as a finished system, it asks designers to identify the capabilities the task truly needs, decide where information must be perceived, stored, reasoned about, acted on, and checked, and then build only the structure justified by those needs. The result is a practical way to think about agent design as a sequence of architectural choices instead of a single model prompt.

It organizes those choices with a seven-module capability stack: core cognition covers perception, memory, reasoning, and action; meta-cognition adds reflection; and system intelligence adds collaboration and governance. These modules are connected at runtime by the Perception-Reasoning-Action loop, with feedback and persistence sub-loops that let evidence flow back into the system and experience survive across iterations. The chapter stresses that repeated steps create compound error, so good designs reduce loop count, improve step quality, add verification, and fail fast when something goes wrong.

To compare architectural options, the chapter introduces a two-axis map that pairs cognitive function with execution topology, helping designers choose between chains, routes, parallel structures, loops, and hierarchies based on cost, latency, trust, and failure mode. It argues that most production systems should begin with one agent and scale only when there is a real structural wall such as context overflow, specialization, parallelism, or the need for independent verification. Governance then sets the trust boundary for consequential actions, and the chapter closes by applying all of this to Argus, a code review agent, showing a minimal PRA loop that later chapters expand into a fuller system.

Agent capabilities build in layers: Core Cognition enables useful work, Reflection adds an explicit feedback path, and Collaboration plus Governance address coordination, authority, and production boundaries.
The Perception-Reasoning-Action loop with reflection and memory sub-loops. Observe Result is a phase of the loop, not an eighth module.
The general agent architecture. Seven cognitive modules, the runtime virtual machine, and the external world form a complete system. Arrows represent the primary, feedback, persistence, and lateral paths; Collaboration and Governance wrap the cognitive core.
The six execution flow shapes used as the map's X-axis. The diagrams show data flow; cognitive function supplies the design intent.
The two-axis map, with 28 named patterns across seven cognitive functions and six execution topologies.
The Pattern Selection Card. A one-page quick reference for moving from a business problem to a set of patterns.

Summary

  • Use the seven cognitive modules to identify design concerns. Core Cognition enables useful work, Reflection adds an explicit feedback path, and Collaboration plus Governance address coordination, authority, and production boundaries.
  • The PRA loop is the cognitive engine. Because errors compound across steps, designs should reduce unnecessary iterations, improve evidence at each step, verify intermediate results, and fail fast when the state is corrupt.
  • The General Agent Architecture separates cognitive modules, runtime infrastructure, and the external world. Review it through four paths: primary flow, feedback, persistence, and collaboration. Make state, tool calls, permissions, and evaluation results observable.
  • The two-axis map combines cognitive function with execution topology. Use it to compare candidate structures against cost, latency, failure modes, and trust boundaries. The Pattern Selection Card turns a business problem into a first-pass design.
  • Start with one agent and scale only after hitting a structural wall: context pressure, distinct expertise, useful parallelism, or the need for an independent reviewer. When delegating, keep task ownership and integration explicit while giving sub-agents bounded local control.
  • Grant autonomy per action, in proportion to reversibility and blast radius. Implement approval gates, bounded scope, override, and audit trails as runtime constraints. Trust should be earned through observed behavior and reversible after incidents.

FAQ

What is the seven-module capability stack in Designing AI Agents?

The seven-module capability stack is a design checklist for agent systems: Perception, Memory, Reasoning, Action, Reflection, Collaboration, and Governance. Each module represents a distinct architectural concern, and a task determines how deeply each one needs to be implemented.

How do I decide which capabilities an agent actually needs?

Start from the business task and its constraints: what the system must perceive, remember, decide, and change, plus which failures are tolerable and where humans must stay in control. Then map those needs to the relevant modules instead of assuming every agent needs the same full stack.

What is the Perception-Reasoning-Action (PRA) loop?

The PRA loop is the core runtime cycle of an agent: perceive evidence, reason about the next step, act, observe the result, and repeat. It is the basic flow that turns capabilities into execution.

Why does the chapter separate Memory from Reasoning?

Memory persists observations, decisions, and outcomes across PRA cycles, while Reasoning selects strategies and plans. Keeping them separate lets teams tune storage and retrieval independently from decision-making and makes long-term state explicit.

Why is the PRA loop risky in long tasks?

Because errors compound across iterations. Even small per-step mistakes can produce much lower end-to-end success rates over many steps, so more autonomy often means more opportunity for error to accumulate.

How does the runtime virtual machine fit into agent architecture?

The runtime VM sits between the cognitive modules and the external world. It provides production concerns such as sandboxing, persistence, tool hosting, monitoring, and safety boundaries, much like an operating system supports software execution.

What are the six execution topologies in the two-axis map?

The six standardized topologies are Chain, Route, Parallel, Orchestrate, Loop, and Hierarchy. They describe how work flows through the system and can be paired with different cognitive functions such as reasoning, reflection, or collaboration.

When should an agent system scale beyond a single agent?

Start with one agent by default. Add more agents only when there is a structural wall such as context overflow, required specialization, parallel independent work, or the need for adversarial verification that a single agent cannot provide well enough.

What does Governance control in an agent system?

Governance constrains what the agent can see, decide, and do. It includes approval gates, action classification, human override, and audit trails so that autonomy is granted in proportion to reversibility, scope, and consequence.

How does the chapter apply these ideas to Argus?

It uses Argus, a code review agent, as the running example. The chapter shows a minimal single-pass PRA implementation, then explains how later chapters will add perception, memory, reasoning depth, reflection, collaboration, and governance as justified by the task.

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