AgentGym: Evaluating and Training Large Language Model-based Agents across Diverse Environments

Zhiheng Xi, Yiwen Ding, Wenxiang Chen, Boyang Hong, Honglin Guo, Junzhe Wang, Xin Guo, Dingwen Yang, Chenyang Liao, Wei He, Songyang Gao, Lu Chen, Rui Zheng, Yicheng Zou, Tao Gui, Qi Zhang, Xipeng Qiu, Xuanjing Huang, Zuxuan Wu, Yu-Gang Jiang

Large Language Models (LLMs) are increasingly transitioning from passive text generators to active "brains" for autonomous agents. These agents are tasked with navigating the web, solving complex games, and utilizing digital tools. However, the development of such agents has historically been hindered by siloed research environments and a lack of standardized platforms for iterative learning.

AGENTGYM addresses these challenges by providing a unified, interactive framework designed to standardize the evaluation and training of general-purpose LLM agents across 14 diverse environments.

The AGENTGYM Framework

To move beyond static benchmarks, AGENTGYM implements a decoupled client-server architecture. This design allows agents to interact with a wide variety of scenarios—including web navigation, embodied AI, games, tool use, and code generation—through a unified HTTP-based API.

The AGENTGYM framework standardizes interaction across diverse scenarios like web navigation, games, and tool use.

The platform includes 14 distinct environments and 89 unique tasks, spanning real-world scenarios such as WebShop (e-commerce), ALFWorld (household tasks), and BIRD-SQL (database management). This diversity ensures that agents are tested on their ability to generalize across different action spaces and observation formats.

Methodology: From Data Collection to Self-Improvement

The researchers introduced two critical components for training robust agents: the AGENTTRAJ dataset and the AGENTSTAR algorithm.

AGENTTRAJ Dataset

High-quality training data is essential for agentic performance. The team developed a "gather-and-filter" pipeline using GPT-4-Turbo to generate initial trajectories. These were then rigorously filtered based on success and correctness, resulting in over 14,000 high-quality samples (AGENTTRAJ-L) used for supervised fine-tuning (SFT).

The AGENTSTAR Algorithm

AGENTSTAR is the core technical innovation of the paper—an iterative self-improvement method inspired by the "RL as Inference" framework. It operates in two repeating phases:

  1. Exploration: The agent interacts with the environment to discover successful paths independently.
  2. Learning: The agent is fine-tuned on these self-generated successful trajectories.

This approach avoids the instability often associated with standard online Reinforcement Learning (RL) methods like Proximal Policy Optimization (PPO) when applied to LLMs.

Key Results and Performance

The most significant finding of the study is that relatively small, open-source models can match or exceed the performance of state-of-the-art commercial models when trained within the AGENTGYM ecosystem.

Comparison of AGENTSTAR against various baselines. Note how it consistently outperforms even strong commercial models like GPT-4-Turbo on key benchmarks.

As shown in the performance comparison, a Llama-2-7B model trained with AGENTSTAR achieved remarkable results:

  • WebShop: Reached a 76.50% success rate, significantly higher than GPT-4-Turbo's 15.50%.
  • ALFWorld: Achieved 88.00%, surpassing GPT-4-Turbo's 67.50%.
  • BabyAI: Reached 82.7%, outperforming the base GPT-4-Turbo model.

These results suggest that for specialized agentic tasks, high-quality interactive data and iterative self-improvement are more impactful than raw model scale. Furthermore, agents trained on AGENTGYM demonstrated strong "Out-of-Domain" (OOD) generalization, successfully handling tasks they never encountered during the training phase.

Conclusion and Future Directions

AGENTGYM demonstrates that the path to general-purpose agents lies in unified, interactive training environments rather than isolated benchmarks. While standard online RL remains unstable for these complex multi-turn tasks, iterative SFT via AGENTSTAR provides a stable and highly effective alternative. Future work will focus on expanding the diversity of environments, testing a broader range of base model architectures, and refining algorithms to better handle sparse-reward scenarios.

Summary updated

BibTeX
@inproceedings{xi2025agentgym,
  author = {Zhiheng Xi and Yiwen Ding and Wenxiang Chen and Boyang Hong and Honglin Guo and Junzhe Wang and Xin Guo and Dingwen Yang and Chenyang Liao and Wei He and Songyang Gao and Lu Chen and Rui Zheng and Yicheng Zou and Tao Gui and Qi Zhang and Xipeng Qiu and Xuanjing Huang and Zuxuan Wu and Yu-Gang Jiang},
  title = {{AgentGym: Evaluating and Training Large Language Model-based Agents across Diverse Environments}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure