Programmatic Tool Calling
Instead of loading every tool definition into context and letting the model call them one at a time, you give it a code execution environment where it writes the script that calls those tools itself. Intermediate results stay in the container: the model only sees what you choose to return. It is Anthropic answer to context bloat in tool-heavy agents, shipped to GA in November 2025.
Strengths
- Isolates tool responses: you decide what comes back into context instead of injecting everything by default
- Roughly 38% fewer billed tokens on a 75-tool benchmark, with no accuracy loss (Anthropic measurement)
- Lets you chain several calls (and several MCP servers) inside one script, in a single round trip
- Backed by Anthropic research: agents do better writing code than chaining raw tool calls
Limitations
- Requires a secure code execution environment (sandbox), not just a plain API call
- Oversized for 2 or 3 deterministic tools: a direct call stays simpler
- Debugging a script that orchestrates several tools takes more discipline than tracing an isolated call
Best for
- Production agents with 10 or more tools, or several MCP servers wired in: that is where token savings show up on the bill
- Workflows where a chatty tool returns large payloads the agent only needs a slice of
- Multi-step tasks where the agent must chain several tools without going back through the model at each step