HyperAIHyperAI

Command Palette

Search for a command to run...

EnvOpt: Closed-Loop Environment Optimization for Agent Post-Training

Abstract

Data-centric recursive self-improvement (RSI) seeks to improve a model by repeatedly turning its evolving behavior into new training data. For tool-using agents, sustaining this process is more dificult because the data are executable environments: each round must preserve a coherent and tight connection from observed behavior to training intent, executable realization, and realized learning outcomes. Our analysis finds that even a capable agent frequently loses this connection showing an incomplete understanding of model behavior, unfaithful implementation of intended environments, and inefective use of feedback across iterations. To address these challenges, we introduce EnvOpt, a framework that organizes environment evolution around traceable training targets. It combines a traceable behavioral map to expose recurring patterns, iterative environment construction to faithfully realize training targets as executable environments, and target-conditioned context refinement to facilitate accumulated feedback utilization. This turns environment generation from a sequence of isolated attempts into a closed-loop data improvement process that adapts as the target model changes. Extensive experiments on τ 2-Bench, BFCL-v4, and AppWorld show that EnvOpt yields substantial improvements in the target model’s performance, while the vanilla agent baseline shows no consistent improvement trend.

One-sentence Summary

Researchers from Fudan University, Microsoft, Shanghai Jiao Tong University, and Harvard University propose EnvOpt, a closed-loop environment optimization framework for agent post-training that combines a traceable behavioral map, iterative environment construction, and target-conditioned context refinement, turning environment generation into an adaptive data improvement process and yielding substantial gains for the target model on τ 2-Bench, BFCL-v4, and AppWorld.

Key Contributions

  • An analysis of data-centric recursive self-improvement for tool-using agents identifies failures in understanding model behavior, realizing training targets as executable environments, and using feedback, reporting 58.8% failure-mechanism coverage and only 21.4% of generated training tasks with reward variation.
  • EnvOpt is introduced as a closed-loop framework that combines a traceable behavioral map, iterative environment construction, and target-conditioned context refinement to connect model behavior, executable training data, and learning feedback.
  • Experiments on τ²-Bench, BFCL-v4, and AppWorld show that EnvOpt yields substantial performance improvements over all baselines across three model sizes, while the vanilla agent baseline shows no consistent improvement trend.

Introduction

Recursive self-improvement for tool-using agents is a central challenge because training data must take the form of executable environments and tasks that evolve as the target model changes. Prior work such as AgentScaler, EnvScaler, ScaleEnv, Agent World Model, and EnvFactory shows that such environments can be synthesized automatically, but it does not provide a reliable mechanism for deciding how the data should adapt across training rounds. In direct experiments, even a strong coding and reasoning agent struggles to sustain improvement, with failures including incomplete model behavior analysis, unfaithful realization of intended training targets, and disconnected cross-round feedback. The authors introduce EnvOpt, a framework that makes environment evolution traceable through a behavioral map, iterative construction and refinement, and target-conditioned context recycling, yielding consistent multi-round gains on three tool-use benchmarks.

Dataset

The authors describe an executable dataset construction stage for data-centric recursive self-improvement. The dataset is built around three interacting components:

  • Environment behavior: defines task mechanics, state transitions, and interaction rules.
  • Task requirements: specify the intended behavior that should be trained.
  • Verifier feedback: provides rewards or judgments about task progress and completion.

Processing and filtering considerations:

  • Executable data must jointly and faithfully realize the intended training target.
  • Executability alone is not treated as sufficient.
  • Three validity failure modes are identified:
    • Missing task mechanisms: the model can bypass the intended behavior.
    • Faulty interaction logic: responses, state transitions, or termination conditions violate task rules.
    • Misaligned verifiers: rewards do not accurately reflect model progress or task satisfaction.

How the data is used:

  • The constructed executable examples are used as training experience.
  • Unfaithful realization makes the training experience deviate from the intended target.
  • This also makes subsequent feedback unreliable for guiding environment evolution.
  • Concrete failure cases are referenced in Appendices B.3 and C.3.

The supplied section does not report exact corpus size or enumerate external data sources.

Method

The authors formalize data-centric recursive self-improvement as an interactive loop between a data agent and a target model. An executable environment is modeled as a partially observable interaction process

