Skip to main content

Agent-lightning is the absolute trainer to light up AI agents.

Project description

Agent-lightning-banner

Agent Lightning⚡

Unit Tests Documentation PyPI version License Ask DeepWiki Discord

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.

Agent-Lightning Core Quickstart

⚡ 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

⚡ Community Projects

⚡ 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 agl.emit_xxx() 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.

Agent-lightning Architecture

⚡ CI Status

Workflow Status
CPU Tests tests workflow status
Full Tests tests summary workflow status
UI Tests UI Tests
Examples Integration examples summary workflow status
Latest Dependency Compatibility latest summary workflow status
Legacy Examples Compatibility compat summary workflow status

⚡ Citation

If you find Agent Lightning useful in your research or projects, please cite our paper:

@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},
}

⚡ 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentlightning-0.3.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentlightning-0.3.0-py3-none-any.whl (612.2 kB view details)

Uploaded Python 3

File details

Details for the file agentlightning-0.3.0.tar.gz.

File metadata

  • Download URL: agentlightning-0.3.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentlightning-0.3.0.tar.gz
Algorithm Hash digest
SHA256 35cd702bce54ff7c8c097d8e73aaf688c6649e4ee81e6e5e0379000465b75d43
MD5 38e7e9687406d3e2ac9ec290cb8518be
BLAKE2b-256 b28f1bed06f70d52ba4b2ed698605fa955a82ee5aaec3addee5a21e3fd7cd0cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentlightning-0.3.0.tar.gz:

Publisher: pypi-release.yml on microsoft/agent-lightning

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentlightning-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: agentlightning-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 612.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentlightning-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ede4cf7de78368326aa97cdd1cbb5e976fd826ed94ad2de04810b8013db8bf87
MD5 74bd68b3aae3065c4a1849934296ad9c
BLAKE2b-256 2c29cf37c89eec96fb3561f9c5bc7c9d6fa8f6b2aa40bc724061e18ce38324bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentlightning-0.3.0-py3-none-any.whl:

Publisher: pypi-release.yml on microsoft/agent-lightning

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page