In-the-Flow Agentic System Optimization for Effective Planning and Tool Use
Zhuofeng Li, Haoxiang Zhang, Seungju Han, Sheng Liu, Jianwen Xie, Yu Zhang, Yejin Choi, James Y Zou, Pan Lu (Stanford)
International Conference on Learning Representations 2026 · Oral
Overview
This article delves into Agent Flow, a novel in-the-flow agentic system designed to significantly enhance the reliability and performance of Large Language Model (LLM) agents in complex, multi-step tasks. Presented by William from Stanford on behalf of Pan Lu, this work addresses critical limitations in current LLM agent paradigms, which often suffer from either monolithic inflexibility or a lack of end-to-end trainability. Agent Flow introduces a modular architecture comprising a planner, executor, verifier, and generator, all integrated through an evolving memory and a shared toolset.

Key moments
- 1:00 Problem: LLM agents fail due to system design issues
- 1:30 Introducing Agent Flow: an in-the-flow agentic system
- 2:00 Agent Flow's modular design: only planner is trained
- 3:00 Example: Agent Flow solves complex task, avoids loops
- 3:30 FlowGRPO: In-the-flow RL optimization for the planner
- 4:00 Agent Flow outperforms baselines including GPT-4o
- 6:30 Q&A: Training only the planner vs. other modules
In-the-Flow Agentic System Optimization for Effective Planning and Tool Use
Speakers: Zhuofeng Li, Haoxiang Zhang, Seungju Han, Sheng Liu, Jianwen Xie, Yu Zhang, Yejin Choi, James Y Zou, Pan Lu (Stanford)
Conference: ICLR 2026
YouTube: https://slideslive.com/39062133
Overview
This article delves into Agent Flow, a novel in-the-flow agentic system designed to significantly enhance the reliability and performance of Large Language Model (LLM) agents in complex, multi-step tasks. Presented by William from Stanford on behalf of Pan Lu, this work addresses critical limitations in current LLM agent paradigms, which often suffer from either monolithic inflexibility or a lack of end-to-end trainability. Agent Flow introduces a modular architecture comprising a planner, executor, verifier, and generator, all integrated through an evolving memory and a shared toolset.
The core innovation of Agent Flow lies in its accompanying training method, FlowGRPO (Flow-Group Normalized Policy Optimization). This method enables the planner module to be optimized directly within the live multi-turn interaction loop, a departure from traditional offline training approaches. By casting the agent's operation as a multi-turn Markov Decision Process and broadcasting final outcome rewards across all planner steps, FlowGRPO effectively solves the long credit assignment problem inherent in complex agentic trajectories.
The significance of Agent Flow is profound for the broader AI/ML community. It offers a robust framework for building more capable and reliable LLM agents that can effectively plan, utilize diverse tools, and verify their actions. The demonstrated performance improvements across various benchmarks, including outperforming models like GPT-4o, highlight its potential to unlock new frontiers in agentic AI, making complex tasks in science, mathematics, and general reasoning more accessible and accurate for autonomous systems.
Background
▶ Watch: Problem: LLM agents fail due to system design issues (1:00)
The rapid advancements in Large Language Models (LLMs) have paved the way for increasingly sophisticated AI agents, capable of tackling complex, multi-step tasks that extend beyond simple question-answering. These agents are now being deployed in diverse domains, from automating virtual labs and replicating scientific research to complex reasoning and problem-solving. However, the development of truly robust and reliable LLM agents remains a significant challenge, largely due to architectural and training limitations.
Currently, two primary paradigms for LLM agents dominate the landscape. The first involves tool-integrated reasoning models, where LLM trajectories are tightly interleaved with external tool calls. These systems are often trained end-to-end, allowing for a monolithic optimization of the entire reasoning and action sequence. While offering the advantage of holistic learning, their monolithic nature can make them inflexible, difficult to debug, and challenging to adapt to new tools or task structures without extensive retraining.
The second paradigm focuses on training-free systems, characterized by multiple specialized modules that collaborate to achieve a goal. These systems are highly modular, allowing different components (e.g., for planning, executing, or verifying) to be designed and refined independently. However, their primary drawback is the lack of end-to-end training. The coordination and interaction between these specialized modules are typically hard-coded or rely on heuristic rules, preventing the system from learning optimal strategies for inter-module collaboration or long-horizon credit assignment. This often leads to suboptimal performance, brittle behavior, and a failure to generalize effectively.
The inherent problem with both approaches is that they compromise either trainability or modularity. As highlighted in the talk, common failure modes for current agents stem directly from these system design issues: steps are repeated unnecessarily, agents struggle with knowing when to terminate, inter-agent misalignment leads to inefficiencies, or verification mechanisms are weak. These issues underscore a fundamental challenge: enabling agents to collaborate effectively and learn from their multi-turn interactions in an end-to-end manner, while retaining the benefits of modularity. Agent Flow emerges as a direct response to this challenge, aiming to synthesize the strengths of both paradigms by offering a modular yet end-to-end trainable agentic system.
Key Findings
▶ Watch: Agent Flow's modular design: only planner is trained (2:00)
Agent Flow introduces a paradigm shift in the design and training of LLM agents, demonstrating significant advancements across several key areas:
- Novel Agentic System Architecture: Agent Flow is presented as an in-the-flow agentic system composed of four specialized, yet interconnected, modules: a Planner, an Executor, a Verifier, and a Generator. These modules interact through an evolving memory and leverage a shared, diverse toolset. Crucially, only the Planner module is trained, serving as the central coordinator that orchestrates the entire agentic workflow. This modular design allows for clear role separation while ensuring coordinated action.
- Innovative Training Method (FlowGRPO): The talk introduces FlowGRPO (Flow-Group Normalized Policy Optimization), a novel reinforcement learning (RL) method specifically designed for optimizing the Agent Flow system. Unlike traditional methods that rely on offline data, FlowGRPO trains the planner directly inside the live multi-turn loop. It addresses the challenging long credit assignment problem by broadcasting the final outcome reward back to all preceding planner steps. Combined with group normalized advantages and KL divergence regularization, FlowGRPO enables stable and efficient learning of optimal planning strategies.
- Substantial Performance Improvements: Agent Flow, powered by FlowGRPO, achieves significant performance gains across a wide array of agentic tasks and benchmarks. The system demonstrates a remarkable 15-16% increase in accuracy on agentic tasks, and strong improvements in mathematical reasoning. It consistently outperforms strong baselines, including a GPT-4o model (a 200 billion parameter model), across representative benchmarks such as 2Wiki, HotpotQA, GAIA, AMIE24, Game of 24, and GPQA. This consistent outperformance underscores the efficacy of the in-the-flow training approach and modular design.
- Enhanced Tool Usage and Efficiency: Training with FlowGRPO leads to a qualitative shift in how the agent utilizes its tools. The talk highlights that tool usage distributions change significantly post-training, indicating a more strategic and effective deployment of available resources. For instance, on 2Wiki problems, Google searches increase, while on specialized benchmarks like MedQA, the agent intelligently defers to Wikipedia Search. This optimized tool use contributes directly to improved task completion rates and overall accuracy.
- Improved Reliability and Controllability: The training process with FlowGRPO results in several desirable properties for the agent. The tool call error rate drops significantly as training progresses, demonstrating that the agent becomes more proficient and reliable in interacting with external tools. Furthermore, the planner becomes more controllable and efficient, with training reward steadily increasing while response lengths become shorter and more stable, indicating optimized planning steps. Comparative analysis against a monolithic tool-integrated RL baseline shows FlowGRPO achieving more steady and stable reward improvements, affirming the robustness of the in-the-flow training setup.
- Scalability with Model Backbones: The effectiveness of Agent Flow and FlowGRPO is shown to consistently scale with larger LLM backbones. Experiments conducted with Qwen 3 billion and Qwen 7 billion parameter models demonstrate that the benefits of the proposed system are not limited to a specific model size but generalize across different scales, suggesting broad applicability.
These key findings collectively demonstrate that Agent Flow offers a powerful and practical solution for building more intelligent, reliable, and efficient LLM agents, pushing the boundaries of what autonomous systems can achieve in complex, multi-faceted tasks.
Technical Deep Dive
▶ Watch: Example: Agent Flow solves complex task, avoids loops (3:00)
Agent Flow tackles the challenge of building robust LLM agents by introducing a novel, modular architecture coupled with an innovative reinforcement learning training paradigm. The system's design is centered around the concept of "in-the-flow" operation and optimization.
Agent Flow Architecture
The core of Agent Flow is its specialized, multi-module architecture, designed to mimic a sophisticated human-like problem-solving process. It comprises four distinct modules:
- Planner: This is the brain of the operation. At each turn, the Planner reads the initial query, the set of available tools, and the current state of the evolving memory. Its primary responsibility is to propose a sub-goal, select the most appropriate tool from the shared toolset to achieve that sub-goal, and provide the necessary context for the tool's execution. Critically, the Planner is the only module that undergoes training in the Agent Flow system, as it is responsible for the overarching coordination and strategic decision-making.
- Executor: Upon receiving instructions from the Planner, the Executor's role is straightforward: it runs the selected tool with the provided context. It acts as the interface between the agent's reasoning process and the external environment or computational utilities.
- Verifier: After the Executor completes a tool call, the Verifier steps in. It checks if the result of the tool execution is correct and aligned with the sub-goal. Based on its assessment, it provides a crucial signal back to the system: either to continue the current trajectory towards the main goal or to terminate the process if the sub-goal is met or an unrecoverable error occurs.
- Generator: While not explicitly detailed in its turn-by-turn action, the Generator is responsible for producing the final answer to the query once the Verifier signals termination and success. It can also act as a base LLM call tool for general text generation or summarization tasks.
These four modules are interconnected through an evolving memory, which continuously updates with the history of interactions, tool outputs, and verification signals. This memory serves as the agent's internal state, providing context for subsequent planning decisions. The modules also share a diverse toolset, which includes:
- A base generator (another LLM call for general text generation).
- Python for computationally heavy or logical tasks.
- Google Search for broad information retrieval.
- Wikipedia Search for structured encyclopedic knowledge.
- Targeted web search for specific website queries.
Formalization as a Markov Decision Process (MDP)
To enable end-to-end training, Agent Flow formally casts its multi-turn operation as a Markov Decision Process (MDP). This formulation provides a rigorous framework for modeling the agent's interaction with its environment over time.
- A trajectory in this MDP consists of a sequence of:
- The Planner's actions (sub-goal proposal, tool selection, context provision).
- The Executor's tool outputs.
- The Verifier's signals (continue/terminate).
- The final generated answer.
This MDP formulation is crucial because it allows for a clean and explicit way to model the long-horizon agentic interaction. The reasoning process remains explicit through continuous memory updates and module transitions, making the agent's internal logic transparent and amenable to optimization.
FlowGRPO: In-the-Flow Reinforcement Learning
The cornerstone of Agent Flow's success is FlowGRPO (Flow-Group Normalized Policy Optimization), a novel training method designed to optimize the Planner within this MDP framework. The key idea behind FlowGRPO is to optimize the Planner inside the live multi-turn loop, rather than relying on static, offline traces of past interactions. This "in-the-flow" approach allows the Planner to learn directly from real-time consequences of its decisions.
The challenges of training in such a long-horizon, multi-step environment are significant, primarily due to the long credit assignment problem – determining which past actions contributed to a distant future reward. FlowGRPO addresses this by:
- Final Outcome Reward Broadcast: The final outcome reward (e.g., success or failure of the entire task) is broadcast over all previous planner steps within a trajectory. This ensures that every planning decision that led to the final outcome receives appropriate credit or blame, effectively solving the long credit assignment problem.
- Group Normalized Advantages: FlowGRPO incorporates group normalized advantages, a technique that helps stabilize training by normalizing the advantage estimates across groups of experiences. This is particularly useful in multi-turn settings where reward signals can be sparse or highly variable.
- KL Divergence Regularization: Similar to standard GRPO (Generalized Policy Optimization) algorithms, FlowGRPO utilizes KL divergence regularization. This mechanism constrains the policy updates, preventing large, destabilizing changes to the Planner's behavior between iterations, thereby ensuring more stable and efficient learning.
By integrating these components, FlowGRPO enables the Planner to learn optimal strategies for proposing sub-goals, selecting tools, and providing context, leading to more reliable, efficient, and successful agentic task completion. The focus on training only the Planner simplifies the optimization problem while leveraging the specialized capabilities of the other modules.
Experimental Setup & Results
▶ Watch: Agent Flow outperforms baselines including GPT-4o (4:00)
The effectiveness of Agent Flow and its training method, FlowGRPO, was rigorously evaluated across a diverse set of benchmarks, demonstrating significant improvements over existing strong baselines.
Baselines and Backbones
For comparison, the researchers employed several strong baselines, notably including GPT-4o, a powerful large language model with an estimated 200 billion parameters. This comparison was crucial to demonstrate that Agent Flow's architectural and training innovations could surpass even highly capable general-purpose models. Additionally, a monolithic tool-integrated RL baseline was used to highlight the stability and efficiency advantages of FlowGRPO's in-the-flow training over traditional end-to-end reinforcement learning approaches that lack modularity.
For the LLM backbones powering Agent Flow's modules, the experiments utilized Qwen 3 billion and Qwen 7 billion parameter models. This allowed for an assessment of the system's scalability and performance across different model sizes.
Benchmarks
Agent Flow was tested on a comprehensive suite of benchmarks designed to evaluate various aspects of agentic reasoning, planning, and tool use:
- 2Wiki: A benchmark requiring multi-hop reasoning over Wikipedia.
- HotpotQA: Another multi-hop question answering dataset.
- GAIA: A general AI agent benchmark.
- AMIE24: Likely a specialized scientific or medical reasoning benchmark (given context of MedQA).
- Game of 24: A mathematical reasoning task requiring strategic numerical operations.
- GPQA: A complex general knowledge question answering benchmark.
- MedQA: A specialized medical question-answering benchmark.
Headline Results and Performance Metrics
The results showcased substantial improvements:
- Overall Performance: Agent Flow achieved a remarkable 15-16% increase in accuracy on agentic tasks. Across all representative benchmarks, it consistently demonstrated strong performance, outperforming GPT-4o in virtually every tested scenario. This is a critical finding, indicating that specialized modular design with targeted training can yield superior results compared to even state-of-the-art generalist LLMs.
- Tool Call Error Rate: As training progressed with FlowGRPO, the tool call error rate dropped significantly. This metric directly reflects the agent's improved proficiency and reliability in selecting and utilizing external tools, an essential aspect of agentic performance.
- Accuracy vs. Number of Turns: The experiments revealed a pretty steady increase in benchmark accuracy as the number of turns the agent was allowed to operate for increased. This suggests that FlowGRPO enables the agent to effectively leverage longer reasoning chains and more complex interactions to achieve better outcomes.
- Planner Controllability and Efficiency: During training, the training reward for the planner rose consistently, while the response length (number of steps/tokens) initially rose and then stabilized, becoming notably shorter and more efficient. This indicates that the planner learned to achieve goals with fewer, more optimized steps.
- Training Stability: When compared to the monolithic tool-integrated RL baseline, FlowGRPO exhibited a more steady and stable improvement in validation reward. This highlights the robustness and efficiency of the in-the-flow training setup, avoiding the oscillations or plateaus often seen in less stable RL training processes.
- Scalability: The performance benefits of Agent Flow were shown to consistently scale with larger models, with improvements observed for both Qwen 3 billion and Qwen 7 billion backbones.
Example Walkthrough
An illustrative example was provided for a question involving computing an ISBN-style check digit from a Tropicos ID.
- Before tuning (without FlowGRPO): The agent initially started well but then entered a loop during a Python coder tool call, leading to failure. This demonstrates a common failure mode in untuned or poorly coordinated agent systems.
- After tuning (with FlowGRPO): The agent successfully navigated the task. It made a different, successful Python coder tool call, completed the necessary computations, and resolved the query. This example vividly illustrates how FlowGRPO enables the planner to make more effective and non-looping tool-use decisions.
Tool Usage Distribution Changes
A key insight from the results was the observation that tool usage distributions changed significantly after FlowGRPO training. For instance, on 2Wiki problems, the amount of Google searches increased, implying the agent learned to prioritize broader information retrieval for that specific task. Conversely, on MedQA, the agent showed a greater propensity to defer to Wikipedia Search, indicating a learned preference for specialized, structured information sources when appropriate. This adaptive tool-use behavior is a direct consequence of the planner's optimization via FlowGRPO.
In summary, the experimental results unequivocally demonstrate that Agent Flow, trained with FlowGRPO, offers a superior approach to building intelligent agents, delivering higher accuracy, improved reliability, and more efficient resource utilization across a wide range of challenging tasks.
Practical Implications
▶ Watch: Q&A: Training only the planner vs. other modules (6:30)
Agent Flow and FlowGRPO present significant practical implications for various stakeholders involved in the development and deployment of AI/ML systems. This work offers a blueprint for overcoming common challenges in LLM agent design, leading to more robust, reliable, and efficient applications.
For Practitioners and Infrastructure Teams
- Building Reliable Agents: Agent Flow provides a clear architectural pattern for constructing LLM agents that are less prone to common failure modes like repeated steps, termination issues, or inter-agent misalignment. The modular design with a dedicated Verifier module inherently builds in a mechanism for self-correction and quality assurance, which is critical for deploying agents in sensitive or high-stakes environments.
- Modular and Maintainable Systems: The separation of concerns into Planner, Executor, Verifier, and Generator modules allows for easier development, debugging, and maintenance. Infrastructure teams can standardize interfaces for each module, enabling independent updates or replacements of components without disrupting the entire system. For example, a new, more efficient Python interpreter or a specialized search API can be integrated as an Executor tool without retraining the entire agent.
- Resource Optimization: The "in-the-flow" optimization of the Planner leads to more efficient tool usage and shorter, more effective reasoning trajectories. This translates to reduced computational costs (fewer LLM calls, less tool execution time) and faster task completion, which is a tangible benefit for managing operational expenses in production environments.
For Model Builders and Deployers
- End-to-End Trainable Modularity: Agent Flow addresses the long-standing tension between modularity and end-to-end trainability. Model builders no longer have to choose between a monolithic, hard-to-control system and a modular but untrainable one. FlowGRPO demonstrates how to effectively train the coordinating intelligence (the Planner) within a modular system, allowing the agent to learn optimal strategies for combining its specialized parts.
- Improved Planning and Tool Use: The system's ability to learn and adapt its tool usage distribution means that model builders can deploy agents that are more intelligent about how they interact with external APIs and computational resources. This adaptability is crucial for agents operating in dynamic environments where the optimal strategy for tool invocation might change.
- Scalability and Adaptability: The demonstrated scalability with different LLM backbones (Qwen 3B to 7B) suggests that the Agent Flow framework is not tied to a specific model size or type. This flexibility allows deployers to choose the most appropriate LLM for their specific performance and cost requirements, confident that the agentic system will still benefit from the FlowGRPO training.
- Community Resources: The availability of community resources (website, Hugging Face) significantly lowers the barrier to entry for model builders wanting to experiment with or adopt Agent Flow. This fosters innovation and accelerates the development of more capable LLM agents.
Tradeoffs and Limitations
While highly promising, Agent Flow also presents certain tradeoffs and considerations:
- Complexity of System Design: While modularity aids maintenance, the initial design and integration of four distinct modules, an evolving memory, and a diverse toolset is inherently more complex than a single-model approach.
- Reliance on Module Quality: Although only the Planner is trained, the overall system performance is still reliant on the underlying quality and consistency of the Executor and Verifier modules. As the speaker noted, these modules "will have to be optimized in some way" or act "pretty consistently" given the context. Poorly performing or unreliable Executors/Verifiers could undermine the Planner's learned strategies.
- Defining the MDP: Effective training with FlowGRPO hinges on a well-defined Markov Decision Process and a clear reward signal. For highly ambiguous or open-ended tasks, crafting this formalization might still pose a challenge.
- Computational Cost of RL Training: While FlowGRPO is shown to be stable and efficient, reinforcement learning, especially in a live multi-turn loop, can still be computationally intensive compared to supervised fine-tuning.
Despite these considerations, Agent Flow represents a significant step forward, providing a robust, trainable, and modular framework that can unlock the full potential of LLM agents for complex, real-world applications. Its success indicates that trainable agentic systems are indeed a broadly relevant and impactful research direction.
Key Takeaways
- Agent Flow is a novel in-the-flow agentic system featuring four specialized modules (Planner, Executor, Verifier, Generator), a diverse toolkit, and an evolving memory for robust multi-step task execution.
- FlowGRPO is an innovative in-the-flow RL tuning method that optimizes the Planner directly within the live multi-turn interaction loop, effectively solving the long credit assignment problem by broadcasting final outcome rewards.
- The system achieves significant performance gains, with 15-16% accuracy increases on agentic tasks, consistently outperforming strong baselines like GPT-4o across various benchmarks.
- FlowGRPO leads to enhanced tool usage efficiency and reliability, reducing tool call error rates and enabling the agent to adapt its tool-use strategies for specific tasks.
- Agent Flow demonstrates improved planner controllability and efficiency, resulting in more stable training, shorter response lengths, and better overall task completion.
- The framework is scalable across different LLM backbones, showing consistent performance improvements with both Qwen 3 billion and 7 billion parameter models, indicating broad applicability.
About the Speaker(s)
The talk was presented by William from Stanford, who represented Pan Lu, the main author of the paper, as Pan Lu was unable to attend. The work, titled "In-the-Flow Agentic System Optimization for Effective Planning and Tool Use," is a joint effort involving a large team of researchers from Stanford and other institutions. The authors include Zhuofeng Li, Haoxiang Zhang, Seungju Han, Sheng Liu, Jianwen Xie, Yu Zhang, Yejin Choi, James Y Zou, and Pan Lu. Pan Lu is highlighted as the primary contact for further questions regarding the paper.
Reviews
→ Top-rated talks at International Conference on Learning Representations 2026
All talks from International Conference on Learning Representations 2026