SkyWaysThe agentic manual

Why your AI agent costs 4× the estimate, and how to fix it

No runaway, no single mistake: four sensible decisions by careful people, multiplying on flat traffic. And the dashboard alarm that gets the one fix that works switched off.

7 minutesIntermediateLesson 9 of 13Updated By

On this page
  1. Sound familiar?
  2. Why does an AI agent cost more than estimated?
  3. Fix the bill, step by step
  4. Where you'll use it
  5. Why it matters
  6. Try it
  7. Key takeaways
  8. FAQ
  9. Apply it in your role
  10. Sources and credits
All lessonsStart here

Getting started

  1. What is the agentic PDLC?
  2. How this tutorial works

Agentic PDLC fundamentals

  1. The evolution of the PDLC
  2. Why agentic AI projects fail
  3. P0 · Frame
  4. P1 · Design & Spec
  5. The one hard gate
  6. P2 · Build & Prove
  7. P3 · Run & Learn
  8. The eight loops
  9. The evidence pack

Methods decoded

  1. AI-DLC vs AIDD vs agentic SDLC
  2. What is AI-DLC?
  3. What is AIDD?
  4. What is the BMAD Method?
  5. What is spec-driven development?
  6. One lifecycle for every method
  7. How much process a change needs

Running delivery

  1. How to run an agentic AI project
  2. Bolts vs sprints
  3. A board for agentic work
  4. Cut delivery from months to weeks
  5. Review AI code by risk
  6. How accurate must an agent be?
  7. Prove the agent meets its bar
  8. Shadow mode and cut-over
  9. Why the AI bill is 4× the estimate
  10. Guardrails that hold
  11. The five governance gates
  12. Catch AI drift
  13. AI incident postmortems

By role

  1. For product managers
  2. For program managers
  3. For solution architects
  4. For engineers
  5. For forward-deployed engineers
  6. For QA
  7. For DevOps and platform
  8. For business sponsors
  9. For executives

Teams and organisation

  1. Team structure for agentic AI
  2. Measuring AI productivity
  3. The maturity model
  4. Rolling it out in 90 days

Practice

  1. The SkyWays case study
  2. The operating rhythm
  3. The workbench
  4. Twelve exercises

Interviews and careers

  1. What is an FDE?
  2. Six answer frameworks
  3. AI PM interview questions
  4. FDE interview questions
  5. GenAI engineer questions
  6. Agentic engineer questions
  7. AWS GenAI questions

In short

An AI agent's bill usually grows because four ordinary habits multiply: more context sent per call, a larger share on the expensive model, a cache that stops hitting, and more attempts per case. So read the per-call log rather than the price list, and confirm the four ratios multiply to the invoice ratio. Then fix them in order of (factor − 1) ÷ days to fix.

context1.62,100→3,360tokens×tier1.550%→100%frontier×cache1.371%→9% hit,f = 0.40×attempts1.421.2→1.7per case= 4.4× the estimate, on flat trafficcontext1.62,100→3,360tokens×tier1.550%→100%frontiercache1.371%→9% hit,f = 0.40×attempts1.421.2→1.7per case×= 4.4× the estimate,on flat traffic

Four ordinary habits, each a sensible decision by a careful person.

Fix in order of (factor − 1) ÷ days: context, tier, cache, then the breaker.

They multiply. The largest ratio change is not the largest factor.

In this lesson you'll learn:

  • how to decompose a surprise bill into four ratios from the per-call log;
  • why the fixes go in order of multiplier removed per day, not by urgency;
  • how to make a prompt cache pay, and the dashboard trap that gets it switched off.

Sound familiar?#

  • The bill tripled and traffic did not move.
  • The first response was a budget increase, and next quarter the bill grew again.
  • Someone found hundreds of "suspiciously fast" responses and proposed turning the cache off.

A bill that leaves its estimate on flat traffic means behaviour changed, and behaviour is only visible per call.

Why does an AI agent cost more than estimated?#

Because cost is a product of habits, not one runaway. Each habit is a sensible decision made by a careful person, and each on its own looks modest. At SkyWays, the fictional airline this manual follows, the day-75 bill was 4.4 times its estimate with traffic flat. Four ratios explained it:

HabitBaseline → nowFactor
Context: the whole conversation resent every turn2,100 → 3,360 tokens a call1.6
Tier: the capable model used for easy calls too50% → 100% on the frontier tier1.5
Cache: the prefix stopped being reused71% → 9% hit ratio1.3
Attempts: more retries per case1.2 → 1.7 attemptsabout 1.4

1.6 × 1.5 × 1.3 × 1.4 ≈ 4.4. Cost per case went from $0.60 to $2.64.

Fix the bill, step by step#

Step 1 · Read the per-call log, not the price list#

Take the log of individual model calls for a baseline week and for now, and compute the four ratios. If you do not have a per-call log (tokens in, tokens out, cache tokens read, model, attempts, per case), that is the first fix: route every call through one gateway that writes it.

Step 2 · Check that the factors multiply to the invoice#

Multiply the four ratios. If the product matches the ratio of this month's bill to the estimate, you have found the whole story. If it does not, a fifth cause exists, often idle infrastructure that bills for existing rather than for use.

Step 3 · Fix in order of multiplier removed per day#

Priority = (factor − 1) ÷ days to fix. It is usually not the order that feels most urgent:

FixFactorDaysPriority
Trim the context: send the slice, not the document1.60.51.2
Restore routing: easy calls to a cheaper model1.50.51.0
Make the cache hit: one model per session, stable prefix1.310.3
Fit a breaker: a loop cap and a token cap per case1.420.2

