Expand description
Prompt cache control for the assembled window.
Every provider’s prompt cache keys on an unbroken prefix, but they differ in how that prefix is nominated. OpenAI-compatible endpoints want a stable routing key so successive requests from one session land on the same shard. Claude wants explicit breakpoints naming the blocks worth persisting. Both are derived from the same two facts the agent already knows: the window layout, and whether the cacheable part of it changed since the previous request.
The second fact is why this type exists rather than a free function.
Reassembly and compaction deliberately rewrite the stable prefix, which
makes everything cached under the old key dead weight. PromptCache
notices the change through a fingerprint and bumps an epoch that is
folded into the cache key, so a rewritten window asks for a new shard
instead of repeatedly missing on the old one.
Structs§
- Prompt
Cache - Derives per-request cache controls for one agent session.
Enums§
- Cache
Lifetime - How long the conversation’s prompt cache stays warm.