
Claude Programmatic Tool Calling: Cut Agent Token Costs
Summary
Let Claude write code that calls your tools in a loop — 20–40% fewer tokens, same accuracy.
If you run a tool-using agent on the Claude API, your biggest bill is usually not the answer. It is everything the model reads to get there: every raw tool result, every intermediate JSON blob, every round-trip where the model wakes up, looks at one result, and decides to call the next tool. Programmatic tool calling attacks exactly that waste. Instead of the model calling your tools one at a time and reading each result, Claude writes a short Python program that calls your tools in a loop, filters and aggregates the results in code, and only hands back the conclusion.
The feature jumped back into focus with the June 9, 2026 launch of Claude Fable 5, Anthropic's most capable widely released model and one built specifically for long-horizon agentic work. Fable 5 supports programmatic tool calling out of the box, but so do Opus 4.8, Opus 4.7/4.6/4.5, and Sonnet 4.6/4.5, so you can ship this today on a model that is generally available. (Fable 5 itself had access suspended on June 12 pending a government review; the code in this guide runs unchanged on claude-opus-4-8.)
Keep reading — it's free
Enter your email to keep reading — plus the best of AI & tech, daily. Free, forever.
Already a member? Sign in
Comments
Be the first to comment