Stop Paying for Invisible Retries: How to Measure What an AI Agent Really Costs
Imagine you hire a researcher to answer a question. They hand you a neat one-page report and say, "That took me 10 minutes." What they don't tell you:
- They made two wrong turns.
- They rewrote the summary because the first draft was in the wrong format.
- They actually spent 20 minutes, but only billed you for the parts that worked.
That is how most AI agents report their cost today.
The attempts nobody counts
An agent step rarely succeeds on the first call. The model answers in prose when you asked for JSON, so the step asks again. A reviewer rejects the answer, so the review runs again. Your provider bills every one of those calls. Most tracking only keeps the call whose answer you ended up using. The failed attempts are spent, billed, and missing from your own numbers.
Here is one small job, two steps, with every call on the receipt:
| step | attempt | result | cost |
|---|---|---|---|
| extract | 1 | failed: prose instead of JSON | $0.005 |
| extract | 2 | ok | $0.006 |
| review | 1 | failed: answer rejected | $0.027 |
| review | 2 | ok | $0.028 |
what you paid: $0.066
what success-only shows: $0.034
The dashboard says $0.034. The provider charges $0.066. In this run, 48% of the spend is invisible, and nothing about the answer tells you it happened. The numbers are illustrative, but the shape is not. Any retry that happens below the layer that records cost is a retry you pay for twice and see once.
Put the retry where the bill can see it
Spendgraph makes one design choice about this: the retry wraps the whole recorded call, not just the model request inside it.
retry inside the callretry around the call
┌ recorded call ──────────
Comments
No comments yet. Start the discussion.