← Back to all projects

Agent Lightning

Trains the model inside an agent you have already built, by sitting between it and the model instead of rewriting it

OfficialMIT
Stars
18.8k
Forks
1.7k
Open issues
183
Last commit
20 Oct 2026

What is Agent Lightning?

The usual objection to reinforcement learning for agents is that it means rebuilding the agent as a training environment, at which point you are no longer improving the thing you run. Agent Lightning avoids that by putting a proxy where the model endpoint used to be: the agent keeps its own tools, prompts, control flow and environment, and every interaction that passes through the proxy becomes training data. A trainer updates the policy, a controller runs the agent locally or as Kubernetes jobs. Microsoft reports taking a 9B model from 41.8% to 56.4% on SWE-bench Verified using 6,000 samples, and publishes that pipeline. This is GPU work with a training stack behind it, not a library you add to an application.

What can you do with Agent Lightning?

  • Train the agent you already run — The agent needs no changes: its tools, prompts and control flow stay in the loop, so what improves is the system you actually deploy.
  • Collect training data from ordinary traffic — A proxy in front of the model turns each interaction into a training sample, so the data comes from real runs rather than a synthetic environment.
  • Read the whole framework if you need to — The maintainers put the code at roughly 3,500 lines, which is small enough to follow when a training run behaves oddly.
  • Run rollouts as Kubernetes jobs — Agents can be launched directly as jobs on a cluster, so collecting experience scales without a separate sandbox service in between.
  • Follow a complete published recipe — The coding-agent example ships the whole pipeline — data cleaning, reward-hacking prevention and training scripts — rather than a fragment to reconstruct.

Before you choose Agent Lightning

  • This is model training. It expects GPUs and a reinforcement-learning stack installed against a matching CUDA build — a very different commitment from adding a library to an application.
  • Version 1.0 was a complete rewrite and earlier releases live on a separate branch, so material written before it describes a different system.

Star history

27 Aug to 30 Oct · +983

17.9k18.8k

Frequently asked questions

Is Agent Lightning free for commercial use?

Agent Lightning is released under the MIT licence — OSI-approved open source, which permits commercial use.

How can Agent Lightning be deployed?

Agent Lightning is available as Self-hosted.

Agent Lightning
Ask AI
GitHub