acceptodds
Published as a conference paper at NeurIPS 2026

I-PTC: Interactive Programmatic Tool Calling for Stateful Tool-Augmented Agents

Huanzhi Mao, Chengkun Cao, Shuo Yuan, Joseph Gonzalez

Abstract

Large language models are increasingly capable of writing and executing code, suggesting a natural paradigm for tool-augmented agents: expressing tool use as programs rather than isolated calls. Programmatic tool calling (PTC) captures this idea through loops, batching, abstraction, and structured computation, but existing PTC approaches are largely stateless, limiting their ability to reuse intermediate results and adapt over time. This is problematic for real-world tasks, where tool environments and problem-solving processes are inherently stateful. We therefore present I-PTC, an interactive framework that executes stateful PTC: models issue code snippets that call tools, maintain reusable state, and evolve the tool interface through API corrections. To evaluate the effectiveness of I-PTC and the general PTC setting, we introduce PTC-BENCH, a benchmark of long-tail, production-style user requests whose difficulty comes from large initial environments, many dependent API interactions, extended planning, and recovery across follow-ups and transient failures. Experiments on PTC-BENCH show that I-PTC improves performance on complex multi-step tasks with large tool sets while substantially reducing token consumption over conventional tool-calling baselines and the original PTC baseline, highlighting stateful programmatic tool calling as a promising direction for scalable tool-augmented agents.

Keywords:
Atlanta, Main Track

Reviews

Among:
Shape:
123456this paper, Top 24%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 4.67 over 3 reviews, above 76% of the others.
Reviewer_XF7aOpenReview ↗
Rating
4
Clarity
3
Confidence
4
Originality
2
Quality
2
Significance
2
Read review
Summary

The paper presents I-PTC, a framework that gives an LLM a stateful Python environment, with on-demand tool inspection and self-evolving API note-taking. It evaluates I-PTC on a custom benchmark PTC-BENCH.

Strengths and weaknesses

Strengths

  • The paper is well written and easy to understand. The figures are clear.
  • The work evaluates program tool calling designs, providing empirical evidence for which design is better.
  • PTC-BENCH is well designed, with different task types, including both single- and two-turn tasks.

Weaknesses:

  • Giving an LLM stateful python environments is not new [1-4]. The work lacks empirical comparison and discussion about the differences between these prior methods and the proposed method. While the work evaluates statefulness explicitly in isolation of other factors, the concept itself is not novel.
  • The experiments only use the official code interpreter tools for Claude but not Gemini or GPT, which could affect the performance.

[1] Ran, Maohao, et al. "CaveAgent: Transforming LLMs into stateful runtime operators." arXiv preprint arXiv:2601.01569 (2026).

[2] Qiao, Bo, et al. "Taskweaver: A code-first agent framework." arXiv preprint arXiv:2311.17541 (2023).

[3] Zhang, Alex L., Tim Kraska, and Omar Khattab. "Recursive language models." arXiv preprint arXiv:2512.24601 (2025).

[4] Cheng, Ellie Y., et al. "Sharing State Between Prompts and Programs." arXiv preprint arXiv:2512.14805 (2025).

Questions
  • What are the error bars for the empirical results?
  • How does enabling on-demand tool inspection and self-evolving API note-taking (isolated and together) on PTC (i.e. without statefulness) perform?
  • How does the official code interpreter tools perform for GPT and Gemini models?
Limitations

Yes

Paper formatting concerns

N/A

Final justification

The authors have addressed by concerns about the novelty claim, the ablations to identify whether the novel contributions improve performance, uncertainty quantification, and the comparison to official code execution environments. With these promised changes to the manuscript, I raise my score from 2 to a 4.

Reviewer_zejjOpenReview ↗
Rating
5
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

This paper studies programmatic tool calling in complex tool-augmented agents. It proposes I-PTC, which extends one-shot, stateless PTC into a notebook-like, interactive, stateful execution environment, enabling models to execute code step by step, inspect intermediate results, reuse variables, and recover from errors. The paper also introduces PTC-BENCH, a tool-calling benchmark targeting long-horizon workflows, multi-API dependencies, multi-turn follow-ups, and error recovery. The authors compare traditional tool calling, standard PTC, and I-PTC on PTC-BENCH, MCP-Universe, and MCP-Bench, reporting performance in terms of task pass rate, token usage, and number of API calls.

