0ca394426f
Dashboard / Chromatic (push) Has been cancelled
Deploy Documentation / deploy (push) Has been cancelled
CPU Test / Lint - fast (push) Has been cancelled
CPU Test / Lint - next (push) Has been cancelled
CPU Test / Lint - slow (push) Has been cancelled
CPU Test / Lint - JavaScript (push) Has been cancelled
CPU Test / Build documentation (push) Has been cancelled
CPU Test / Test (AgentOps, legacy, Python 3.10) (push) Has been cancelled
CPU Test / Test (LLM proxy, legacy, Python 3.10) (push) Has been cancelled
CPU Test / Test (Others, legacy, Python 3.10) (push) Has been cancelled
CPU Test / Test (Store, legacy, Python 3.10) (push) Has been cancelled
CPU Test / Test (Utilities, legacy, Python 3.10) (push) Has been cancelled
CPU Test / Test (Weave, legacy, Python 3.10) (push) Has been cancelled
CPU Test / Test (AgentOps, stable, Python 3.11) (push) Has been cancelled
CPU Test / Test (LLM proxy, stable, Python 3.11) (push) Has been cancelled
CPU Test / Test (Others, stable, Python 3.11) (push) Has been cancelled
CPU Test / Test (Others, latest, Python 3.13) (push) Has been cancelled
CPU Test / Test (Store, latest, Python 3.13) (push) Has been cancelled
CPU Test / Test (Utilities, latest, Python 3.13) (push) Has been cancelled
CPU Test / Test (Weave, latest, Python 3.13) (push) Has been cancelled
CPU Test / Test (Store, stable, Python 3.11) (push) Has been cancelled
CPU Test / Test (Utilities, stable, Python 3.11) (push) Has been cancelled
CPU Test / Test (Weave, stable, Python 3.11) (push) Has been cancelled
CPU Test / Test (AgentOps, stable, Python 3.12) (push) Has been cancelled
CPU Test / Test (LLM proxy, stable, Python 3.12) (push) Has been cancelled
CPU Test / Test (Others, stable, Python 3.12) (push) Has been cancelled
CPU Test / Test (Store, stable, Python 3.12) (push) Has been cancelled
CPU Test / Test (Utilities, stable, Python 3.12) (push) Has been cancelled
CPU Test / Test (Weave, stable, Python 3.12) (push) Has been cancelled
CPU Test / Test (AgentOps, latest, Python 3.13) (push) Has been cancelled
CPU Test / Test (LLM proxy, latest, Python 3.13) (push) Has been cancelled
CPU Test / Test (JavaScript) (push) Has been cancelled
127 lines
10 KiB
Markdown
127 lines
10 KiB
Markdown
<!-- WEHUB_ZH_README -->
|
||
> [!NOTE]
|
||
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
|
||
> [English](./README.en.md) · [原始项目](https://github.com/microsoft/agent-lightning) · [上游 README](https://github.com/microsoft/agent-lightning/blob/HEAD/README.md)
|
||
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
|
||
|
||
<p align="center">
|
||
<img src="docs/assets/readme-banner.svg" alt="Agent-lightning-banner" style="width:600px"/>
|
||
</p>
|
||
|
||
# Agent Lightning⚡
|
||
|
||
[](https://github.com/microsoft/agent-lightning/actions/workflows/badge-unit.yml)
|
||
[](https://microsoft.github.io/agent-lightning/)
|
||
[](https://badge.fury.io/py/agentlightning)
|
||
[](LICENSE)
|
||
[](https://deepwiki.com/microsoft/agent-lightning)
|
||
[](https://discord.gg/RYk7CdvDR7)
|
||
|
||
**点亮 AI 智能体的终极训练器。**
|
||
|
||
加入我们的 [Discord 社区](https://discord.gg/RYk7CdvDR7),与其他用户和贡献者交流。
|
||
|
||
## ⚡ 核心特性
|
||
|
||
- 让你的智能体在几乎 **零代码改动(ZERO CODE CHANGE)** 的情况下变成可优化的强者!💤
|
||
- 支持使用 **任意(ANY)** 智能体框架(LangChain、OpenAI Agent SDK、AutoGen、CrewAI、Microsoft Agent Framework...)构建;甚至无需智能体框架(Python OpenAI)也能用。随心所欲!🤖
|
||
- 在多智能体系统中 **选择性(Selectively)** 优化一个或多个智能体。🎯
|
||
- 支持 **强化学习(Reinforcement Learning)**、自动提示词优化(Automatic Prompt Optimization)、监督微调(Supervised Fine-tuning)等多种 **算法(Algorithms)**。🤗
|
||
|
||
更多内容请参阅我们的[文档网站](https://microsoft.github.io/agent-lightning/).
|
||
|
||
<p align="center">
|
||
<img src="docs/assets/readme-diff.svg" alt="Agent-Lightning Core Quickstart" style="width:100%"/>
|
||
</p>
|
||
|
||
## ⚡ 安装
|
||
|
||
```bash
|
||
pip install agentlightning
|
||
```
|
||
|
||
如需最新每夜构建版本(前沿功能),可从 Test PyPI 安装:
|
||
|
||
```bash
|
||
pip install --upgrade --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ --pre agentlightning
|
||
```
|
||
|
||
更多细节请参阅我们的[安装指南](https://microsoft.github.io/agent-lightning/stable/tutorials/installation/)
|
||
|
||
要开始使用 Agent-lightning,请查看我们的[文档](https://microsoft.github.io/agent-lightning/)和[示例](./examples)。
|
||
|
||
## ⚡ 文章
|
||
|
||
- 12/17/2025 [采用轨迹级聚合实现更快训练](https://agent-lightning.github.io/posts/trajectory_level_aggregation/) Agent-lightning 博客。
|
||
- 11/4/2025 [使用 Tinker ✕ Agent-lightning 调优任意 AI 智能体](https://medium.com/@yugez/tuning-any-ai-agent-with-tinker-agent-lightning-part-1-1d8c9a397f0e) Medium。另见 [Part 2](https://medium.com/@yugez/tuning-any-ai-agent-with-tinker-agent-lightning-part-2-332c5437f0dc).
|
||
- 10/22/2025 [告别 Retokenization 漂移:在智能体 RL 中通过 OpenAI 兼容 API 返回 Token ID 的重要性](https://blog.vllm.ai/2025/10/22/agent-lightning.html) vLLM 博客。另见 [知乎文章](https://zhuanlan.zhihu.com/p/1965067274642785725).
|
||
- 8/11/2025 [用强化学习训练 AI 智能体编写并自我纠正 SQL](https://medium.com/@yugez/training-ai-agents-to-write-and-self-correct-sql-with-reinforcement-learning-571ed31281ad) Medium。
|
||
- 8/5/2025 [Agent Lightning:用强化学习训练任意 AI 智能体](https://arxiv.org/abs/2508.03680) arXiv 论文。
|
||
- 7/26/2025 [我们发现了一种用 RL 训练任意 AI 智能体的方法,几乎无需修改代码。](https://www.reddit.com/r/LocalLLaMA/comments/1m9m670/we_discovered_an_approach_to_train_any_ai_agent/) Reddit。
|
||
- 6/6/2025 [Agent Lightning - Microsoft Research](https://www.microsoft.com/en-us/research/project/agent-lightning/) 项目页面。
|
||
|
||
## ⚡ 社区项目
|
||
|
||
- [DeepWerewolf](https://github.com/af-74413592/DeepWerewolf) — 基于 AgentScope 与 Agent Lightning 构建的中文狼人杀智能体强化学习训练案例研究。
|
||
- [AgentFlow](https://agentflow.stanford.edu/) — 模块化多智能体框架,结合规划器、执行器、验证器与生成器智能体及 Flow-GRPO 算法,用于解决长视野、稀疏奖励任务。
|
||
- [Youtu-Agent](https://github.com/TencentCloudADP/Youtu-agent) — Youtu-Agent 让你轻松构建并训练智能体。基于 Agent Lightning 的[修改分支](https://github.com/microsoft/agent-lightning/tree/contrib/youtu-agent-lightning)构建,Youtu-Agent 已在数学/代码与搜索能力上验证了多达 128 GPU 的稳定收敛强化学习训练。还可查看[配方](https://github.com/TencentCloudADP/youtu-agent/tree/rl/agl)及其博客[*别再与智能体 RL 较劲:Youtu-Agent 如何轻松实现稳定的 128 GPU 扩展*](https://spotted-coconut-df8.notion.site/Stop-Wrestling-with-Your-Agent-RL-How-Youtu-Agent-Achieved-Stable-128-GPU-Scaling-Without-Breaking-2ca5e8f089ba80539a98c582b65e0233).
|
||
|
||
## ⚡ 架构
|
||
|
||
Agent Lightning 将运行组件精简到最少,让你专注于创意本身,而非底层 plumbing。你的智能体照常运行;你仍可选用任意智能体框架;只需接入轻量级的 `agl.emit_xxx()` 辅助工具,或让 tracer 采集每一次 prompt、工具调用与 reward。这些事件会成为结构化 span,流入 LightningStore——一个集中式枢纽,负责同步任务、资源与 trace。
|
||
|
||
Store 的另一端是你选择或自行编写的算法。算法读取 span、从中学习,并发布更新后的资源,例如优化后的 prompt 模板或新的 policy 权重。Trainer 将所有环节串联起来:向 runner 流式传输数据集,在 store 与算法之间传递资源,并在改进生效时更新推理引擎。你可以在此止步,也可以让同一循环持续运转。
|
||
|
||
无需重写、无需绑定,从首次 rollout 到持续改进,路径清晰明了。
|
||
|
||
<p align="center">
|
||
<img src="docs/assets/readme-architecture.svg" alt="Agent-lightning Architecture" style="width:100%"/>
|
||
</p>
|
||
|
||
## ⚡ CI 状态
|
||
|
||
| 工作流 | 状态 |
|
||
|----------|--------|
|
||
| CPU 测试 | [](https://github.com/microsoft/agent-lightning/actions/workflows/tests.yml) |
|
||
| 完整测试 | [](https://github.com/microsoft/agent-lightning/actions/workflows/badge-unit.yml) |
|
||
| UI 测试 | [](https://github.com/microsoft/agent-lightning/actions/workflows/dashboard.yml) |
|
||
| 示例集成 | [](https://github.com/microsoft/agent-lightning/actions/workflows/badge-examples.yml) |
|
||
| 最新依赖兼容性 | [](https://github.com/microsoft/agent-lightning/actions/workflows/badge-latest.yml) |
|
||
| 旧版示例兼容性 | [](https://github.com/microsoft/agent-lightning/actions/workflows/badge-compat.yml) |
|
||
|
||
## ⚡ 引用
|
||
|
||
如果你在研究或项目中觉得 Agent Lightning 有帮助,请引用我们的论文:
|
||
|
||
```bibtex
|
||
@misc{luo2025agentlightningtrainai,
|
||
title={Agent Lightning: Train ANY AI Agents with Reinforcement Learning},
|
||
author={Xufang Luo and Yuge Zhang and Zhiyuan He and Zilong Wang and Siyun Zhao and Dongsheng Li and Luna K. Qiu and Yuqing Yang},
|
||
year={2025},
|
||
eprint={2508.03680},
|
||
archivePrefix={arXiv},
|
||
primaryClass={cs.AI},
|
||
url={https://arxiv.org/abs/2508.03680},
|
||
}
|
||
```
|
||
|
||
## ⚡ 贡献
|
||
|
||
本项目欢迎贡献与建议。请先阅读[贡献指南](docs/community/contributing.md),了解推荐的贡献切入点、环境配置、分支约定与 Pull Request 要求。多数贡献需签署贡献者许可协议(Contributor License Agreement,CLA),声明你有权且确实授予我们使用你贡献的权利。详情请访问 https://cla.opensource.microsoft.com.
|
||
|
||
当你提交拉取请求(pull request)时,CLA 机器人会自动判断你是否需要提供 CLA(Contributor License Agreement,贡献者许可协议),并会以合适的方式标注该 PR(例如状态检查、评论)。只需按照机器人提供的说明操作即可。在使用我们 CLA 的所有仓库中,你只需完成一次此流程。
|
||
|
||
本项目已采用 [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 了解更多信息,请参阅 [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 或通过 [opencode@microsoft.com](mailto:opencode@microsoft.com) 联系我们,提出任何其他问题或意见。
|
||
|
||
## ⚡ 商标
|
||
|
||
本项目可能包含项目、产品或服务的商标或标识。Microsoft 商标或标识的授权使用须遵守并遵循 [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). 在本项目的修改版本中使用 Microsoft 商标或标识,不得造成混淆或暗示 Microsoft 的赞助。任何第三方商标或标识的使用均须遵守该第三方的相关政策。
|
||
|
||
## ⚡ 负责任 AI(Responsible AI)
|
||
|
||
本项目已经过评估和认证,符合 Microsoft Responsible AI Standard(微软负责任 AI 标准)。团队将持续监控和维护该仓库,并在出现任何严重问题(包括潜在危害)时予以处理。
|
||
|
||
## ⚡ 许可证
|
||
|
||
本项目采用 MIT License 许可。详情请参阅 [LICENSE](LICENSE) 文件。
|