Agent Cost Monitoring: What a Cost Spike Usually Means
Short answer
A rising LLM API bill for a production agent is often a reliability signal, not just a budget issue. Retry storms on hallucinated tool calls, context accumulation across a long agent loop, and runaway tool calls all inflate cost before they show up as a visible error rate or a user complaint. Each has an upstream change behind it, sometimes one that never touched your repo.
A 200-task benchmark published in April 2026 found that 90.8% of an AI agent’s retries were wasted: 466 of 513 retry attempts hit a tool name the model had hallucinated, a permanent error no amount of retrying could fix (Towards Data Science).
Every one of those retries is a billed API call. A team watching only total spend sees those wasted retries as a cost line moving the wrong direction, not as a hallucination problem with a name.
This is the pattern behind most agent cost monitoring gaps: the dashboard shows the number going up, not why. Cost is often the first signal a production agent gives when something breaks, and it usually arrives before a user complains or a support ticket opens.
What Rising Agent API Costs Usually Mean
Three failure modes inside the agent produce a cost signature before they produce a visible quality problem.
The first is retry storms on non-retryable errors, the pattern in the benchmark above. A hallucinated tool name or a malformed argument fails every time, and a retry policy built for transient errors like timeouts burns budget on a call that was never going to succeed.
The second is context accumulation. Augment Code’s analysis of agent loop token costs found that each step’s tool output and reasoning trace gets carried into every later call, so a 20-step loop generates roughly 10 times the cumulative input tokens a flat per-step estimate would suggest.
In their worked example, a naive 10-step file-reading agent cost about 43 times more than a single-pass version of the same task.
The third is a runaway tool loop: the agent calls the same tool repeatedly with similar arguments, reasoning over a result that never resolves the task. Each iteration bills tokens whether or not it moves the agent closer to done.
There is a fourth that never comes through your repo. The model provider updates the model underneath you, responses get more verbose, and per-session cost climbs with nothing in your diff to explain it.
None of these show up in an error rate. The agent completes the task, or times out cleanly, and the cost is the only signal that something is wrong.
Telling Benign Growth From a Reliability Problem
More users spending more money looks similar to a misbehaving agent spending more money, at least on a total-spend graph. The difference shows up at the session level.
Benign growth moves with traffic: session count and total cost rise together, and average cost per session stays flat. A reliability problem moves independent of traffic: cost per session climbs on its own, or a small number of sessions account for a disproportionate share of new spend.
Each failure mode leaves a trace-level fingerprint that doesn’t require knowing the agent’s error rate ahead of time. A tool invoked repeatedly with near-identical arguments that keep failing echoes the retry-storm pattern in the benchmark above; the same shape where every call succeeds but the task gets no closer to done is a runaway loop. A prompt size that climbs step over step within a session echoes the context-accumulation pattern Augment Code measured. Output tokens jumping across every session at once, with no deploy on your side, points at a provider update, not your code.
Setting Up Agent Cost Monitoring That Catches Quality Problems
A cost anomaly is a useful alert only if it points at a cause. Session-level cost tracked alongside the signals already watching for hallucination and tool failure turns a spend spike into a specific, actionable finding instead of a line item someone has to go investigate by hand.
The New Stack’s reporting on agentic system failures put it plainly: “Systems that cannot answer questions about which actions they took, why those actions were taken, how much each action cost and how/why each action failed have not moved past the demo stage, regardless of the quality of the output.”
Correlating cost with quality is what closes that gap. Tessary reads the trend in cost per session alongside the trend across grader verdicts, rather than any single spike; a grader misfires at a stable rate, so cost and a quality signal moving together marks a real change. When they do, the same graders that already flag tool errors and hallucinations show which one fired on the expensive sessions, and the correlated alert routes to Slack, PagerDuty, or Linear instead of a dashboard nobody is watching.
The correlation still isn’t the cause. The last step is tracing the failure back to the change that started it: the prompt edit that kicked off the retry storm, the tool update that broke a schema and turned every call into three, the provider update that raised token counts with no deploy on your side. When your agent starts costing more in production, Tessary tells you what caused it, in time to fix it before the bill compounds.
Tessary runs this over your existing traces, whether they arrive through OTLP or get pulled from a connected Langfuse or Braintrust source. Your Langfuse dashboard will show the cost line and the score line both moving; it won’t say which change made them move. Tessary reads the same traces and answers that question. Setting up agent monitoring and alert routing covers the wiring. Connecting a source takes a few minutes, with no new instrumentation and no credit card.
Frequently asked questions
- What does a sudden spike in agent API costs usually mean?
- It usually means one of three things is happening under the hood: the agent is retrying calls that can never succeed (a hallucinated tool name, for example), a long-running loop is carrying every prior step's output into each new call and compounding token cost, or a tool is being called repeatedly without the task getting closer to done. All three inflate cost before they produce a visible error rate. A fourth cause never appears in your repo at all: the model provider updates the model underneath you and responses get more verbose.
- How do I tell if a cost increase is from more users or a broken agent?
- Check whether cost per session is flat or rising. Benign growth moves with traffic: session count and total cost rise together, and the average cost per session stays about the same. A reliability problem shows cost per session climbing on its own, or a small number of sessions accounting for a disproportionate share of new spend, independent of how much traffic increased.
- Why do agent loops get so much more expensive the longer they run?
- Most agent loops resend the full conversation history, including every prior tool result and reasoning step, on each new call. That makes token cost grow roughly with the square of the number of steps rather than linearly. Augment Code's analysis of agent loop token costs found a naive 20-step loop can generate around 10 times the cumulative input tokens a flat per-step estimate would suggest.
- What is a retry storm in an LLM agent?
- A retry storm is when an agent's retry policy keeps retrying a call that fails for a permanent reason, such as a hallucinated tool name or a malformed argument, treating it the same as a transient error like a timeout. A 200-task benchmark found 90.8% of retries in one agent framework were spent on exactly this kind of non-retryable failure.
- How can I set up alerts for agent cost anomalies?
- Track cost at the session level alongside your existing quality signals (hallucination detection, tool-error rates, incomplete task completion) so a cost anomaly and a quality signal on the same session can be correlated automatically. Route the correlated alert, not the raw cost number, to the tool your team already watches: Slack, PagerDuty, or Linear.
Written by
Akhil Varma · Founder, Tessary
Akhil builds Tessary — AI personas that run real-browser usability tests on B2B SaaS products. Previously shipped product at multiple early-stage startups; writes about usability testing, AI personas, and the economics of B2B research.