DEV Community

Cover image for It's Not the Model: Five Checks That Catch Agent Workflows Before Production
getletset
getletset

Posted on

It's Not the Model: Five Checks That Catch Agent Workflows Before Production

# Why Most AI Agent Workflows Break in Production — and the Five Checks That Catch It Early

Everyone has a demo that works. Very few have a workflow that survives Tuesday.

I've read through a lot of agent pipelines — internal ones, open-source ones, the ones people post asking "why does this randomly do X". The failure patterns repeat with almost boring regularity. What's more interesting: almost none of them are model capability problems. They're contract problems. Swapping in a stronger model fixes exactly none of them.

Here are the five I see most often, and the check that catches each one before it reaches production.

## 1. Context drift

A long-running task accumulates its own history. By step 30, the agent is reasoning from a summary of a summary of step 4, and the original constraint — "don't touch the billing schema" — has quietly evaporated. Nothing errors. The agent just starts solving a slightly different problem than the one you gave it.

The usual fix is "better prompting", which is the wrong layer. Prompts don't survive compression.

The check: does any step re-assert the hard constraints from the original request, independently of the conversation history? If a constraint only exists inside the message log, it is already gone.

## 2. Unverified self-assessment

The agent writes the code, then writes the test, then reports that the test passes. This is not verification; it's a closed loop with one participant. It will report success with total confidence, and it will be wrong at a rate that stays invisible to you because you only ever see the successes that happened to be real.

The check: can you name the independent verifier? It has to be something the generator cannot influence — a deterministic assertion, a different model with no access to the reasoning trace, or a human gate. If the answer is "the agent checks its work", you have no verifier.

## 3. Silent tool failure

A tool returns empty. An API returns 200 with an error body. A search returns zero results because the query was malformed. The agent treats all three as "completed, nothing to report" and keeps building on the void. Ten steps later you get a fluent, well-structured, entirely fictional answer.

This one is brutal because there is no exception to catch.

The check: does every tool have a success/failure contract that is distinct from "returned something"? Empty is not success. 200 is not success if the body says otherwise. If you can't state a tool's failure condition in one sentence, you don't know when it's lying to you.

## 4. Retry amplification

Non-idempotent side effects plus automatic retries equals duplicate orders, duplicate emails, duplicate charges. The agent sees a timeout, retries, and the first attempt was actually fine. Now you have two.

The check: classify every side effect as reversible / compensable / irreversible, and put the irreversible ones behind an idempotency key or a human confirmation. "It usually works" is not a classification.

## 5. Over-broad agency

The agent has write access to everything, because scoping permissions is tedious. Then one plausible-sounding misinterpretation reaches production data. The damage isn't proportional to the bug — it's proportional to the permissions.

The check: for each credential the agent holds, can you name the task that requires it? If not, remove it. Least privilege is cheap; incident response isn't.


## The pattern

Notice what these have in common. Every one is a missing boundary: a missing constraint re-assertion, a missing independent verifier, a missing failure contract, a missing idempotency key, a missing permission scope.

Boundaries are unglamorous. They don't demo. They don't make it into the launch thread. But they are the entire difference between a workflow that runs and a workflow that mostly runs.

The temptation, when an agent misbehaves, is to upgrade the model. Notice that a stronger model fails these five checks in exactly the same way — faster, and with more convincing prose.

## The 15-minute audit

Before shipping any agent workflow, answer these five in writing. If you can't, you've just found your next task.

  1. Where do the original hard constraints get re-asserted, independent of the message history?
  2. Who is the independent verifier, and what can it not see?
  3. For each tool: what does failure look like, and how is it distinguished from empty success?
  4. Which side effects are irreversible, and what stops a retry from duplicating them?
  5. For each credential the agent holds: which task requires it?

Five questions. Most workflows fail two or three of them.


Next in this series: how to actually measure the failure rate instead of guessing at it — the harness, the metrics, and what "reliable enough" means for a task that has no test suite.

Top comments (0)