Open-source project
microsoft/agent-lightning avatar
microsoft/agent-lightning

Agent Lightning v1.0: A 3,500-Line RL Trainer That Keeps Your Agent Harness Intact

The absolute trainer to light up AI agents.

18,996 stars1,726 forksPythonMIT

At a glance

What is it?
Microsoft's Agent Lightning is a lightweight reinforcement learning framework that trains AI agents through a proxy, without rewriting their tools or control flow. This review covers its architecture, setup, and the trade-offs of its zero-change approach.
Who is it for?
Adopt Agent Lightning if you need to apply RL to an existing agent stack without rewriting its tools or control flow, especially if you can run Kubernetes jobs and want a small codebase you can audit. Avoid it if you need a turnkey solution with no infrastructure setup, or if your agent cannot tolerate the overhead of a proxy.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 11 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 23, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • microsoft/agent-lightning18,996 ★ · +1,403
Star history
Repository2026-08-212026-11-23
microsoft/agent-lightning17.6k19k

1,403 Stars in the last 94 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What Problem Agent Lightning Solves

Reinforcement learning for agents usually means re-architecting the agent to expose training hooks, or running it inside a sandbox that changes its behavior. Agent Lightning attacks that friction directly. It is a framework for training agents with RL while the agent keeps its real harness: tools, context, control flow, and environment stay in the loop. The README claims zero changes to the agent itself. That is the core value proposition. The intended user is someone who already has an agent that works, wants to improve it with RL, and does not want to maintain a separate training version. The project is from Microsoft, and the README links to a project page and a technical report, so this is aimed at practitioners who read papers and are willing to configure a GPU stack.

The Three-Component Architecture

Agent Lightning v1.0 splits training into three lightweight pieces. The Trainer runs verl and vLLM, builds training samples, and updates the policy. The API Gateway proxies model requests and captures training data. The Rollout Controller launches agents either locally or as Kubernetes Jobs. The data flow is straightforward: the Trainer creates rollouts, the Controller launches agents, and the Gateway turns the agent's interactions into training data. The key mechanism is that the agent calls the model through an OpenAI-compatible API, and the Gateway sits in that path. That is how the framework captures trajectories without modifying the agent. The README mentions a v1.0 proxy, and a vLLM blog post about returning token IDs via the OpenAI-compatible API, which suggests the Gateway handles token-level details to avoid retokenization drift. The architecture is deliberately minimal, which fits the 3,500-line claim.

Getting It Running: Commands and Config

Installation is not a pip install; it is a repository clone plus a sync and a setup script. The README gives this example for a CUDA 13.0 machine: cd into the repo, run uv sync, then run bash scripts/setup_verl.sh 0.8.0 cu130. That script installs verl version 0.8.0 for CUDA 13.0. This is a GPU-heavy setup, and the documentation links to an Installation Guide for details. The Quick Start guide covers a local first run. Configuration is split across three areas: Trainer Configuration for verl integration and trace aggregation, API Gateway Configuration for the proxy settings, and Controller Configuration for local and Kubernetes runners. There is also a section on Asynchronous Training, which mentions collocated async collection and pause/drain. So the config surface is non-trivial, but it is organized by component.

The Coding Agent Example: A Concrete Claim

The README's headline result is a coding agent training example. Using only 6,000 training samples, an end-to-end Qwen3.5-9B workflow improves SWE-bench Verified from 41.8% to 56.4%, a gain of 14.6 percentage points. That is a specific number, and the README says the full pipeline is released, including data cleaning, reward-hacking prevention, and training scripts. This is the strongest evidence that the framework works for a real task. But note the claim is about a single model and a single benchmark. The README also lists other evaluation domains: Search R1, LLM-in-Sandbox, and Coding Agent, with pure RL showing improvements across all three. Still, the coding example gives a concrete baseline for what you might expect.

Kubernetes Support: A Different Way to Run Rollouts

Agent Lightning runs agents directly as Kubernetes Jobs without relying on external sandbox services. That is a design choice with real implications. If you already run Kubernetes, this removes a dependency on a separate sandbox provider. If you do not, it adds operational overhead. The Rollout Controller can run agents locally or as Jobs, so you can start local and move to Kubernetes later. The README emphasizes this as a key feature, and the Controller Configuration section covers both runners. This is a point of differentiation: you control the execution environment, for better or worse. The trade-off is that you are responsible for the Kubernetes cluster's reliability and security, which the framework does not manage.

Where It Might Be the Wrong Tool

