Models · 2026-10-18

You cache answers by prompt hash.

Your product catalogue changed this morning, and users are still getting yesterday’s answers.

  1. AStop caching - correctness beats savings
  2. BInclude the DATA VERSION in the cache key, so a catalogue change is a different question
  3. 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
  4. 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.

More on this topic

More on Way of the Agent

Real situations from building agents - with the answer and why.

Solve a new one every day on the Path