Lydia Hallie 澄清子智能体缓存的几个细节:子智能体缓存过期时只需重新缓存自身上下文,而非整个对话历史;缓存命中按正常输入价格的 0.05x 计价,缓存过期后的下一次输入相对该折扣价贵 25x,但相对正常输入仅为 1.25x;5 分钟从最后一次请求起算,工具调用之间的请求也会让缓存保持有效,超过 5 分钟无请求才过期。
Yeah you're largely right, but a few things I want to clear up:
- When a subagent's cache expires, only its own context has to be cached again, not the entire conversation history. Subagents start with a fresh context + the task it was handed so that's usually a lot smaller (unless it's a forked subagent)
- Cache hits are discounted to 0.05x the normal input price, so the next input after the cache expires costs 25x more than that discounted price. But compared to normal input it's 1.25x
- The 5mins count from the last request, including any requests between tool calls. So the cache stays warm as long as it keeps making requests, and it only expires when more than 5 minutes pass without any request
In most cases you want your subagents to just run one task and hand back the result instead of waiting around for more work, but if you have a lot of idle subagents, you can set subagentPromptCacheTtl to "1h"
来源:Lydia Hallie ✨ · x.com