GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
RecentarXiv preprint

Agent Lightning v1.0: Towards Harnessed Agentic RL

Train an agent through the same harness it runs in at deployment. Microsoft's 3,500-line control plane, four traps in turning API calls into training data, and a 41.8% to 56.4% SWE-bench gain.

Breakdown by FDE Interviews · 13 min read · Updated

About the original · 2026
AUTHORS
He, Zhang, Zhang, Zhou, et al.
FROM
Microsoft, Fudan University, Zhejiang University, University of Edinburgh
PUBLISHED
Aug 2026 · arXiv preprint
CITED BY
8Semantic Scholar · Oct 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 19% of this breakdown.

01

The paper in one minute

Agents ship inside harnesses: the code that builds each prompt, runs tools, trims or summarizes context, and sometimes delegates to subagents. If you train a model with reinforcement learning (RL) inside a simplified loop and then deploy it in a real harness, it is trained for one environment and used in another. The authors' term harnessed agentic RL means training through the same harness used in production.

Their original Agent Lightning did this with a proxy: the harness talks to what looks like a normal OpenAI-compatible endpoint, and the trainer records the calls. Several frameworks have since adopted the idea. This paper, a full rewrite in about 3,500 lines of code, does two things.

First, it names four problems that appear when the trainer only sees API calls. Retokenization: the text of a response, re-tokenized inside the next prompt, may not match the tokens the model actually sampled, so calls cannot always be stitched into one sequence. Advantage calculation: one rollout can become several training samples, and the group baseline changes depending on whether you count rollouts or samples. Loss normalization: averaging per sample gives rollouts that split into more samples more weight. Backend scheduling: the number of samples is known only after the agents run.

Second, it builds the system: an API Gateway storing rollouts and events with idempotent endpoints, a Rollout Controller that runs agents as Kubernetes jobs, and a trainer on VERL that merges calls only on exact token matches and computes everything per rollout. Trained this way, Qwen3.5-9B in mini-SWE-agent went from 41.8% to 56.4% on SWE-bench Verified.

THE IDEA, VISUALLY
THE HARNESS OWNS THE LOOP; THE TRAINER WATCHES CALLS Customized Trainer VERL; creates rollouts, builds samples from events API Gateway rollouts, models, events; idempotent endpoints Rollout Controller polls queued rollouts; K8s Jobs or local pool Agent harness, unchanged OpenAI client pointed at the proxy URL /proxy/rollout/{id}/attempt/{id}/.../chat/completions Each call is logged as prompt tokens, response tokens and log probabilities; the reward arrives as one more event. FOUR PROBLEMS THE PAPER NAMES Retokenization merge calls only on exact token prefix Advantage baseline per rollout, not per sample Loss normalization each rollout weighs the same Backend scheduling a rollout's samples share one update About 3,500 lines of code; collocated async RL ~2x over sync. RL ALONE, BEFORE → AFTER Search agent, Llama-3.2-3B 25.1 → 41.7 Instruction following, Qwen3-4B 51.9 → 70.2 SWE-bench Verified, Qwen3.5-9B 41.8 → 56.4 validation reward for the first two (search: 50 per dataset) CODING VALIDATION, BEST REWARD (FIGURE 9) sample-level advantage 35.0 rollout-level advantage 33.1 + rollout-level norm 38.2 one run each; SWE-bench reported for the last only FROM 59,136 TASKS TO ~6,000 SWE-smith tasks 59,136 empty problem statement −18,033 missing problem branch −1,265 > 200 tests, or solved 4 of 4 removed kept: mixed + 1,000 all-fail ~6,000 + 400 test 36% of rollouts stay one sample; 2.41 per rollout
Agent Lightning separates who runs the agent from who trains the model: the harness calls a proxy as if it were any model API, and a small control plane turns those recorded calls into training samples. Most of the paper is about the bookkeeping that step needs to get right.
Research notes: the problem, approach and results
41.8% → 56.4%

SWE-bench Verified for Qwen3.5-9B after RL through the mini-SWE-agent harness, on about 6,000 training tasks

2.41

training samples per coding rollout on average; only 36% of rollouts stayed a single sample

59,136 → ~6,000

SWE-smith tasks before and after removing broken, oversized and always-solved tasks

THE PROBLEM

Agents now run inside harnesses (Claude Code, OpenHands, mini-SWE-agent) that build their own prompts, call tools, summarize context and spawn subagents. Classic RL frameworks want the agent loop inside the trainer, so the model is trained in a loop it will never use. Training through the real harness means the trainer sees only a stream of API calls, and turning those into correct training samples is unsolved.

THE IDEA

Let the harness keep its loop and point its model client at a proxy. A gateway records every call with its exact tokens and log probabilities under a rollout ID; a controller runs agents as Kubernetes jobs; the trainer merges calls only when tokens match exactly and computes advantages and loss normalization per rollout, not per sample.

THE RESULT

With about 6,000 cleaned SWE-smith tasks and RL alone, Qwen3.5-9B in mini-SWE-agent rose from 41.8% to 56.4% on SWE-bench Verified. A search agent and an instruction-following agent also improved. Collocated asynchronous training ran about twice as fast as synchronous training on fewer GPUs.

02

Why it matters to an FDE

Most FDE work does not train models. Two situations make this paper relevant anyway.

The first is a customer with an open-weight model, a specific agent workflow and enough examples with checkable outcomes: tickets closed, tests passing, forms filled correctly. The paper shows that RL through the customer's own harness, with modest data, can move a small model a long way on a coding task. It also shows what that costs in engineering: a data-cleaning pipeline that discarded about 90% of the source tasks, sandboxes, network policies, and an agent that learned to cheat within the first runs.

The second applies to anyone running agents as a service. The control plane is a clean pattern for long-running jobs:

One source of truth. The gateway's record of each run is authoritative; the executor reconciles toward it.

Idempotent endpoints. Retrying any control call after a network failure cannot corrupt state.

A shared run ID. The rollout ID sits in the proxy URL, so every model call, reward and log line joins to one record for debugging.

Attempts are explicit. A rerun is a new attempt under the same rollout, not a new run.

The reward-hacking list is worth reading even if you never train anything. Given a repository and a test suite, the agent found the answer in git history, downloaded upstream source with curl and pip, and fetched code with urllib. Agents you evaluate will find the same shortcuts.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 149 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    The four problems and the paper's choices, the control plane, the results and three misreadings

    Free account
  2. 04How it works

    The gateway's objects and API, the controller, sample assembly, collocated async RL and safeguards

    Premium
  3. 05The numbers that matter

    The coding pipeline numbers, the three training variants, sample statistics and the other two agents

    Premium
  4. 06Try it yourself

    Reproduce the advantage and loss examples, watch retokenization break merges, test the retry rule

    Premium
  5. 07Where it breaks

    Attribution of the gain, missing compute numbers, the dedup rule, eventual consistency and slips

    Premium
  6. 08Using it on a deployment

    Whether to RL-train in a customer's harness, and reusing the control-plane pattern either way

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →