Skip to content

Code-backed environment scaling: AgentScaler, EnvScaler and EnvFactory

optionalextendedfrontierpaperrubric 8/122025 · ~20 min

Runnan Fang, Shihao Cai, Baixuan Li, …, Pengjun Xie, Fei Huang, Jingren Zhou

Read first: Synthetic RL environments for agent training: a map

Status

TL;DR. AgentScaler (Tongyi Lab, Sep 2025) treats environment construction as a scaling problem. It collects more than 30,000 APIs (ToolBench, APIGen and an internal repository) and links tools whose parameter embeddings are similar. Louvain communities on this graph become more than 1,000 domains. For each domain an LLM writes a database schema and implements every tool as Python code that reads or writes it, so the environment is a database you can reset and check. Tasks are directed walks on the tool graph; a simulated user pursues them with the agent; trajectories pass a three-stage filter. Two-stage SFT (general domains, then vertical domains) on Qwen3 gives AgentScaler-4B/8B/30B-A3B. The paper does no RL, but frames the environments as “inherently well-suited for RL”. This page also covers two later code-backed recipes: EnvScaler, which does train with RL, and EnvFactory, which trades environment count for task quality.

The environment is fully simulated but not LLM-simulated at step time. Tool responses come from executing generated code on a database. The construction steps:

  1. Domains from a tool graph. Edge between two tools if the cosine similarity of their parameter vectors exceeds a threshold τ; Louvain community detection gives the domains. Similarity is symmetric and only proposes candidate links, so inside each domain an LLM then examines every pair of tools to judge whether one really depends on the other (§2.1). Example: search_flights returns a flight_id that book_flight needs as input, so the edge runs from search to booking, not the reverse. These directed dependencies are what make the task walks in step 3 sensible.
  2. Programmatic materialization. Domain tools’ parameters become a database schema; each tool becomes a Python function over it.
  3. Tasks from walks. From a varied initial state, sample a directed walk until a step limit or a node with no outgoing edges. Execute the calls with generated arguments to record the gold database state.
  4. Simulated interplay. A simulated user holds the intent; the agent calls tools until the user deems the task done.
  5. Funnel filter. Validity (well-formed turns, n-gram repetition removed), then final database state equals gold, then exact tool-sequence match where the gold sequence has no writes. Trajectories with tool errors are kept on purpose, to teach recovery.

Loss is applied only to assistant tool calls and responses, not to user turns or tool outputs.

Results. Table 1: AgentScaler-30B-A3B scores τ-bench Retail/Airline 70.4/54.0, τ²-Bench Retail/Airline/Telecom 70.2/60.0/55.3, and ACEBench-en overall 75.7. The Qwen3-Thinking-30B-A3B base scores 67.8/48.0, 58.8/58.0/26.3 and 67.2. AgentScaler-4B scores 64.3/54.0 on τ-bench and 65.9 on ACEBench-en, against 59.1/52.5 and 49.5 for its base. On ACEBench-zh (Table 2), overall scores rise from 43.9 to 65.6 at 4B and from 74.2 to 81.5 at 30B. Both stages help on ACEBench-en (Fig. 3). pass^k on τ²-Bench falls as k grows, so consistency is still an issue. Caveat: the authors observe that their generated τ-bench domains closely match the official implementations.

EnvScaler (RUC, Jan 2026). EnvScaler pushes the same “programmatic, not hallucinated” stance and argues that LLM-simulated environments are “prone to hallucinations and inconsistencies”. SkelBuilder mines topics, models each environment’s logic and filters skeletons by quality; ScenGenerator writes several task scenarios per environment together with rule-based trajectory validation functions. It builds 191 environments and about 7K scenarios and, unlike AgentScaler, trains Qwen3 models with both SFT and RL (code). It is the main code-backed baseline in Agent World Model: AWM beats it on BFCLv3 and MCP-Universe, while EnvScaler is higher on τ²-bench.

EnvFactory (May 2026). EnvFactory (2605.18703) targets the quality of tasks rather than the number of environments. It explores authentic online resources to build and verify stateful, executable tool environments, then samples tools along their dependency graph and rewrites the resulting queries to carry implicit intents and ambiguity, so tasks read like user requests instead of instruction lists. With only 85 verified environments (842 tools) across 7 domains it produces 2,575 trajectories (1,622 for SFT, then 953 for GRPO). These improve Qwen3-series models by up to 15% on BFCLv3 and 8.6% on MCP-Atlas, and the authors report stronger results than concurrent pipelines that use about five times as many environments.

AgentScalerEnvScalerEnvFactory
Environment sourceLouvain clusters of 30K+ real API specsmined topics → modelled skeletonsexplored authentic resources
Scalemore than 1,000 domains191 envs, ~7K scenarios85 envs, 842 tools
Quality controlfinal DB state; tool sequence for read-onlyrule-based trajectory validation functionsenvironments explored and verified as executable; queries refined for naturalness
Training evidenceSFT onlySFT + RLSFT + RL (GRPO)

EnvFactory’s result hints that environment count alone is a weak proxy for training value, and that task verification and naturalness may matter as much. No paper yet isolates this with matched models, training budgets and benchmarks, so treat it as a hypothesis.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Mechanism

    AgentScaler builds a tool graph by linking two APIs when the cosine similarity of their parameter embeddings exceeds a threshold, then runs Louvain community detection. Walk through how this produces domains, environments and tasks, and say what each step assumes.

    What a strong answer covers
    • Edges approximate data dependencies (one tool's parameters overlap another's); communities of densely linked tools become domains (more than 1,000 from 30,000+ APIs). Inside each domain an LLM then checks the dependency between each pair of tools, because symmetric parameter similarity only proposes candidates.
    • Per domain, an LLM writes a database schema from all tool parameters and implements each tool as Python reading or writing that database; the database is the environment state.
    • Tasks come from directed walks on the domain graph from a random start, executing real calls on the database to record the gold state; a simulated user then pursues the intent with the agent.
    • Assumptions: parameter similarity plus the LLM check finds real dependencies, generated code is a faithful tool, and walk-derived sequences are tasks people would ask for.
  2. Derive / compute

    The filter keeps trajectories whose final database state matches the gold state, and falls back to exact tool-sequence match when the gold sequence has only read operations. Derive why state matching alone fails for read-only tasks, and what each check lets through or rejects wrongly.

    What a strong answer covers
    • Read-only tasks leave the database unchanged, so every trajectory, including one that did nothing useful, matches the gold state; the check gives no signal.
    • Exact sequence match catches that case but rejects valid alternative orders or extra harmless reads (false negatives), biasing data toward the walk's single path.
    • State match for write tasks accepts any path to the right end state (good) but cannot see what the agent told the user; a wrong final answer with correct writes still passes.
    • The answer an IR person wants for retrieval tasks (what was returned to the user) needs a separate answer check, which neither filter provides.
  3. Critique

    The authors note that their generated databases and code for τ-bench domains are highly consistent with the official τ-bench implementations, and they evaluate on τ-bench and τ²-Bench. Critique what this means for the reported gains and what control you would ask for.

    What a strong answer covers
    • If APIs from the same sources produce near-copies of evaluation environments, gains on those domains partly measure in-distribution training, not general agentic ability.
    • The τ²-Bench Telecom jump for the 30B model (26.3 to 55.3) and the ACEBench gains are on less overlapping domains and are the stronger evidence, but overlap there is not ruled out either.
    • Control: hold out the evaluation domains (remove their communities from the graph) and report the gap; also report a decontamination check on tools and schemas.
    • Separate effects: training is SFT only (no RL), so the comparison is to the base Qwen3 model, not to an equally sized SFT on other tool data.

Done with this page?

Status