SuperAPI AI Directory

AgentFlow

AgentFlow is a trainable, tool-integrated agent framework developed by lupantech, designed to overcome the scalability and generalization limitations of tool-augmented reasoning methods. It adopts a modular design comprising four specialized modules: Planner, Executor, Verifier, and Generator, which work collaboratively across multiple rounds of interaction through evolving memory and integrated tools. The framework uses Flow-based Group Refined Policy Optimization (Flow-GRPO) to optimize the Planner online, performing excellently on 10 benchmarks spanning search, agentic reasoning, mathematics, and science, with a 7B model even surpassing GPT-4o with around 200B parameters. The framework supports multi-tool integration (such as Python coding, Google search, Wikipedia search, etc.) and provides inference and training pipelines. The project has been accepted by ICLR 2026 and the NeurIPS 2025 workshop, and ranked second in HuggingFace Daily Paper.

Open website

About this tool

AgentFlow is a trainable, tool-integrated agent framework designed to overcome the scalability and generalization limitations of current tool-augmented reasoning methods. Unlike mainstream methods such as Search-R1 that train a single LLM to interleave reasoning steps with tool calls, AgentFlow introduces a modular agent system comprising four specialized modules: Planner, Executor, Verifier, and Generator. These modules work collaboratively across multiple rounds of interaction through evolving memory and integrated tools.

Key capabilities:

  • Modular agent system: four specialized modules coordinate their work, solving complex reasoning tasks across multiple rounds through evolving memory and a toolkit.
  • Multi-tool integration: seamlessly connects to a variety of tool ecosystems, including base_generator, python_coder, google_search, wikipedia_search, web_search, etc.
  • Flow-GRPO algorithm: Flow-based Group Refined Policy Optimization, which supports long-horizon reasoning tasks under sparse rewards and enables in-flow agent optimization.
  • Verified results: AgentFlow (7B backbone) surpasses top baselines on 10 benchmarks, with search tasks +14.9%, agentic reasoning +14.0%, mathematics +14.5%, and science +4.1%, even surpassing GPT-4o with around 200B parameters.

Usage:

  • Environment requirements: Python 3.11 is recommended.
  • Installation setup: Environment variables need to be configured. Copy .env.template from agentflow/.env.template and rename it to .env, placing it in the agentflow/ folder, and update the API keys: OPENAI_API_KEY (for evaluating responses), GOOGLE_API_KEY (for the Google search tool), DASHSCOPE_API_KEY (optional, for calling Qwen-2.5-7B-Instruct as the engine for the agent and tools), TOGETHER_API_KEY (optional, a recommended alternative for international users). The Qwen2.5-7B-instruct model can also be served via vLLM.
  • Quick inference: Before running, it is recommended to verify the API keys and environment configuration. A command can be run to test all integrated tools and the LLM engine. To quickly try out the system, you can run python quick_start.py.
  • Flow-GRPO training (optional): Before training, it is recommended to verify the tools, LLM engine, and network configuration. Train by mixing two datasets: NQ (Natural Questions) for agent search, and DeepMath-103K for mathematical reasoning. Use tmux to start training. All training hyperparameters are configured in train/config.yaml. Comprehensive logging is provided to monitor training.
  • Benchmark testing: Use VLLM to deploy the trained planner model and run inference on specific benchmark tasks. Each task folder contains data, logs, and results.
  • Using your own model: AgentFlow supports using different LLM engines for each agent module. Modify the llm_engine_name parameter in the corresponding run.sh script. Other agents (executor, verifier, generator) use a fixed LLM engine by default (Qwen-2.5-7B-Instruct via DashScope), and you can modify self.llm_engine_fixed in agentflow/agentflow/models/planner.py:19, as well as the llm_engine_name parameter used when instantiating the Executor in agentflow/agentflow/solver.py:232.

Applicable scenarios:

  • Agent tasks that require complex reasoning and tool use, such as search, mathematics, and scientific question answering.
  • Long-horizon reasoning tasks, especially in sparse-reward environments.
  • Research and development of trainable agent systems, optimizing planning and tool use.

Limitations:

  • Requires API keys and network configuration, and may incur costs (specific pricing is not provided in the materials).
  • Requires a Python 3.11 environment, and GPU support is recommended (e.g., Lambda provides GPU support).
  • The training and inference process requires a certain technical background, and configuration is relatively complex.

The project has been accepted by ICLR 2026 and the NeurIPS 2025 Efficient Reasoning Workshop, and ranked second in HuggingFace Daily Paper.