Strengths and weaknesses

Strengths

  1. The paper proposes a simple and practical interface design that extends programmatic tool calling from one-shot script execution to an interactive, stateful process. The method itself is not overly complex and is highly feasible from an engineering perspective.

  2. In scenarios involving long tool-calling chains, multiple API dependencies, and reuse of intermediate states, the method shows clear performance and efficiency advantages over traditional tool calling and standard PTC.

Weaknesses

  1. In my view, Raw I-PTC may have broader application potential than Full I-PTC, since document updates may involve cross-task settings, and the advantage of tool selection may only become evident when the toolset is large. It would be helpful to more comprehensively discuss the advantages and disadvantages of Raw I-PTC compared with traditional tool calling in terms of effectiveness, efficiency, and broader applicability, such as on Tau-Bench.

  2. Intuitively, operating I-PTC/Raw I-PTC requires strong capabilities in instruction understanding, instruction following, and code generation. The reported gains mainly come from very strong models, which may pose challenges for smaller models. The paper could further discuss the model capability threshold for I-PTC and whether the added interaction complexity may introduce new difficulties for smaller models.

  3. The appendix could include more concrete benchmark examples to aid understanding.

Questions

Compared with Tool calling and PTC, which mechanism primarily accounts for I-PTC's token savings? From the perspective of interaction rounds with the environment, does T-PTC offer any efficiency advantage over traditional tool calling?

Limitations

Yes

Paper formatting concerns

No

Final justification
  1. The paper proposes a simple and practical interface design that extends programmatic tool calling from one-shot script execution to an interactive, stateful process. The method itself is not overly complex and is highly feasible from an engineering perspective.

  2. In scenarios involving long tool-calling chains, multiple API dependencies, and reuse of intermediate states, the method shows clear performance and efficiency advantages over traditional tool calling and standard PTC.

During the rebuttal period, the authors provide additional experiments, most of which address my concerns.

Reviewer_D9JmOpenReview ↗
Rating
5
Clarity
3
Confidence
4
Originality
3
Quality
2
Significance
3
Read review
Summary

Conventional tool calling for agents follows call-observe-call pattern and emits isolated tool calls one at a time, inefficient for long-workflows. Programmatic tool calling (PTC) lets agents write executable programs that orchestrate tools with loops, batching, abstraction, conditionals, and structured computation. Existing PTC approaches are largely stateless, treating code as a one-shot orchestration mechanism where intermediate results are not preserved across calls and models often commit to a full program before observing tool outputs. This limits observability and error recovery.

To address these, this work presents I-PTC, an interactive framework that executes stateful PTC, which is more adaptive than one-shot PTC and more scalable than sequential tool calling. Under this framework, models execute code in a persistent notebook-like execution environment, where models can incrementally write code, inspect intermediate outputs, and reuse cached variables. I-PTC also introduces two mechanisms: self-evolving API documentation, and on-demand tool inspection.

To evaluate the effectiveness of I- PTC, this work also introduces PTC-BENCH, a benchmark of 240 manually created tasks for evaluating tool-use interfaces. It consists of production-style user requests and simulated API whose difficulty comes from large initial environments, many dependent API interactions, extended planning under constraints, and reuse of partial work across follow-ups and transient failures. Compared to existing benchmarks, PTC-BENCH focues on long-horizon, stateful, and computation-heavy workflows.

Experiments show that compared to conventional tool calling and the original PTC, I-PTC consistently improves task success while reducing token usage and unnecessary tool calls.

Strengths and weaknesses

Quality

  • [Strength] Claims are generally well-supported by experimental results. Ablations are helpful.
  • [Weakness] See Questions

