Agentic RL — Reinforcement Learning for LLM Agents

Agentic RL — Reinforcement Learning for LLM Agents

The 2024–2026 frontier discipline of training an LLM to act over many turns — calling tools, searching, browsing, editing code, driving a computer — by optimizing the whole multi-step trajectory against a reward grounded in environment outcomes. This is a distinct discipline from single-turn reasoning RL (the GRPO/RLVR/DeepSeek-R1 recipe that produces a long chain of thought and checks one final answer). The defining survey (arXiv:2509.02547) calls the shift one “from passive sequence generators into autonomous, decision-making agents embedded in complex, dynamic worlds.”

The one-sentence framing: reasoning RL optimizes a single response; agentic RL optimizes a trajectory of interleaved (think → act → observe) steps where the environment talks back between actions. Everything hard about agentic RL follows from that — credit assignment across many steps, masking the tokens the environment produced, instability over long horizons, and the rollout infrastructure to run environments in the training loop.

Scope boundary (read first)


1. The multi-turn POMDP — why agentic RL is a different problem

The formal heart of the field (survey arXiv:2509.02547, Table 1). Single-turn LLM RL — the survey calls it PBRFT (preference-based RL fine-tuning, i.e. RLHF/DPO and reasoning-RL) — is a degenerate single-step MDP: one static prompt state {s₀}, a pure-text action, horizon T=1, γ=1, objective E_{a∼π}[r(a)]. Agentic RL is a genuine POMDP ⟨𝒮, 𝒜, 𝒫, ℛ, γ, 𝒪⟩:

Component PBRFT (single-turn) Agentic RL (multi-turn)
State static prompt {s₀} temporally extended, T>1, dynamic transition P(s_{t+1}|s_t,a_t)
Action pure text 𝒜_text 𝒜_text ∪ 𝒜_action — reason in text and emit environment/tool calls
Observation (full state visible) partial — agent sees tool results / env feedback, not the latent world state
Reward single scalar r(a) step-wise R(s_t,a_t); sparse task reward + optional dense sub-rewards
Objective E[r(a)] discounted trajectory return E_τ[Σ_t γ^t R(s_t,a_t)]

Two consequences define the discipline:

  1. The action space is hybrid. The agent interleaves thinking tokens (reasoning) with action tokens (a tool call, a search query, a shell command, a click). The policy must learn both what to think and when/what to act.
  2. Reward is sparse and delayed. Success is usually known only at the end (did the tests pass? did the DB reach the goal state?), so the gradient must be propagated back across a long trajectory of mostly-unrewarded steps. The survey names temporal credit assignment as the central bottleneck for long-horizon tool use. This is the problem §5 (algorithms) exists to solve.

The survey organizes agent capabilities the RL is meant to improve into six dimensions: planning, tool use, memory, reasoning, self-improvement, perception.


2. Agentic RLVR — verifiable rewards from environment outcomes

Agentic RL inherits RLVR from reasoning models (reward = an automatic verifier, not a learned reward model — see reasoning-models.md §3) but changes where the verifier’s signal comes from: a real environment outcome rather than a math-answer string match. This is the single most important practical idea — it is what makes agentic RL trainable without human labels.

Canonical instances (and their exact reward functions):

Why this differs from reasoning-model RLVR: in reasoning-models, the verifier checks a closed-form answer the model produced in one shot. Here the verifier runs the artifact in an environment — executes the patched repo’s test suite, checks the final database state against a goal, or scores whether the retrieved answer matches — and the agent took many actions to get there. Same RLVR principle (grounded truth, hard to hack vs a learned RM), different reward source and a long trajectory to assign it across.


3. RL environments & gyms — the step/reset interface

In agentic RL, an “environment” is a sandboxed, resettable process the RL loop drives via a Gymnasium-style interface — concretely, the thing that takes the agent’s action, mutates world state, and returns an observation plus (eventually) a reward. Getting this interface standard, sandboxed, parallelizable, and reproducible is half the engineering.

Reproducibility & sandboxing are first-class because code-execution and computer-use environments run untrusted, side-effecting actions — Docker isolation (OpenEnv) and deterministic seeds/state are what make a rollout repeatable and safe to parallelize.


