Prompt caching is how most Claude bills actually come down
Uncached long context is the usual 3x overspend. Cache the stable prefix, budget the rest, and measure cost per successful task.
Prompt caching reuses the stable prefix of a Claude prompt so you do not pay full price to re-read the same system instructions, tool schemas and retrieval boilerplate on every turn. It is the highest-leverage cost control we install on inherited agents.
The typical overspend we measure is about 3.4x, usually from context that did not need to be there. Teams notice the invoice before they notice the architecture. Caching without a context budget just makes a bloated prompt cheaper. Do both.
What belongs in the cache
Put the parts that change rarely in the cached prefix:
- System prompt and policy
- Tool schemas
- Static few-shot examples
- The retrieval instructions, not the retrieved documents
Leave user turns, live records and per-request retrieval outside the cache. If those land in the prefix, you invalidate the cache constantly and pay twice.
Measure the right unit
Cost per token is a vendor metric. Cost per successful task is an operating metric. Pair caching with eval gates so a cheaper prompt is not a worse prompt.
Also watch latency. A huge uncached prefix is slow and expensive. Caching helps both, which is why it belongs in week one of a production agent build, not after finance escalates.
A simple sequence
- Trace ten real tasks and list every token source.
- Split stable versus per-request context.
- Enable caching on the stable prefix.
- Cap retrieved chunks and conversation history.
- Re-run the golden set and compare spend and pass rate.
If the bill is the reason the pilot cannot go live, start with this sequence, then read context engineering for Claude. The two problems are usually the same problem.
Related notes
Quality and cost
Claude Agent Observability: Trace Model Calls, Tools, Cost, and Failures
A production guide to tracing Claude model calls, tools, cost, failures, and task outcomes with OpenTelemetry-shaped telemetry.
Quality and cost
Put eval gates on your Claude agent before you scale traffic
An eval harness turns Claude quality into a CI number. Here is the minimum setup that catches regressions before customers do.
Quality and cost
Structured outputs make Claude agents callable by software
If downstream code cannot parse the answer, you do not have an integration. Use schemas, validate, and eval the JSON, not the vibe.