Home icon

Groundhog Day for AI agents: Prompt caching patterns for using OpenAI models on Amazon Bedrock

Machine Learning Blog



This article explains how prompt caching reduces costs for AI agents using OpenAI models on Amazon Bedrock by reusing cached prompts instead of reprocessing the same context repeatedly.

  • Agents must resend entire conversation history, tools, and instructions on every turn; prompt caching stores and reuses this prefix at reduced cost
  • Use explicit caching to mark static tools and instructions for reuse; use implicit caching to automatically cache growing conversation history
  • Combine both modes: explicit markers for shared content and implicit mode for conversation growth across agent turns
  • Keep the reusable prefix stable and byte-for-byte identical; append new information after cache boundaries to maintain reuse
  • Use allowed_tools to restrict callable functions without invalidating cache; append new tools with additional_tools during sessions
  • Warm shared prefixes before launching parallel helper agents to ensure cache population before concurrent requests
  • Monitor cache effectiveness using cached_tokens and cache_write_tokens in response usage; track cost savings in CloudWatch metrics
  • Achieved 61-64% input cost reduction in tested workloads compared to no caching

Prompt caching breaks the Groundhog Day cycle for AI agents, enabling them to reuse context efficiently and significantly reduce token costs while maintaining conversation continuity.



Go to article

The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.

Related articles

Jul 30
2026
Introducing explicit prompt caching for OpenAI GPT-5.6 models on Amazon Bedrock
Sep 11
2026
Beyond the price per token: Choosing the right OpenAI model on Amazon Bedrock for your workload
Oct 9
2026
Amazon Bedrock now supports reasoning summaries for OpenAI models
Oct 16
2026
Building trust in AI agents: A production-ready evaluation framework with Amazon Bedrock AgentCore

The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.