Getting Your First Agent Live

From Demo to Hours: Building Multi-Step Reliability in Production Agents

Abstract illustration: From Demo to Hours: Building Multi-Step Reliability in Production Agents

What you will learn here

This article maps the five failure modes that surface only when agents run for hours rather than minutes, explains why each one is structurally predictable, and gives you concrete instrumentation patterns to catch them before they reach users. It draws on published results from teams that have solved pieces of this problem and on failure-rate data from enterprise deployments covering hundreds of thousands of agent runs.

If you have a working demo and are now asking why it breaks at scale, this is the gap you are trying to close.


The scale problem is not the one you tested for

A five-minute proof of concept exercises a narrow, happy-path slice of your agent’s behaviour. It uses a fraction of the context window, calls two or three tools in a predictable sequence, and finishes before any state has time to drift. The moment you move to 24/7 production operation, every one of those safe assumptions collapses.

According to a Composio analysis published in May 2026, only 10% of organisations that report measurable gains from agent pilots successfully scale to production. The remaining 57% stall because of hallucination and reasoning failures at real-world data volume. That gap is not a model quality problem. It is an architecture and instrumentation problem.

The five failure modes below are each independently solvable. The difficulty is that most agent frameworks do not address any of them out of the box.


The five failure modes

1. Context window saturation

Every tool call return, every intermediate reasoning step, and every retrieved document adds tokens to the active context. In a short demo, utilisation stays low. In a session that runs across dozens of tool calls or retrieves from a large RAG pipeline, the window fills and the model begins dropping early-session detail silently. It does not throw an error. It just forgets constraints it was given at the start.

Instrument this with a token counter at every tool-return boundary. Log utilisation as a ratio. At 70% capacity, trigger a summarisation step or a state checkpoint before continuing. Some teams use a sliding-window approach where completed subtasks are compressed into a structured summary and removed from the live context.

2. State corruption

Agents that write to external systems mid-task create partial state when they fail partway through. A compliance workflow that updates three records before hitting an API timeout leaves one record updated and two untouched. Without a rollback strategy, the system is now inconsistent.

Data from AIThinkerLab’s production agent analysis puts this in concrete terms: 30% of autonomous agent runs hit exceptions that require recovery. These are not just code errors. They include model hallucinations, context window overflows, and API rate limits. Without explicit rollback logic, each of those exceptions leaves systems in a partially updated state.

Syntes addressed this on a live Shopify and Snowflake knowledge graph by validating every Cypher query result before committing it and requiring human approval for writes above a defined scope threshold. The pattern is straightforward: treat agent-initiated writes as transactions, not fire-and-forget calls.

flowchart TD
    A[Agent plans write operation] --> B[Validate output schema]
    B --> C{Schema valid?}
    C -- No --> D[Return error to agent, retry once]
    C -- Yes --> E{Scope within threshold?}
    E -- No --> F[Route to human approval queue]
    E -- Yes --> G[Execute write]
    G --> H{Write succeeded?}
    H -- No --> I[Rollback, log exception, alert]
    H -- Yes --> J[Confirm state, continue task]
    D --> K[Increment failure counter]
    K --> L{Failures exceed limit?}
    L -- Yes --> M[Abort task, checkpoint state]
    L -- No --> B

3. Token budget exhaustion

Separate from context saturation, token budget exhaustion is a cost and latency problem. An agent with no per-task call limit will keep reasoning and retrying until it either succeeds or hits the model provider’s hard limit. In practice, this means a single stuck task can consume the budget allocated for dozens of normal tasks.

Set a maximum tool-call count per task at planning time, not as a global cap. When an agent exceeds that count without reaching a terminal state, surface it as a stalled task rather than letting it continue. Tool misuse and incorrect tool arguments account for approximately 31% of production agent failures in enterprise deployments, and a large share of those failures trigger exactly this kind of unbounded retry loop.

4. Reasoning drift

Reasoning drift is the multi-turn version of goal misalignment. The agent begins with a clear objective, but across many steps the intermediate reasoning accumulates small errors or reinterpretations. By step 20, the agent is optimising for a subtly different goal than the one it started with.

Research from Latitude and Wei et al. shows that agents evaluated only on final output quality pass 20 to 40% more test cases than full trajectory evaluation reveals. The failure is invisible unless you log and review the full reasoning chain, not just the terminal output.

