Part III · Building and operating AI/Chapter 12 of 20/6 min read

Choose an Agent Pattern

How to choose between fixed workflows, single-agent loops, event-driven background agents and multi-agent architectures without drowning in compounding failure rates.

A procedure binder guides a bounded agent workstation with explicit tools and permissions.
A procedure binder guides a bounded agent workstation with explicit tools and permissions.Plate 12
On this page5 sections
  1. 01Know the difference between workflows and agent loops
  2. 02Respect compounding step reliability
  3. 03Pick from four proven production patterns
  4. 04Equip agents with reusable skills, not sprawling prompts
  5. 05Engineer termination, compaction and human control

"Build an agent" has become the default answer to almost every AI product brief, even when a three-step deterministic pipeline would be faster, cheaper and ten times easier to debug.

An agent is simply a system where a model runs in a loop, deciding its next action (searching, calling a tool, inspecting an error, asking for clarification or stopping) based on intermediate results rather than following a hard-coded sequence. That extra autonomy unlocks messy, open-ended tasks that rigid scripts cannot handle. It also multiplies every failure mode: compounding errors, runaway token loops, unpredictable latency and wider security blast radius.

Good architecture matches the degree of autonomy to the shape of the problem, not the hype cycle.

Know the difference between workflows and agent loops

Before choosing an agent framework, separate two fundamentally different execution models:

  • Fixed workflow (chaining / orchestration): Code controls the exact sequence of steps (for example: extract fields -> validate schema -> query ERP -> draft exception summary). Models execute bounded reasoning inside specific steps, while deterministic logic handles branching, retries and state transitions.
  • Agentic loop: The model controls the flow. Given a goal, context and a set of tools, it plans steps dynamically, reacts to unexpected tool outputs and decides when the job is complete.

Respect compounding step reliability

Multi-step autonomy faces unforgiving maths. If an agent must execute five required steps in sequence, each succeeding independently 95% of the time with no error recovery, overall task success drops to 77% (0.95^5). Stretch that to ten steps and end-to-end success falls to 60% (0.95^10).

Interactive explorer

Compounding reliability across agent steps

Even high per-step accuracy decays rapidly over long chains unless you shorten steps or add verification checkpoints.

Unverified chain (5 steps)

77.4%

Formula

0.9505

With mid-loop check + retry

98.3%

25%50%75%100%1 step5 steps10 steps15 steps

Real production traces behave even less predictably: errors correlate (a bad retrieval on step 1 poisons steps 2 through 5), while good tool validation and recovery can catch specific mistakes mid-loop. The practical product lesson stays unchanged:

  • Shorten the chain. Collapse unnecessary intermediate tool calls into purpose-built composite tools that do deterministic lookups and filtering in code.
  • Verify between steps. Run cheap deterministic checks (schema validation, record existence, arithmetic checks) after critical tool calls so errors get caught before they compound.
  • Measure trajectory and outcome separately. An agent that hits the right final answer after twelve redundant tool calls and a forbidden lookup is not production-ready (covered in Evaluating an AI Product).

Pick from four proven production patterns

Three work cells represent research, task execution and manager-worker agent patterns.

1. Research and synthesis (read-only agent)

The agent searches across permitted sources, cross-checks conflicting evidence, asks follow-up queries when gaps appear and produces a structured brief for a human to review.

  • Best fit: Account prep, policy research, incident investigation, competitive analysis.
  • Main risk: Read-only access eliminates write damage, yet still leaves you exposed to data leakage across tenants, indirect prompt injection inside retrieved documents and fluent synthesis that hides conflicting sources. Always link claims back to verifiable passages.

2. Bounded task execution (single agent with scoped tools)

A single agent plans and executes actions through tightly scoped tools (drafting records, running tests, proposing schedule changes, submitting approved updates).

  • Best fit: High-frequency operational workflows where inputs vary widely but allowed actions are well defined.
  • Main risk: Scope creep and partial failures. Enforce write permissions, spending caps and approval previews in backend code, and pair every write tool with idempotency and timeout handling (The Model Harness and Routing).

3. Event-driven background agents (asynchronous automation)

Instead of waiting for a human to open a chat window, the agent triggers automatically from system events: an inbound support ticket, a new pull request, a failed data pipeline, a weekly schedule or a database update. Clean outputs proceed automatically within narrow bounds; uncertain or high-risk cases route into a human exception queue.

  • Best fit: Continuous triage, monitoring, enrichment, documentation drift checks and scheduled reporting where system-level leverage beats individual chat sessions.
  • Main risk: Silent failure at scale. Because no human is watching the run live, background agents require strict budgets (max steps, max spend, max runtime), dead-letter queues for failures, sampled quality audits and a clear operational owner.

4. Multi-agent architectures (orchestrator-worker / specialist sub-agents)

Work splits across specialised sub-agents (for example, an orchestrator delegating isolated sub-tasks to a research worker and a verification worker, or running parallel sub-tasks over separate documents).

  • When it earns its keep: Sub-tasks are genuinely independent and parallelisable, require strict context isolation (preventing a huge intermediate trace from polluting the main context window), or enforce distinct permission boundaries (such as separating an untrusted-content reader from a privileged action executor in Agent Security Boundaries).
  • Why multi-agent usually fails first: Every handoff between agents loses nuance, duplicates context tokens, inflates latency and creates circular delegation loops ("ping-ponging" blame between reviewer and worker agents). Never build a three-agent org chart ("PM agent, engineer agent, QA agent") merely because humans organise that way. Prove a single well-tooled agent with clean context cannot clear the bar first.

Equip agents with reusable skills, not sprawling prompts

As an agent takes on more tasks, stuffing every procedure and edge-case rule into one giant system prompt causes instruction conflicts and context rot.

Package repeatable domain procedures as modular skills: concise, versioned instruction files (containing goals, required steps, decision rules, examples and escalation criteria) loaded dynamically only when the task matches. Because skills live as plain, versioned files alongside code or team documentation, domain experts and PMs can review, refine and test procedural changes without rewriting the underlying agent runtime.

Engineer termination, compaction and human control

Every production agent needs explicit guardrails that prevent runaway execution:

  • Hard loop budgets: Maximum step count, maximum wall-clock duration and maximum dollar/token spend per run, with a graceful fallback summary when a budget trips.
  • Context compaction: For long-running tasks, summarise completed sub-steps and drop raw verbose tool payloads (like 200-line JSON dumps) from active context before accuracy degrades.
  • Checkpointing and resumability: Persist state between major steps so a long-running workflow can pause for human approval, survive a transient API outage or hand off cleanly to an operator without restarting from zero.
  • Explicit human role: Decide upfront whether the person is approving a plan before execution, reviewing diffs after execution or triaging exceptions from a background queue, and build the interface directly around that role (Design for Shared Control).

Choose the simplest pattern that clears the job's real complexity. Every extra degree of agent freedom is an ongoing engineering and evaluation bill your team will pay every week the product stays live.

Handbook v4.0 · Ch. 12Updated Nov 2026