Prompt Caching with Deep Agents
Key point
Deep Agents automates prompt caching strategies that differ across model providers, reducing the operating costs of AI agents.
Details
A key factor in improving cost efficiency when operating AI agents at scale is Prompt Caching. Using prompt caching can reduce inference-time token costs by 41-80%.
Chat models must reprocess all previous tokens—system prompts, tool descriptions, message history, and so on—every time a new message is added. However, with prompt caching, the model's state is saved as a snapshot, so only the new text needs to be processed on the next request, dramatically cutting costs.
The challenge, however, is that caching support differs by model provider. For example, Anthropic and Gemini support Explicit Breakpoints, but OpenAI does not. TTL settings and cache prewarm features also vary from provider to provider.
Deep Agents uses the following automated strategies to address this complexity:
- Set Explicit Cache Breakpoints where supported
- Opt into the provider's Implicit Caching where explicit support is unavailable
- Structure prompts to maximize cache read efficiency
This allows users to freely switch model providers while still enjoying maximum token savings.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.