You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ If you find Agent Lightning useful in your research or projects, please cite our
99
99
100
100
## ⚡ Contributing
101
101
102
-
This project welcomes contributions and suggestions. Start by reading the [Contributing Guide](docs/community/contributing.md) for 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.
102
+
This project welcomes contributions and suggestions. Start by reading the [Contributing Guide](docs/community/contributing.md) 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.
103
103
104
104
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.
Agent Lightning thrives on community improvements, whether you are polishing docs, fixing bugs, or building new features. This guide shows the shortest path from cloning the repository to shipping a polished pull request.
3
+
Agent Lightning gets better every time someone files a clear bug, polishes docs, improves tests, or lands a new feature. This guide collects the expectations, checklists, and tips that help you go from “I have an idea” to “my pull request just merged.”
4
4
5
-
## Step 1. Prepare Your Environment
5
+
## Before You Start
6
6
7
-
### Prerequisites
7
+
Agent-lightning is built by a small Microsoft Research team with limited reviewer hours and GPU budget. For any sizeable change (new algorithm, example, or API surface) please first discuss scope with us in [Discord](https://discord.gg/RYk7CdvDR7). Early alignment keeps your effort from being blocked late in the process.
8
8
9
-
-**Python** 3.10 or newer (we test on 3.10–3.13).
10
-
-**uv** for dependency and virtual environment management. Install it from the [official uv docs](https://docs.astral.sh/uv/getting-started/installation/).
11
-
-**Git** configured with your GitHub credentials.
9
+
## Where You Can Help
10
+
11
+
Pick a lane, or combine several. Just keep the discussion-first principle in mind for anything non-trivial.
12
+
13
+
### Documentation Improvements
14
+
15
+
Documentation improvements are the easiest way to get started. You can find more about how to write good documentations and organize documentations in the following sections. Here are some general contribution points we can think of:
- Organize content using the directories listed below so readers can actually find it.
19
+
- Avoid duplicate prose, unrelated “how-to” guides, or translations (we cannot maintain them today).
20
+
21
+
!!! note "Changes that are usually rejected"
22
+
23
+
- Copy/pasting existing docs with shallow edits.
24
+
- Adding a `how-to` guide that is not tied to a new example.
25
+
- Adding doc translations to other languages (no capacity to review/maintain yet).
26
+
27
+
### Bug Fixes
28
+
29
+
Bug fixes are the fastest way to get familiar with the codebase. To get started, you can:
30
+
31
+
- Browse the ["good first issue"](https://github.com/microsoft/agent-lightning/labels/good%20first%20issue) and ["bug"](https://github.com/microsoft/agent-lightning/labels/bug) labels; drop a comment before you start so we can mark it as taken.
32
+
- For fresh bugs, open an issue with reproduction steps, logs, and expected behavior before submitting a fix.
33
+
- Keep each pull request focused, ideally avoiding breaking API changes. Larger refactors should be discussed via RFC or maintainer sync.
34
+
35
+
### New Examples
36
+
37
+
Examples must be curated so that we can maintain them. We generally merge only those that meet at least one (ideally several) of these criteria:
38
+
39
+
- Demonstrates an agent framework or workflow that is materially different from what already exists. ([LangChain](https://www.langchain.com/) vs. [LlamaIndex](https://www.llamaindex.ai/) is not different enough; [LangChain](https://www.langchain.com/) vs. [n8n](https://n8n.io/) or [Vercel AI SDK](https://ai-sdk.dev/) is, because they either have different orchestration paradigms or differ in programming languages.)
40
+
- Shows measurable performance gains on a **real-world** problem with a **real-world** dataset, such as tuning a search agent with Google Search API or improving a coding agent’s (e.g., Claude Code) SWE-Bench score.
41
+
- Integrates a new algorithm, training backend, or serving stack (see “New Algorithms” below).
42
+
- Validates scenarios that are rarely tested, such as multi-modality agents or long-lived memory/workflow agents.
43
+
44
+
Bonus points for examples that:
45
+
46
+
- Ship CI or self-test coverage so we know they still work as the core evolves. **Otherwise, we would have to mark the example as unmaintained because we won't be able to test the examples manually before each release.**
47
+
- Include a [`docs/how-to/`]({{ src("docs/how-to/") }}) guide (or a detailed README if no how-to exists) without duplicating content in multiple places.
48
+
- Favor simple, dependency-light code over heavy abstractions.
49
+
50
+
!!! warning "Please discuss first"
51
+
52
+
Examples tend to be the most time-consuming contributions for both you and reviewers. Sync with us on Discord or through an issue before diving into a new one.
53
+
54
+
### Fresh Implementations of Core Modules
55
+
56
+
If you are looking to extend [`Runner`][agentlightning.Runner], [`Tracer`][agentlightning.Tracer], [`Adapter`][agentlightning.Adapter], [`LightningStore`][agentlightning.LightningStore], or another core interface, here are the steps:
57
+
58
+
1. File an issue or proposal first.
59
+
2. Explain which interface you are extending, why existing implementations are insufficient, and how you intend to test compatibility with the rest of the stack (unit tests, documentation updates, example refreshes, etc.).
60
+
3. Any API changes must be reviewed up front. DO NOT begin coding large changes before the discussion lands!
61
+
62
+
### New Algorithms
63
+
64
+
If you are integrating a new training/serving backend, check whether it already lives in the [Algorithm Zoo](../algorithm-zoo/index.md) or is covered in the [Examples Catalog](../how-to/examples-catalog.md). We especially welcome:
65
+
66
+
- Currently unsupported or under-tested algorithms such as Supervised Fine-tuning (SFT), Direct Policy Optimization (DPO), or Monte Carlo Tree Search (MCTS).
67
+
- Tuning [Resource][agentlightning.Resource]s that are not supported yet, such as workflows or memory.
68
+
- Expansions of supported stacks, e.g., adding multi-modality to APO or multi-agent prompt tuning.
69
+
- Reinforcement-learning integrations beyond our current stack of [VERL](https://github.com/volcengine/verl), [vLLM](https://vllm.ai/), [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-foundry/models/openai), and [Tinker](https://tinker-docs.thinkingmachines.ai/). Contributions using [SGLang](https://github.com/sgl-project/sglang), [TRL](https://github.com/huggingface/trl), [SkyRL](https://github.com/NovaSky-AI/SkyRL), [RLinf](https://github.com/RLinf/RLinf), [litgpt](https://github.com/Lightning-AI/litgpt), or similar are welcome.
70
+
71
+
Most brand-new algorithms ultimately land as “new examples,” so read that section too. Post an issue or design doc to scope the work, reuse existing utilities, and avoid duplicating efforts. Mature, battle-tested examples graduate into the [Algorithm Zoo](../algorithm-zoo/index.md).
12
72
13
-
### Clone the Repository
73
+
### Ecosystem Projects
14
74
15
-
Fork the repo, then clone your fork and register the upstream remote so you can stay current:
75
+
Have a project that builds on Agent-lightning but does not belong in the main repo? Fork it or depend on it externally, then let us know. We can showcase notable projects in [Community Projects](../index.md) and the main [README]({{ src("README.md") }}).
76
+
77
+
### Other Contribution Ideas
78
+
79
+
-**Tests.** Add or improve cases in [`tests/`]({{ src("tests") }}) (unit, integration, or end-to-end).
80
+
-**Benchmarks.** Expand [`tests/benchmark`]({{ src("tests/benchmark") }}) to stress large-scale training or rollouts.
81
+
-**Issue triage.** Reproduce bugs, confirm whether they reproduce on `main`, or suggest short-term mitigations so maintainers can prioritize.
82
+
83
+
## Contribution Workflow
84
+
85
+
The steps below keep changes reviewable and CI-friendly. Follow them in order; rerun the relevant pieces if you revisit a branch later.
86
+
87
+
### 1. Prepare Your Environment
88
+
89
+
Minimum tooling:
90
+
91
+
-**Python** 3.10+ (3.12 recommended).
92
+
-**uv** for dependency and virtual-environment management. Install it using the [official uv docs](https://docs.astral.sh/uv/getting-started/installation/).
93
+
-**Git** configured with your GitHub credentials.
94
+
95
+
Clone your fork and point `upstream` at the official repo:
Want GPU extras, example dependencies, or other optional features? Pin everything in one pass:
109
+
Need GPU extrasor specific optional dependencies? Lock them in with one command:
32
110
33
111
```bash
34
112
uv sync --frozen \
@@ -41,49 +119,55 @@ uv sync --frozen \
41
119
--no-default-groups
42
120
```
43
121
44
-
After `uv sync`, run commands with `uv run ...` (or `uv run --no-sync` once the environment is locked), or activate the virtual environment in `.venv/`.
45
-
46
-
---
122
+
After `uv sync`, run commands via `uv run ...` (add `--no-sync` once the environment is locked) or activate `.venv/`.
47
123
48
-
##Step 2. Install and Run Pre-commit
124
+
###2. Install and Run Pre-commit
49
125
50
-
We enforce formatting and linting with [pre-commit](https://pre-commit.com/). Install the hooks once, then run them before every push:
126
+
Formatting and linting are enforced through [pre-commit](https://pre-commit.com/). Install once, then run before each push:
51
127
52
128
```bash
53
129
uv run pre-commit install
54
-
55
-
# The following will auto-run if you have set up the pre-commit hooks to run automatically on commit.
56
130
uv run pre-commit run --all-files --show-diff-on-failure --color=always
57
131
```
58
132
59
-
Running them locally saves a CI round-trip and keeps diffs tidy.
133
+
Once installed, the hooks run automatically on every `git commit`. Running the pre-commit hooks locally keeps CI green and diffs manageable.
60
134
61
-
---
135
+
### 3. Branch From a Fresh `main`
62
136
63
-
## Step 3. Branching Workflow
64
-
65
-
Start from a fresh `main`, then branch for your change:
137
+
Start all work from the latest upstream state:
66
138
67
139
```bash
68
140
git fetch upstream
69
141
git checkout main
70
142
git merge upstream/main
71
143
```
72
144
73
-
Create a topic branch with one of these prefixes:
145
+
Branch naming convention:
146
+
147
+
-`feature/<short-description>` for new features.
148
+
-`fix/<short-description>` for bug fixes.
149
+
-`docs/<short-description>` for documentation-only updates.
150
+
-`chore/<short-description>` for tooling or maintenance.
151
+
152
+
Use lowercase with hyphens, e.g., `feature/async-runner-hooks`.
74
153
75
-
-`feature/<short-description>` for new features
76
-
-`fix/<short-description>` for bug fixes
77
-
-`docs/<short-description>` for documentation-only work
78
-
-`chore/<short-description>` for tooling or maintenance
154
+
!!! note "Where should docs or examples live?"
79
155
80
-
Stick to lowercase words separated by hyphens, e.g. `feature/async-runner-hooks`.
156
+
Many new contributors get confused about what to put in the `docs/how-to/` directory and what to put in the `examples/` directory (particularly README files). Here is a quick reference you can refer to:
81
157
82
-
---
158
+
| Location | Description |
159
+
| --- | --- |
160
+
| `docs/algorithm-zoo/` | Documentation for **built-in algorithms** shipped with Agent-lightning. |
161
+
| `docs/how-to/` | Step-by-step **how-to guides**, usually tied to an example in `examples/`. |
162
+
| `docs/tutorials/` | Conceptual walkthroughs for components or workflows. See [debugging](../tutorials/debug.md) or [parallelization](../tutorials/parallelize.md) for examples. |
163
+
| `docs/deep-dive/` | Advanced explanations and in-depth concepts. |
164
+
| `examples/<name>/README.md` | Example-specific README. If any related how-to if that exists, link to it avoid duplicating the same instructions twice; write only brief instructions on how to install and run the example. Otherwise, you can make the README more detailed and self-explanatory. |
83
165
84
-
## Step 4. Test Your Changes
166
+
Remember to register new docs in [`mkdocs.yml`]({{ src("mkdocs.yml") }}), add examples to [examples/README]({{ src("examples/README.md") }}), and update the [Examples Catalog](../how-to/examples-catalog.md).
85
167
86
-
Most updates should ship with automated checks. Preface commands with `uv run` so they use the project environment.
168
+
### 4. Test and Validate
169
+
170
+
Most contributions require automated checks. Prefix commands with `uv run` so they use the project environment.
87
171
88
172
**Full test suite**
89
173
@@ -97,53 +181,43 @@ uv run pytest -v
97
181
uv run pytest tests/path/to/test_file.py -k test_name
98
182
```
99
183
100
-
**Optional/gated tests**
101
-
102
-
GPU-specific suites or API-dependent tests run automatically when the required hardware or environment variables (such as `OPENAI_API_KEY`) are present.
184
+
**Optional/gated tests:** GPU-specific suites or API-dependent tests run automatically when the required hardware or environment variables (such as `OPENAI_API_KEY`) are present.
103
185
104
-
**Static analysis**
186
+
**Static analysis:**
105
187
106
188
```bash
107
189
uv run pyright
108
190
```
109
191
110
-
Touching code under `examples/`? Each directory includes a README with example-specific smoke tests—run those too.
192
+
If you have touched code under `examples/`, you should run the example-specific smoke tests. Each directory includes a README with example-specific smoke tests—run those too.
111
193
112
-
---
194
+
!!! note "Build documentation when needed"
113
195
114
-
## Step 5. Build Documentation (When Applicable)
196
+
Keep API references under [docs/reference]({{ src("docs/reference/") }}) up to date. Doc-only changes should still build cleanly:
115
197
116
-
Doc changes should build cleanly before you push:
198
+
```bash
199
+
uv run mkdocs serve --strict # live reload
200
+
uv run mkdocs build --strict # CI-equivalent
201
+
```
117
202
118
-
```bash
119
-
uv run mkdocs serve --strict # live reload while editing
120
-
uv run mkdocs build --strict # CI-equivalent validation
121
-
```
122
-
123
-
`--strict` matches CI and promotes warnings to errors so you catch them early.
124
-
125
-
---
203
+
`--strict` elevates warnings to errors so you catch issues before CI.
126
204
127
-
## Step 6. Final Local Checks
205
+
Before opening a PR, double-check the basics:
128
206
207
+
- Run `uv lock` if you changed dependencies.
129
208
- Run `uv run pre-commit run --all-files` (hooks installed via `pre-commit install` run automatically on `git commit`, but rerun them if you amended history).
130
-
- Execute the relevant test commands from Step 4.
131
-
- Validate any affected examples by following the instructions in `examples/<name>/README`.
209
+
- Execute the relevant commands from the test list above.
210
+
- Validate each affected example via its README instructions.
132
211
133
-
---
212
+
### 5. Open a Pull Request
134
213
135
-
## Step 7. Open a Pull Request
136
-
137
-
1. Push your branch to your fork:
214
+
1. Push your branch:
138
215
```bash
139
216
git push origin <branch-name>
140
217
```
141
218
2. Open a PR against `microsoft/agent-lightning:main`.
142
-
3. Complete the PR template with:
143
-
- A concise summary of the change.
144
-
- The tests or commands you ran (copy from Step 4/6).
145
-
- Linked issues (use `Fixes #123` to auto-close).
146
-
4. Attach screenshots or terminal output when it clarifies behavior.
147
-
5. Address review feedback promptly. Use focused commits, and consider `git commit --fixup` for follow-up adjustments.
148
-
149
-
Thanks for contributing—every improvement grows the Agent Lightning community!
219
+
3. Fill out the template with a concise summary, the commands/tests you ran, and linked issues (use `Fixes #123` syntax to auto-close).
220
+
4. Include screenshots or logs if they clarify behavior.
221
+
5. Address review feedback promptly. Follow-up tweaks work best as focused commits; `git commit --fixup` is handy for reviewer-suggested edits.
222
+
223
+
Thanks for contributing! every improvement strengthens the Agent Lightning community!
0 commit comments