Add trajectory logging as a first-class concern in your agent observability setup. Checkpoint the stated goal at regular intervals and compare it against the original objective programmatically. A simple string-similarity check between the current reasoning step’s stated objective and the session-start objective catches most drift before it compounds.

5. Tool call cascade failures

A cascade starts when one tool returns an unexpected schema. The agent interprets this as a task failure and calls a second tool to compensate. That tool also fails, triggering a third call. Each call adds latency, consumes tokens, and may write partial state.

The fix is a circuit breaker at the tool-call layer: after two consecutive failures on related tool calls within a single task, halt and escalate rather than continuing. This is distinct from the per-task call budget. The circuit breaker responds to failure patterns; the budget responds to volume.

flowchart TD
    A[Tool call issued] --> B{Response valid?}
    B -- Yes --> C[Continue reasoning]
    B -- No --> D[Increment consecutive failure count]
    D --> E{Count >= 2?}
    E -- No --> F[Retry with corrected arguments]
    F --> A
    E -- Yes --> G[Open circuit breaker]
    G --> H[Log cascade, alert on-call]
    H --> I[Escalate task to human review]

What production teams actually did

Stripe’s compliance review agents, built on the ReAct framework and running on AWS Bedrock, achieved a 26% reduction in review handling time with a 96% helpfulness rating in January 2026. Human experts retain final decision authority. The engineering work that got them there included explicit context management, structured tool validation, and human checkpoints at defined reasoning milestones, not just a capable model.

BarmeniaGothaer’s “Mina” agent handles 6,000 calls per day across 50 internal destinations with a 90% reduction in switchboard workload. Sustained volume at that scale requires tiered escalation logic so that exception cases exit the agent loop cleanly rather than degrading the session for the caller.

Cohesity, ServiceNow, and Datadog all shipped rollback governance tooling in response to production failures observed in customer deployments. Agent governance has moved from a post-hoc concern to a standard product category because the failure modes described above are consistent enough across deployments to warrant dedicated tooling.

Teams using LangGraph or similar stateful orchestration frameworks can define explicit state checkpoints natively. Teams on lighter frameworks often bolt on a checkpoint pattern manually, writing agent state to an external store at each tool-call boundary so that a failed run can resume rather than restart. Some governance platforms, Prefactor among them, provide this as infrastructure rather than requiring teams to build it themselves.

For a fuller picture of how these patterns fit into a complete agentic AI architecture, and how to evaluate whether your current setup handles trajectory failures, the agent evaluation guide covers the instrumentation in more depth.


Where to start

Map your current agent against the five failure modes above and identify which ones you have no instrumentation for. That gap is your highest-priority engineering work before any production rollout. Take the agent readiness assessment to get a structured view of where your architecture is exposed and what to address first.

Matt Doughty Matt Doughty CEO & Co-Founder, Prefactor

Founder of Prefactor, writing on the operational reality of getting AI agents into production — identity, governance, evaluation, and the plumbing assistants never needed.

Frequently asked questions

Why do agents that pass all tests still fail in production?

Test suites typically evaluate final output quality, not full trajectories. Research shows agents evaluated only on final output pass 20-40% more test cases than trajectory evaluation reveals, meaning multi-turn goal drift goes undetected until a live session exposes it.

How do I know when my agent's context window is approaching saturation?

Instrument token counts at every tool call return and log the ratio of context used to context available. Set an alert threshold at around 70% utilisation, which gives you enough headroom to summarise or checkpoint state before the model starts dropping early-session detail.

What is a tool call cascade failure?

It happens when one tool returns an unexpected schema or error, and the agent calls a second tool to compensate, which also fails, triggering a third call. Each call adds latency and token cost. Without a maximum tool-call budget per task, a single bad API response can exhaust the entire session.

Does adding human oversight reduce agent reliability problems?

It bounds the blast radius rather than eliminating the underlying failures. Stripe's compliance review agents retained human final-decision authority and achieved a 96% helpfulness rating, but the engineering work to get there still addressed context management, tool validation, and reasoning checkpoints separately.

Stay ahead of the curve

No spam. Unsubscribe anytime. A resource by Prefactor.

Almost there — check your inbox to confirm your subscription.