Agents Learn Their Runtime: Interpreter Persistence as Training-Time Semantics

Victor May, Aaditya Salgarkar, Yishan Wang, Diganta Misra, Huu Nguyen
3/1/2026
cs.AIcs.LG

No official code found. Best implementation: mrcabbage972/agents-learn-runtime (0 stars, Apache-2.0, last commit 2026-02-27).

Abstract

Tool-augmented LLMs are increasingly deployed as agents that interleave natural-language reasoning with executable Python actions, as in CodeAct-style frameworks. In deployment, these agents rely on runtime state that persists across steps. By contrast, the traces used to post-train these models rarely encode how interpreter state is managed. We ask whether interpreter persistence is merely a runtime scaffold, or a property of the training data that shapes how agents learn to use the interpreter. We isolate state persistence as a training-time variable. We introduce Opaque Knapsack, a procedurally generated family of partially observable optimization tasks designed to prevent one-shot solutions. Item attributes and constraints are hidden behind budgeted tool calls, forcing multi-turn control flow and iterative state revision. Holding task instances, prompts, tools, model, and supervision fixed, we generate matched trajectories differing only in whether interpreter state persists across steps or resets after each action. We then fine-tune identical base models (Qwen3-8B) on each trace variant and evaluate all four train-runtime combinations. Our 2x2 cross-evaluation shows that interpreter persistence shapes how agents reach solutions, not whether they do: solution quality is statistically indistinguishable across conditions, but token cost and stability differ substantially. A persistent-trained model in a stateless runtime triggers missing-variable errors in roughly 80% of episodes; a stateless-trained model in a persistent runtime redundantly re-derives retained state, using roughly 3.5x more tokens. Interpreter persistence should be treated as a first-class semantic of agent traces. Aligning fine-tuning data with deployment runtimes improves efficiency and reduces brittle train-runtime mismatches.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Official implementation for the paper "Agents Learn Their Runtime: Interpreter Persistence as Training-Time Semantics".

00Shell, PythonFeb 24, 20267 months agoApache-2.0

Similar Papers

Cite this paper

@article{may2026agents,
  title  = {Agents Learn Their Runtime: Interpreter Persistence as Training-Time Semantics},
  author = {Victor May and Aaditya Salgarkar and Yishan Wang and Diganta Misra and Huu Nguyen},
  year   = {2026},
  eprint = {2603.01209},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2603.01209v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2603.01209.svg)](https://codeofpaper.com/paper/2603.01209)

Discussion