agent-lightning
microsoft/agent-lightning
The absolute trainer to light up AI agents.
Overview
Agent Lightning is a Python library designed for optimizing and training AI agents with minimal code change. It supports reinforcement learning, automatic prompt optimization, supervised fine-tuning, and works with various agent frameworks or standalone Python OpenAI.
Categories
Tags
Similar tools
ECC
affaan-m/ECC
The agent harness performance optimization system
hermes-agent
NousResearch/hermes-agent
The self-improving AI agent built by Nous Research
AutoGPT
Significant-Gravitas/AutoGPT
AutoGPT: Build, Deploy, and Run AI Agents
ollama
ollama/ollama
Get up and running with Kimi-K2.6, GLM-5.1, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
langflow
langflow-ai/langflow
Langflow is a powerful platform for building and deploying AI-powered agents and workflows.
dify
langgenius/dify
Production-ready platform for agentic workflow development
Install
pip install agent-lightningREADME
Agent Lightning⚡
The absolute trainer to light up AI agents.
Join our Discord community to connect with other users and contributors.
⚡ Core Features
- Turn your agent into an optimizable beast with ZERO CODE CHANGE (almost)! 💤
- Build with ANY agent framework (LangChain, OpenAI Agent SDK, AutoGen, CrewAI, Microsoft Agent Framework...); or even WITHOUT agent framework (Python OpenAI). You name it! 🤖
- Selectively optimize one or more agents in a multi-agent system. 🎯
- Embraces Algorithms like Reinforcement Learning, Automatic Prompt Optimization, Supervised Fine-tuning and more. 🤗
Read more on our documentation website.
⚡ Installation
pip install agentlightning
For the latest nightly build (cutting-edge features), you can install from Test PyPI:
pip install --upgrade --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ --pre agentlightning
Please refer to our installation guide for more details.
To start using Agent-lightning, check out our documentation and examples.
⚡ Articles
- 12/17/2025 Adopting the Trajectory Level Aggregation for Faster Training Agent-lightning blog.
- 11/4/2025 Tuning ANY AI agent with Tinker ✕ Agent-lightning Medium. See also Part 2.
- 10/22/2025 No More Retokenization Drift: Returning Token IDs via the OpenAI Compatible API Matters in Agent RL vLLM blog. See also Zhihu writeup.
- 8/11/2025 Training AI Agents to Write and Self-correct SQL with Reinforcement Learning Medium.
- 8/5/2025 Agent Lightning: Train ANY AI Agents with Reinforcement Learning arXiv paper.
- 7/26/2025 We discovered an approach to train any AI agent with RL, with (almost) zero code changes. Reddit.
- 6/6/2025 Agent Lightning - Microsoft Research Project page.
⚡ Community Projects
- DeepWerewolf — A case study of agent RL training for the Chinese Werewolf game built with AgentScope and Agent Lightning.
- AgentFlow — A modular multi-agent framework that combines planner, executor, verifier, and generator agents with the Flow-GRPO algorithm to tackle long-horizon, sparse-reward tasks.
- Youtu-Agent — Youtu-Agent lets you build and train your agent with ease. Built with a modified branch of Agent Lightning, Youtu-Agent has verified up to 128 GPUs RL training on maths/code and search capabilities with steady convergence. Also check the recipe and their blog [Stop Wrestling with Your Agent RL: How Youtu-Agent Achieved Stable, 128-GPU Scaling Without Breaking a Sweat](https://spotted-coconut-df8.notion.