You cache answers by prompt hash.
Your product catalogue changed this morning, and users are still getting yesterday’s answers.
- AStop caching - correctness beats savings
- BInclude the DATA VERSION in the cache key, so a catalogue change is a different question
- CShorten the cache TTL to one second and warm it again every morning, so stale answers expire almost at once while repeated questions stay fast
- DCache only failed calls, which never go stale
Answer: B
Include the DATA VERSION in the cache key, so a catalogue change is a different question
Why
A cache key must name everything the answer depends on, and the answer depended on data the prompt never mentioned. A one-second TTL is the same bug with a smaller window - it just makes staleness rare enough to be hard to debug.
- ModelsReasoning tokens are 70% of your agent’s bill.
- ModelsEvery request in your support agent runs a reasoning model at high effort.
- ModelsYou need to classify millions of short messages, cheaply and fast.
- ModelsEvery request - from trivial “is this spam?” checks to hard multi-step reasoning - goes to your largest, most expensive model.
More on Way of the Agent
- Course programThe first three modules are free: start in the browser or the app, no card needed.
- Library: guides, skills and promptsReady prompt templates, grouped into collections.
- AI ChroniclesSourced stories from the history of AI.
- ConceptsPlain-language explainers of agent engineering.
- Learn AI agentsApps and courses for learning AI agents, compared honestly.
Real situations from building agents - with the answer and why.
Solve a new one every day on the Path