In five minutes, see the five leaks that quietly burn money in production agents — and the code to stop each one
Your Agent Is Wasting Tokens and You Don't Know It - Erik Hanchett, AWS · Erik Hanchett
6 min total·Actually worth watching closely: ~3 min·3 must-watch clips
- 0:00 – 0:24Listen
Opening: your agent is quietly burning money
Frames the problem of tokens being silently wasted in agent applications and previews five actionable ways to reduce token costs while using and creating agents.
Most token waste happens in places you aren't looking — check each stage in turn
Purely spoken intro with no key visuals; just catch the framing of the problem▶ Jump to 0:00Speaker · Erik Hanchett - 0:24 – 1:10Watch
Technique 1: cache the system and tool prompts
Shows the code for setting cachePrompt=default in Strands Agents: the full system prompt goes over on the first call, and every subsequent call sends a much reduced version.
Prompt caching is the cheapest optimization and the first one to make
At 24s the speaker says 'Let me show you some code' — the on-screen demo is code you can copy directly▶ Jump to 0:24Speaker · Erik Hanchett - 1:10 – 1:55Listen
Technique 2: route models by task difficulty
Use a frontier model like Claude Sonnet for difficult tasks and a cheap one like Claude Haiku for simpler ones — you can even have another very cheap model dedicated to deciding which model to use.
Don't let the most expensive model do all the work — the routing itself can be very cheap
Mostly spoken strategy with no must-watch demo; understanding the routing idea is enough▶ Jump to 1:10Speaker · Erik Hanchett - 1:55 – 2:45Watch
Technique 3: offload large tool results
Demonstrates using Strands Agents APIs to store large tool results locally or in the cloud, keeping only a summary in the context instead of carrying the full data through every loop.
Tool results shouldn't go into the context as-is — store them and substitute a summary
At 115s the code demo returns ('Let me show you some code on here'); watch the screen for the specific API usage▶ Jump to 1:55Speaker · Erik Hanchett - 2:45 – 4:05Watch
Technique 4: cap tool loops + observability review
Set a max iterations cap on tool loops to stop runaways, and before deploying use observability tools to check every single tool call's running time and loop count.
A tool loop without an iteration cap can turn into an infinite money burner at any moment
Around 202s the speaker walks the audience through each tool's call stats; the observability view is key to understanding the diagnostic method▶ Jump to 2:45Speaker · Erik Hanchett - 4:05 – 5:25Skim
Technique 5: trim conversation history with a sliding window
Use the Sliding Window Conversation Manager to send back only the last N messages (10 by default), and summarize the trimmed early messages back into the context.
A multi-turn conversation's full history is re-billed on every call; sliding window plus summarization is the standard fix
Mostly configuration options and slides — a quick glance at the settings is enough, no need to watch frame by frame▶ Jump to 4:05Speaker · Erik Hanchett - 5:25 – 5:54Listen
Wrap-up: five techniques combine into a complete strategy
Recaps the five techniques — caching prompts, model routing, offloading tool results, capping loops with observability, and trimming conversation history — stressing that using them in combination makes a complete cost-optimization plan.
The five techniques aren't multiple choice — stack them to maximize savings
Spoken closing summary with no new visuals; just take in the conclusion▶ Jump to 5:25Speaker · Erik Hanchett