Back to Feed
Agents / Benchmarks & Evals

Programmatic Tool Calling Beats JSON

Original: The Bitter Lesson of Tool Calling

Listen to the summary

Uses a voice available on your device

Audio options
On this page

Key Takeaways

  • Programmatic tool calling matches or outperforms JSON baselines in 13 out of 14 models when performing parallel tool execution.
  • The GPT-5.6 family shows a 10.6% improvement over the JSON baseline on BFCL v4 benchmarks.
  • JSON tool calling failures increase significantly at higher fan-out levels, with total enumeration failure occurring between 70 and 72 calls for Claude Sonnet 5.
  • Programmatic tool calling maintains 100% enumeration accuracy even at a fan-out of 100 tool calls.
  • The approach is significantly more resilient to context rot and context flooding compared to JSON-based methods.

Summary & Methodology Analysis

The researchers compared two paradigms for tool interaction: standard JSON tool-call objects and programmatic tool calling (PTC). In the programmatic approach, tools are exposed as typed Python stubs. The model generates a Python script to invoke these tools, which an agent loop then executes in a shell subprocess. This allows for a more native interaction model where the tool execution and result handling occur in a single agent turn. The study used 14 language models from the GPT and Claude families to evaluate performance on the BFCL v4 benchmark, with ablation studies performed on parallel fan-out, sequential chaining, and context degradation conditions. Results indicate that accuracy for PTC scales with model generation rather than the model family itself, with the GPT-5.6 family demonstrating clear performance gains. However, some models like GPT-4.1, GPT-4o, and GPT-5.4-mini underperformed because they failed to generate proper newline characters in their Python code. PTC proved notably more stable than the JSON baseline, which suffered from significant degradation during context flooding and completely failed to enumerate tools at high fan-out thresholds. The researchers noted that JSON tool calling hits a hard limit between N = 70 and 72 calls for Claude Sonnet 5, whereas PTC maintained 100% enumeration accuracy at N = 100. Despite these gains, the study is limited by the use of echo-return stubs in BFCL v4, which measures serialization accuracy instead of end-to-end correctness. Additionally, the small sample sizes in the ablation studies, ranging from 31 to 52 entries per condition, lead to wide confidence intervals, and the ground-truth labels may contain noise inherent to the deterministic scoring mechanism used.

Cross-Examination & FAQs

A deeper dive clarifying mechanics, constraints, and baseline evaluations.

Q1. What is the core difference between JSON and programmatic tool calling?

JSON tool calling requires the model to emit structured JSON objects to invoke tools, while programmatic tool calling enables the model to write and execute Python scripts using typed stubs to perform the same actions.

Q2. Does programmatic tool calling perform better than JSON tool calling?

Yes, in 13 out of 14 models tested, programmatic tool calling either matched or outperformed the JSON baseline during parallel tool execution.

Q3. Are there specific conditions where one method performs better?

Programmatic tool calling is more resilient to context rot and context flooding, and it does not hit the same enumeration limits as JSON methods when performing a high number of parallel tool calls.

Q4. What is parallel fan-out in the context of this paper?

Parallel fan-out refers to the ability of the model to generate and manage multiple concurrent tool calls, which the paper tested up to N = 100.

Q5. Did all models succeed with programmatic tool calling?

No. GPT-4.1, GPT-4o, and GPT-5.4-mini performed worse than the baseline because they generated Python code containing character sequences for newlines instead of actual newline characters.

Q6. What were the limitations of the BFCL v4 benchmark for this study?

The benchmark relies on echo-return stubs, meaning it measures argument serialization accuracy rather than the correctness of end-to-end tool interactions where outputs influence future steps.

Q7. Is the performance gain consistent across all model families?

The accuracy of programmatic tool calling tracks with the model generation, not the specific model family.

Q8. How did the researchers conduct their ablation studies?

They performed ablation studies by testing models under conditions of sequential chaining, parallel fan-out, and context rot using a subset of the BFCL v4 benchmark.

Q9. Are the individual model results statistically significant?

Individual model results have wide confidence intervals due to small sample sizes of 31 to 52 per condition, so the study primarily highlights aggregate cross-model patterns.