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 LinarXiv 2026 · arXiv

TL;DR

LegoEnv introduces a modular paradigm for building LLM agent training environments using reusable "atoms"—intents, rules, data, and servers. By evolving these shared components when failures occur, it creates a self-improving ecosystem that significantly boosts agent performance across diverse business automation tasks, outperforming existing synthetic pipelines.

What Problem Does This Paper Address?

LLM agents learn best by doing, but they need high-quality environments to practice in. Currently, researchers face a dilemma: manually craft high-quality environments (which doesn't scale) or use LLMs to generate them from scratch (which scales but often results in low-quality, inconsistent, or "broken" tasks).

The core issue with current automated methods is the lack of reuse. If an LLM generates a faulty tool or an inconsistent database for one task, that failure isn't used to improve other similar tasks. There is no shared "memory" or infrastructure. LegoEnv addresses this by breaking environments down into modular, reusable parts, ensuring that a fix in one component improves every environment that uses it.

Methods

The authors propose a "Self-Evolving Agentic Environment" framework based on four types of Atoms:

  1. Intent Atoms: Specific goals (e.g., "create an invoice").
  2. Rule Atoms: Business logic or constraints (e.g., "only approve payments over $10,000 if a manager signs off").
  3. Data Atoms: Real-world public datasets used to seed the environment's state.
  4. Server Atoms: Tool providers compiled from actual open-source code repositories.

The LegoEnv Pipeline

The process moves through several sophisticated stages:

  • Modular Recombination: Atoms are combined into "skeletons" based on structural constraints (e.g., a server must actually possess the tools required by an intent). Figure 2: Atom pools and constraints
  • Build & Admit: A builder agent turns the skeleton into a functional environment. It must pass a "correctness check" where a reference solution succeeds, but the initial state does not already satisfy the goal.
  • Self-Evolution: If a "teacher" agent fails to solve an admitted environment, a diagnosis agent investigates. It attributes the failure to a specific atom or builder instruction. Fixing that one atom automatically repairs all other environments in the pool that rely on it. Figure 1: Overview of LegoEnv
Figure 2: The four atom pools on one worked example (pay invoices over 10,000 only if approved). The brown links, numbered 1–4, are the four structural constraints of §3.3.
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.

Datasets

LegoEnv was used to build a corpus of 5,465 verified environments spanning 223 different applications. The authors evaluated their trained agents on three major benchmarks:

  1. AutomationBench: 600 complex, cross-application business workflows.
  2. MCP-Mark: 127 tasks involving Model Context Protocol servers (testing transfer to unseen tools).
  3. BFCL v4 (Berkeley Function Calling Leaderboard): A standard for evaluating tool-use and function-calling capabilities.

Key Insights and Ideas

  • The Power of Attribution: In traditional pipelines, a failed training task is often just discarded. In LegoEnv, a failure is a bug report. Because the environment is modular, the system can pinpoint exactly which "Lego brick" is broken.
  • Efficiency of Scale: The authors found that 997 individual environment repairs could be reduced to just 33 root causes. This means a small number of architectural fixes can yield a massive increase in solvable training data.
  • Real-World Grounding: By using open-source code for servers and real datasets for data, LegoEnv avoids the "uncanny valley" of purely synthetic data, leading to better generalization on real-world tasks.
  • Evolutionary Gains: One round of evolution raised the share of solvable environments from 71.6% to 88.3%, proving the loop's effectiveness.

Key Results

LegoEnv demonstrated significant performance lifts across multiple training regimes:

  • Supervised Fine-Tuning (SFT): Training Qwen3.6-27B on LegoEnv data doubled its performance on AutomationBench, jumping from 16.0% to 32.0%.
  • Reinforcement Learning (RL): Using LegoEnv's programmatic verifiers as rewards in a GRPO (Group Relative Policy Optimization) setup improved a strong Qwen3.8-27B base from 37.6% to 40.3%.
  • Competitive Edge: When compared against four other state-of-the-art synthetic environment pipelines (like AWM and EnvFactory) at the same data budget, LegoEnv outperformed them by 37% to 87%. Figure 4: Scaling and Evolution
Figure 4: Scaling and Evolution

Limitations and Future Work

  • Domain Specificity: The current implementation is focused on English-language business automation. Expanding to other languages or domains (like scientific research or creative coding) remains a future step.
  • Agent Dependency: The quality of the evolution loop depends on the capability of the "builder" and "diagnosis" agents. As base models improve, the environment generation will likely become even more robust.
  • Convergence: The study covers one major evolution round; it is not yet clear how many rounds are required before the system reaches a point of diminishing returns.

Summary updated

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.
BibTeX
@misc{jiang2026legoenv,
  author = {Zhuosong Jiang and Chengxu Wu and Junqi Liu and Yujie Yi and Siqin Wang and Zhixuan Huang and Jinqian Jiang and Lijun Xiao and Jianxun Li and Yongyang Pan and Jieran Wang and Shiqi Shen and Fei Liu and Xinyu Lin},
  title = {{LegoEnv: Self-Evolving Agentic Environments via Modular Recombination}},
  year = {2026},
  eprint = {2611.01834},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.01834},
}
Figure