Let the API Auto-Clear Stale Tool Results Mid-Run

Up to ~84% fewer total tokens on long, tool-heavy runs (Anthropic's 100-turn web-search eval); far less on short conversations, and it does invalidate your prompt cache when it fires Advanced 3 min read

In long agent loops, every old file dump and search result gets re-billed as input on each new turn. Anthropic's context-editing beta makes the API itself swap stale tool results for short placeholders once you cross a token trigger, so you stop re-paying for context the agent no longer needs.

๐Ÿ”’ Pro tip ยท Advanced

Unlock this tip โ€” and 50 more

This is one of 51 advanced, fact-checked tactics reserved for Pro. Get the full 73-tip library, a searchable archive, and a new tip every morning. Free for 7 days, then $9/mo.

Prefer to browse? The 22 Beginner tips are free forever.