FlowReasoner: Reinforcing Query-Level Meta-Agents

Hongcheng Gao, Yue Liu, Yufei He, Longxu Dou, Chao Du, Zhijie Deng, Bryan Hooi, Min Lin, Tianyu PangarXiv 2025 · OpenReview

Abstract

This paper proposes a query-level meta-agent named FlowReasoner to automate the design of query-level multi-agent systems, i.e., one system per user query. Our core idea is to incentivize a reasoning-based meta-agent via external execution feedback. Concretely, by distilling DeepSeek R1, we first endow the basic reasoning ability regarding the generation of multi-agent systems to FlowReasoner. Then, we further enhance it via reinforcement learning (RL) with external execution feedback. A multi-purpose reward is designed to guide the RL training from aspects of performance, complexity, and efficiency. In this manner, FlowReasoner is enabled to generate a personalized multi-agent system for each user query via deliberative reasoning. Experiments on both engineering and competition code benchmarks demonstrate the superiority of FlowReasoner. Remarkably, it surpasses o1-mini by 10.52% accuracy across three benchmarks.

Introduction

Multi-agent systems (MAS) have emerged as a powerful paradigm for complex task solving with Large Language Models (LLMs). However, designing an optimal MAS—comprising specific agent roles and interaction workflows—is challenging. Traditional approaches rely on human experts or task-level meta-agents that create a static, "one-size-fits-all" system for a broad category of tasks.

FlowReasoner addresses the limitations of these rigid systems by introducing a query-level meta-agent. Instead of a fixed workflow, FlowReasoner dynamically designs a custom MAS for every individual user query. This "one-size-fits-one" approach ensures that simple queries avoid unnecessary overhead while complex queries receive the robust multi-agent coordination they require.

Comparison of task-level vs. query-level meta-agents.

Methodology

The development of FlowReasoner follows a three-stage pipeline designed to instill and refine architectural reasoning:

  1. Reasoning Data Distillation: Using DeepSeek-R1 (671B), the authors generated a dataset of reasoning traces and corresponding multi-agent workflows for a wide variety of queries.
  2. Supervised Fine-Tuning (SFT): Efficient models (DeepSeek-R1-Distill-Qwen 7B and 14B) were fine-tuned on this distilled data to establish a baseline capability for deliberative workflow design.
  3. Reinforcement Learning (RL) with Execution Feedback: The meta-agent is further optimized using Grouped Relative Policy Optimization (GRPO). Crucially, the reward signal is derived from external execution feedback—the success of the generated code in a sandbox environment. A multi-purpose reward function balances performance, complexity (to prevent over-engineering), and efficiency (to minimize token costs).
Evolution of MAS design paradigms: from human-crafted to search-based, and finally to reasoning-based (FlowReasoner).

Experimental Results

FlowReasoner was evaluated on three major code generation benchmarks: BigCodeBench, HumanEval, and MBPP.

  • Performance Gains: FlowReasoner-14B achieved a significant 10.52% accuracy improvement over o1-mini across the benchmarks.
  • Comparison with Baselines: It outperformed existing automated workflow designers, such as MaAS and Aflow, by approximately 5 percentage points.
  • Model Agnosticism: The workflows designed by FlowReasoner proved effective even when the underlying "worker" agents were replaced with different models (e.g., GPT-4o-mini, Claude 3.5), demonstrating the robustness of the meta-agent's architectural reasoning.

Conclusion

FlowReasoner represents a paradigm shift in multi-agent system design, moving from static task-level templates to dynamic, query-level reasoning. By leveraging external execution feedback through RL, the system learns to act as an architect, tailoring agent configurations to the specific needs of each problem. While currently focused on code generation due to the availability of objective feedback, the "one-size-fits-one" philosophy offers a promising path toward more efficient and capable AI systems across diverse domains.

The code is available at https://github.com/sail-sg/FlowReasoner.

Summary updated

BibTeX
@misc{gao2025flowreasoner,
  author = {Hongcheng Gao and Yue Liu and Yufei He and Longxu Dou and Chao Du and Zhijie Deng and Bryan Hooi and Min Lin and Tianyu Pang},
  title = {{FlowReasoner: Reinforcing Query-Level Meta-Agents}},
  year = {2025},
  eprint = {2504.15257},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.15257},
}
Figure