arXiv:2611.01834cs.CLNov 2026

Manuscript Offprint

arXiv:2611.01834

LegoEnv: Self-Evolving Agentic Environments via Modular Recombination

Zhuosong Jiang, Chengxu Wu, Junqi Liu, Yujie Yi, Siqin Wang, Zhixuan Huang, Jinqian Jiang, Lijun Xiao, Jianxun Li, Yongyang Pan, Jieran Wang, Shiqi Shen, Fei Liu, Xinyu Lin

Zhuosong Jiang 1∗⋄^{1*\diamond}, Chengxu Wu 2∗⋄^{2*\diamond}, Junqi Liu 3∗⋄^{3*\diamond}, Yujie Yi 4∗⋄^{4*\diamond}, Siqin Wang 1^{1}, Zhixuan Huang 2⋄^{2\diamond}, Jinqian Jiang 2⋄^{2\diamond}, Lijun Xiao 1^{1}, Jianxun Li 5^{5}, Yongyang Pan 5^{5}, Jieran Wang 5^{5}, Shiqi Shen 5^{5}, Fei Liu 6^{6}, Xinyu Lin 1^{1}

1^{1}National University of Singapore 2^{2}Peking University 3^{3}University of California, Santa Cruz

4^{4}Shanghai Jiao Tong University 5^{5}Tencent 6^{6}Emory University

Abstract

LLM agents learn by interacting with environments, yet existing environments are designed for specific tasks and fail to generalize to new ones. Recent methods automate environment construction with LLMs. However, they generate each environment from scratch, neither reusing parts shared across environments nor carrying a fix from one environment to the rest. To address this, we propose a new paradigm of evolving environment atoms, which composes environments from reusable atoms (intent, rule, data and server) and evolves the atoms when an environment fails to give reliable feedback (e.g., an application lacks a tool the task requires). To instantiate this paradigm, we introduce LegoEnv, which builds 5,465 verified environments over 223 applications, and one round of evolution raises the share of solvable environments from 71.6% to 88.3%. On AutomationBench, SFT on these environments lifts Qwen3.6-27B from 16.0% to 32.0%, and RL with their verifiers lifts Qwen3.8-27B from 37.6% to 40.3%. Further analyses show steady gains with corpus size, transfer to unseen applications, and failures concentrated in a few shared root causes.

1 Introduction

LLM agents have demonstrated remarkable performance across a wide range of domains, spanning from resolving complex issues in software engineering (Jimenez et al., 2023; Yang et al., 2024) and solving competition mathematics (DeepSeek-AI, 2025) to discovering new knowledge and algorithms (Lu et al., 2024; Novikov et al., 2025). Agents acquire these abilities by interacting with environments, where the agent acts, the environment responds, and the response becomes supervision, as trajectories for supervised fine-tuning (Zeng et al., 2023; Prabhakar et al., 2025; Xu et al., 2025; Pan et al., 2024) or rewards for reinforcement learning (DeepSeek-AI, 2025; Qian et al., 2025; Feng et al., 2025; Dong et al., 2025; Jiang et al., 2025; Da et al., 2025). Since an agent can learn only what its environments can pose and check, the construction and quality of environments are among the most critical steps in agent training.

Existing environments are typically designed for a specific task, with the data, the tools and the verifier built together to provide high-quality feedback (Zhou et al., 2023; Xie et al., 2024; Yao et al., 2024; Trivedi et al., 2024; Shepard and Salimans, 2026; Wu et al., 2025). 1^{1} However, they fail to generalize when the task becomes more complex or moves to a new scenario (e.g., an office agent’s task shifts from paying invoices in an accounting system to onboarding employees in an HR system), since different tasks require different data, tools, operations and checks. Therefore, scalable construction that quickly builds high-quality environments for diverse tasks is essential for training agents effectively and efficiently.

To scale environments up, recent methods use LLMs to generate the tools, data and tasks of each environment (Fang et al., 2025; Song et al., 2026; Tu et al., 2026; Wang et al., 2026b; Xu et al., 2026a; Zeng et al., 2026; Dong et al., 2026). However, different environments share common parts (e.g., a mail application for sign-off and an approval policy) while differing in task-specific ones (e.g., invoice records versus employee profiles). Generating each environment from scratch thus neither reuses the experience gained from previous constructions nor avoids the cost of rebuilding the shared parts (Table 9).

Based on the above insights, we propose a new

∗^{*}Equal contribution. ⋄\diamondWork done during an internship at Tencent. Code: https://github.com/JazyJiang/LegoEnv. Correspondence: zhuosong.jiang@u.nus.edu.

1^{1}We count one environment per concrete task, together with the applications, data and verifier it requires. For example, paying the approved invoices of a month is one environment, and escalating the overdue invoices on the same applications is another.

Figure

Figure 1: Overview of LegoEnv. Four pools of atoms are collected from real sources and composed into skeletons under structural constraints. A builder agent turns each skeleton into an environment, which is admitted only after its verifier passes a correctness check. Environments that yield no successful trajectory are diagnosed, and the result files an issue against an atom and waits for its fix, supplements a pool, or revises the builder; tasks that are merely hard are kept.

paradigm, evolving atoms for scalable agentic environments, which builds environments from smaller reusable units. Specifically, we decompose an environment into four kinds of atoms, namely intent (goal to achieve), rule (business rule to follow), data (records for the agent to use), and server (tool provider), and construct each environment by composing them. When an environment fails, we trace the failure to the atoms behind it and evolve those atoms, so that every later environment built from them benefits. This paradigm brings three benefits. (1) Scalability. New environments are created by composing existing atoms, so their number grows with the compositions rather than with manual effort. (2) Self-evolution. Atom sets and atom properties will be evolved from construction failures, therefore allowing later environments to avoid the same errors and reuse the new atoms. (3) Real-world grounding. Every atom is initially collected from a real source, so the environments reflect real-world needs and carry practical value.

Based on this paradigm, we develop LegoEnv (Figure 1) for business domains. LegoEnv first collects atoms from real sources and recombines them under structural constraints. It then builds an environment from each valid composition and keeps it only if its verifier passes a correctness test. Finally, it diagnoses the environments that no teacher can solve and evolves the atoms that cause the failures, which raises the share of solvable envi-

ronments from 71.6% to 88.3% in one round. We evaluate LegoEnv on AutomationBench (Shepard and Salimans, 2026), MCP-Mark (Wu et al., 2025) and BFCL v4 (Patil et al., 2025). Supervised fine-tuning on our environments improves Qwen3.6-27B by 100% and Qwen3.5-27B by 625% on AutomationBench, outperforming four public synthesis pipelines by 37% to 87% under the same budget. Using the environments' verifiers as rewards for reinforcement learning further improves Qwen3.8-27B by 7.2%.

Our contributions are threefold:

  • We propose evolving atoms, a paradigm that composes environments from reusable intent, rule, data, and server atoms, which are collected from real sources and evolve over time.

  • We instantiate it as LegoEnv, which tests every verifier before use and attributes each environment fault to an atom, a verifier kind or a builder instruction, so that one repair reaches every environment that shares it.

  • We show that the environments improve three bases on AutomationBench, with supervised gains that transfer to MCP-Mark, exceed four public pipelines at equal budget, and serve unchanged as rewards for reinforcement learning.