The cost death spiral: when errors buy retries and retries buy more errors

An agent that fails a step often retries it, and each retry re-sends a longer context. Left unchecked, the loop spends more to get less, and the ROI goes negative while the dashboard stays green.

B

Balagei G Nagarajan

4 MIN READ


A downward spiral where each loop is labeled error then retry then larger context then more cost
So the retry is both more expensive and more likely to fail than the original attempt.
— from “The cost death spiral: when errors buy retries and retries buy more errors”

Key facts.

  • The "Expensively Quadratic" analysis of the LLM agent cost curve shows agent loops grow cost roughly quadratically because each turn re-sends the full history, so a ten-turn session lands near 50x a single call rather than 10x, with cache reads dominating long conversations. source
  • "The Illusion of Diminishing Returns" found per-step execution accuracy degrades as steps increase, partly through a self-conditioning effect where prior errors in context make further errors more likely, so success after t steps falls roughly as p to the power t. source
  • Together these mean the longest, most retry-heavy runs are both the most expensive and the most error-prone, which is the mechanism of the spiral. source

How does the spiral actually start?

It starts with a single unhandled failure. A tool returns an error, or a step produces a wrong result, and the agent decides to try again. That retry re-sends the conversation so far, which is now longer, so it costs more. The longer context is also harder to reason over, and the self-conditioning effect means the earlier error sitting in the context nudges the model toward another. So the retry is both more expensive and more likely to fail than the original attempt. When it fails, the agent retries again, with an even longer context, and the loop has begun. Each turn around the loop spends more and succeeds less, which is the definition of a spiral.

The reason a stronger model does not save you is that neither driver is about raw capability. The cost driver is the quadratic accumulation of re-sent history, which is the same for any model. The error driver is per-step degradation over long runs, which holds across model sizes. A more capable model might start the spiral less often, but once it is in one, it pays the same accumulation tax and faces the same long-horizon decay. The fix is not a better model. It is a circuit breaker.

Radial spiral diagram with cost and error rate both climbing turn by turn until a circuit-breaker cap halts it

What stops a cost death spiral?

A hard limit and a reset. The hard limit is a per-task budget cap and a retry ceiling, so the loop cannot run unbounded no matter what the agent decides. The reset is context management: instead of re-sending an ever-growing transcript, summarize the state and start the retry from a compact context, which breaks both the cost accumulation and the self-conditioning that the old errors were feeding. With those two controls, a failure becomes a bounded, cheap event that either recovers quickly or escalates to a human, rather than an open-ended loop that drains the budget while the dashboard reports the agent as busy.

Without controlsWith circuit breaker
Retries unboundedRetry ceiling enforced
Context grows every retryContext reset to compact state
Cost accumulates quadraticallyCost capped per task
Errors self-condition more errorsOld errors cleared on reset

The Pattern Intelligence Layer is where the spiral is caught as a pattern, not after the invoice. Retry rate, context growth, and cost per task are tracked at the pattern level, so a run that starts to loop is flagged and capped before it drains the budget. Reliability at the pattern level means a failed step is a bounded cost with a known exit, which is what keeps one bad attempt from turning into a death spiral.

Frequently asked questions

Why don't retries just fix the problem?
Because each retry re-sends a longer context, costing more, and the earlier error in that context makes another error more likely. The retry is both pricier and less reliable than the first attempt.

Will a better model avoid the spiral?
It may start one less often, but once in it, the same quadratic cost accumulation and long-horizon accuracy decay apply. The fix is a budget cap and context reset, not a bigger model.

How do I cap it without losing recovery?
Set a retry ceiling and per-task budget, and reset context to a compact summary on retry. A failure then recovers cheaply or escalates, instead of looping unbounded.


Share this post

Join the discussion

Have a take, a war story, or a question? Sign in with GitHub to comment and react. Comments are powered by GitHub Discussions, ad-free and yours to moderate.

Continue Reading

Find where your agent breaks, before you build it

Faultmap maps where your agent will fail from the goal and your data, then hands you the first test suite it has to pass.