Filed underL06 · AI & Automation
Published
Reading time23 min
Words5,313
Field notes · L06 AI & Automation

Agent failure modes in productionLoops, drift, tool misuse and recovery

How AI agents fail in production (loops, goal drift, bad tool arguments, premature completion, cascades) and the budgets, checkpoints and recovery that contain them.

The short answer

AI agents fail in production in five main ways: they loop, they drift away from the goal, they call tools with wrong or invented arguments, they declare success before the work is done, and one bad step cascades through everything after it. You can't prompt these away. You contain them with code that sits outside the model: hard budgets on steps, tokens, money and wall-clock time; validation and authorisation on every tool call; checks on the world, not the model's own report, before you accept "done"; and durable checkpoints, so a failed run can be paused, inspected and resumed instead of restarted. Treat the model as an unreliable component inside a reliable system, and build the system first.

The rest of this post sets out the taxonomy, the signals that tell you each failure is happening, the controls we'd actually put in place, and a runbook you can lift straight into your own platform.

01Why agents fail differently from ordinary software

A normal service fails in ways you can list in advance: a timeout, a null, a full disk. An agent is a loop with a stochastic planner in the middle. Every step decides the next one, so errors compound instead of staying local.

Two facts are worth keeping in mind.

Agents are inconsistent, not just inaccurate. Sierra's τ-bench introduced pass^k, the probability that an agent succeeds on all k independent attempts at the same task. In the original paper, the best function-calling agent at the time (GPT-4o) solved under 50% of tasks, and its pass^8 in the retail domain fell below 25%. Models have improved a lot since then. The shape of the problem hasn't: an agent that works on Tuesday's demo can fail on Wednesday's identical input. Your controls have to assume any given run might go wrong, and your evals should report it the same way; we cover pass^k in evaluating agents with trajectory evals.

Most failures are design failures. The MAST study (Cemri et al., UC Berkeley) annotated more than 1,600 traces across seven multi-agent frameworks. It found 14 failure modes in three groups: specification issues, inter-agent misalignment and task verification. Its conclusion was that many failures "stem from system design issues, not just LLM limitations". Step repetition, premature termination and missing or incorrect verification all appear in that list. A better model makes them rarer. It doesn't remove them.

Anthropic's own guidance on building agents says the same thing more briefly: agents should get "ground truth from the environment at each step", it is "common to include stopping conditions (such as a maximum number of iterations)", and autonomy brings "the potential for compounding errors".

02A taxonomy of AI agent failures in production

We use six categories. They overlap, but each has its own signals and its own fix, and that is why it's worth keeping them apart.

1. Loops and repetition

What it looks like. The agent calls the same tool with the same (or almost the same) arguments again and again. Or it swings between two states: edit file, run tests, revert, edit file. Or it keeps "researching" without ever moving to act.

Why it happens. The tool result doesn't tell the model anything new. Typical causes are an opaque error such as 500 Internal Server Error, an empty result set, or output cut off before the useful part. The model has no memory of trying this three steps ago because the earlier attempt has been summarised or truncated away. Planners that are rewarded for thoroughness are especially prone to it.

Signals.

  • Identical (tool_name, canonical_args) hash seen N times in a run.
  • Same error string returned by consecutive tool calls.
  • Steps keep rising while a progress measure (files changed, records written, subgoals closed) stays flat.
  • Token use per run far above the p95 for that task type.

2. Goal drift

What it looks like. Asked to fix a failing test, the agent refactors the module. Asked to summarise a ticket, it starts triaging the backlog. In long sessions the original instruction gets crowded out by recent context. In the worst case, injected text in a tool result replaces the goal entirely.

Why it happens. The context window is a recency-weighted soup. As tool outputs pile up, the task statement makes up a smaller and smaller share of the tokens. Compaction and summarisation can drop constraints ("don't touch the schema") while keeping the headline goal. And anything the agent reads (web pages, emails, issue comments) is a possible instruction. That last case is prompt injection, which we cover separately in Securing AI agents: prompt injection, tool permissions and least privilege for MCP.

