AgentBrew: Offline Tool-Use Agent Learning from Raw Real-World Trajectories
Zhiyi Lyu, Yewen Li, Longtao Zheng, Shengtian Yang, Lang Feng, Lei Feng, Peng Jiang, Kun Gai, Qingpeng Cai, Bo An
NeurIPS 2026
Abstract. LLM-based agents are increasingly deployed in real-world applications through tool-use APIs, yet training them for specific environments remains fundamentally difficult: real-world applications provide no pre-defined tasks or verifiers, no faithful simulators, and limited budget for large-scale environment interaction. In this paper, we propose AgentBrew, an offline training framework that learns effective tool-use policies from a single batch of raw interaction trajectories, without task verifiers or iterative on-policy rollouts. The agent first explores the target environment to collect a raw trajectory corpus without quality filtering. To extract training signal from this noisy corpus, retrospective task inference reconstructs an aligned instruction for each trajectory based on its actual outcome, and PMI-Based credit assignment decomposes the trajectory's total information about the inferred instruction into additive per-action credits via pointwise mutual information (PMI). These credits weight the policy training objective, amplifying informative actions while suppressing ineffective ones. On three real-world MCP applications (GitHub, Notion, PostgreSQL), AgentBrew improves Qwen3-32B by +8.7 Acc / +9.7 Score on average, surpassing Qwen3-235B (+2.3 / +4.4) and outperforming rejection sampling (+5.9 / +10.3). These results demonstrate that fine-grained offline learning can recover useful supervision from raw trajectories that filtering-based approaches would discard.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (poster) · 3 reviews · OpenReview
Updated 25 Nov 2026, 03:50 UTC.
- Decision
- Accept (poster)
Read decision
Meta-review
My preliminary meta-review based on the reviews and initial look at the paper.
Positives: All reviewers are positive on the PMI-based credit assignment which is the main contribution of the paper. Reviewers seem to agree that the problem is well motivated Several reviewers think that the ablations are thorough
Negatives: At least two reviewers have concerns about the circularity: i.e. descriptions being derived from the actions, which reviewers are concerned may lead to PMI merely reward actions being explainable rather than performing correct actions Reviewers are also concerned with the similarity with HER Two reviewers have questions or concerns about the decision about CoT during training Another concern is the size of the task set (approximately 100 tasks in total).
Pre-rebuttal: Authors should respond to all author comments. AC thinks that the most important issues surround the small size of the datasets and the questions about CoT training, circularity and similarity to HER. AC does not agree with 4rjG's concern about frontier models. Since these models are large and trained on large amounts of data and do not publicly report information about training it is impossible to either fairly compare or even fully understand the gap. AC encourages authors to discuss comparisons to SOTA models but this should not be a reason for rejection.
Final meta-review: After author rebuttal and reviewer discussion, reviewers are all now generally positive on the paper, but with a few lingering concerns. Many of the concerns were clarified or addressed in rebuttal (particularly the dataset size and missing baseline for 4rjG), as acknowledged by reviewers, but not all (such as the concern about CoT training). However, reviewers are still generally positive, although all at the borderline and think the paper provides important contributions, so AC agrees with the consensus to accept.
Final justification
See above
- Final justification
- See above
Read meta-review
Meta-review
My preliminary meta-review based on the reviews and initial look at the paper.
Positives: All reviewers are positive on the PMI-based credit assignment which is the main contribution of the paper. Reviewers seem to agree that the problem is well motivated Several reviewers think that the ablations are thorough
Negatives: At least two reviewers have concerns about the circularity: i.e. descriptions being derived from the actions, which reviewers are concerned may lead to PMI merely reward actions being explainable rather than performing correct actions Reviewers are also concerned with the similarity with HER Two reviewers have questions or concerns about the decision about CoT during training Another concern is the size of the task set (approximately 100 tasks in total).
Pre-rebuttal: Authors should respond to all author comments. AC thinks that the most important issues surround the small size of the datasets and the questions about CoT training, circularity and similarity to HER. AC does not agree with 4rjG's concern about frontier models. Since these models are large and trained on large amounts of data and do not publicly report information about training it is impossible to either fairly compare or even fully understand the gap. AC encourages authors to discuss comparisons to SOTA models but this should not be a reason for rejection.
Final meta-review: After author rebuttal and reviewer discussion, reviewers are all now generally positive on the paper, but with a few lingering concerns. Many of the concerns were clarified or addressed in rebuttal (particularly the dataset size and missing baseline for 4rjG), as acknowledged by reviewers, but not all (such as the concern about CoT training). However, reviewers are still generally positive, although all at the borderline and think the paper provides important contributions, so AC agrees with the consensus to accept.
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 2/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper proposes AgentBrew, a three-stage offline training framework for LLM-based tool-use agents in real-world environments (GitHub, Notion, PostgreSQL via MCP), to tackle the problem that real-world deployments lack pre-defined task suites, verifiers, simulators, and large interaction budgets. AgentBrew (1) collects a raw trajectory corpus through grounded exploration without quality filtering; (2) performs experience distillation via retrospective task inference (rewriting instructions to match actual outcomes) and PMI-based credit assignment (decomposing trajectory-level information into per-action credits); and (3) trains using these credits as sample weights in a weighted SFT objective. On three MCP applications, it improves Qwen3-32B, surpassing Qwen3-235B and outperforming rejection sampling. The distilled data also transfers to a 14B model.
Strengths and weaknesses
Strengths
Originality
- The paper identifies an important problem: existing training approaches for tool-use agents assume verifiers, simulators, or large interaction budgets, but they are not always available in real-world applications. The problem identification is well-motivated, even though the solution's framing is debatable (see Weaknesses).
- The PMI-based credit assignment is novel. Using the chain rule of PMI to decompose trajectory-level information into per-action credits provides an exact additive decomposition with intuitive properties: informative actions get high credit, redundant ones near-zero, and misleading ones negative (clamped to zero) credit.
Quality
- The PMI-based credit assignment is mathematically clean, and it complements the retrospective task inference. The two components addressing different failure modes (task-level misalignment and action-level noise).
- The ablation comparing credit assignment strategies shows PMI consistently outperforming Uniform, LLM Score, and InfoPO. The transferability experiment demonstrates practical value for amortizing API costs.
Clarity
- Well-written with clear notation and detailed case studies that make the method concrete and interpretable.
Weaknesses
Quality
- By rewriting task instructions to match what trajectories already achieved, the framework can only reinforce behaviors the base model already exhibits. It has no mechanism to discover or credit actions never tried. This creates a self-reinforcing loop: explore within current capability -> relabel partial successes as training targets -> improve at what the model already does. Rejection sampling, by contrast, preserves original goals and filters for lucky successes that exceed typical behavior, providing a path to capability expansion. The 18.2% average accuracy may partly reflect this ceiling. The circularity is amplified by using a single model (Qwen3-32B) for all pipeline stages (exploration, task inference, credit computation, and training), so the model's own biases determine what is proposed, inferred, and credited, with no external signal to break the loop. Continual learning is therefore unclear: the improved model's trajectories would still be relabeled to match their outcomes, potentially converging rather than further improving.
- "No verifier" framing overstates the advantage. Retrospective task inference, which infers what a trajectory accomplished, is arguably harder than verification (checking whether a specific goal was met). Both require understanding complex stateful API interactions. If an LLM cannot determine whether a task was completed, why can it reliably determine what was accomplished? The real trade-off is the verifier discarding data while the rewriter preserving data, with similar inference difficulty.
Originality
- Replacing instructions with ones the trajectory actually fulfills is now new: HER in classic RL, HSL with environment rewards, AgentHER with failure classification. The paper cites all three but does not discuss what is novel beyond applying the same idea without rewards. Stripping chain-of-thought and adding inference constraints are implementation details, not conceptual advances. The real novel PMI credit mechanism is conflated with hindsight relabeling under the unified AgentBrew framing.
Significance
- Large gap to frontier models. AgentBrew-trained Qwen3-32B achieves only 18.2% accuracy, far below Gemini-3 Pro (57.1%) and GPT-5 (50.0%). The method surpasses a 235B model of the same family, but the agent still fails on >80% of tasks. The paper does not discuss what fraction of this gap is bridgeable by the proposed approach versus what requires fundamentally different methods (online exploration, stronger base models, external feedback, etc.).
Clarity
- No comparison against training on only "well-aligned" trajectories (as classified by the GPT-5 judge) with uniform weighting. This would disentangle the value of including misaligned trajectories (which PMI suppresses) from action-level credit assignment on aligned ones.
Questions
- What fraction of inferred tasks are classified as "well-aligned" by the GPT-5 judge? How does the quality correlate with trajectory length/complexity?
- How does performance scale with the number of trajectories? A learning curve would help practitioners decide how much exploration is needed for a new application.
- Robustness experiments: Section 4.5 ranks trajectories by alignment with the original instruction, but since retrospective inference rewrites instructions to match trajectories, original alignment becomes irrelevant. A more meaningful experiment would measure noise after rewriting.
- Why does rejection sampling achieve 0% accuracy on Notion? How many trajectories did the judge retain? If essentially zero pass the filter, this seems like a judge prompt/setup failure rather than an inherent limitation of filtering.
Limitations
This paper identifies some limitations (narrow evaluation scope, degradation on long/chaotic trajectories). One additional limitation deserves mention:
- Clamping negative PMI credits to zero introduces a bias toward learning recovery behaviors. When an erroneous action is followed by a corrective action, the error is suppressed (zero weight) while the recovery is reinforced. In an optimal trajectory, neither would be needed. The policy may thus learn "how to recover from mistakes" rather than "how to avoid them." This is inherent to any information-theoretic credit mechanism on imperfect trajectories without counterfactual reasoning, but deserves explicit acknowledgment.
Final justification
Overall, the PMI-based credit assignment is a novel contribution that demonstrably outperforms alternative weighting strategies. The rebuttal provides the missing baseline, confirming that action-level credit adds value beyond trajectory-level filtering. Remaining issues are not disqualifying, but the camera-ready should explicitly acknowledge the structural ceiling and adjust the novelty positioning of the task inference component.
Formatting concerns
N/A
3 comments
Thanks the authors for the detailed and data-rich rebuttal.
They addresses most of my concerns and the new ablations collectively strengthen the paper. Please add provided information to the paper.
Two issues remain and they should be clearly stated.
- Self-Reinforcing Comfort Zone is a structural limitation/ceiling: Argument (1) conflates expanding the task distribution with expanding capabilities. By rewriting multi-step tasks into easier subsets the model already partially solves, the new tasks are just downgraded versions of the originals. The 7% → 54% alignment gain reflects better data utilization, not capability growth. The authors note that rejection sampling faces the same exploration ceiling, which is true, but the two methods bias in different directions: RS retains fully-completed trajectories for the original ambitious tasks, selectively reinforcing the model's peak performance (although RS's effectiveness depends on judge reliability), while AgentBrew rewrites tasks to match partial completions, reinforcing the model's typical performance on easier subsets. Argument (2) addresses a different concern (Reviewer GX8L's: does PMI merely measure self-consistent narrative?). It does not address ours. We never doubted the model learns from real tool-call outcomes; our concern is whether that learning can push beyond the current capability boundary, which this ablation cannot speak to.
- Hindsight Relabeling needs better novelty positioning: The ablation shows the revision-based variant outperforms trajectory-only inference, but the paper should reframe this component as "improved hindsight relabeling for compositional tool-use" rather than presenting it as a distinct contribution.
Overall, the PMI-based credit assignment is a novel contribution that demonstrably outperforms alternative weighting strategies. The rebuttal provides the missing baseline, confirming that action-level credit adds value beyond trajectory-level filtering. Remaining issues are not disqualifying, but the camera-ready should explicitly acknowledge the structural ceiling and adjust the novelty positioning of the task inference component.
I have raised my rating to 4 (Borderline accept).
We sincerely thank the reviewer for the constructive engagement and for raising the score. We fully agree with both points and will address them in the camera-ready version.
- Self-Reinforcing Comfort Zone. We accept this as a structural limitation. AgentBrew operates on a fixed offline corpus, and the recoverable supervision is inherently bounded by the behaviors present in that corpus. This is a general constraint of offline learning: any method that learns from a static dataset cannot acquire behaviors absent from the data. We note that even these "downgraded" subtasks remain challenging for the base model (e.g., 3.6 Acc on Notion), indicating that substantial gains are achievable within the current exploration distribution before this ceiling is reached. Nonetheless, pushing beyond this boundary requires mechanisms such as online exploration or external feedback. We will explicitly acknowledge this structural ceiling in Section 6.
- Novelty Positioning of Task Inference. We agree and will reframe accordingly. The task inference component is designed for complex real-world tool-use environments with compositional multi-API tasks, inspired by the principle of hindsight relabeling. The primary novelty claim will be centered on PMI-based credit assignment, with original-task-anchored inference positioned as a validated design choice (10.7/66.3 → 14.2/70.1) rather than an independent contribution.
Thank you again for the feedback that has significantly improved the paper's positioning and transparency.
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This work proposes AgentBrew, an offline data augmention method that generates training supervision signal from offline agent trajectories. By generating task backwards from trajectory and generating credit weight from information gain, the method improved the model performance and beat other training datasets such as TOUCAN.
Strengths and weaknesses
I really like the idea of using information gain to assign credit from the whole trajectory to each individual action. The use of the PMI chain rule is elegant, and provides an alternative to the heuristic per-action scoring used in much prior work.
My main concern is regarding the claimed novelty of the retrospective task inference method. Generating tasks from trajectories is a widely used approach for training tool-call agents [1]. I would suggest that the authors re-frame the contribution around the PMI-based credit assignment method, while citing and discussing the relevant prior work.
Also, since CoT is discarded entirely and credit is only assigned at the action level, the method may have limited applicability to reasoning-style agent policies.
Questions
Does your method generalize to other models such as Qwen 4B/30BA3B?
How does your method work for reasoning models?
Limitations
the proposed method only works for instruct-style models. This is not a critical issue, but I encourage the authors to discuss it explicitly.
Final justification
My concerns regarding CoT is not fully addressed thus i'm keeping my original positive score.
Formatting concerns
n/a
1 comment
Rebuttal
We sincerely appreciate your thoughtful and encouraging feedback, and we are grateful for your positive assessment of AgentBrew’s backward task inference, its effectiveness over prior training dataset. Regarding your concerns, we provide our responses below:
W1: Distinction from Prior Hindsight Relabeling and Trajectory-to-Task Methods
We thank the reviewer for this suggestion and agree that deriving tasks from trajectories is an established technique that should be more thoroughly discussed. We will add Trajectory2Task to the related work, and revise our contribution statement to make PMI-based per-action credit assignment the primary methodological novelty.
At the same time, AgentBrew is not a direct application of existing hindsight relabeling. HER-style methods assume an environment-defined goal space and a reward function that can be recomputed after replacing the original goal. In our setting, neither is available: MCP trajectories are governed by free-form natural-language instructions, and the environment provides no state-to-goal mapping, goal taxonomy, or reward. Retrospective task inference therefore constructs the missing goal representation by constrained revision of the original instruction, removing unsupported subtasks while preserving the original task structure and environment-confirmed outcomes.
We will position this component as a substantive adaptation of hindsight relabeling to unstructured tool-use environments, while emphasizing that the central new mechanism is what follows: the inferred task serves as the reference variable for PMI-based credit assignment, which identifies the contribution of individual actions without rewards or verifiers.
W2 & Q2 & L1: Applicability to Reasoning-Style Agent Policies
Thank you for raising this point. We want to clarify that CoT is removed only during the distillation stage (task inference and credit computation), not during training. We discuss the two aspects below.
(1) CoT is retained and utilized during training. We remove CoT before task inference because it is conditioned on the original instruction and may reflect intended rather than achieved outcomes. Task inference therefore relies only on the objective interaction record: tool calls and environment responses. During training, however, the step-level credit is applied to the complete action, including both CoT and tool-call tokens. Thus, reasoning associated with high-credit actions is reinforced, while reasoning associated with low-credit actions is down-weighted.
To verify this design, we ran an ablation on Notion that masks the CoT loss and trains only on tool-call tokens:
| Variant | Acc | Score |
|---|---|---|
| Qwen3-32B (base) | 3.6 | 60.1 |
| AgentBrew w/ CoT masked | 7.1 | 62.4 |
| AgentBrew (full) | 14.2 | 70.1 |
The full method substantially outperforms the masked variant, showing that retaining weighted CoT provides significant additional supervision and that its benefit outweighs the residual misalignment in the original reasoning.
(2) The framework is compatible in principle with reasoning-style policies. Credit computation operates on tool calls and environment responses after CoT has been removed. Therefore, its direct computational cost depends on the interaction sequence rather than the original reasoning length. The reasoning tokens are retained during training, allowing high-credit steps to supervise the planning and decision process that produced successful tool calls.
Our current formulation nevertheless assigns one weight to the entire reasoning-and-action step and does not provide token-level credit within the CoT. We use Qwen3-32B in non-thinking mode because collecting approximately 8,500 long-horizon trajectories with a long-thinking policy would exceed our interaction budget. We will clarify this limitation in Section 6 and evaluate reasoning models in future work.
Q2: Generalization Across Model Sizes and Architectures
Thank you for this question. We provide direct evidence that AgentBrew’s distilled supervision transfers to a smaller policy model.
(1) Cross-size transfer is already demonstrated. As shown in Table 3, we apply data distilled by Qwen3-32B to train a 14B model without any additional environment interaction. AgentBrew-14B achieves 20.2 avg Acc / 55.3 Score, outperforming the Qwen3-14B base by +11.5 Acc / +12.5 Score, and on Notion nearly matches the 32B result. Two baselines that also leverage larger models in their pipelines (Toucan-14B, AWM-14B) show limited improvement, suggesting the gains come from the quality of the distilled signal rather than capacity alone.
(2) The optimization procedure is architecture-agnostic. PMI computation requires token-level log-likelihoods, while policy learning uses standard weighted SFT; neither assumes a specific dense-model architecture. Therefore, the same procedure is mechanically applicable to models such as Qwen3-30B-A3B and smaller Qwen models. However, our current experiment validates transfer to 14B, rather than the full pipeline on every model size. For very small models such as 4B, we expect positive transfer but potentially lower absolute performance due to weaker instruction-following and long-horizon tool-use capabilities.
Thank you again for your valuable and encouraging feedback. We will incorporate all these clarifications and improvements into our revision.
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper studies how to adapt a tool-use agent to a specific real-world application when none of the usual training prerequisites are available, such as no predefined tasks, no verifiers, no reward, etc. The authors propose AgentBrew, a three-stage offline framework. (1) AgentBrew collects an unfiltered corpus of raw trajectories grounded in the environment's live state; (2) Then it applies retrospective task inference, which replaces each trajectory's original instruction with an inferred instruction describing what the trajectory actually accomplished, followed by PMI-based credit assignment, which uses the chain rule of PMI to decompose a trajectory's total information into exact additive per-action credits; (3) use these credits as sample weights in a weighted SFT objective. The authors conduct experiments on three MCP applications (GitHub, Notion, PostgreSQL), AgentBrew improves Qwen3-32B by +8.7 Acc / +9.7 Score on average, surpasses the in-family 235B model, and outperforms rejection sampling and vanilla SFT.
Strengths and weaknesses
Strengths
- The PMI decomposition is mathematically clean. Per-action credits are obtained as successive differences of conditional NLL. The authors conduct experiments comparing it to common heuristic credit schemes, and demonstrate the effectiveness.
- The ablations are thorough. Each ablation isolates one component: Section 4.3 shows PMI outperforms Uniform / LLM Score / InfoPO, and Section 4.4 shows the inferred task description substantially beats the original task description. Section 4.5 shows performance increases monotonically as progressively lower-quality data is added, which is the most direct support for the central claim that even poor trajectories contain usable actions.
- Data-leakage control is rigorous. Verifiers are used only at evaluation time, and training/test environments are fully isolated at the level of entities, data, and state.
Weaknesses
-
PMI in fact measures an action's explanatory power with respect to the inferred task description, not its quality. For example, a suboptimal or redundant action can receive a high weight as long as it aligns with the task description. Since the inferred description is itself derived from these actions, this circularity means PMI may reward actions for being explainable rather than for being good. Thus, it is possible that the PMI assigns wrong credits to training steps and leads to training collapse.
-
Credits calculated by PMI are computed without CoT, but training adds CoT back. Since the CoT was generated under the original task, which is often wrong, the model may be trained on reasoning that justifies an incorrect goal. Why is the CoT included in the SFT loss rather than masked out, as it is during credit computation?
-
The evaluation covers three MCP environments, each with roughly 30 tasks. Thus, the average-Acc advantage over Qwen3-235B and the Notion improvement over the base model each amount to only a small number of additional correct tasks. It would be great if the authors broaden evaluation coverage, and report results over multiple seeds with error bars, so that the main claims can be shown to be statistically robust rather than potentially within noise.
Questions
Please refer to the weaknesses part.
Limitations
Please refer to the weaknesses part.
Final justification
The authors' rebuttal addressed most of my concerns and thus I remain a positive score.
Formatting concerns
No.
3 comments
Rebuttal
We sincerely appreciate your in-depth and constructive feedback. We are also grateful for kindly pointing out that our method is well-motivated. Regarding your concerns, we provide our responses below:
W1: Does PMI Reward Explainability Rather Than Action Quality?
We thank the reviewer for this important concern. We agree that if the inferred task were a free-form narration of the action sequence, credit would primarily measure narrative fit. Our design prevents this unconstrained form of circularity by constructing the inferred task as a constrained edit of the original instruction grounded in environment feedback.
(1) The inferred task is not generated from scratch by summarizing the trajectory. The inference model receives both the original instruction and the trajectory, and is prompted to minimally edit the original task so that it matches what the environment actually confirmed (Appendix E). The observations are produced by the real application and cannot be fabricated by our pipeline. Moreover, unsupported claims must be removed, and no entities or outcomes beyond those evidenced by successful operations may be introduced. Thus, the inferred task cannot freely rationalize every action or simply restate the trajectory.
(2) Credit tracks marginal evidence for environment-confirmed outcomes, rather than mere narrative consistency. Given the grounded inferred task, per-action PMI measures how much additional evidence each action–observation pair provides beyond the preceding trajectory. Redundant calls tend to receive near-zero credit because they add little new information, while failed calls receive low or negative credit when their error responses provide no evidence for the achieved outcome, as illustrated in Figures 5–7. We agree that PMI remains an informational proxy rather than a causal measure of action optimality; our claim is that environmental grounding makes this proxy substantially more meaningful than measuring consistency with an unconstrained trajectory summary. Empirically, training remained stable across all runs, with no indication of the proposed collapse.
Ablation: the role of environment feedback. We remove all environment observations from the trajectory, keeping the rest of the pipeline unchanged. On Notion:
| Variant | Acc | Score |
|---|---|---|
| Qwen3-32B (base model) | 3.6 | 60.1 |
| Vanilla SFT | 7.1 | 59.8 |
| AgentBrew w/o observation | 7.1 | 65.4 |
| AgentBrew (full) | 14.2 | 70.1 |
Without observations, performance falls back to roughly the level of Vanilla SFT, confirming that environment feedback provides the grounding that makes credit assignment meaningful. Credit quality depends on what the environment confirmed, not on the semantics of the actions themselves.
W2: Why Retain CoT in the SFT Objective?
We thank the reviewer for this insightful question, which allows us to clarify a design choice left implicit in the paper. Removing CoT is necessary for task inference, but retaining it is important for policy training: it supervises intermediate planning and tool-use decisions, while step-level weighting suppresses reasoning associated with unreliable actions.
(1) When a tool call is unreliable, its associated CoT is down-weighted with it. Although PMI credit is computed from the tool call and environment response, the resulting weight is applied to the entire action, including both the reasoning and tool-call tokens. A step tends to receive high credit when its action–observation pair provides additional evidence for the environment-grounded inferred task. Conversely, failed or redundant calls receive low or negative credit when they provide little or contradictory evidence for the achieved outcome. Their associated reasoning is therefore down-weighted together with the tool call. Figure 3(c–d) further shows that poorly aligned trajectories carry less information under the raw PMI measure.
(2) Revision-based task inference makes useful CoT more likely to remain relevant to the inferred task. The inferred task is obtained by revising the original instruction based on the full trajectory and environment feedback (Appendix E; Figures 5–7), rather than being generated independently. For successful, high-credit steps, the associated reasoning is more likely to contain useful procedural supervision, because it led to an action that produced evidence for the revised task. We do not claim that PMI certifies every reasoning token; instead, we evaluate the net effect of retaining CoT empirically.
CoT masking ablation. We mask the loss on CoT tokens and train only on tool-call tokens:
| Variant | Acc | Score |
|---|---|---|
| Qwen3-32B (base) | 3.6 | 60.1 |
| AgentBrew w/ CoT masked | 7.1 | 62.4 |
| AgentBrew (full) | 14.2 | 70.1 |
The full method substantially outperforms the masked variant, improving Acc from 7.1 to 14.2 and Score from 62.4 to 70.1. This result does not imply that every retained reasoning trace is perfectly aligned; rather, it shows that the useful procedural supervision contained in the weighted CoT outweighs its residual misalignment.
W3: Evaluation Scale and Statistical Robustness
We thank the reviewer for this important point. Our gains are measured over ~560 subtask-level verifiers and remain stable across three independent runs.
(1) Evaluation granularity. Each task is decomposed into multiple subtasks, each checked by an independent programmatic verifier (7 per task on average, ~560 verifier-level checks in total across the three environments). Acc is a strict all-or-nothing task-level metric where a single task flip moves it by several points at this suite size, whereas Score computes the average pass rate over all ~560 subtask-level verifiers, providing substantially finer resolution. We therefore regard Score as the primary metric for judging statistical robustness.
(2) Multiple evaluation runs. We rerun all three methods with three independent seeds and report mean ± std below. Score variance is small (std ≤ 1.4 in every cell), while the margins are large: AgentBrew leads the base model by +9.7 Score and Qwen3-235B by +4.2 Score on average. The only nonzero Acc std (GitHub) corresponds to exactly one task differing across runs, confirming that the same task subsets pass consistently.
| Method | GitHub Acc / Score | Notion Acc / Score | Postgres Acc / Score | Avg Acc / Score |
|---|---|---|---|---|
| Qwen3-32B | 10.7±0.0 / 49.3±1.0 | 3.6±0.0 / 60.0±0.3 | 14.3±0.0 / 36.9±0.7 | 9.5±0.0 / 48.7±0.3 |
| Qwen3-235B† | 16.7±2.1 / 62.3±0.8 | 10.7±0.0 / 66.2±0.6 | 19.0±0.0 / 34.4±1.4 | 15.5±0.7 / 54.3±0.2 |
| AgentBrew | 20.2±2.0 / 63.4±0.5 | 14.2±0.0 / 70.3±0.6 | 23.8±0.0 / 41.7±0.4 | 19.4±0.7 / 58.5±0.1 |
†Accessed via API without seed control; three independent runs under identical decoding settings.
Thank you again for your valuable and encouraging feedback. We will incorporate all these clarifications and improvements into our revision.
Response to rebuttal
Thanks the authors for the comprehensive rebuttal! Most of my concerns have been addressed. And thus I remain positive score.
while failed calls receive low or negative credit when their error responses provide no evidence for the achieved outcome
I have a question with this claim. Please correct me if I am wrong.
Suppose the original task contains subgoals A, B, and C, while the inferred task only contains A and B. According to Eq. 3 (line 181), an action that aims to solve C (which does not appear in the inferred task) would receive low credit. In contrast, an action that aims to solve A would receive high credit even if the action itself is incorrect. Thus, I believe failed calls do not always receive low credits. If so, it would be great to elaborate more about the PMI mechanism in the revised manuscripts.
We sincerely thank the reviewer for the continued engagement and the positive assessment. This is a precise question, and we are happy to clarify.
PMI credit is computed over the joint action–observation pair (c_t, o_t), not over the action c_t alone. While c_t may be thematically related to subgoal A, the observation o_t is produced by the real environment and serves as grounding. When the action fails, o_t typically contains an error response that provides no evidence, or even contradictory evidence, for the successful completion of A as described in Î_n. This prevents the pair from reducing uncertainty about Î_n, resulting in low or negative credit.
This is consistently reflected in our case studies, where all failed actions receive negative credit despite being thematically relevant to the inferred task:
- Figure 5 (GitHub):
get_file_contents→ file not found → w_t = −0.138 - Figure 6 (Notion):
update-a-block→ 400 validation error → w_t = −0.35 - Figure 7 (PostgreSQL):
execute_sql→ SQL syntax error → w_t = −0.214
However, we acknowledge that the reviewer's concern is valid in cases where the environment does not provide informative feedback for a failed action (e.g., silent failures that return no error signal). In such scenarios, the observation o_t lacks the grounding needed to counteract the information leaked by c_t, and an incorrect action could indeed receive undeservedly high credit. The accuracy of PMI credit assignment fundamentally depends on the informativeness of environment observations. In the MCP environments we evaluate, API responses are generally informative, which is why PMI credit works well in practice, but this assumption may not hold universally.
We will elaborate on this dependence and its implications in the revised manuscript. Thank you again for helping us identify and articulate this important nuance.
Comments on the paper
1 comment
Summary Response to AC's Four Key Concerns
Dear Reviewers and ACs,
We sincerely thank all reviewers and ACs for their constructive feedback and insightful suggestions. We are encouraged that reviewers recognized the clear motivation of the problem setting, the novelty and mathematical clarity of PMI-based credit assignment, and the thoroughness of the ablation studies.
We have carefully addressed each concern with additional experiments, analyses, and clarifications. Below we summarize the main clarifications organized around the four issues highlighted by the AC.
- Small Dataset Size (Reviewer GX8L)
While the evaluation suite contains approximately 100 tasks across three environments, the effective evaluation granularity is substantially finer: each task is decomposed into ~7 subtasks on average, yielding ~ 560 independent programmatic verifier checks in total. The Score metric (average subtask pass rate) provides continuous-valued, fine-grained resolution and serves as our primary robustness metric. To further address this concern, we conducted three independent evaluation runs for all methods. Score variance is consistently small (std ≤ 1.4), while AgentBrew's margins are large (+9.7 Score over the base model, +4.2 over Qwen3-235B on average), confirming that the reported improvements are well beyond noise.
- CoT Training (Reviewers GX8L, 6Yr4)
CoT is handled differently across the two pipeline stages by design, and its retention during training is empirically validated. CoT is removed during distillation (task inference and credit computation) because it was generated conditioned on the original, often failed instruction and may reflect intended rather than achieved outcomes. During training, PMI credit is applied to the complete action including both reasoning and tool-call tokens, so that reasoning associated with low-credit actions is automatically down-weighted together with the tool call. The CoT masking ablation on Notion confirms that weighted CoT provides substantial procedural supervision that outweighs residual misalignment. The framework is also compatible with reasoning-style policies in principle, as credit computation operates solely on tool calls and observations, independent of reasoning format. We use non-thinking mode due to interaction budget constraints and will evaluate reasoning-style models in future work.
- Circularity (Reviewers GX8L, 4rjG)
The concern is that inferred tasks are derived from actions, so PMI may reward explainability rather than action quality. Our key design choice that mitigates this circularity is environment grounding: both the inferred task and the per-action credit are anchored in real application observations that the pipeline cannot fabricate. The inferred task is a constrained edit of the original instruction that retains only outcomes confirmed by successful environment responses (Appendix E), and PMI credit is computed over the joint action–observation pair — failed actions receive low or negative credit because the environment's error response provides no evidence for the inferred task (Figures 5–7). Removing all environment observations drops performance from 14.2/70.1 to 7.1/65.4 on Notion, confirming that the training signal derives from what the environment confirmed, not from action semantics alone.
On a related but distinct point, we accept Reviewer 4rjG's observation that the self-reinforcing capability ceiling is a structural limitation of offline learning: the recoverable supervision is bounded by behaviors present in the fixed corpus. We will explicitly acknowledge this in Section 6 and identify online exploration as a complementary direction.
- Similarity to HER (Reviewers 6Yr4, 4rjG)
We acknowledge that AgentBrew shares the high-level hindsight relabeling principle with HER. The key difference lies in the setting: HER assumes an environment-defined goal space and a reward function that can be recomputed after goal replacement, whereas real-world MCP applications provide neither goal taxonomy, state-to-goal mapping, nor reward. Our revision-based, environment-grounded task inference is therefore a necessary adaptation of the hindsight idea to compositional multi-step tool-use scenarios, and the ablation (trajectory-only inference: 10.7/66.3 → revision-based: 14.2/70.1 on Notion) confirms this design is non-trivial. Following the reviewers' constructive suggestion, we will reframe this component as an adaptation inspired by hindsight relabeling, while positioning PMI-based credit assignment as the primary methodological contribution.
During the rebuttal period, we have made our best efforts and shown our utmost sincerity in addressing the reviewers' concerns. We sincerely appreciate the reviewers' and ACs' time and effort.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Rebuttal
We sincerely appreciate your thorough and constructive feedback, and we are grateful for your positive assessment of the problem motivation, the originality and mathematical clarity. Regarding your concerns, we provide our responses below:
Thank you for this thoughtful analysis. We clarify how AgentBrew expands the effective training distribution and avoids a closed self-reinforcement cycle.
(1) AgentBrew expands the task-conditioned training distribution rather than merely reinforcing original-task successes. We agree that a fixed offline corpus cannot provide supervision for actions that were never attempted; however, this limitation applies equally to rejection sampling. The key difference is how the sampled behaviors are utilized. Rejection sampling retains only rare trajectories that fully satisfy their original instructions. AgentBrew instead remaps partially successful trajectories to new, environment-grounded tasks, creating valid
(task, trajectory)pairs outside the original task-conditioned sampling distribution. PMI credit then identifies the informative actions within these trajectories. Thus, AgentBrew converts a substantially broader portion of the collected behavior distribution into useful supervision, rather than repeatedly fitting only existing complete successes.This is consistent with Yue et al. [1], who show that RL-based filtering mainly reallocates probability toward behaviors already present in the base distribution. AgentBrew differs from pure self-filtering because real environment outcomes determine which new task–behavior associations are learned.
[1] Yue, Yang, et al. "Does reinforcement learning really incentivize reasoning capacity in llms beyond the base model?."
(2) Environment grounding breaks the closed self-evaluation cycle. Although Qwen3-32B is used throughout the pipeline, inferred tasks and credits are constrained by real application observations that the model cannot fabricate. Removing observations on Notion reduces performance from 14.2/70.1 to 7.1/65.4 Acc/Score, showing that the gains arise from environment-grounded outcomes rather than model self-consistency alone.
We thank the reviewer for this thoughtful analysis. We address both points together as they share a common explanation.
(1) Retrospective inference expands the learnable data distribution, while rejection sampling compresses it. We agree with the reviewer that both LLM-based verification and retrospective inference face similar difficulty. The key difference is their effect on the training data distribution: rejection sampling retains only trajectories judged as successful, compressing the distribution to a small subset biased toward simpler tasks; retrospective inference rewrites instructions to match actual outcomes, expanding the alignment rate from
~7% to 54%(judged by gpt5) on Notion and broadening the range of learnable behaviors. Since both approaches inevitably introduce noise, the downstream quality control mechanism becomes critical.(2) Rejection sampling retains a small and noisy subset on Notion. The Qwen3-32B judge retains only ~17% of trajectories. Since only 7% of the original pairs are judged well-aligned, even assuming all aligned pairs were retained, at least ~59% of the retained subset remains misaligned. Under uniform SFT, these hallucinated approvals introduce misaligned supervision, leading to degraded performance: 0 Acc / 53.2 Score, below the base model’s 3.6 / 60.1.
We agree that hindsight relabeling originates from HER. The key differences lie in how the hindsight task is constructed in an open-ended tool-use environment and how it is subsequently used for fine-grained credit assignment.
First, classical HER assumes an environment-defined goal representation and a reward function that can be recomputed after replacing the original goal. In real-world MCP applications, tasks are compositional natural-language instructions involving multiple entities, APIs, and state changes, and the environment provides neither a goal taxonomy nor a state-to-goal mapping. The achieved task must therefore be recovered from an unstructured action–observation trajectory.
Second, our inference differs from existing natural-language hindsight relabeling in how the original task constrains the output. Unlike AgentHER, which infers a new goal from the trajectory outcome without using the original task as a semantic anchor, we minimally revise the original instruction by preserving its high-level structure, removing unsupported subtasks, and retaining only environment-confirmed outcomes (Appendix E; Figures 5–7). This constraint reduces the ambiguity of long trajectories that may otherwise admit many plausible hindsight descriptions.
Additional experiment. We remove the original-task anchor and infer a new task solely from the action–observation trajectory:
Revision-based inference improves Acc from 10.7 to 14.2 and Score from 66.3 to 70.1. This experiment does not claim hindsight relabeling as a new principle; rather, it shows that original-task anchoring is an important formulation choice for constructing a coherent reference task before PMI-based credit assignment.
We agree that a substantial gap to frontier models remains. AgentBrew targets data efficiency, that is, extracting strongersupervision from a fixed, unlabeled interaction budget, rather than replacing stronger base models or online exploration. The reported gains therefore demonstrate the value of offline environment-specific adaptation, not that the frontier-model gap is fully bridgeable. Moreover, performance continues to improve with corpus size (§Q2), suggesting that the current setting has not yet saturated.
We thank the reviewer for these insightful questions. We provide an analysis based on post-rewrite alignment, which directly measures the noise remaining after retrospective inference.
Retrospective inference produces 54–67% well-aligned pairs, while PMI assigns substantially lower credit to the remaining noise. Using GPT-5 to classify each inferred instruction–trajectory pair, we find that 67% on GitHub and 54% on Notion are well-aligned. Misaligned pairs receive approximately half the mean credit of aligned pairs. We also observe that alignment decreases for longer trajectories, while their mean credit decreases accordingly, showing that PMI is sensitive to both post-rewrite noise and trajectory complexity.
Trajectory-level filtering alone cannot explain AgentBrew’s gains. On GitHub, filtering the corpus to only GPT-5-classified well-aligned pairs improves Score from 55.4 to 59.5, but leaves Acc unchanged at 17.8. In contrast, applying PMI weighting to the same full corpus achieves 21.4 Acc / 63.5 Score, outperforming the filtered baseline by +3.6 Acc / +4.0 Score despite retaining misaligned pairs. This shows that action-level credit provides additional value beyond data selection and offers a direct robustness analysis against post-rewrite noise.
We thank the reviewer for this constructive suggestion. Figure 4 (§4.5) can be read as a learning curve: the Notion corpus contains 2,615 trajectories, and we train on the top 15%, 50%, 75%, and the full set ranked by quality in descending order. Performance improves monotonically as data grows, even though each expansion adds strictly lower-quality trajectories. We further add a random 50% subset to disentangle quantity from quality. It reaches 10.7 / 64.3, close to the quality-ranked 50% (10.7 / 66.2) and well below the full corpus (14.2 / 70.1), indicating that gains are driven by corpus size rather than by a small high-quality core. This suggests practitioners can benefit from broad, unfiltered exploration instead of investing in careful curation.
We agree that PMI-weighted SFT provides only positive reinforcement: clamping removes faulty actions from training but does not explicitly penalize them. Distinguishing recoverable errors from actions that should be avoided requires counterfactual or optimal-path supervision, unavailable in our offline setting. We will clarify this limitation and identify preference-based negative supervision as future work.