Improve the accuracy of a LangChain agent using reinforcement learning without rewriting it.
Automatically optimize the system prompt of an OpenAI-SDK agent based on recorded execution traces.
Fine-tune a CrewAI multi-agent system on real task examples to reduce failure rate.
Record tool calls and rewards from an existing AutoGen agent and use them to train a better policy.
Requires an existing agent framework and a reward function, install via pip as agentlightning.
Agent Lightning is a training toolkit from Microsoft for AI agents. The idea is to take an agent you have already built and improve its behavior using machine-learning techniques, with as close to zero code changes as possible. Rather than forcing you to rewrite your agent, Agent Lightning slips in alongside it and learns from how the agent actually runs. It is framework-agnostic. You can plug in agents built with LangChain, OpenAI Agent SDK, AutoGen, CrewAI, Microsoft Agent Framework, or even agents written directly against the OpenAI API with no framework at all. In a system where several agents work together, you can choose to optimize one, some, or all of them. The supported optimization approaches include Reinforcement Learning, Automatic Prompt Optimization, and Supervised Fine-tuning. Under the hood, your agent keeps running normally. A lightweight tracer, or an explicit emit helper you drop into code, records every prompt, tool call, and reward as structured spans. Those spans flow into a central component called the LightningStore, which keeps tasks, resources, and traces in sync. On the other side, an algorithm reads the spans, learns from them, and writes back updated resources such as refined prompt templates or new policy weights. A Trainer streams data to runners, moves resources between the store and the algorithm, and updates the inference engine when improvements land. You would use this if you have a working agent that you want to make smarter or more accurate without throwing it away and starting over. The package is installed with pip under the name agentlightning, and the codebase is Python.
← microsoft on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.