An agentic AI application in production, three agents deep, and a bill nobody has examined.
Your Scenario
You have inherited an agentic AI application that handles customer support tickets and is
already in production. Every ticket passes through three agents in sequence: 5,000 tickets
a month, $5,000 on the bill, exactly $1.00 a ticket. Nobody has looked at
that number since the system was built, and your CFO has just worked out it is 2% of
revenue.
A first tuning pass (Agent 2 now runs on Sonnet, among other fixes) has already
taken it down to $3,500 a month, $0.70 a ticket, and finance has built a plan on that
number: $35,000 a month at 50,000 tickets. Your job is to find out why the bill will not behave like that plan, fix it without
breaking the system, and tell finance what it will really cost. One constraint holds all the
way through: resolution must never fall below 85%. The sections below walk you from
the bill, to the scaling surprise, to the levers that fix it, to a redesign.
What you will do
Your Scenario — you are here. How the application is wired.
Scaling Challengescored — your forecast said
$35,000 for 50,000 tickets and the invoice says $90,000. Track down why.
Track: Understand the Cost of the AI Applicationscored —
use the tags to see which agent, and which part of a ticket, the money goes to, and what
a model swap would cost you in resolution.
Optimization Leversscored — try each lever on the
$90,000 system, from routing and caching to infrastructure and guardrails, and see what
each is worth on its own.
Redesign and Forecastscored — apply what you found to
redesign the system, then tell finance the new monthly forecast and the budget you need.
Takeaways — what to carry away, and where each section shows up in a real
organization. It opens once you have sent finance your forecast.
This section and the takeaways are reading.
The four in the middle are scored, and the sidebar keeps the count as you go.
The system today
After the first tuning pass Agent 2 runs on Sonnet. The costs on the diagram are the model calls for one ticket, with no caching and before any loops or retries.
Every ticket goes through all three, in order. The
figures are what each agent is billed for on one ticket of the system as it was built,
counting the context it re-sends on every call of its loop.
Agent 1 · Triage
Claude Opus · about 12 seconds
Reads the ticket, the customer's profile and recent orders, then
classifies the problem, sets a priority and writes a hand-off summary for Agent 2.
Three calls, each carrying about 20,000 tokens of context.
Per 1,000 tickets
60,000 in at $5 per 1M$300.00
Caching, −10% of input−$30.00
400 out at $25 per 1M$10.00
$0.28 a ticket
A small answer from a large read. Its cost is almost all context.
Agent 2 · Analysis
Claude Opus · about 45 seconds
Searches the knowledge base, the billing system and similar past
tickets, then works out the root cause and the fix. Five calls, each re-sending about
17,000 tokens as the evidence piles up.
Per 1,000 tickets
85,000 in at $5 per 1M$425.00
Caching, −10% of input−$42.50
1,500 out at $25 per 1M$37.50
$0.42 a ticket
A large context on the priciest model, and the agent that writes the
most.
Agent 3 · Resolution
Claude Sonnet · about 33 seconds
Reads everything — the full conversation, Agent 2's analysis, the
refund policy and the tone guide — and drafts the reply. Four calls, each carrying about
40,000 tokens.
Per 1,000 tickets
160,000 in at $2 per 1M$320.00
Caching, −10% of input−$32.00
1,200 out at $10 per 1M$12.00
$0.30 a ticket
The most tokens of any agent, yet cheaper than Agent 2, because Sonnet
costs 2.5 times less per token than Opus.
Where it started
Monthly Cost
$5,000
Per Ticket
$1.00
Response Time
90 sec
Resolution
87%
Exercise 1 · Scaling Challenge
Challenge: you scaled the system to 50,000 tickets a month. Your forecast said $35,000. The invoice says $90,000. Work out why. Where the cost sits, and how to fix it, come next.
At 5K a month
$3,500
$0.70 a ticket
Forecast at 50K
$35,000
10× the tickets, 10× the cost
Invoice at 50K
$90,000
10× the tickets, 25.7× the cost
No price changed. Cost per ticket did: $0.70 became $1.80. Your forecast multiplied the tickets, but it never asked what each ticket would cost. Answer three questions to find where the extra $55,000 came from.
TrackSee where the money went
The invoice has a single line: Anthropic API, $90,000. Finance wants to know which agent and which tickets are responsible. What do you set up first?
TrackFind the biggest driver
The tags split the extra $55,000 into three drivers. Which one do you go after first?
TrackPick the number to report
Finance asks for one number to track this application from now on. Which should it be?
What you found
The forecast multiplied the tickets and forgot the tokens per ticket. The extra $55,000 was three drivers: loops ($30,000), context growth ($15,000) and escalations ($10,000).
Loops are the biggest and the reason cost is not linear: each retry re-sends the whole context.
Report the cost of a closed ticket, $2.12, not the cost of the attempts.
Next, see where the cost sits inside a ticket.
Exercise 2 · Track: Understand the Cost of the AI Application
Challenge: the calls are tagged. Use the tags to see where the $90,000 system’s cost sits: which agent, which part of a ticket, and what changing a model would cost you in resolution. No changes yet.
Invoice at 50K
$90,000
The model calls alone
$0
Tokens per ticket
0
Calls per ticket
12
What the tags show, per agent
The rest of the $90,000 is loops, retries and context growth multiplying those calls.
TrackFind the dearest agent
Which agent costs the most?
TrackSplit input from output
What share of a ticket's cost is input, what the agents read, and what share is output, what they write?
TrackPrice a model swap
Triage is a simple classification, yet it runs on Opus. Which single model swap saves the most without breaking the 85% resolution floor?
Exercise 3 · Optimization Levers
Challenge: this is the $90,000 system. Try each lever and watch what it is worth, on its own and stacked. Then answer the four questions below.
TrimCut the cost of a ticket
Routing replaces the three model choices below.
TameStop it running away
Guardrails cut the loop and context-growth costs by a large share. They do not remove them: some retries are legitimate and some threads really are long.
What it does to the bill
Monthly forecast
$0
Saved vs today
-$0
Resolution
0%
Response time
0 sec
What each lever is worth on its own
The brief still holds: a response in 90 seconds or less and resolution of 85% or better.
What is prompt caching? Every call starts
with the same instructions, policies and tool definitions. With prompt caching the provider
remembers that unchanged start of the prompt and charges about a tenth of the normal input
price to read it again. It only touches input: the ticket is different every time, and
output is never discounted. This lab takes a modest 10% off input, about 9% off the
bill, because only a small share of what these agents read is reusable and the cache expires
after about five idle minutes. Prompts that repeat long, identical text can save far more.
TrimWhich lever goes after the tokens
The tags show that many tickets are simple, and that Opus is seeing more of them than it should. Which change goes after the tokens each ticket uses, without hurting resolution?
TrimKnow what caching can and cannot do
Input is 94% of the bill, because each agent re-sends mostly the same context on every call. Someone suggests turning on prompt caching. Which statement about it is true?
TrimChoose the infrastructure
Finance suggests changing the infrastructure to save money. Which change cuts the bill without breaking the 90-second response?
TameStop it running away
A prompt change goes out on Friday evening and Agent 2 starts looping on every ticket. Which controls would have stopped it?
Exercise 4 · Redesign and Forecast
Challenge: finance approved $35K a month, and the system is spending $90K. You worked out why and where the cost sits using Track, then tried the Trim levers that cut the cost of a ticket and the Tame guardrails that stop it running away. Now work with your engineering teams to apply those changes and redesign the system, at 50K tickets a month. Keep the response within 90 seconds and resolution at 87% or better (the 85% floor plus a two-point buffer, because resolution drifts down as harder tickets arrive), and bring today's spend down by at least a third. Then work out the new monthly forecast and tell finance what it looks like. You will not get back to $35K, so the number you land on is the new budget you ask for.
TrackMeasure it
Tracking does not lower the bill. It is what makes the forecast something finance can check.
TrimCut the cost of a ticket
Routing replaces the three model choices below.
TameStop it running away
Guardrails cut the loop and context-growth costs by a large share. They do not remove them: some retries are legitimate and some threads really are long. The kill switch changes no number. It covers the failure you did not predict, so finance will want it.
Your forecast
New monthly forecast
$0
Est. Resolution
0%
Old budget
$35,000
Current spend
$90,000
How the forecast builds up
Design vs. constraints
Target (a third below today)$60,000
Your forecast$0
Min resolution (floor + buffer)87%
Your est.0%
Max response time90 sec
Your est.0 sec
Status
❌ Over Budget
Your note to finance
Takeaways · From the Lab to Your Organization
Goal: carry the method out of the lab. Nothing on this page is scored.
The takeaways open once you have sent your note to finance in the last section.
Where each section shows up at work
The application, the agents and the figures were made up for the lab. The method is the part that is real.
SectionIn the labAt work
TrackScaling Challenge
You traced a $35,000 forecast to a $90,000 invoice and chose the number to report.
When an invoice and its forecast diverge, look for retries, loops and context that grows with every call before you blame the price per token, and report the cost of a closed ticket.
TrackUnderstand the Cost
You found the dearest agent, that about 96% of a ticket is input, and which model swap is safe.
Tag every model call with the agent, the ticket type and the outcome. Expect one step to carry a disproportionate share, and price a swap in resolution before you make it.
TrimOptimization Levers
You tried routing, caching and infrastructure, and saw what each was worth on its own.
Trial the cheaper model on a slice of live traffic and measure accuracy before you roll it out. Treat caching as a modest, safe extra, and committed capacity as a decision for finance.
TameOptimization Levers
You capped the calls and the spend per ticket, and kept a kill switch.
Add a call cap, a budget per task and a kill switch before a new agent goes live. Controls that act beat alerts that report.
All threeRedesign and Forecast
You sent finance a number, a way to check it, and the controls that protect it.
Take those same three things to finance for any new agentic feature before it launches, and keep a kill switch for the failure nobody predicted.
Your first week back
Tag AI spend by workload and by agent, so you can see where one task’s cost goes.
Quote the cost of a closed ticket, or your own equivalent outcome, instead of the raw model bill.
Set an accuracy floor before you change any model.
Add a call cap, a budget per task and a kill switch before a new agent goes live.
Re-forecast from measured tokens per task, not from a guessed volume.