microsoft /agent-lightning
The absolute trainer to light up AI agents.
★ 18,958⑂ 1,723👁 79⑃ 492● 203▤ 11
+5
日增长
+70
周增长
+288
月增长
18,958
stars
1,723
forks
79
watchers
492
prs
203
issues
11
releases
README
3,500-Line Lightweight Agentic RL Framework for Training Agents with Real Harnesses! Documentation · Technical Report · WeChat Group (微信群) · MIT License Agent Lightning was completely refactored in v1.0. For legacy releases earlier than v1.0, see this branch. ⚡ News - [2026/11] We release a Score Centering example for math reasoning, with GRPO and score centering presets, INT8 inference, and an INT4 Attention KV cache. - [2026/10] Read our AGL-SKILL: Coding Harnesses as Agentic Optimizers technical report on using coding harnesses to optimize other agents across five benchmarks. - [2026/09] We release a new coding agent example based on an MoE model. Pure RL improves Qwen3.5-35B-A3B on SWE-bench Verified from 47.8% to 61.6% after training it on only 1.8K training examples! - [2026/08] Agent Lightning Skill is released. It helps a coding agent improve another AI agent against a benchmark. - [2026/08] Agent Lightning v1.0 technical report is released! - [2026/08] We open source Agent Lightning v1.0! ⚡ Key Features - 🪶 ~3,500 lines of code: We treat simplicity as the first principle. - 🧩 Train with real agent harnesses: Agents interact with the model through the Agent Lightning v1.0 proxy with ZERO changes, while keeping tools, context, control flow, and environments in the loop. - ☸️ Native Kubernetes support: Run agents directly as Kubernetes Jobs without relying on external sandbox services. - 💻 Full coding agent training example: Using only 6K 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. We release the full pipeline, including data cleaning, reward-hacking prevention, and training scripts. Update: We release a new coding agent training example based on Qwen3.5-35B-A3B. Pure RL improves Qwen3.5-35B-A3B on SWE-bench Verified from 47.8% to 61.6% after only 1.8K training examples, a gain of 13.8 percentage points. ⚡ Installation The following is an example installation on a CUDA 13.0 machine: bash cd uv sync bash scripts/setup_verl.sh 0.8.0 cu130 See the Installation Guide for details. ⚡ Architecture Agent Lightning v1.0 keeps the training architecture simple with three lightweight components: - Trainer: Runs verl and vLLM, builds training samples, and updates the policy. - API Gateway: Proxies model requests and captures training data. - Rollout Controller: Runs agents locally or as Kubernetes Jobs. The Trainer creates rollouts, the Controller launches agents, and the Gateway turns interactions into training data, while agents continue to run with their real harnesses. ⚡ Results We evaluate Agent Lightning v1.0 across several practical training domains, including Search R1, LLM-in-Sandbox, and Coding Agent. Pure RL delivers substantial improvements across all three domains, as shown below. ⚡ Documentation | Section | Content | |---------|---------| | Installation | Base environment
Top issues
#116Based on the rag project, there are several questions26 comments · 2025-09-30#401How to save val_data predictions during each evaluation of `trainer.fit`?15 comments · 2025-12-11#89Is is possible to support Google Agent Development Kit (ADK) in the future?15 comments · 2025-09-12#425APO's TraceToMessages adapter fails with multi-turn agent rollouts (KeyError: 'role')14 comments · 2025-12-17#119I think dont put compute_response_mask in trainer.py, otherwise response_mask may not contiguous, put it in deamon.py?13 comments · 2025-09-30#438[BUG] Potential Memory Leak Issue12 comments · 2025-12-29#352Error with vllm11 comments · 2025-12-03#337🚀 Refactoring Proposal: Adopt Ruff for Integrated Linting and Formatting11 comments · 2025-11-26
Latest release
Agent Lightning v1.0.3 v1.0.3 2026-11-03Highlights - Score Centering for low-precision RL: Added Score Centering with top-K behavior-probability capture and a runnable Qwen3.5-9B math training example. (651, 677). - Lower-memory MoE routing replay: Reduced peak host-memory usage when decoding routed experts by processing one rollout at a time, while preserving the resulting training tensors (636). Features - Added INT8 weight/activation rollouts with an INT4 Attention KV cache, weight synchronization, and model preparation and precision-verification tools for the math training example (651). - Added opt-in trajectory pre