4. Reward design & long-horizon failure modes (the Echo Trap)

Reward design is harder over long horizons because failure modes appear that do not exist in single-turn RL. The key primary source is RAGEN (arXiv:2504.20073).


5. GRPO/PPO adapted to multi-turn — observation masking & credit assignment

Naive single-turn GRPO/PPO fails in the multi-turn setting (RAGEN Finding 1: vanilla adaptations get early gains then collapse). Two adaptations are essentially mandatory.

5a. Observation / tool-token masking (the non-negotiable fix)

Compute the policy-gradient loss only over the tokens the agent generated, and mask out every token the environment returned (tool outputs, retrieved documents, observations). Reasons: those tokens were not produced by the policy (training on them is “fundamentally incorrect”), and long observations would otherwise dominate the loss weight. Search-R1 calls this “retrieved token masking” and shows it is required for stable RL; WebAgent-R1/VAGEN (arXiv:2505.16421) document the same for web/VLM agents. This is the multi-turn analog of SFT’s prompt-token masking, and the most common silent bug when people first extend GRPO to agents.

5b. Credit assignment — trajectory-level vs step-level advantage

The core problem: with reward only at the end, how do you decide which of 20 actions deserved credit? Two patterns:

Practical mental model: start from GRPO (the reasoning-models base), then (1) mask observation tokens, (2) pick a credit-assignment scheme (trajectory-level StarPO if you mainly have an end reward; nested GiGPO if states recur and you want step-level signal), and (3) stabilize (trajectory filtering, clip-higher, watch entropy/variance for the Echo Trap).


6. Rollout infrastructure for agentic RL

The rollout — running the agent through the environment to collect trajectories — is the agentic-RL bottleneck: every training step needs fresh on-policy trajectories, and each trajectory is many slow generate→act→observe round-trips. The architectural fix is asynchronous, server-based generation with actor–learner separation.

The distinction from distributed-training: that reference owns how gradients are sharded/synced across GPUs (FSDP/ZeRO/parallelism). This owns how trajectories are generated and fed to the trainer — the rollout half that only exists in RL.


7. Tool-use RL & the agent-as-policy view

The agent is the policy: instead of prompting a fixed model to call tools (harness work → agent-harness-construction.md), you train the model with RL to decide when and how to call tools, interleaving reasoning with tool calls and learning the strategy from outcome feedback. The survey groups this as tool-integrated reasoning (TIR).


8. The 2025–2026 agentic-RL model wave

The field moved sharply from single-turn RLVR to multi-turn, environment-grounded agentic RL as the dominant post-training frontier (survey arXiv:2509.02547).


9. Agent RL evaluation / benchmarks

What you optimize against (and report). Most are task-success benchmarks — the reward signal and the eval are often the same environment.

Benchmark Domain What it measures
SWE-bench / SWE-bench Verified SWE / code resolve a real GitHub issue; tests pass. Verified = 500 human-filtered issues. The SWE-agent standard.
τ-bench (arXiv:2406.12045) tool-agent-user (airline/retail/telecom/banking) agent + simulated user + domain API tools; compares final DB state to a goal state; introduces pass^kreliability over k independent trials, not just pass@1.
τ²-bench (arXiv:2506.07982) dual-control conversational agent and user both modify a shared world state — harder coordination.
WebArena / WebArena-Lite / BrowserGym web navigation complete real web tasks in a live browser env; unified obs/action spaces.
GAIA general assistant real-world multi-step questions needing tools/web/reasoning.
OSWorld / AppWorld / Android-in-the-Wild computer-use / GUI execute multi-step GUI/OS tasks.
Terminal-Bench terminal / shell complete tasks in a terminal harness.
ALFWorld / WebShop / AgentBench / AgentGym embodied-text / shopping / general classic multi-turn agent RL training+eval envs (RAGEN, GiGPO use ALFWorld/WebShop).

Eval hygiene specific to agents: report pass^k / reliability (τ-bench) not just pass@1 — an agent that succeeds once in eight tries is not production-ready; and beware that the training environment and eval benchmark overlapping invites the same contamination/over-fit concerns as any RL setup.


Practical patterns

Anti-patterns

Troubleshooting

References