AI Agent Architecture in Production: Patterns That Survive Real Workloads

Most agent projects die in the same place: the gap between a flawless demo and the first week of real traffic. The demo operates one clean trajectory against a cooperative input. Production sends thousands of trajectories a day, each one a chance for a tool to time out, a model to wander off task, or a retry to fire twice against a system that wasn’t expecting it. The model rarely got worse between the demo and the outage. The structure around it was never built to absorb what real workloads do.

Agentic AI 1 July 2024

If you own an agent that tested well and then started generating support tickets, the cause is almost never model quality. AI agent architecture, the scaffolding that decides what the model is allowed to do, where its state lives, and what happens when a step fails, is what separates a system that scales from one that collapses the moment it leaves the controlled environment.

The reliability math most agent demos hide

Illustration: The reliability math most agent demos hide

Start with the arithmetic, because it governs everything downstream. A single model step that succeeds 95% of the time feels dependable. Chain twenty of those steps into one autonomous trajectory and the end-to-end success rate is 0.95²⁰, roughly 36%. Nothing in that system is broken. Each component performs as advertised. The composition is what fails, which is why an agent that handles a three-step task convincingly falls apart on a fifteen-step one, and why “make the agent more autonomous” is usually the wrong instinct.

The architectural response is unfashionable. The most reliable production agents are the least agentic ones. You push as much control flow as possible into deterministic code, with explicit branches, validation, typed transitions, and reserve the model’s discretion for the few steps that genuinely need judgment. The boundary between deterministic orchestration and model discretion is the single most consequential line in the design, and most teams draw it far too wide. Every degree of freedom you hand the model is a degree of freedom you then have to evaluate, observe, and govern.

State, side effects, and the cost of a retry

An LLM call is stateless; an agent is not. The context window is working memory, held well below the level of durable state, and treating it as the system of record is how agents lose track of what they have already done. Production agents externalise state into something inspectable and durable: a store that records each step, its inputs, its output, and its status, so a trajectory can be paused, resumed, audited, and replayed. In a regulated workflow, an action you cannot reconstruct after the fact is an action you cannot defend.

State matters most at the instant an agent does something irreversible. Agents take actions, they post entries, send messages, move funds, update records, and actions have a property text generation does not: they cannot be retried for free. A timeout on a side-effecting tool call leaves you not knowing whether the action happened at all. Retry blindly and you have sent the payment twice. The pattern that survives is borrowed from distributed systems: idempotency keys on every side-effecting call, an action ledger that records intent before execution, and compensating steps that can unwind a partial trajectory. Skip this and your first network blip becomes a duplicate-transaction incident.

You also cannot operate what you cannot see. Every production trajectory should be captured end to end, each prompt, tool call, intermediate output, and decision, as a trace an engineer can open and walk through. That capture is the only honest foundation for evaluating agents in production: you assemble a regression suite from real trajectories and score the entire path, held together with the final answer rather than separated from it, because an agent can reach a correct result through a process you would never sign off on.

What AI agent architecture buys you in a regulated environment

None of this is free. Externalised state and full tracing add storage and engineering overhead. Deterministic orchestration is more code to maintain than a single reasoning loop. Reloading context on every step makes token cost scale with trajectory length, and latency compounds. A fifteen-step agent inherits the tail latency of fifteen tool calls, so your p99 is set by your slowest dependency in place of your average one. Pretending otherwise is how a budget blows up in month three.

Illustration: What AI agent architecture buys you in a regulated environment

What that cost buys is the thing that lets the system operate in a regulated environment at all. Trajectory logs become your audit trail. Bounded action spaces and scoped credentials become your blast radius. Human review placed at the specific high-consequence action boundaries, held above sprinkled everywhere or bolted on at the end, becomes your oversight. This is why we treat governance as a load-bearing part of the architecture in place of a closing disclaimer. It is structural, or it is theatre.

Where it almost broke

A back-office document agent we operated shows where this bites. It extracted fields from incoming filings and updated a system of record, which worked until a downstream API began returning slowly under load. The tool call timed out, the orchestration retried, and because the update was not idempotent, a subset of records got written twice before anyone noticed. The model never erred. The fix was structural. An idempotency key was introduced, an action ledger was added to record intent before execution, and a circuit breaker halted the trajectory in place of retrying into a degraded dependency. The agent became less autonomous and considerably more trustworthy, and the operational instrumentation that made the failure visible is what turned a silent corruption into a caught incident.

The agent that holds up under real workloads is more constrained, more instrumented, and frankly more boring than the one that wowed the room, because the engineering value sits in the scaffolding, and the model’s freedom to roam contributes little to it. Sound AI agent architecture treats the model as one fallible component inside a governed system, bounded, observed, recoverable, and the framing of the model as the system itself sits well outside how a durable design behaves. Teams that internalise this stop asking whether the model is good enough and start asking whether the structure around it can absorb the day the model, the tools, and the network all have a bad afternoon at once.

If your agents already clear the demo, the question worth your team’s time is the harder one underneath it: when a step fails at scale, and eventually one will, does the architecture fail safely, or does it fail silently?

Related: Agentic AI

Tell us the number you need to move.

…outcomes that survive scrutiny.