The zero-change promise has limits. The agent must interact with the model through an OpenAI-compatible API, because the Gateway proxies model requests. If your agent uses a non-standard model interface or embeds the model directly, you cannot use Agent Lightning without changing that interface. Also, the framework is tied to verl and vLLM. The setup script pins verl to a specific version, and the Trainer runs vLLM. That means your model serving stack must align with those tools. The README's installation example is CUDA 13.0 specific, so other CUDA versions may need different setup. The 3,500-line codebase is small, but that also means you may need to read the source to troubleshoot. The README mentions reward-hacking prevention in the coding pipeline, and says the full pipeline is released, so read it and the technical report to understand the failure modes they guard against.

Alternatives and How They Differ

For a direct alternative, consider frameworks that do not require a proxy. For example, a traditional RL training loop for agents, like those built on Ray RLlib or custom verl loops, would require you to instrument your agent to emit trajectories. That is a different approach: you modify the agent to expose training data, rather than intercepting model calls. The trade-off is that you get more control over the data format, but you lose the zero-change benefit. Another alternative is to use a sandbox-based RL framework that isolates the agent entirely, which changes the execution environment and may not reflect production behavior. Agent Lightning's approach is to keep the harness intact and intercept at the API layer, which is a middle path. The vLLM blog post about token ID return is a specific technical detail that other frameworks may not handle, so that could be a deciding factor.

Maintenance and License Considerations

The project is licensed under MIT, which is permissive and allows commercial use, modification, and redistribution, with no copyleft obligations. That is a low-license-risk choice for adoption. The repository is active, with the last push on November 2, 2026, and v1.0.2 released on September 29, 2026. The v1.0 release was a complete refactor, and the README explicitly says legacy releases before v1.0 are on a v0.x branch. That means the API and architecture changed significantly at v1.0, so if you adopt, you should target v1.0 and not rely on older tutorials. The project has a technical report on arXiv, which is a good sign for documentation depth. However, the framework depends on external tools like verl and vLLM, so your upgrade cost is tied to their release cycles. The setup script pins verl 0.8.0, so you must track when Agent Lightning updates that script. The README mentions a blog post about trajectory-level aggregation for faster training, so there is ongoing development, but the maintenance burden is on you to keep the stack in sync.

Editorial conclusion

Adopt Agent Lightning if you need to apply RL to an existing agent stack without rewriting its tools or control flow, especially if you can run Kubernetes jobs and want a small codebase you can audit. Avoid it if you need a turnkey solution with no infrastructure setup, or if your agent cannot tolerate the overhead of a proxy. Before adopting, verify that your agent's harness works through the OpenAI-compatible API, confirm your CUDA and verl versions match the setup script, and read the technical report for the exact reward-hacking prevention methods used in the coding example.

Frequently asked questions

what is microsoft agent lightning

It is a Python framework for reinforcement learning training of AI agents, described as about three and a half thousand lines of code. Its central claim is that agents keep their real harnesses and interact with the model through a proxy with no changes, while their tools, context, control flow and environments stay in the loop. It has a technical report, a skill, and seven documented examples.

how to use agent lightning

The README gives an example installation for a machine with a recent CUDA generation: change into the repository, sync the Python environment, then run a setup shell script with a version of the training library and a CUDA tag. After that it points to a documentation quick start page covering the local first run and the end to end flow, plus pages for the trainer, the gateway and the controller.

What does Lightning AI do?

The repository is not from that company and makes no reference to it. It is a Microsoft project: a framework that trains AI agents with reinforcement learning by running the training library and an inference server behind a proxy, with the agent's own harness left unmodified, and with agents executed locally or as Kubernetes jobs.

Is ChatGPT an AI agent?

The repository does not discuss any product by name. What its examples describe is a general agent with computer and code execution tools, a multi-turn retrieval and reasoning agent, a coding agent trained against repository tests, and several reasoning and interactive environment examples, all trained with pure reinforcement learning through a proxy.

dspy vs agent lightning

The repository makes no comparison. Its own eleven runtime dependencies are a web framework, an application server, a validation library, an HTTP client with retries, a logging library, a templating engine, a YAML parser, a Kubernetes client, and two exactly pinned configuration packages. Its articles list includes a post from the inference server's own blog about returning token identifiers through an OpenAI compatible API.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/microsoft-agent-lightning.svg)](https://hysenlabs.com/projects/microsoft-agent-lightning)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/microsoft-agent-lightning.svg)](https://hysenlabs.com/projects/microsoft-agent-lightning)

Was this useful?