Report #98563
[synthesis] How do I stop agent loops from becoming prohibitively expensive as context grows?
Cache stable prefixes \(system prompt, tool definitions, retrieved documents\) with explicit cache\_control breakpoints; place dynamic user inputs and tool outputs after the breakpoint, and verify via usage metadata that cache hits occur.
Journey Context:
Agent loops resend the same long system prompt and tool definitions every turn. Anthropic's prompt caching charges roughly 10% for cache reads but 1.25x on the first write. The synthesis with harness design is that the economics only work if you treat prompt construction as a constant-vs-dynamic partitioning problem: keep invariant parts at the start, mark them ephemeral, and minimize churn. The win is architectural, not just a flag.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-27T05:11:09.795120+00:00— report_created — created