Manuscript Offprint

arXiv:2610.22448

Lean4AgenticRL: Advancing Agentic RL with Verifiable Multi-level Process Rewards

Ruida Wang, Gerald Friedland, Tong Zhang, Chris Kong

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Enhancing the agentic capabilities of Large Language Models (LLMs) to tackle complex software engineering (SWE) and general terminal-usage problems is a pressing challenge. Current state-of-the-art LLMs often go through large-scale agentic Reinforcement Learning (RL). However, they mostly rely on high-level outcome rewards (Zeng et al., 2026), with minimal consideration of low-level toolcall and mid-level workflow-stage rewards, which makes the training less effective. To overcome this limitation, we propose Lean4AgenticRL, which, to the best of our knowledge, is the first framework that grounds multi-level process rewards in the unified Lean4 formalization schema for open-ended agentic RL. Lean4AgenticRL first builds a problem-specific workflow system that balances the agent's own capability and controllability during execution, laying the foundation for further verification. Subsequently, our workflow formalization and multi-level reward annotation methods enable agent behavior verification within a general harness system. It provides multi-level rewards to support more effective agentic RL with the workflow-stage-normalized GRPO algorithm. Using Lean4AgenticRL, we train LAR-9B/27B, a family of models with enhanced agentic capability. Extensive experiments indicate that our model outperforms the leading model of the similar size. LAR-27B achieves 77.3% on TerminalBench-2.1. On average, our models outperform the base model by 9.89% and surpass the second-best model of comparable size we know by 5.07%. These results indicate the potential of integrating formal methods in enhancing open-ended agentic RL.

1 INTRODUCTION

The ability of Large Language Models (LLMs) to perform long-running agentic tasks has been regarded as a key capability by the computer science community (Wang et al., 2026b). This capability is typically evaluated by solving complex software engineering (SWE) (Jimenez et al., 2024) and terminal-usage (Team, 2025c) tasks within advanced harness frameworks (Anthropic, 2026a; OpenAI, 2025; Merrill & Shaw, 2025). Given the significant practical value (OpenAI, 2026), training advanced agentic LLMs has become an important research direction. Agentic capability in LLMs refers to the model's ability to actively interact with an environment to explore, understand, and resolve tasks. Previous works have developed multiple approaches to strengthen this ability, including simple prompting (Yao et al., 2022; Madaan et al., 2023) and building supervised fine-tuning datasets (Pan et al., 2024; Badertdinov et al., 2026). Building on the success of scaling Reinforcement Learning with Verifiable Rewards (RLVR) (Guo et al., 2025; Team et al., 2025) and multi-turn agentic RL methods (Pan et al., 2024; Wei et al., 2026; Wang et al., 2026c), the community has driven significant progress in long-horizon agent tasks such as SWE and terminal-usage.

Despite significant progress in large-scale agentic RL, reliably assigning process rewards in long agent traces remains an open problem. In particular, current agentic RL methods (Zeng et al., 2026; Xu et al., 2026; Team et al., 2026) primarily rely on high-level outcome rewards, building on their success in single-turn RLVR. However, these signals do not directly distinguish useful intermediate

∗^{*}Work done during an internship at Amazon Web Services.

†^{\dagger}Correspondence to: Chris Kong at luyankon@amazon.com.

Figure

(a) Problem-specific Workflow Agent System

Multi-level Verifiable Reward Annotation

Figure

(b) Workflow Formalization and Multi-level Reward Annotation

Figure

(c) Lean4AgenticRL Training

Figure 1: Overview of Lean4AgenticRL framework: The Lean4AgenticRL framework contains three major steps: (a) Problem-specific workflow agent system: A plan-then-execute process that first explores and produces the problem-specific workflow (PSWF). Then execute the PSWF to solve the task. (b) Workflow Formalization and Multi-level Reward Annotation: An annotation process that formalizes the PSWF into our generalized Lean4Agent framework. Then segment the agent trajectory into workflow stages, and assign mid-level workflow-stage rewards and low-level toolcall rewards. (c) Lean4AgenticRL training: We apply the workflow-stage-normalized GRPO algorithms to train the LLM agent with multi-level rewards.

actions from incorrect or redundant steps within successful trajectories, limiting the effectiveness of training (Liu et al., 2026a). This has motivated the use of process rewards to supervise the agent's intermediate steps (Wang et al., 2026c; Xi et al., 2026). However, existing approaches often focus on low-level toolcall results, which may overlook broader workflow progress and degrade performance when a single toolcall cannot directly connect to the task objectives (Modecrua et al., 2026). Overall, these limitations highlight the need to unify the high-level outcome rewards, mid-level workflow-stage rewards, and low-level toolcall rewards in a verifiable way to enable more effective agentic RL.

To address the above limitations, we propose Lean4AgenticRL, a unified framework for deriving multi-level rewards within a uniform, Lean4Agent verifiable, open-ended agentic RL setting. The overview of Lean4AgenticRL is presented in Figure 1. In Lean4AgenticRL, we first use problem-specific workflow (PSWF) agent system that balances the agent's inherent capabilities with execution controls through a plan-then-execute paradigm. It further provides the basis for verifying agent behaviors. Subsequently, we extend the Lean4Agent (Wang et al., 2026b) verification framework from fixed workflows to general harnesses. Then, we formalize the PSWF and segment the agent trajectories into formal workflow stages and annotate the trajectories with high-level outcome rewards ( α\alpha), mid-level workflow-stage rewards ( β\beta), and low-level toolcall rewards ( γ\gamma). These reward signals synergistically support learning from both final outcomes and intermediate behaviors through our workflow-stage-normalized GRPO algorithm, enabling more effective agentic RL.

We summarize our contributions as follows: (1) We propose Lean4AgenticRL, which, to the best of our knowledge, is the first framework that derives multi-level process rewards within Lean, a uniform dependent-type verifiable language, for agentic RL in open-ended domains that enables more effective agentic RL. (2) We develop problem-specific workflow and generalize the current agent verification framework from fixed workflow to general harness systems. They greatly enlarge the applicability of the current uniform formal agent verification system. (3) We train LAR-9B/27B through Lean4AgenticRL. Extensive experiments indicate that our model outperforms the leading model of comparable size on SWE and general terminal-usage tasks. LAR-27B achieves 77.3% on TerminalBench-2.1 (Team, 2025c) and, across the three benchmarks we evaluated, our model outperforms their base model by 9.89% and the second-best models of comparable size by 5.07% on average. The performance highlights the effectiveness and generality of Lean4AgenticRL.

Furthermore, Lean4AgenticRL offers a new view of agentic RL methods grounded in formal verification and provides a unified framework for future studies to explore applications of formal methods within the modern RL paradigm. To facilitate the advancement of the fields, our code and model have been open-sourced in https://github.com/RickySkywalker/Lean4AgenticRL

References (45)