AgentFlow
AgentFlow is a trainable, tool-integrated agentic framework that optimizes a modular system of Planner, Executor, Verifier, and Generator agents using Flow-GRPO. It solves scalability and generalization limits in tool-augmented reasoning for long-horizon tasks. Aimed at developers and researchers building advanced AI agents.
🎬 7B Agent Outsmarts a 200B LLM: AgentFlow by Stanford · Discover AI
✨ Key features
- Modular agentic system with four specialized modules
- Multi-tool integration including search, code, and generators
- Flow-GRPO algorithm for in-the-flow agent optimization
- Proven results on 10 benchmarks, outperforming GPT-4o
- Supports custom LLM engines for each agent module
🎯 Use cases
- Complex question answering with web search
- Mathematical reasoning with tool use
- Agentic reasoning tasks requiring multi-step planning
- Benchmarking agentic systems on search, math, and science tasks
📦 Installation
🧰 Requirements: Python 3.11, API keys for OpenAI, Google, and optionally DashScope or Together, or serve a local vLLM model.
bash setup.sh
source .venv/bin/activatesudo apt-get update
sudo apt-get install parallelCopy the .env.template file from agentflow/.env.template and rename it to .env, then place it in the agentflow/ folder. Update the following variables with your own API keys:
OPENAI_API_KEY(for judging reasponse)GOOGLE_API_KEY(for Google Search tool)DASHSCOPE_API_KEY([optional] for calling Qwen-2.5-7B-Instruct as engine for agents and tools)TOGETHER_API_KEY([optional] alternative for calling Qwen-2.5-7B-Instruct as engine for agents and tools - recommended for international users)- More ways: serve Qwen2.5-7B-instruct model with vLLM (details refer to
serve_vllm_local.md).
cp agentflow/.env.template agentflow/.env
# Then edit agentflow/.env with your API keys
🚀 Usage
python quick_start.py
Example output:
==> Initializing agentflow...
==> Setting up tools...
==> 🎯 Reasoning Steps from AgentFlow (Deep Thinking...)
==> 🔍 Step 0: Query Analysis
==> 🎯 Step 1: Action Prediction (Google_Search_Tool)
==> 🛠️ Step 1: Command Execution (Google_Search_Tool)
...
**Answer:** The capital of France is Paris.
==> ✅ Query Solved!
❓ FAQ
What are the prerequisites for installing AgentFlow?
Python 3.11 is recommended. You also need to set up API keys for OpenAI, Google, and optionally DashScope or Together, or serve a local model with vLLM.
How do I test if my environment is correctly configured?
Run bash ./tools/test_all_tools.sh to test tools and python agentflow/scripts/test_llm_engine.py to test LLM engines.
Can I use my own model with AgentFlow?
Yes, you can modify the llm_engine_name parameter in run.sh for the planner, and for other agents modify self.llm_engine_fixed in planner.py and the Executor instantiation in solver.py.
How do I train AgentFlow with Flow-GRPO?
Prepare datasets with python data/get_train_data.py and python data/aime24_data.py, then start training using tmux with bash train/serve_with_logs.sh and bash train/train_with_logs.sh.
📊 Repository
🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.