e=(S,A,T,O),e = (\mathcal{S}, \mathcal{A}, \mathcal{T}, \mathcal{O}),e=(S,A,T,O),

where S\mathcal{S}S is the state space over structured environment data, A\mathcal{A}A is the set of executable actions exposed through tool calls, T(s′∣s,a)\mathcal{T}(s' \mid s, a)T(s′∣s,a) defines how actions update state, and O(o∣s′,a)\mathcal{O}(o \mid s', a)O(o∣s′,a) returns the visible tool output or user response.

At each round ttt, the data agent constructs a set of executable training instances

Dt={(ej,xj,vj)}j=1nt,D_t = \{(e_j, x_j, v_j)\}_{j=1}^{n_t},Dt​={(ej​,xj​,vj​)}j=1nt​​,

where eje_jej​ is an executable environment, xjx_jxj​ defines the task goal and initial conditions, and vjv_jvj​ is a verifier that evaluates task completion. This generation process is conditioned on a research context CtC_tCt​ containing execution history, memory, prior feedback, external examples, and the current pool of environments and tasks, so that

Dt=DataAgent(Ct).D_t = \mathrm{DataAgent}(C_t).Dt​=DataAgent(Ct​).

The generated data are submitted to a fixed training and evaluation service that updates the target model through online reinforcement learning and returns feedback:

(πt+1,Ft)=TrainEval(πt,Dt),(\pi_{t+1}, F_t) = \mathrm{TrainEval}(\pi_t, D_t),(πt+1​,Ft​)=TrainEval(πt​,Dt​),

where πt\pi_tπt​ is the target model before training, πt+1\pi_{t+1}πt+1​ is the updated model, and FtF_tFt​ includes training dynamics and evaluation results. Finally, the context is updated as

Ct+1=UpdateContext(Ct,Dt,Ft).C_{t+1} = \mathrm{UpdateContext}(C_t, D_t, F_t).Ct+1​=UpdateContext(Ct​,Dt​,Ft​).

The proposed method, EnvOpt, instantiates this loop through three components: a traceable behavioral map for model behavior analysis, iterative environment construction for executable data generation, and target-conditioned context refinement for feedback utilization.

Traceable Behavioral Map

The traceable behavioral map separates a persistent evidence layer from a compact reading view. Given raw trajectories Tt,iT_{t,i}Tt,i​ for task iii, an LLM performs extraction and source review to produce source-grounded mechanism records:

Mt=⋃iExtractReview(Tt,i).\mathcal{M}_t = \bigcup_i \mathrm{ExtractReview}(T_{t,i}).Mt​=i⋃​ExtractReview(Tt,i​).

Each record connects an environment mechanism, task requirement, observed failure, or recovery to its source and applicable conditions. Bounded hierarchical merging then builds a draft report by factoring shared premises while preserving distinct actors, scopes, dependencies, and recovery branches:

Rtdraft=FactorMerge(Mt).R_t^{\mathrm{draft}} = \mathrm{FactorMerge}(\mathcal{M}_t).Rtdraft​=FactorMerge(Mt​).

To refine the draft efficiently, the authors randomly sample 10% of the mechanism records to form a compact review subset Mtcheck⊆Mt\mathcal{M}_t^{\mathrm{check}} \subseteq \mathcal{M}_tMtcheck​⊆Mt​. An LLM checks whether the draft preserves the sampled mechanisms and their applicable conditions. The refinement operation repairs conflicting entries and appends only missing distinctions:

Rˉt=Repair(Rtdraft,Mtcheck),\bar{R}_t = \mathrm{Repair}(R_t^{\mathrm{draft}}, \mathcal{M}_t^{\mathrm{check}}),Rˉt​=Repair(Rtdraft​,Mtcheck​), Rt=Rˉt⊕Supplement(Mtcheck,Rˉt).R_t = \bar{R}_t \oplus \mathrm{Supplement}(\mathcal{M}_t^{\mathrm{check}}, \bar{R}_t).Rt​=Rˉt​⊕Supplement(Mtcheck​,Rˉt​).

Here ⊕\oplus⊕ appends missing distinctions without rewriting preserved content. The resulting report contains four fields, namely domain, environment, task behavior, and failure behavior, and it is stored in the research context CtC_tCt​ with links back to the original trajectories.

Iterative Environment Construction

