# Anthropic killed Tool calling

Source: https://www.youtube.com/watch?v=3wglqgskzjQ
Recap page: https://rapidrecap.app/video/3wglqgskzjQ
Generated: 2026-02-22T11:03:02.289+00:00

---
## Quick Overview

Anthropic's Programmatic Tool Calling (PTC) fundamentally changes agent efficiency by allowing the LLM to execute code within a sandbox to handle complex, multi-step tasks, resulting in a 37-50% reduction in token consumption compared to traditional iterative tool calling, especially for tasks involving batch processing, dynamic filtering, and complex parameter handling, which was demonstrated by solving a puzzle much faster and with significantly fewer tokens using Opus 4.5 PTC compared to Sonnet 4.5's traditional method.

**Key Points:**
- Programmatic Tool Calling (PTC) reduces token consumption by 37-50% by eliminating network overhead for intermediate steps, shifting computation into a code execution environment.
- Traditional tool calling required multiple round trips (e.g., 10 messages for a 5-step task), whereas PTC completes complex tasks in just 2 messages (1 script request + 1 final response).
- PTC enables advanced patterns like batch processing with loops, conditional logic based on intermediate results, and dynamic filtering (e.g., filtering raw HTML dumps before context inclusion).
- Tool Use Examples within tool definitions significantly improve accuracy (from 72% to 90% in internal testing) for complex parameter handling, such as nested JSON structures in the `create_ticket` tool.
- Tool Search Tool is introduced to manage large toolsets by deferring the loading of infrequently used tools until they are explicitly discovered on-demand, saving initial context tokens.
- The Opus 4.5 model using PTC solved the 'Victorian Lock' puzzle, requiring multiple Fibonacci calculations and tool invocations, using only 240 total billed tokens, compared to Sonnet 4.5 which used 783,967 tokens for a similar task.

![Screenshot at 00:04: A side-by-side comparison showing the significant efficiency difference between Sonnet 4.5 \(Traditional Tool Calling\) consuming over 783,000 tokens and Opus 4.5 \(Programmatic Tool Calling enabled\) solving the same complex puzzle using only 240 tokens.](https://ss.rapidrecap.app/screens/3wglqgskzjQ/00-00-04.jpg)

**Context:** This video introduces Anthropic's Programmatic Tool Calling (PTC), also referred to as Tool Call 2.0, which is an evolution from the traditional JSON-based tool calling method. The core problem addressed is the inefficiency and high token cost associated with the iterative, 'ping-pong' loop of sending a tool call request, waiting for the result, and feeding it back to the LLM for the next step. PTC solves this by allowing the LLM to write and execute code directly within a sandboxed environment to process tool outputs programmatically before synthesizing a final response, leading to massive efficiency gains.

## Detailed Analysis

The video details the shift from traditional tool calling to Programmatic Tool Calling (PTC) in Anthropic models like Claude Opus 4.5. Traditional tool calling involves an inefficient loop where the LLM generates a tool call request, the client executes it, returns the result, and this process repeats until the task is complete, leading to high latency and token consumption, as illustrated by a puzzle requiring 10 messages (5 requests/5 responses) and nearly 800k tokens for Sonnet 4.5. PTC streamlines this by allowing the LLM to generate Python code that executes within a sandboxed container. This code can perform complex logic like batch processing, dynamic filtering of raw tool outputs (like HTML dumps), and conditional branching based on intermediate results, all within a single script execution. The result is a massive reduction in overhead, achieving a 37-50% reduction in token consumption, as the complex multi-step process is condensed into just two messages (1 script request + 1 final response). Furthermore, the introduction of Tool Search and `defer_loading: true` configuration allows agents to manage large toolsets by loading only necessary tools initially, saving context space. Tool Use Examples are also shown to be crucial for complex schemas, improving accuracy from 72% to 90% on parameter handling tests.

### Programmatic Tool Calling (PTC)

- Exactly the same concept as traditional function calling, but it enables the LLM to write code to process tool outputs internally rather than just outputting JSON for immediate API invocation.

### Traditional Tool Calling Problems

- Leads to non-deterministic behavior and unnecessary token usage, especially when dealing with tasks requiring multiple tool calls (e.g., searching emails and then reading each one), resulting in gigantic response payloads.

### Tool Call 2.0 Features

- Introduces Programmatic Tool Calling, Tool Search (to discover tools on demand via `defer_loading: true`), Dynamic Filtering (to filter raw HTML dumps), and Tool Use Examples for complex schema handling.

### Batch Processing with Loops

- PTC allows writing code to process multiple items in parallel or loops (e.g., querying databases across multiple regions) reducing model round-trips from N to 1.

### Dynamic Filtering

- Solves the 'HTML Dump' problem by executing sandbox code to filter raw HTML/web fetch results, reducing input tokens by 24% on average for Sonnet 4.6 and 16% for Opus 4.6.

### Tool Use Examples

- Beneficial for complex nested structures and tools with many optional parameters; internal testing showed accuracy improving from 72% to 90% on complex parameter handling when examples were provided.

### Efficiency Comparison

- Opus 4.5 with PTC solved a complex puzzle using only 240 tokens, drastically outperforming Sonnet 4.5's traditional method which used 783,967 tokens, demonstrating significant time and token savings.

![Screenshot at 00:00: Viewing the Anthropic API documentation page detailing 'Programmatic tool calling' and model compatibility.](https://ss.rapidrecap.app/screens/3wglqgskzjQ/00-00-00.jpg)
![Screenshot at 00:04: A side-by-side comparison showing the significant efficiency difference between Sonnet 4.5 \(Traditional Tool Calling\) consuming over 783,000 tokens and Opus 4.5 \(Programmatic Tool Calling enabled\) solving the same complex puzzle using only 240 tokens.](https://ss.rapidrecap.app/screens/3wglqgskzjQ/00-00-04.jpg)
![Screenshot at 01:41: A slide illustrating the problem of the 'JSON Ping-Pong Loop' killing agent efficiency due to excessive HTTP round-trips and context window overflow.](https://ss.rapidrecap.app/screens/3wglqgskzjQ/00-01-41.jpg)
![Screenshot at 02:34: A slide detailing the 'Pure LLM context passing' problem, showing how retrieving multiple emails requires numerous sequential tool calls, consuming excessive context.](https://ss.rapidrecap.app/screens/3wglqgskzjQ/00-02-34.jpg)
![Screenshot at 09:47: A graphic illustrating Dynamic Filtering, where raw HTML \('Context Pollution'\) is funneled through a 'Sandbox Script' to extract only relevant content before entering the LLM's context window.](https://ss.rapidrecap.app/screens/3wglqgskzjQ/00-09-47.jpg)
