back to home

microsoft / agent-lightning

The absolute trainer to light up AI agents.

15,473 stars
1,323 forks
140 issues
PythonTypeScriptJavaScript

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing microsoft/agent-lightning in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/microsoft/agent-lightning)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

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 For the latest nightly build (cutting-edge features), you can install from Test PyPI: 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*. ⚡ Architecture Agent Lightning keeps the moving parts to a minimum so you can focus on your idea, not the plumbing. Your agent continues to run as usual; you can still use any agent framework you like; you drop in the lightweight helper, or let the tracer collect every prompt, tool call, and reward. Those events become structured spans that flow into the LightningStore, a central hub that keeps tasks, resources, and traces in sync. On the other side of the store sits the algorithm you choose, or write yourself. The algorithm reads spans, learns from them, and posts updated resources such as refined prompt templates or new policy weights. The Trainer ties it all together: it streams datasets to runners, ferries resources between the store and the algorithm, and updates the inference engine when improvements land. You can either stop there, or simply let the same loop keep turning. No rewrites, no lock-in, just a clear path from first rollout to steady improvement. ⚡ CI Status | Workflow | Status | |----------|--------| | CPU Tests | | | Full Tests | | | UI Tests | | | Examples Integration | | | Latest Dependency Compatibility | | | Legacy Examples Compatibility | | ⚡ Citation If you find Agent Lightning useful in your research or projects, please cite our paper: ⚡ Contributing This project welcomes contributions and suggestions. Start by reading the Contributing Guide for recommended contribution points, environment setup, branching conventions, and pull request expectations. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. ⚡ Trademarks This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies. ⚡ Responsible AI This project has been evaluated and certified to comply with the Microsoft Responsible AI Standard. The team will continue to monitor and maintain the repository, addressing any severe issues, including potential harms, if they arise. ⚡ License This project is licensed under the MIT License. See the LICENSE file for details.