$ show lupantech/AgentFlow
AgentFlow is a framework for building and training agentic LLM systems using reinforcement learning, specifically Flow-GRPO (Flow-based Group Refined Policy Optimization). It provides a modular architecture with four core rolesβPlanner, Executor, Verifier, and Generatorβthat coordinate via evolving memory and tool calls over multiple turns. The system supports both inference (via a Solver) and distributed RL training (via a Trainer/Client/Server architecture built on verl, vLLM, and Ray). It includes a multi-provider LLM engine abstraction (OpenAI, Anthropic, Gemini, DeepSeek, etc.), a tool system with metadata-driven discovery, and instrumentation for tracing and reward collection. The repository is heavily research-oriented, with benchmark datasets (AIME24, GPQA, GAIA, HotPotQA, etc.) and training pipelines for optimizing agent planners. While primarily an application framework, it has strong data/research components, making it a hybrid project with a focus on reproducible agentic reasoning experiments.
The LLM identified 4 files worth highlighting for reuse:
Defines the abstract EngineLM base class and CachedEngine mixin for all LLM backends. Provides a clean interface for chat completion, structured output, and caching (via diskcache). This pattern is reusable for integrating any LLM provider into an agent system with minimal adaptation.
Implements the BaseTool metadata model with fields like tool_name, input_types, demo_commands, and user_metadata. Tools are discovered dynamically and executed via a standard execute() method. This pattern is reusable for building extensible tool ecosystems in any agent framework.
Provides the Memory class that tracks query, files, actions, and observations across turns. It formats history for planner context and supports structured storage. This component is self-contained and reusable for any multi-turn agent system requiring state tracking.
Contains the flow_cli decorator that auto-generates CLI arguments from class __init__ signatures using argparse. This utility simplifies configuration for experiment scripts and is reusable in any Python project needing declarative CLI generation.