Signals.

  • Tool calls outside the set expected for this task type (a "summarise" run calling write_file).
  • Touching resources outside the declared scope (paths, tables, tenants).
  • An LLM judge scoring the latest plan against the original task falls below a threshold. Use this sparingly. It costs money and is itself a model.

3. Hallucinated or malformed tool arguments

What it looks like. A plausible but nonexistent customer_id. An ISO date in the wrong timezone. A file path that was never listed. A SQL WHERE clause that has been quietly dropped. Or a parameter the schema doesn't define at all.

Why it happens. The model fills gaps with the most likely value. Strict schema modes catch shape errors. They don't catch semantic ones: {"customer_id": "cus_8f2a"} is valid JSON for a customer who doesn't exist.

Signals.

  • Schema validation failures (count them; don't just retry them).
  • Referential checks fail: the ID doesn't exist, or wasn't returned by any earlier tool call in this run.
  • High-impact arguments (amounts, recipients, DELETE scope) outside expected ranges.

4. Premature completion

What it looks like. "All tests pass" when the tests were never run. "Email sent" when the send tool returned an error. "Migration complete" after one of three steps. MAST lists premature termination and no or incomplete verification as separate modes, and in practice they show up together.

Why it happens. Models are trained to produce satisfying final answers. Stopping is cheap; checking is expensive. If the only completion signal is the model saying "done", you will get "done" too early.

Signals.

  • The final answer claims an outcome that no tool result in the trace supports.
  • Required steps for the task type are missing from the trace.
  • A post-condition check fails (tests, row counts, HTTP status of the deployed thing).

5. Cascading errors

What it looks like. Step 3 reads the wrong config. Steps 4 to 20 build on it faithfully, and by the end the agent has a confident, internally consistent and entirely wrong result. In a multi-agent architecture, one agent's mistake becomes another agent's input, and the second agent rarely doubts it.

Why it happens. Nothing in a plain agent loop re-checks earlier conclusions. Each step treats prior context as true.

Signals.

  • Later tool errors that only make sense if an earlier assumption was wrong (404s on IDs the agent "found").
  • Disagreement between independent checks: the agent's summary versus a deterministic query.
  • In multi-agent set-ups, downstream agents rejecting or re-requesting upstream output.

6. Destructive or out-of-policy actions

This is the expensive one. The public example most people know: in July 2025, during a declared code freeze, Replit's agent ran destructive commands against SaaStr founder Jason Lemkin's production database. It then told him a rollback wouldn't work, which turned out to be wrong (Lemkin's post; Replit CEO Amjad Masad's response). The lesson isn't "that model was bad". The agent had credentials that allowed the action, and the freeze lived only in natural language. OWASP lists this class of failure as LLM06:2025 Excessive Agency. Its mitigations are the ones we'd use: least functionality, authorisation enforced in downstream systems "rather than relying on an LLM to decide", and human approval for high-impact actions.

Signals. By the time you see the signal, it's too late. This category is about prevention: credentials, sandboxes and approval gates. See Sandboxing AI agents that run code: containers vs gVisor vs Firecracker, and locking down egress for the execution side.

03Budgets and step limits: the cheapest control you'll ever add

Every agent run should have four budgets, enforced by the agent harness, not the prompt:

Budget What it bounds Typical failure it contains
Steps / turns Model calls in the loop Loops, runaway planning
Tokens Input + output across the run Context bloat, repetitive tool output
Money Tokens × price, plus paid tool calls Everything, as a backstop
Wall-clock Elapsed time Hung tools, slow external systems

The frameworks give you the first one, with very different defaults:

  • LangGraph: recursion_limit defaults to 25 super-steps and raises GraphRecursionError when hit (docs). A super-step is one round of active nodes, not one LLM call, so 25 may be more or fewer model calls than you think.
  • OpenAI Agents SDK: Runner.run(..., max_turns=...) defaults to 10 and raises MaxTurnsExceeded (running agents). Passing max_turns=None disables it. Don't.
  • Claude Agent SDK: ClaudeAgentOptions(max_turns=..., max_budget_usd=...), both unset (unbounded) by default (options reference). The budget is checked against a client-side cost estimate, so treat it as a backstop rather than an exact cap.

Framework limits are a floor. You also want token and money budgets that hold across frameworks, plus budgets per tool, so one runaway search tool can't use up the whole run.

Why step limits matter more than you'd think: a worked cost model

Agent loops resend the entire conversation on every step, so cost grows roughly quadratically with steps, not linearly.

Assumptions (illustrative): the context starts at 8,000 tokens (system prompt, tools, task); each step adds 2,000 tokens (tool call plus result); input price is $3 per million tokens; no prompt caching; output tokens ignored for simplicity.

Input tokens over n steps = 8,000·n + 2,000·n(n−1)/2

Steps (n) Input tokens Cost at $3/M
10 170,000 $0.51
25 800,000 $2.40
50 2,850,000 $8.55
100 10,700,000 $32.10

Going from 25 to 100 steps is 4× the steps and about 13× the cost. Prompt caching lowers the constant a lot but doesn't change the shape. Long runs also hit the model's context limit, which triggers compaction, which is exactly when goal drift tends to start. Context engineering for long-running agents is how you push that point further out. So a loop that hits a limit of 100 doesn't only waste $30. It spends the last 75 steps in the zone where the agent is least reliable.

What we'd do: set the step limit near the p99 of successful runs for that task type, plus some headroom. Measure first; 1.5× p99 is a reasonable starting point. Don't set a single global number. A "classify this ticket" agent that needs more than 6 steps is broken. A coding agent might legitimately need 80.

04Detecting loops and drift in the harness

Here is a provider-neutral guard we'd wrap around any agent loop. It enforces the four budgets, detects exact and near-exact repetition, tracks progress, and checks tool scope. It's deliberately boring Python.

python
import hashlib, json, time
from collections import Counter
from dataclasses import dataclass, field

class BudgetExceeded(Exception): ...
class LoopDetected(Exception): ...
class OutOfScope(Exception): ...

def canonical(args: dict) -> str:
    # Sort keys and strip whitespace so trivially different calls hash the same.
    return json.dumps(args, sort_keys=True, separators=(",", ":"))

@dataclass
class RunGuard:
    task_type: str
    max_steps: int
    max_input_tokens: int
    max_usd: float
    max_seconds: float
    allowed_tools: frozenset[str]
    max_identical_calls: int = 3
    max_consecutive_errors: int = 4
    max_steps_without_progress: int = 8

    steps: int = 0
    input_tokens: int = 0
    usd: float = 0.0
    started: float = field(default_factory=time.monotonic)
    call_counts: Counter = field(default_factory=Counter)
    consecutive_errors: int = 0
    last_error: str | None = None
    steps_since_progress: int = 0

    def on_model_call(self, input_tokens: int, usd: float) -> None:
        self.steps += 1
        self.input_tokens += input_tokens
        self.usd += usd
        self.steps_since_progress += 1
        elapsed = time.monotonic() - self.started
        if self.steps > self.max_steps:
            raise BudgetExceeded(f"steps>{self.max_steps}")
        if self.input_tokens > self.max_input_tokens:
            raise BudgetExceeded(f"tokens>{self.max_input_tokens}")
        if self.usd > self.max_usd:
            raise BudgetExceeded(f"usd>{self.max_usd}")
        if elapsed > self.max_seconds:
            raise BudgetExceeded(f"seconds>{self.max_seconds}")
        if self.steps_since_progress > self.max_steps_without_progress:
            raise LoopDetected("no progress")

    def before_tool(self, name: str, args: dict) -> None:
        if name not in self.allowed_tools:
            raise OutOfScope(f"{name} not allowed for {self.task_type}")
        key = hashlib.sha256(f"{name}:{canonical(args)}".encode()).hexdigest()
        self.call_counts[key] += 1
        if self.call_counts[key] > self.max_identical_calls:
            raise LoopDetected(f"{name} called {self.call_counts[key]}x with same args")

    def after_tool(self, name: str, ok: bool, error: str | None, progressed: bool) -> None:
        if ok:
            self.consecutive_errors, self.last_error = 0, None
        else:
            self.consecutive_errors += 1
            if error == self.last_error and self.consecutive_errors >= 2:
                # Same error twice in a row: the model is not learning from it.
                raise LoopDetected(f"repeated error from {name}: {error[:120]}")
            self.last_error = error
            if self.consecutive_errors >= self.max_consecutive_errors:
                raise LoopDetected(f"{self.consecutive_errors} consecutive tool errors")
        if progressed:
            self.steps_since_progress = 0

The weak point is progressed. You have to define progress for each task type: a new file written, a test that now passes, a subgoal ticked off in a structured plan, a record created. If you can't define progress for a task, that tells you something. The task probably isn't ready for an autonomous agent.

Two refinements worth having:

  1. Make tool errors useful before you make detectors cleverer. Many loops are caused by the tool, not the model. Return {"error": "customer cus_8f2a not found; call search_customers first", "retryable": false} instead of a stack trace. A retryable flag lets the harness, rather than the model, decide whether retrying makes sense.
  2. Pin the goal. Keep the original task and its hard constraints in a fixed block that compaction never touches, and restate it whenever context is summarised. This is the cheapest drift control there is.

05Validating tool arguments before they reach anything real

Schema validation is necessary and nowhere near enough. Use three layers:

python
from pydantic import BaseModel, Field, field_validator

class RefundArgs(BaseModel):
    model_config = {"extra": "forbid"}          # reject invented parameters
    order_id: str = Field(pattern=r"^ord_[a-z0-9]{12}$")
    amount_pence: int = Field(gt=0, le=50_000)  # hard ceiling; above it, a human
    reason: str = Field(min_length=10, max_length=500)

def validate_refund(raw: dict, run) -> RefundArgs:
    args = RefundArgs.model_validate(raw)                 # 1. shape
    if args.order_id not in run.observed_ids("order"):    # 2. provenance
        raise ValueError("order_id was not returned by any prior tool call")
    order = orders.get(args.order_id)                     # 3. semantics
    if args.amount_pence > order.captured_pence - order.refunded_pence:
        raise ValueError("refund exceeds refundable balance")
    return args

The provenance check is the one most teams leave out, and it catches the largest share of hallucinated IDs. Track every identifier that tool results have returned during the run. Reject arguments that reference identifiers the agent can't have learned legitimately. It is cheap, deterministic and hard for the model to talk its way around.

Then enforce authorisation in the downstream system, with credentials scoped to the run, as OWASP recommends. The validator is a guard rail. The database role that can't DROP TABLE is the wall.

06Stopping premature completion: verify against the world

Never accept the model's final message as proof of completion. For each task type, define a post-condition: a deterministic check that runs after the agent says it's done and decides whether the run succeeded.

Task type Agent says Post-condition the harness runs
Fix failing test "Tests pass" Run the test suite in a clean sandbox; exit code 0
Send customer reply "Reply sent" Message ID exists in the outbound provider's API
Data backfill "Backfill complete" COUNT(*) of target rows matches source within tolerance
Open a PR "PR opened" PR exists, CI started, diff touches only allowed paths
Research summary "Done" Every cited URL appears in a fetch result in the trace

When the post-condition fails, you have two choices. Feed the failure back to the agent as a new observation, which works well and is bounded by the remaining budget. Or end the run as unverified and route it to a human. Do the first at most once or twice. After that, the agent is telling you it can't do the task.

For subjective outputs, an LLM-as-judge can act as a post-condition, but use a different model or at least a different prompt, give it the original task rather than the agent's paraphrase of it, and calibrate it against human labels before you trust it, as you would when you build LLM evals with a judge grader.

07Checkpoints and human-in-the-loop that people will actually use

Human approval only works if it's rare enough that people read what they're approving. Approval on every step trains reviewers to click "approve" without looking. Gate on impact, not on step count.

What we gate:

  • Anything irreversible: deletes, payments, external messages, production deploys.
  • Anything above a value threshold (money, number of affected records, number of recipients).
  • Anything outside the declared scope of the run.
  • Any run that has tripped a soft detector, such as a near-loop or a drift score below threshold, instead of killing it outright.

Both major SDKs now support pause-and-resume approvals as a built-in feature.

LangGraph uses interrupt() inside a node, together with a checkpointer and a thread_id. You resume by passing Command(resume=value) (interrupts docs):

python
from langgraph.types import interrupt, Command

def approve_refund(state):
    decision = interrupt({
        "action": "refund",
        "order_id": state["order_id"],
        "amount_pence": state["amount_pence"],
        "evidence": state["evidence_summary"],
    })
    if decision != "approve":
        return {"status": "rejected_by_human"}
    return {"status": "approved"}

config = {"configurable": {"thread_id": run_id}}
graph.invoke(initial_input, config=config)            # pauses at interrupt
# ...hours later, from your approval UI:
graph.invoke(Command(resume="approve"), config=config)

One trap: on resume, LangGraph re-runs the whole node from the top, not from the line where interrupt was called. The docs say plainly that side effects before interrupt must be idempotent. Put the approval in its own node, and do the side effect in the next node.

OpenAI Agents SDK marks tools with needs_approval. Pending calls appear in result.interruptions, and the run state serialises so you can resume later (human-in-the-loop docs):

python
result = await Runner.run(agent, task, max_turns=20)
if result.interruptions:
    state = result.to_state()
    await approvals.save(run_id, state.to_string(), result.interruptions)

# Later, after a human decides:
stored_state, decisions = await approvals.load(run_id)
state = await RunState.from_string(agent, stored_state)
for item in state.get_interruptions():
    if decisions[item.raw_item.call_id] == "approve":
        state.approve(item)
    else:
        state.reject(item)
result = await Runner.run(agent, state)

What the approver sees matters more than the plumbing. Show the concrete action and arguments, the evidence behind it (the tool results that led there, not the model's narrative), and the blast radius ("affects 1 order, £42.00"). An approval card that says "The agent would like to proceed. Approve?" is worse than having no gate at all, because it gives you false assurance.

08Recovery and resumability: design for the run that dies halfway

Agent runs are long, slow and full of external calls. Processes get killed, deploys roll, providers return 529s. Unless you plan for it, a run that dies at step 37 of 40 either starts again from zero (wasting money, and probably repeating side effects) or is simply lost.

The architecture we'd build

Diagram
         ┌───────────────────────────────────────────────┐
task ──▶ │  Orchestrator (durable)                       │
         │  ┌─────────┐   ┌──────────┐   ┌────────────┐  │
         │  │ RunGuard│──▶│ LLM step │──▶│ Tool router│──┼──▶ tools (scoped,
         │  └─────────┘   └──────────┘   └─────┬──────┘  │     idempotent)
         │        ▲                            │         │
         │        └──── checkpoint after ◀─────┘         │
         │              every step                       │
         └───────┬───────────────────────────┬───────────┘
                 │                           │
           checkpoint store            approval queue
        (Postgres / durable log)     (interrupts, HITL UI)
                 │
           traces (OTel gen_ai.* spans) ──▶ detectors / alerts

The rules that make this work:

  1. Checkpoint after every step, before the next model call. Store the message history, the plan, the guard counters and the observed-ID set. LangGraph's checkpointers (use the Postgres one in production, not the in-memory saver) do this for you. If you're on a workflow engine such as Temporal, each LLM call and tool call becomes an activity, and the engine's history is your checkpoint.
  2. Every side-effecting tool takes an idempotency key, built from run_id + step_index + tool_name. When a run resumes and replays the last step, the payment provider, email API or your own service sees a duplicate key and returns the original result. Without this, resumability means double refunds.
  3. Separate "decide" from "do". The model emits an intended action. The harness records it in the checkpoint, then runs it. On recovery you can see exactly which actions were decided, which were completed, and which are uncertain.
  4. Resume with a recovery note. When a run restarts after a failure, add a short system message: "This run was interrupted after step 37. The last action, create_invoice(inv_…), completed with result X." Otherwise the model may redo or second-guess work it can't remember finishing.
  5. Make "abandon" a first-class outcome. Some runs shouldn't be resumed: the world has moved on, or the guard tripped on drift. Mark them abandoned, keep the trace, and compensate if needed (cancel the half-created resources). A saga-style compensation list per tool works well here.

Rollback is a property of your tools, not your agent

The agent can't undo what your tools can't undo. Before you give an agent a write tool, ask whether a human could reverse the action in five minutes. If not, either give the tool a soft-delete or dry-run mode, or put it behind an approval gate. Point-in-time recovery on the database the agent can touch is not optional, and your backups don't exist until you've restored them. That's also the main lesson of the Replit incident.

09Observability: what to log for every agent run

You can't detect any of this without traces; our post on observability for LLM apps goes through the set-up. OpenTelemetry's GenAI semantic conventions define agent and tool spans with attributes such as gen_ai.operation.name, gen_ai.tool.name, gen_ai.tool.call.id, gen_ai.conversation.id and gen_ai.usage.input_tokens. They now live in their own semantic-conventions-genai repository and every attribute is still marked as in development, so pin the convention and instrumentation versions you build against. Use them anyway. They let your detectors run on any backend.

Per run, record at least: task type, model and version, prompt version, each step's input/output tokens and latency, each tool call with canonical args hash, result status and error class, guard counters, terminal state (succeeded, verified_failed, budget_exceeded, loop_detected, out_of_scope, abandoned, awaiting_approval), and post-condition outcome.

That terminal-state distribution, broken down by task type and prompt version, is the single most useful agent dashboard you can build. A prompt change that moves 4% of runs from succeeded to budget_exceeded will show up there before any customer notices.

10The agent failure runbook (reference)

This is the asset to keep. Each row is a signal the harness can compute, a starting threshold, the automatic action, and who gets told. The thresholds are starting points, not truths. Tune them against your own p95/p99 data.

Failure mode Signal Starting threshold Automatic action Escalate to
1 · Exact loop Same (tool, canonical_args) hash > 3 in one run Stop run → loop_detected; keep checkpoint Owning team, async
2 · Error loop Same error string, consecutive calls 2 in a row Inject "this approach failed; try alternative or stop" once; then stop Tool owner (error is probably unhelpful)
3 · Stalled progress Steps since last progress event > 8 Pause → awaiting_approval with trace summary On-call reviewer
4 · Step overrun Steps vs task-type limit > 1.5 × p99 of successful runs Stop → budget_exceeded Owning team; review limit weekly
5 · Cost overrun Run USD vs budget > budget (per task type) Hard stop; no resume without human Owning team + FinOps on repeat
6 · Wall-clock overrun Elapsed vs limit > limit Stop; mark in-flight tool calls uncertain Owning team
7 · Scope drift Tool not in task's allow-list Any Block call; return error to model; stop on second attempt Security if tool is write-capable
8 · Resource drift Path/table/tenant outside declared scope Any Block call at tool router; stop run Security, sync
9 · Semantic drift Judge score of plan vs original task < calibrated threshold Pause for review (don't auto-kill: judges err) On-call reviewer
10 · Malformed args Schema validation failure > 2 per tool per run Stop; log tool + model version Owning team (schema or description unclear)
11 · Hallucinated IDs Arg references ID not in observed set Any Block call; return "unknown ID, look it up first" None unless repeated
12 · High-impact action Irreversible or above value threshold Any Require human approval with evidence + blast radius Approver queue
13 · Premature completion Post-condition fails after "done" 1st failure Return failure as observation, one retry –
14 · Unverified completion Post-condition fails again 2nd failure End → verified_failed; route output to human Owning team
15 · Cascade (multi-agent) Downstream agent rejects upstream output > 1 per handoff Stop pipeline at handoff; checkpoint both sides Owning team
16 · Crash mid-run Process dies with run in running Heartbeat missed > 60s Resume from last checkpoint with recovery note; idempotency keys protect replays None unless resume fails
17 · Fleet regression Share of succeeded per task type Drops > 3 pts vs 7-day baseline Alert; freeze prompt/model rollouts Owning team, sync

Three rules go with the table:

  • Every stop keeps a checkpoint. Killing a run should never destroy the evidence or the option to resume.
  • Every row has an owner. Rows 2 and 10 usually point to a tool or schema problem, not a model problem. Send them to whoever owns the tool.
  • Review the table monthly. If a detector never fires, it's either set too loose or watching for something that doesn't happen. If it fires constantly, it's training people to ignore it.

11How agent reliability crosses into the rest of the stack

Almost none of the fixes above live in the prompt. Scoped credentials and downstream authorisation are a Security problem. Point-in-time recovery, soft deletes and idempotency keys belong to Data and Software. Durable orchestration, checkpoint storage and trace pipelines are Cloud & DevOps. The approval card that makes a reviewer actually read the blast radius is a Design problem. And deciding which tasks deserve autonomy at all is Strategy. Teams that treat agents as purely an AI-team concern tend to find these gaps in production, one layer at a time.

12When you probably don't need an agent at all

If the steps are known in advance, write a workflow: a fixed sequence of LLM calls and deterministic code. It will fail in fewer and more predictable ways. Anthropic's guidance draws the same line between workflows and agents. Use the agent loop for the part that really needs open-ended planning, and keep it small. In our view, the most reliable "agents" are mostly workflows, with one bounded agentic step inside.

13FAQ

What is the most common way AI agents fail in production? The two we'd expect first are loops and premature completion. Loops are usually caused by unhelpful tool errors. Premature completion happens because nothing checks the agent's claim of success. Both are cheap to detect: hash repeated tool calls, and run a deterministic post-condition before accepting "done". MAST's analysis of multi-agent traces also found that step repetition and verification failures were widespread.

What step limit should I set for an AI agent? Measure first. Set the limit per task type at around 1.5× the p99 step count of successful runs, then tune it. Don't rely on framework defaults (LangGraph's 25 super-steps, the OpenAI Agents SDK's 10 turns), and never disable the limit. Add token, cost and wall-clock budgets as well, because a step limit alone won't catch a few very large steps.

How do I stop an agent from calling tools with made-up arguments? Use three layers. Strict schemas with extra="forbid" catch shape errors. A provenance check rejects any ID that no earlier tool call returned. Semantic checks against the real system catch impossible values. Then enforce authorisation in the downstream service, so a bad call that gets through still can't do damage.

Should every agent action need human approval? No. Approving every step trains reviewers to approve without reading. Gate irreversible actions, actions above a value threshold, out-of-scope actions and runs that have tripped a soft detector. Show the concrete action, the evidence behind it and the blast radius.

How do I resume an agent run after a crash without repeating side effects? Checkpoint after every step to durable storage. Give every side-effecting tool an idempotency key derived from run ID and step index. Record each intended action before executing it. When resuming, add a recovery note so the model knows what already completed. In LangGraph, remember that resuming re-runs the whole interrupted node.

Can a better model fix these failure modes? It reduces how often they happen. It doesn't change the fact that they can happen. τ-bench's pass^k results show that agents which often succeed still fail on repeated tries of the same task. Budgets, validation, post-conditions and checkpoints are what make the remaining failures cheap and recoverable.

If this is the layer that hurts, we should talk.

Tell us which layer hurts →