Tool-heavy agents repeat work constantly. Caching is the difference between viable and expensive.
Layered Cache
- Prompt fingerprint cache.
- Tool output cache by normalized args.
- Retrieval cache by semantic neighborhood.
const key = sha256(JSON.stringify({ promptTemplate, contextHash, toolSig }));Cache policy must encode freshness risk, not only hit-rate goals.