# https://github.com/microsoft/agent-lightning 项目说明书

生成时间: 2026-05-21 08:39:26 UTC

## 目录

- [仓库概览](#overview)
- [入口与运行边界](#entrypoints)
- [架构证据地图](#architecture)
- [运维与验证边界](#operations)

<a id='overview'></a>

## 仓库概览

### 相关页面

相关主题：[入口与运行边界](#entrypoints), [架构证据地图](#architecture), [运维与验证边界](#operations)

<details>
<summary>相关源码文件</summary>

以下源码文件用于生成本页说明：

- [README.md](https://github.com/microsoft/agent-lightning/blob/main/README.md)
- [pyproject.toml](https://github.com/microsoft/agent-lightning/blob/main/pyproject.toml)
- [contrib/README.md](https://github.com/microsoft/agent-lightning/blob/main/contrib/README.md)
- [dashboard/README.md](https://github.com/microsoft/agent-lightning/blob/main/dashboard/README.md)
- [dashboard/package.json](https://github.com/microsoft/agent-lightning/blob/main/dashboard/package.json)
- [examples/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/README.md)
- [examples/apo/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/apo/README.md)
- [examples/azure/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/azure/README.md)
- [examples/calc_x/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/calc_x/README.md)
- [examples/chartqa/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/chartqa/README.md)
- [examples/claude_code/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/claude_code/README.md)
- [examples/minimal/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/minimal/README.md)
</details>

# 仓库概览

本页在 Human Wiki provider 不可用时基于仓库证据生成，只使用 README、文件树和已选源码文件，不把模板描述冒充项目事实。

## README 证据

<p align="center">
  <img src="docs/assets/readme-banner.svg" alt="Agent-lightning-banner" style="width:600px"/>
</p>

# Agent Lightning⚡

[![Unit Tests](https://github.com/microsoft/agent-lightning/actions/workflows/badge-unit.yml/badge.svg)](https://github.com/microsoft/agent-lightning/actions/workflows/badge-unit.yml)
[![Documentation](https://img.shields.io/badge/GitHub%20Pages-Documentation-blue)](https://microsoft.github.io/agent-lightning/)
[![PyPI version](https://badge.fury.io/py/agentlightning.svg)](https://badge.fury.io/py/agentlightning)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/microsoft/agent-lightning)
[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/RYk7CdvDR7)

**The absolute trainer to light up AI agents.**

Join our [Discord community](https://discord.gg/RYk7CdvDR7) 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](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>

## ⚡ Installation

```bash
pip install agentlightning
```

For the latest nightly build (cutting-edge features), you can install from Test PyPI:

```bash
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](https://microsoft.github.io/agent-lightning/stable/tutorials/installation/) for more details.

To start using Agent-lightning, check out our [documentation](https://microsoft.github.io/agent-lightning/) and [examples](./examples).

## ⚡ Articles

- 12/17/2025 [Adopting the Trajectory Level Aggregation for Faster Training](https://agent-lightning.github.io/posts/trajectory_

[excerpt truncated]

## 已选源码清单

- `README.md`
- `pyproject.toml`
- `contrib/README.md`
- `dashboard/README.md`
- `dashboard/package.json`
- `examples/README.md`
- `examples/apo/README.md`
- `examples/azure/README.md`
- `examples/calc_x/README.md`
- `examples/chartqa/README.md`
- `examples/claude_code/README.md`
- `examples/minimal/README.md`

| 文件 | 证据角色 | 大小 |
|---|---|---|
| `README.md` | README/产品与使用证据 | 9958 bytes |
| `pyproject.toml` | 包与运行时元数据 | 8738 bytes |
| `contrib/README.md` | 文档证据 | 2011 bytes |
| `dashboard/README.md` | 文档证据 | 790 bytes |
| `dashboard/package.json` | 包与运行时元数据 | 2377 bytes |
| `examples/README.md` | 文档证据 | 6244 bytes |
| `examples/apo/README.md` | 文档证据 | 3914 bytes |
| `examples/azure/README.md` | 文档证据 | 9661 bytes |
| `examples/calc_x/README.md` | 文档证据 | 3563 bytes |
| `examples/chartqa/README.md` | 文档证据 | 4077 bytes |
| `examples/claude_code/README.md` | 文档证据 | 5821 bytes |
| `examples/minimal/README.md` | 文档证据 | 1786 bytes |

资料来源：`[README.md:1-120]()`

---

<a id='entrypoints'></a>

## 入口与运行边界

### 相关页面

相关主题：[仓库概览](#overview), [架构证据地图](#architecture), [运维与验证边界](#operations)

<details>
<summary>相关源码文件</summary>

以下源码文件用于生成本页说明：

- [README.md](https://github.com/microsoft/agent-lightning/blob/main/README.md)
- [pyproject.toml](https://github.com/microsoft/agent-lightning/blob/main/pyproject.toml)
- [contrib/README.md](https://github.com/microsoft/agent-lightning/blob/main/contrib/README.md)
- [dashboard/README.md](https://github.com/microsoft/agent-lightning/blob/main/dashboard/README.md)
- [dashboard/package.json](https://github.com/microsoft/agent-lightning/blob/main/dashboard/package.json)
- [examples/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/README.md)
- [examples/apo/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/apo/README.md)
- [examples/azure/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/azure/README.md)
- [examples/calc_x/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/calc_x/README.md)
- [examples/chartqa/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/chartqa/README.md)
- [examples/claude_code/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/claude_code/README.md)
- [examples/minimal/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/minimal/README.md)
</details>

# 入口与运行边界

下面文件是安装、启动、配置或宿主集成的高信号候选。这里给出证据地图，不推断未经执行验证的 API 契约。

| 文件 | 证据角色 | 大小 |
|---|---|---|
| `README.md` | README/产品与使用证据 | 9958 bytes |
| `pyproject.toml` | 包与运行时元数据 | 8738 bytes |
| `contrib/README.md` | 文档证据 | 2011 bytes |
| `dashboard/README.md` | 文档证据 | 790 bytes |
| `dashboard/package.json` | 包与运行时元数据 | 2377 bytes |
| `examples/README.md` | 文档证据 | 6244 bytes |
| `examples/apo/README.md` | 文档证据 | 3914 bytes |
| `examples/azure/README.md` | 文档证据 | 9661 bytes |
| `examples/calc_x/README.md` | 文档证据 | 3563 bytes |
| `examples/chartqa/README.md` | 文档证据 | 4077 bytes |
| `examples/claude_code/README.md` | 文档证据 | 5821 bytes |
| `examples/minimal/README.md` | 文档证据 | 1786 bytes |

资料来源：`[README.md:1-120](https://github.com/microsoft/agent-lightning/blob/main/README.md)`

---

<a id='architecture'></a>

## 架构证据地图

### 相关页面

相关主题：[仓库概览](#overview), [入口与运行边界](#entrypoints), [运维与验证边界](#operations)

<details>
<summary>相关源码文件</summary>

以下源码文件用于生成本页说明：

- [README.md](https://github.com/microsoft/agent-lightning/blob/main/README.md)
- [pyproject.toml](https://github.com/microsoft/agent-lightning/blob/main/pyproject.toml)
- [contrib/README.md](https://github.com/microsoft/agent-lightning/blob/main/contrib/README.md)
- [dashboard/README.md](https://github.com/microsoft/agent-lightning/blob/main/dashboard/README.md)
- [dashboard/package.json](https://github.com/microsoft/agent-lightning/blob/main/dashboard/package.json)
- [examples/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/README.md)
- [examples/apo/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/apo/README.md)
- [examples/azure/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/azure/README.md)
- [examples/calc_x/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/calc_x/README.md)
- [examples/chartqa/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/chartqa/README.md)
- [examples/claude_code/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/claude_code/README.md)
- [examples/minimal/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/minimal/README.md)
</details>

# 架构证据地图

本节只根据仓库路径组织可能的架构区域；需要运行验证的行为不会在这里断言。

- `.`: `README.md`, `pyproject.toml`
- `contrib`: `contrib/README.md`
- `dashboard`: `dashboard/README.md`, `dashboard/package.json`
- `examples`: `examples/README.md`, `examples/apo/README.md`, `examples/azure/README.md`, `examples/calc_x/README.md`, `examples/chartqa/README.md`, `examples/claude_code/README.md`

资料来源：`[pyproject.toml:1-120](https://github.com/microsoft/agent-lightning/blob/main/pyproject.toml)`

---

<a id='operations'></a>

## 运维与验证边界

### 相关页面

相关主题：[仓库概览](#overview), [入口与运行边界](#entrypoints), [架构证据地图](#architecture)

<details>
<summary>相关源码文件</summary>

以下源码文件用于生成本页说明：

- [README.md](https://github.com/microsoft/agent-lightning/blob/main/README.md)
- [pyproject.toml](https://github.com/microsoft/agent-lightning/blob/main/pyproject.toml)
- [contrib/README.md](https://github.com/microsoft/agent-lightning/blob/main/contrib/README.md)
- [dashboard/README.md](https://github.com/microsoft/agent-lightning/blob/main/dashboard/README.md)
- [dashboard/package.json](https://github.com/microsoft/agent-lightning/blob/main/dashboard/package.json)
- [examples/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/README.md)
- [examples/apo/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/apo/README.md)
- [examples/azure/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/azure/README.md)
- [examples/calc_x/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/calc_x/README.md)
- [examples/chartqa/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/chartqa/README.md)
- [examples/claude_code/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/claude_code/README.md)
- [examples/minimal/README.md](https://github.com/microsoft/agent-lightning/blob/main/examples/minimal/README.md)
</details>

# 运维与验证边界

运维建议仅来自仓库中真实存在的文件。把该项目用于 agent 工作流前，仍需在 sandbox 中验证安装、quickstart 和运行行为。

- Documentation signal: `README.md`
- Runtime/package signal: `pyproject.toml`
- Documentation signal: `contrib/README.md`
- Documentation signal: `dashboard/README.md`
- Runtime/package signal: `dashboard/package.json`
- Documentation signal: `examples/README.md`
- Documentation signal: `examples/apo/README.md`
- Documentation signal: `examples/azure/README.md`
- Documentation signal: `examples/calc_x/README.md`
- Documentation signal: `examples/chartqa/README.md`

资料来源：`[contrib/README.md:1-120](https://github.com/microsoft/agent-lightning/blob/main/contrib/README.md)`

---

---

## Doramagic 踩坑日志

项目：microsoft/agent-lightning

摘要：发现 7 个潜在踩坑项，其中 0 个为 high/blocking；最高优先级：能力坑 - 能力判断依赖假设。

## 1. 能力坑 · 能力判断依赖假设

- 严重度：medium
- 证据强度：source_linked
- 发现：README/documentation is current enough for a first validation pass.
- 对用户的影响：假设不成立时，用户拿不到承诺的能力。
- 建议检查：将假设转成下游验证清单。
- 防护动作: 假设必须转成验证项；没有验证结果前不能写成事实。
- 证据：capability.assumptions | art_9b504779cfa046a894eeb7c9d3a298c6 | https://github.com/microsoft/agent-lightning#readme | README/documentation is current enough for a first validation pass.

## 2. 维护坑 · 维护活跃度未知

- 严重度：medium
- 证据强度：source_linked
- 发现：未记录 last_activity_observed。
- 对用户的影响：新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。
- 建议检查：补 GitHub 最近 commit、release、issue/PR 响应信号。
- 防护动作: 维护活跃度未知时，推荐强度不能标为高信任。
- 证据：evidence.maintainer_signals | art_9b504779cfa046a894eeb7c9d3a298c6 | https://github.com/microsoft/agent-lightning#readme | last_activity_observed missing

## 3. 安全/权限坑 · 下游验证发现风险项

- 严重度：medium
- 证据强度：source_linked
- 发现：no_demo
- 对用户的影响：下游已经要求复核，不能在页面中弱化。
- 建议检查：进入安全/权限治理复核队列。
- 防护动作: 下游风险存在时必须保持 review/recommendation 降级。
- 证据：downstream_validation.risk_items | art_9b504779cfa046a894eeb7c9d3a298c6 | https://github.com/microsoft/agent-lightning#readme | no_demo; severity=medium

## 4. 安全/权限坑 · 存在安全注意事项

- 严重度：medium
- 证据强度：source_linked
- 发现：No sandbox install has been executed yet; downstream must verify before user use.
- 对用户的影响：用户安装前需要知道权限边界和敏感操作。
- 建议检查：转成明确权限清单和安全审查提示。
- 防护动作: 安全注意事项必须面向用户前置展示。
- 证据：risks.safety_notes | art_9b504779cfa046a894eeb7c9d3a298c6 | https://github.com/microsoft/agent-lightning#readme | No sandbox install has been executed yet; downstream must verify before user use.

## 5. 安全/权限坑 · 存在评分风险

- 严重度：medium
- 证据强度：source_linked
- 发现：no_demo
- 对用户的影响：风险会影响是否适合普通用户安装。
- 建议检查：把风险写入边界卡，并确认是否需要人工复核。
- 防护动作: 评分风险必须进入边界卡，不能只作为内部分数。
- 证据：risks.scoring_risks | art_9b504779cfa046a894eeb7c9d3a298c6 | https://github.com/microsoft/agent-lightning#readme | no_demo; severity=medium

## 6. 维护坑 · issue/PR 响应质量未知

- 严重度：low
- 证据强度：source_linked
- 发现：issue_or_pr_quality=unknown。
- 对用户的影响：用户无法判断遇到问题后是否有人维护。
- 建议检查：抽样最近 issue/PR，判断是否长期无人处理。
- 防护动作: issue/PR 响应未知时，必须提示维护风险。
- 证据：evidence.maintainer_signals | art_9b504779cfa046a894eeb7c9d3a298c6 | https://github.com/microsoft/agent-lightning#readme | issue_or_pr_quality=unknown

## 7. 维护坑 · 发布节奏不明确

- 严重度：low
- 证据强度：source_linked
- 发现：release_recency=unknown。
- 对用户的影响：安装命令和文档可能落后于代码，用户踩坑概率升高。
- 建议检查：确认最近 release/tag 和 README 安装命令是否一致。
- 防护动作: 发布节奏未知或过期时，安装说明必须标注可能漂移。
- 证据：evidence.maintainer_signals | art_9b504779cfa046a894eeb7c9d3a298c6 | https://github.com/microsoft/agent-lightning#readme | release_recency=unknown

<!-- canonical_name: microsoft/agent-lightning; human_manual_source: deepwiki_human_wiki -->
