rillr
About Guidelines Privacy Terms Log in Join Rillr
← AI
towardsai.com · Sep 25

Claude’s New addTools() Can Reuse 98.7% of Your Next Request. Editing tools[] Reuses None.

Author(s): Chew Loong Nian – AI ENGINEER Originally published on Towards AI. Anthropic’s SDK 0.128.0, released with Claude Opus 5.5, can hand the model a new tool mid-run without touching tools[]. It needs one beta flag the runner won’t add for you. If your Claude agent picks up a new tool halfway through a long conversation, the way you add it decides how much of the next request can still come from the prompt cache: 98.7% of it with the new runner.addTools(), none if you edit tools[]. After introducing the problem of tool changes during long runs, the article explains what changed in the Anthropic SDK (TypeScript 0.128.0) and why editing tools[] is expensive: tool definitions are at the front of the prompt-cached prefix, so changing them forces a full cache miss. It then shows how addTools() avoids that by leaving tools[] intact and instead appending a system message containing a tool_addition block, so only the appended part is processed as new input. The author provides and walks through a reproducible Node script that measures request JSON reuse, demonstrating up to 98.7% shared prefix with addTools() versus near-zero reuse when updating tools[], and shows how the gap grows w…

Visit article ↗ ▲ 0 💬 0
Discussion

0 comments

No comments yet. Start the discussion.