Iterative environment construction turns the research context CtC_tCt​ into executable training data. The data agent first selects environments to create or revise and allocates training tasks. It specifies each environment objective, requirements, and expected behaviors, then delegates implementation to a persistent Env Builder subagent. Each builder produces candidate environment-task-verifier triples (e,x,v)(e, x, v)(e,x,v) aligned with the specification.

The current target model then performs probe rollouts on representative tasks. An independent review agent examines the implementation, generated tasks, execution checks, and probe rollouts to assess implementation correctness, target alignment, and likely task difficulty. The reviewer issues a decision to accept the candidate or request refinement, together with actionable feedback. Implementation issues return to the same builder for revision and re-review, while specification or difficulty issues return to the data agent for higher-level data decisions. This process produces a batch of quality-checked training data DtD_tDt​ for reinforcement learning, aligning environment behavior and reward feedback with the intended capability targets.

Target-Conditioned Context Refinement

Because data evolution should be judged relative to the capabilities the generated data were intended to improve, the context is organized around explicit capability targets. Before proposing environment changes, the data agent records the target requirement and expected effect based on observed model behavior. These targets serve as a shared reference for interpreting later feedback.

The method then performs version-aware evidence alignment. Environment versions and training-task IDs link each target to its accepted instances in DtD_tDt​, actual reinforcement learning groups and rollouts, and associated evaluation tasks. This yields a target-conditioned evidence view that connects three perspectives:

Training target⏟expected capability⟷Actual training⏟RL dynamics⟷Target evaluation⏟related performance.\underbrace{\text{Training target}}_{\text{expected capability}} \longleftrightarrow \underbrace{\text{Actual training}}_{\text{RL dynamics}} \longleftrightarrow \underbrace{\text{Target evaluation}}_{\text{related performance}}.expected capabilityTraining target​​⟷RL dynamicsActual training​​⟷related performanceTarget evaluation​​.

Context refinement proceeds through expectation-observation comparison. The data agent jointly examines training rewards, within-task reward contrast, related evaluation outcomes, and evaluation trajectories against the expected effect. It assesses whether the generated data provided useful learning signals and whether the targeted behavior improved. The resulting supporting observations, mismatches, and unresolved questions are written into Ct+1C_{t+1}Ct+1​, where they guide subsequent revisions to environment mechanisms, task difficulty, sampling, and decisions to retain or pause environments. Each iteration therefore refines the research context used to plan the next training intervention.

Experiment

The experiments evaluate EnvOpt and several baselines on τ²-Bench, BFCL-v4, and AppWorld using Qwen3 models, with public splits guiding environment evolution and held-out private splits used for final testing. Codex-Vanilla shows that strong agents alone do not sustain improvements across iterations, whereas EnvOpt consistently outperforms untrained models, fixed environments, and static environment-scaling methods. Ablations confirm that traceable behavioral maps, target-conditioned context refinement, and iterative environment construction each contribute to better task coverage, failure understanding, and learnable reward signals, and joint optimization across benchmarks transfers some gains to unseen benchmarks.

On the three evaluated benchmarks, the untrained Qwen3-4B-Instruct-2507 model establishes a baseline, while existing environment and training-set construction methods produce mixed results and often lower the average score. ENVOPT is the only method that improves every benchmark, achieving the highest per-benchmark scores and the highest average by a wide margin. ENVOPT delivers double-digit gains over the untrained baseline on all three benchmarks and is the only evaluated method to improve every benchmark. Among the non-ENVOPT baselines, Fixed-Env essentially matches the no-training average while Codex-Vanilla, AWM, and EnvScaler end with lower average performance.

Across three evaluated benchmarks, the untrained Qwen3-4B-Instruct-2507 model serves as a baseline, while existing environment and training-set construction methods yield mixed results and often reduce average performance. ENVOPT is the only approach that improves all benchmarks, achieving the best per-benchmark results and the highest average score by a substantial margin, with double-digit gains over the untrained baseline. Among the other baselines, Fixed-Env performs similarly to the no-training average, whereas Codex-Vanilla, AWM, and EnvScaler end with lower average performance.


Build AI with AI

From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.

AI Co-coding
Ready-to-use GPUs
Best Pricing

HyperAI Newsletters

Subscribe to our latest updates
We will deliver the latest updates of the week to your inbox at nine o'clock every Monday morning
Powered by MailChimp