AI 智能体的土拨鼠之日:Amazon Bedrock 上 OpenAI 模型的提示缓存模式
原标题:Groundhog Day for AI agents: Prompt caching patterns for using OpenAI models on Amazon Bedrock
AI 摘要
AWS Machine Learning Blog 发布技术文章,介绍在 Amazon Bedrock 上使用 OpenAI 模型时,如何通过提示缓存(prompt caching)降低 AI 智能体的成本。文章解释了智能体每一轮都需重发工具定义、指令和历史记录,导致重复计费;提示缓存通过保存 prefill 阶段的 KV 状态,在后续请求中复用相同前缀,按更低价格计费。文章区分了隐式缓存(由 Bedrock 自动选择可复用前缀边界)与显式缓存(用 prompt_cache_breakpoint 标记),并建议两者结合使用,同时给出静态内容缓存、跨会话复用及子智能体场景的实践模式。
正文节选
Groundhog Day for AI agents: Prompt caching patterns for using OpenAI models on Amazon Bedrock Every time you spin off your agent, it has to re-read its whole life story before performing an action. Here’s how to make it remember without having to feed it the same context again. In the movie Groundhog Day, Bill Murray’s character re-lives the same February 2 every day. He wakes up to the same song playing on the radio, in the same inn, and the same small town, again and again for what some movie