The most common way to teach a tool-using AI agent—an AI that calls external functions like search, lookup, or ordering on a person's behalf—is to "gather a lot of conversations that ended well and have it imitate them."
Picture a scene. A customer says, "Cancel two of my orders, and swap an item on a third." The agent looks up the account, confirms, and carries out the cancellations and the swap. The system logs this as an "execution success." But what if the log includes a change the customer had already retracted mid-conversation, now processed anyway? This is exactly where the system's scoring (did it execute?) and what the customer actually wanted (did it match the intent?) part ways. Is a log like this really worth imitating?
This paper's answer is no. The fact that a log ended in success guarantees neither what it teaches nor that the imitated behavior was correct. So Trajectory2Gym changes the approach. Not "collect successful logs," but "deliberately manufacture interactions worth learning from." To give away the result up front: a model trained on data built this way improved substantially, especially on multi-turn tasks. The specific numbers come in the results section below.
In this article, a "trajectory" means one complete record of the conversation and calls an agent left behind while handling a single task.
A tool-using agent's job doesn't end with a single call. Let's walk the order-change example a little further. A capable support agent looks up the account; if an email lookup fails, it asks for the name and postal code and tries again; it reads each order to confirm it's in a "cancelable" state; and only after checking once more with the user does it execute the cancellations and the swap using the identifiers that surfaced from "reading the order." Each individual call is simple. What's hard is the order you chain those calls in and what you lean on to decide the next one—in other words, the dependencies. The paper calls this kind of flow "compositional interaction."
The conditions for being good training data fall out of this. The paper splits them in two.
Yet most standard collection methods filter logs only by "was the task completed?" or "did the individual call execute successfully?" This leaves two holes.
Hole 1 — the scenes you actually want to teach are rare. Of the 34,772 "certified" candidate logs the authors gathered, 40.9% contained at most two decisions eligible for supervised learning, and only 10.0% captured a "recovery after a real failure." In other words, the very scenes that matter—multi-step dependencies and error recovery—barely appear in the data.
Hole 2 — success doesn't mean the action was justified. The paper's Figure 1 makes the point. In the Tau2 Retail environment, a user asks for a larger bottle and a darker light (a dimmer lamp), then ultimately confirms only the lamp. Filter by execution success alone and both swap requests remain "valid," because replaying them in the original execution environment makes both go through. But the side collecting the data sees the whole log, while the student model that actually learns sees only what was on screen at that moment. So Trajectory2Gym keeps only the lamp swap, based on the most recent confirmation, and drops the already-retracted bottle swap from training.
Prior reports the authors cite back this up: train directly on raw log imitation, and performance can end up worse than the untrained starting-point model.
Existing data-curation research splits broadly into "select successful logs and imitate them as-is" and "exploit failures and recovery too." Trajectory2Gym is closest to the failure-exploiting camp, but it goes one step further. Even for an action that executed successfully, it asks one more layer—"was it visible at the moment of decision?"—and when structure is lacking, rather than discarding, it deliberately manufactures to fill the gap. (The names and lineage of the representative works are collected in the references at the end.)
The "Gym" in the name sums up the direction. It's not about selecting a strong athlete but about designing, from scratch, the equipment to build up the weak muscles. Let's push the earlier order-change case through three stages.
Stage 1 — deliberately manufacture the missing situations. First, write out every interaction as a combination of "which capabilities does it require?" The order-change path is "lookup → error → clarification → retry → read order → confirm → cancel → update." Count how often such a path appears in the current data (the number of logs per path), pick out the rare paths, and tell a teacher model to "actually walk this path." The key is that the teacher really runs it in the original execution environment, producing genuine observations, state changes, and rejections. If you need "recovery after a lookup failure" data, you deliberately trigger a rejection and manufacture the recovery that follows. And you accept as training candidates only the logs where the path's dependencies actually show up in the execution log. Proposals the teacher got wrong are not included.
Stage 2 — only grounded actions become the ground truth. Split the execution log into two blocks. One is the context the student model "sees," the other is the ground truth the student learns to "imitate."
Into the context go only the events that actually surfaced in the original execution environment. The teacher's hints, or backstage information known only to the collecting side, are left out. Qualifying as ground truth is judged on two counts: (1) did the call execute without error, and (2) was that tool actually visible to the agent at the time, with arguments like the order ID backed by information that had appeared on screen earlier? For an order change, the order ID used for the cancellation must have been on screen from the earlier "read order." An ID known only during collection cannot become ground truth.
This is where the handling of recovery diverges. The scene where the lookup was rejected is not erased; it's laid out as two pieces, side by side.
Delete the failure from the data and you can never teach "how to recover when you get stuck." So instead of erasing it, the failure stays as input and only the recovery is carved out as ground truth. Finally, you check that the order required by the task was followed and that the original execution environment's grader recognized the final success.
Stage 3 — weight things so one conversation doesn't monopolize training. A long multi-turn conversation gets split into many training examples. Average by the example and long conversations overwhelm short ones. So weighting is applied at the conversation (parent) level, not the example level, so that each conversation—long or short—gets the same weight.
The three stages lose their force when they act alone. For instance, if Stage 1 manufactures rare recovery scenes but you drop Stage 2's grounding check, you end up teaching, as ground truth, the shortcut that was known only during collection.
Evaluation ran on three benchmarks—Tau1, Tau2, and BFCL (standard tests of an agent's tool-use ability)—using five sizes of the publicly released pre-training model Qwen3 (1.7B, 4B, 8B, 14B, 30B-A3B). Each model received only one epoch of full-parameter fine-tuning (SFT, training that adjusts the whole model to the ground-truth data) on size-matched data (11.6k–19.9k logs), with no reinforcement learning. So the before-and-after difference reads as the effect of the entire "we built the data this way" recipe. Within that recipe, which design element contributed how much is separated out by the later ablation.
Scoring uses the original execution environment's task success for Tau1 and Tau2; BFCL reports eight categories but takes as its headline the Overall, which is not a flat average of all eight categories. Instead, it averages the four Non-live categories into one score, averages the three Live categories into a second score, and takes the Multi-turn Base score as a third—then weights those three equally, at one-third each (per the original paper's Table 2 and Appendix A.1). One evaluation-design caveat up front: Tau1 Airline reused the same 50 tasks used to build the training data for evaluation as well, and Appendix A.2 explicitly states this is "evaluation on already-seen tasks." So that score should be read as performance on tasks seen during training, not as generalization to unseen tasks.
The heart of the comparison is the "paired comparison." A post-trained model is run against its own pre-training state, once per task, under the same tasks, the same interface, the same response-generation settings, the same user simulator, and the same grader. That way only "how much does the same model change when the data is built this way?" remains, with no other variable creeping in. (Comparisons against public training checkpoints and closed models differ in training data, model family, and context budget, so they are not same-condition comparisons—those tables and their conditions are gathered in the references at the end.)
Results first. Across all five sizes of the public pre-training model, the equally-weighted average over the three benchmarks rose by 16.9–29.8 percentage points. The details split three ways.
Multi-step tasks rose sharply. The average on tasks where state accumulates (Tau1, Tau2) rose 20–41 points at every size (the smallest, 1.7B, +20.04; 4B and up, 35–41 points). As a representative case, Qwen3-4B's Tau2 average jumped from 19.17 to 69.17. The gains didn't concentrate in one spot but spread broadly: 24 of the 25 pairs across five domains × five sizes improved (the lone exception is 1.7B's Tau2 Airline, which stayed at 20.00). In particular, BFCL Multi-turn Base, which measures multi-step dependency, rose 7–41 points, matching the design aimed at "dependency between steps." But reading these numbers as "generalization to new tasks" overstates them—as noted above, Tau1 Airline reused the 50 training tasks for evaluation, so that portion is a score on "already-seen tasks" (Appendix A.2).
On single-call tasks there was also a loss. BFCL's Live Simple alone (the category expecting a single, immediate call) dropped 6–13 points in four of the five sizes. The authors attribute this to "a tendency to lean toward gathering information even on immediate-answer queries," but this is a hypothesis about the observation (the drop), not a confirmed cause.
Each design element contributed—but by widely varying amounts. The ablation (removing design elements one at a time; Qwen3-8B, three benchmarks equally weighted) consisted of four comparisons, and the effect sizes varied greatly by element. The largest came from adding the missing parent (conversation)-level normalization, which rose from 59.94 to 67.97, +8.04 points. The other three elements were around +2–4 points. Note that the baseline scores of the four comparisons differ from one another, so directly comparing the sizes across stages calls for caution. In particular, the targeted-expansion (compositional synthesis) comparison did not fix the number of training tokens, so its difference cannot be read as "the effect of the synthesis method alone."
| Element added/removed | Baseline condition (score) | After adding | Change |
|---|---|---|---|
| Parent (conversation)-level normalization | Example-level normalization 59.94 | 67.97 | +8.04 |
| Compositional synthesis (targeted expansion) | Existing candidate pool 69.08 | 72.63 | +3.55 |
| Decision grounding | Loose success-based 65.22 | 67.97 | +2.75 |
| Structural selection | Random selection 68.23 | 70.55 | +2.32 |
The targeted-expansion row (compositional synthesis) is a comparison that did not fix the number of training tokens, so the numerical difference should not be read as the contribution of the synthesis method alone.
Being good at function calling doesn't mean being good at state-dependent tasks—the gap is clear when compared against other models of the same size, and the numbers are gathered in the references at the end.
Start with the limits the authors acknowledge themselves. Live Simple's drop (6–13 points, four sizes) is a clear trade-off, and its cause is, in the authors' own words, a "hypothesis." Also, the tables against public checkpoints and closed models are not same-condition comparisons. So no ranking can be concluded from those tables. A flat claim like "Trajectory2Gym > reinforcement-learning methods" goes beyond this paper's evidence.
The question that will decide real-world adoption is the "execution environment" side. The synthesis depends on "really running it in the original execution environment to produce genuine observations and rejections." This leads to three burdens. First, the cost of having an execution environment and a grader. You need an environment that actually runs the task and judges success. Second, the requirement to log the information visible at that moment. To judge whether an action was justified, "what was on screen at the time of decision" must be in the log. Third, the tension between extra lookups and fast handling. Teaching the agent to verify information thoroughly is good for multi-step tasks, but for queries that should finish in one shot, like Live Simple, it can backfire.
Let's also be clear about limits in the evaluation design itself. Tau1 Airline reused the 50 training tasks for evaluation too, so that score is on "already-seen tasks" (Appendix A.2). So the overall gain should not be read as generalization performance on unseen tasks. Beyond that, the fact that validation was done on only one Qwen3 family, and that evaluation was designed as one run per task, are also part of the scope to keep in mind when reading the results.
ONTLE is a service where a human PM takes on a client's project and an AI agent assists with the legwork. The work the agent takes on—or will take on—is also not a single call. It looks up the task board, requests re-authentication if a permission error occurs, confirms the changeable state, and only after the human PM's confirmation does it edit and announce using the real task ID. It's a multi-step task in the same vein as the order change we saw.
But PM work carries two conditions the benchmarks don't have.
First, work spans multiple days. An approval given Monday gets overturned Wednesday, and permissions get revoked midway. If the log can't record "the approval and permission that were valid at the moment of decision" together with their timing, an action that sends out today's announcement under a permission from two days ago gets recorded as a "success" and mixed into the training data. So approvals and permissions must be recorded not just as values but together with "from when to when they were valid."
Second, you have to decide where to draw the line on what counts as an error. Suppose a client requests a "schedule change" and then quickly retracts it. The log keeps both the pre-retraction request and the post-retraction confirmation, and the system lets both execute successfully. Filter by success alone and an action that "includes the retracted change in the announcement" masquerades as good training data. To count this as an error, you must be able to separate retracted requests from confirmed ones based on the log's "last confirmation."
So this paper gives ONTLE not an "answer" but something to check first. Given the result that the effect grew as state accumulated and turns lengthened, there's a "possibility" it will work more strongly on a multi-day PM agent than on a short QA bot. But that is an expectation, not a confirmed fact. So the first step is not grand adoption but measurement—opening our PM agent's logs and actually counting, starting with "can we separate retracted requests from confirmed ones?"
No. The training in this paper is fine-tuning (SFT) only, not reinforcement learning. It's easy to confuse with reinforcement-learning environment libraries (e.g., OpenAI Gym) because the names are similar, but here "Gym" is just a metaphor for "designing the equipment to build up the weak capabilities."
Generalizing it that way is a misreading. The post-trained 4B came out ahead on a specific benchmark (Tau2), against the "pre-training" state of a larger model. It doesn't mean the 4B beats the 30B on every task; it should be read as meaning that, even at the same capacity, "what you trained on" can change the result a great deal.
The failure-exploiting camp includes FACA, which uses the next turn's user reaction for credit assignment; DARC, which diagnoses failures to select recovery interventions; and SEAL, which bundles diagnosis-based interface adaptation with policy updates. The synthesis/curation camp includes approaches that build large-scale function-calling data from verified execution; TopoCurate, which selects data by interaction structure; Code2Skill, which extracts reusable procedures from source code; and Patches-to-Trajectories, which infers efficient steps from privileged references. The DAgger lineage in imitation learning, which separates "knowledge known only to the demonstrator" from "what the student sees," connects to this paper's grounding logic.
Below are reference comparisons that are not fair A/B tests, because the training data, model family, and source protocol differ. No ranking can be concluded from these tables.
| Comparison item | This paper | Reference figure | Condition | |---|---|---|---| | Tau2 best (30B-A3B) | 84.17 | GPT-5.2 84.76 / Claude-4.5-Opus 85.31 | Closed model, not same condition | | Tau2 (8B) | 74.17 | At least +28 points over all re-evaluated checkpoints (incl. 14B, 32B) | Differing data, family | | Tau2 Telecom (30B-A3B) | 12.50 → 95.00 | — | Largest improvement margin | | BFCL Multi-turn Base (4B and up) | Exceeds GPT-5.5 (60.00) | GPT-5.5 60.00 | Differing source protocol | | BFCL Overall (30B-A3B) | 80.93 | Gemini-3.0-Pro 79.97 | Each with its own source protocol |Function-calling ability and state-dependent ability are distinct: EnvFactory-8B comes close to this paper's 8B (78.62) on BFCL Overall (77.55) and ties on Multi-turn Base (68.00), but trails by 47.5 points on Tau2. On the equally-weighted average of the three benchmarks, this paper's 8B at 67.97 also surpassed all re-evaluated checkpoints (up to 57.17).
Editor's note. This article was written based on excerpts from the paper. The ablation's parent-level normalization figures (59.94 → 67.97) are per §5.4 and Table 3. The fact that Tau1 Airline reused the 50 training tasks for evaluation too—making it an evaluation on "already-seen tasks"—is stated explicitly in Appendix A.2, so the overall gain should not be read as new-task generalization. The variance of the one-run-per-task design, and the additional analyses in the appendix and later tables, lie beyond the provided excerpts and could not be verified. The targeted-expansion (compositional synthesis) comparison did not fix the number of training tokens, so that numerical difference should not be read as the effect of the synthesis method alone. The figures and comparisons in the body are the values stated in the excerpt, and the parts marked "hypothesis" in the causal explanations are the authors' conjectures.