The breaker comes last and still matters: the other fixes lower a rate, but a breaker makes a runaway impossible, however it is triggered.

Step 4 · Make the cache pay#

A cached prefix costs a little more to write and much less to read. Against the input price, a five-minute cache write costs about 1.25×, an hour-long write about 2×, and a read about 0.1×, so a prefix used twice has already paid for itself, and one used ten times costs about a fifth. But it only pays if it hits: put nothing volatile inside the cached block, keep the request after the marker, and use one model per task, because the cache is scoped to the model.

toolssystemshared contextdomain contextcache markerthe requeststable: written once at 1.25×, read at 0.1×toolssystemshared contextdomain contextstable abovecache markerthe request

Move the request before the marker and no two calls share a prefix.

The hit ratio goes to zero and the caching line item still says it is on.

The cache matches an exact prefix. Stable first, marker, then whatever changes.

Step 5 · Avoid the dashboard trap#

Cache hits return fast. A latency dashboard that flags very fast responses as suspected failures will report hundreds of them, and someone will propose switching the cache off, raising the bill by about a third within a day, because the anomaly was the cache working. Put the cache tokens read in every trace row, and exclude cache hits from the alert.

Step 6 · Close the loop in the design#

The fix is not finished until the decision that allowed the habit changes: the model-tier decision record gets a new version, and cost per case becomes a monitored number with an owner and an alert. The cost loop

Where you'll use it#

  • The first time a bill surprises anyone, before any budget conversation.
  • In P1 design, where the context layout, routing and caching are decided.
  • In P3 operation, with cost per case on the same dashboard as quality.

Why it matters#

Escalating cost is one of the three reasons Gartner gives for expecting over 40% of agentic AI projects to be cancelled by 2027. A bill handled as a budget question recurs next quarter with a different multiple; handled as a design question, it falls, and stays down.

Try it#

A bill is 3× its estimate on flat traffic. The per-call log shows context up 1.5×, frontier-tier share up 1.25×, cache hit ratio unchanged, and attempts up 1.6×. Do the factors explain the bill, and what do you fix first? (Context fix: half a day; routing: half a day; breaker: two days.)

Show the answer

Yes: 1.5 × 1.25 × 1.6 = 3.0. Priorities: context (1.5 − 1) ÷ 0.5 = 1.0; attempts (1.6 − 1) ÷ 2 = 0.3; routing (1.25 − 1) ÷ 0.5 = 0.5. So the order is context, routing, then the breaker. The attempts factor is the largest single ratio here, but it takes the longest to fix, so it removes the least multiplier per day.

Key takeaways#

  1. A surprise bill is usually four habits multiplying (context, tier, cache, attempts), visible only per call.
  2. Fix in order of (factor − 1) ÷ days, and fit a breaker so a runaway is impossible.
  3. Make the cache hit, mark hits in the trace, and close the loop in the design with a monitored cost per case.

FAQ#

How do I reduce LLM costs in production?#

Measure per call first. Then trim the context you send each turn, route easy calls to a cheaper model, make your prompt cache actually hit, and cap loops and tokens per case. Most of the saving usually comes from the first two, in a day's work.

Does prompt caching reduce costs?#

Yes, when the cached prefix is reused. A cache write costs slightly more than normal input and a cache read costs a fraction of it, so a prefix reused even twice saves money. It stops saving if anything changing sits inside the cached block, or if the model changes mid-task.

What is a normal cost per task for an AI agent?#

There is no normal; there is your estimate, derived from tokens per call, calls per case and the price of each tier, and there is your measured cost per case against it. Track the ratio, and alert when it passes a threshold: this manual's default is 3×.

Why did our AI costs go up with no traffic change?#

Because behaviour changed: longer context, more calls on the expensive model, a cache that stopped hitting, or more retries, or infrastructure that bills while idle. The per-call log shows which; the invoice cannot.

Apply it in your role#

If you are…Do thisThe AI-augmented shortcut
A forward-deployed engineerPut the per-call log in on day one. The customer's first bill is the moment the engagement is judged.Ask a model to compute the four signatures from the log and name the largest.
A product manager or FDPMReport cost per case beside the saving, and ask "which signature?" whenever the bill moves.Have a model draft the bill explanation for finance from the four ratios.
A GenAI or agentic AI engineerStabilise the prompt prefix so the cache hits, route easy calls to a cheaper model, and cap loops and tokens per case.Ask a coding agent to restructure the prompt: stable blocks first, then the cache point, then the request.

Across the enterprise. A central gateway with cost tags per feature makes every team's bill diagnosable, and charging back by feature makes each owner care about theirs.

The ten-minute workflow. Diagnose a bill from the per-call log:

Here is our per-call log for two periods: <CSV: timestamp, feature, model, input_tokens,
output_tokens, cached_tokens, attempt>. Per case, compute tokens per call, the share on each model
tier, the cache hit ratio and attempts. Show each factor's ratio between the periods, confirm they
multiply to the bill's ratio, and rank the fixes by (factor − 1) ÷ days to fix, using: <estimates>.

Sources and credits#

IdeaOriginSource
The four bill factors and the fix order (factor − 1) ÷ daysOriginal: this manualHow to control the token bill
Cache write and read multipliers, and model-scoped cachesBorrowed: documented, September 2026; prices changeAnthropic and Amazon Bedrock prompt-caching documentation; see Formulas
Escalating costs as a cause of cancellationBorrowedGartner (2025). Press release, 25 June
The 3× cost alertOriginal: a working default to tuneSources and Confidence
The SkyWays billIllustrative: a fictional airlineTry the cache calculator

Prefer GitHub? This track is on the wiki, and this lesson is markdown. Found a mistake? Edit this lesson, or say so.