Agent²: An Agent-Generates-Agent Framework for Reinforcement Learning Automation

Yuan Wei, Xiaohan Shan, Ran Miao, Jianmin LiSubmission to ICLR 2026 · Rejected

TL;DR

Agent² is a novel "agent-generates-agent" framework that uses Large Language Models (LLMs) to fully automate the design of Reinforcement Learning (RL) agents. By decomposing the process into MDP modeling and algorithmic optimization, it autonomously translates natural language tasks into high-performing code, outperforming manual baselines by up to 55%.

What Problem Does This Paper Address?

Developing a Reinforcement Learning agent is often considered a "black art." Even for experts, the workflow is tedious: you have to manually define state representations, "shape" reward functions so the agent actually learns, pick the right algorithm (e.g., PPO vs. SAC), and then spend days tuning hyperparameters.

While "AutoML" has made strides in supervised learning, AutoRL has lagged behind because it’s not just about tuning a model—it’s about designing the entire interaction loop between the agent and its environment. Most existing tools only automate small pieces of this pipeline. Agent² aims to bridge this gap by providing an end-to-end, "zero-human-intervention" pipeline that handles everything from problem analysis to final code execution.

Methods

The authors introduce a dual-agent architecture consisting of a Generator Agent (the designer) and a Target Agent (the learner). The process is split into two main stages:

  1. Task-to-MDP Mapping: The Generator Agent reads the environment's raw code and a natural language description of the goal. It then writes Python "wrappers" to refine the observation space, discretize or scale the action space, and—most importantly—rewrite the reward function to be more informative.
  2. Algorithmic Optimization: Once the "rules of the game" (the MDP) are set, the Generator Agent selects the most suitable RL algorithm, designs a custom neural network architecture (e.g., choosing between MLPs, CNNs, or RNNs), and initializes hyperparameters.

A standout feature is the Adaptive Verification and Refinement loop. Agent² doesn't just "one-shot" the code. It attempts to train the Target Agent, monitors the training curves via TensorBoard, and if it detects anomalies (like a flat reward curve or a crash), it feeds that "performance feedback" back to the LLM to iterate on the design. The framework is built on the Model Context Protocol (MCP) to ensure standardized communication between these modules.

Datasets

The researchers evaluated Agent² across a diverse range of standard and complex RL benchmarks:

  • MuJoCo: Classic continuous control tasks (Ant, Humanoid, Hopper, Walker2d).
  • MetaDrive: A large-scale autonomous driving simulator involving complex sensory data.
  • MPE (Multi-Agent Particle Environment): Cooperative tasks like "Simple Spread."
  • SMAC (StarCraft Multi-Agent Challenge): High-stakes tactical coordination in a simulated combat environment.

Key Insights and Ideas

  • MDP Refinement is the Secret Sauce: The paper finds that simply optimizing hyperparameters isn't enough. The biggest gains often come from the LLM's ability to "re-engineer" the MDP—for example, by adding auxiliary rewards that help the agent learn faster in "sparse" environments.
  • LLMs as Domain Experts: The framework uses the LLM (specifically Claude-3.7-Sonnet in their tests) to act as a senior RL researcher, applying "best practices" (like LayerNorm or specific activation functions) that a novice might miss.
  • The Power of the Loop: The "aha moment" is the closed-loop refinement. By treating training logs as a "bug report," the system can self-correct. If an agent isn't exploring enough, the LLM might suggest increasing the entropy coefficient in the next iteration.

Key Results

Agent² consistently beat well-established RL libraries (like XuanCe, Tianshou, and OpenAI’s SpinningUp) that use manual configurations:

  • Performance Boosts: In the MuJoCo "Ant" task using the TD3 algorithm, Agent² achieved a 55% improvement over the baseline.
  • Solving "Broken" Baselines: In the "Humanoid-TD3" task, the standard baseline performed terribly (score of ~547) due to poor default settings. Agent² autonomously diagnosed the issue and lifted the score to 5425.5.
  • Multi-Agent Success: In StarCraft (SMAC), Agent² improved win rates significantly (e.g., from 0.77 to 0.94 in the 8m scenario), proving it can handle complex tactical coordination.
  • Ablation: Their study showed that MDP adaptation improved performance in 83% of cases, while subsequent algorithmic optimization provided further gains in 67% of those cases.

Limitations and Future Work

  • Stochasticity: Because LLMs are non-deterministic, there is a risk that the "Generator Agent" might produce different results across different runs, making exact replication a challenge.
  • Computational Cost: The iterative refinement loop requires training multiple agents to completion (or near-completion), which can be computationally expensive compared to a single manual run.
  • Complexity Ceiling: While it handles SMAC and MetaDrive, the authors note that truly open-ended, real-world robotics or high-dimensional tasks might require even more sophisticated reasoning than current LLMs provide.
  • Future Directions: The authors suggest extending the framework to handle even more diverse environments and improving the efficiency of the feedback loop to reduce the number of training iterations needed.

Summary updated

Abstract

Reinforcement learning (RL) agent development traditionally requires substantial expertise and iterative effort, often leading to high failure rates and limited accessibility. This paper introduces Agent$^2$, an LLM-driven agent-generates-agent framework for fully automated RL agent design. Agent$^2$ autonomously translates natural language task descriptions and environment code into executable RL solutions without human intervention. The framework adopts a dual-agent architecture: a Generator Agent that analyzes tasks and designs agents, and a Target Agent that is automatically generated and executed. To better support automation, RL development is decomposed into two stages—MDP modeling and algorithmic optimization—facilitating targeted and effective agent generation. Built on the Model Context Protocol, Agent$^2$ provides a unified framework for standardized agent creation across diverse environments and algorithms, incorporating adaptive training management and intelligent feedback analysis for continuous refinement. Extensive experiments on benchmarks including MuJoCo, MetaDrive, MPE, and SMAC show that Agent$^2$ outperforms manually designed baselines across all tasks, achieving up to 55\% performance improvement with consistent average gains. By enabling a closed-loop, end-to-end automation pipeline, this work advances a new paradigm in which agents can design and optimize other agents, underscoring the potential of agent-generates-agent systems for automated AI development.
BibTeX
@misc{wei2025agent,
  author = {Yuan Wei and Xiaohan Shan and Ran Miao and Jianmin Li},
  title = {{Agent²: An Agent-Generates-Agent Framework for Reinforcement Learning Automation}},
  year = {2025},
  eprint = {2509.13368},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.13368},
}
Figure