Clarity

  • [Strength] The paper is generally well written and easy to follow.
  • [Weakness] It can be helpful to include pointers to appendices in the main text. For example, a reference to 8.3.5 in benchmark design can be helpful.
  • [Weakness] A relatively minor note: there appears to be various somewhat redundant appearances of the same content in the main text, e.g., sources of difficulty for the benchmark, definition of the three interface families, etc.

Significance

  • [Strength] With the enhancement in accuracy and relatively significant improvement in efficiency, as supported by table 2, the proposed I-PTC framework is likely to be beneficial to the community.

Originality

  • [Strength] This work proposes a new framework (I-PTC) and introduces a new benchmark (PTC-Bench).
Questions

I’ve ordered the questions roughly by order of priority. Given time/space constraint, feel free to address the higher-ordered ones first.

  • Q1 - As mentioned in Limitations, I-PTC inherits overheads from notebook-style persistent execution. While the presented experimental results highlight the improvements in token usage, it does not show the other execution overhead. It would be helpful to also present that in some form so one can see the net efficiency.
  • Q2 - To better understand where the improvement (especially in token usage) comes from, it would be helpful to also conduct ablations for on-demand tool inspection, and present the ablations as (1) raw I-PTC vs. (2) raw I-PTC + on-demand tool inspection vs. (3) raw I-PTC + self-evolving API documentation vs. (4) raw I-PTC + self-evolving API documentation + on-demand tool inspection. Right now, (2) is indirectly provided and (3) is missing.
 On a related note, based on Table 4 and Figure 5, I believe one can infer that on-demand tool inspection accounts for almost all of the improvements in token usage. It might be helpful to explicitly mention this.
  • Q3 - Table 3, Figure 4, and Table 4 are all run for one select model only. It is understandable that due to time and resource constraint, it might not be feasible to run all models, but it can be worthwhile to justify why the specific model is selected, and why there are reasons to believe these results would generalize to other models.
  • Q4 - It is said that PTC-bench focuses on long-horizon tasks; table 1 shows high number of API calls; section 4 explains that benchmark tasks have at most two turns. How do these three concepts—horizon, API calls, turns—relate to one another? Additionally, two turns still seem relatively low in view of realistic human usage pattern. How might I-PTC and other interfaces fare beyond two turns?
  • Q5 - While the primary contribution of I-PTC being highlighted is stateful, it is named as Interactive-PTC not stateful-PTC. What exactly is the interplay between “interactive” and “stateful”? Can they be decoupled or are they bundled?
  • Q6 - Table 2 is informative, but the overall trends can be slightly hard to grasp. It might be helpful to include aggregate statistics and potentially plots of those.
  • Q7 - It can be helpful to include API calls as a metric in Table 2.
Limitations

Yes

Paper formatting concerns

N/A

Final justification

I maintain my original rating of "accept" as this work proposes a new benchmark and a new framework that is well-motivated and effective in practice. Additionally, during rebuttal, the authors diligently responded to all my questions and provided helpful clarifications.

Comments on the paper

1 comment
Meta-review

R1 gives a 5 and considers the framework practical, the benchmark well designed, and the claims well supported. R2 gives a 4 and highlights the simplicity and engineering feasibility. R3 gives a 2 and argues that stateful Python environments for LLMs are not new, citing four prior works.

The split is really about novelty versus engineering contribution. My own reading is that the paper contributes two things: a concrete framework (I-PTC with self-evolving API docs and on-demand inspection) and a benchmark (PTC-BENCH). The works R3 cites are relevant but address different settings, mostly general code execution rather than interactive tool calling with state persistence and API evolution.

Questions for the rebuttal, in priority order.

  • R3 cites CaveAgent, TaskWeaver, Recursive LMs, and Sharing State Between Prompts. Can you provide a table showing what I-PTC does differently, in particular on API correction and on-demand inspection?

  • R1 notes that Table 3, Figure 4, and Table 4 use only one model. Can you justify why the results would generalize, or add one more model?

  • R3 asks for variance. Single-run results on stochastic agent benchmarks are fragile. Can you report repeated runs for at least a subset?

  • R1 and R2 both ask where the efficiency gain comes from. Can you isolate on-demand tool inspection from statefulness?

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.