Every team running agents in production eventually hits the same wall: the agent is good enough to ship, but not good enough to trust unsupervised, and the obvious next move — fine-tune the underlying model on your own traces — usually means rewriting half your agent stack to produce training-compatible logs. That rewrite cost is why most teams never actually close the loop between “agent runs in prod” and “agent gets better from running in prod.” Microsoft’s Agent Lightning v1.0, released August 17, targets exactly that gap, and the design decision behind it is worth understanding even if you never install it.

The core idea: execution and training are different concerns

Agent Lightning’s architecture rests on one separation: how your agent executes a task (tool calls, control flow, context management, retries) has nothing to do with how the underlying model learns from that execution. Most RL-for-agents tooling conflates the two — you adopt their agent framework, or you don’t get the training loop. Agent Lightning instead sits between your agent and the model API as a transparent proxy.

The system has two lightweight pieces:

  • API Gateway — a drop-in proxy that intercepts your agent’s existing model calls and captures the trace (prompt, tool calls, response, and eventually the reward signal) without your agent code knowing it’s being observed.
  • Trainer — runs verl and vLLM under the hood, turns captured traces into training samples, and pushes policy updates back to the model your gateway is serving.

Because the boundary is the HTTP call to the model, Agent Lightning works with LangChain, the OpenAI Agents SDK, AutoGen, or a hand-rolled agent loop — “almost ZERO code modification” is Microsoft’s own framing, and structurally it holds up: you point your existing base_url at the gateway instead of the model provider, and everything downstream is unchanged. The whole core framework is about 3,500 lines of Python, which is small enough to actually read in an afternoon if you want to know what it’s doing to your traces before you trust it with production traffic.

What it looks like in practice

Conceptually, integration is a one-line change plus a reward function:

# Before: agent talks directly to the model provider
client = OpenAI(base_url="https://api.openai.com/v1")

# After: agent talks to the Agent Lightning gateway instead
client = OpenAI(base_url="http://localhost:8000/al-gateway/v1")

# Elsewhere: define what "good" means for your task
def reward_fn(trace):
    # trace.tool_calls, trace.final_state, trace.user_feedback, etc.
    if trace.final_state.ticket_resolved and not trace.escalated:
        return 1.0
    return 0.0

The gateway captures everything flowing through it; the Trainer consumes those traces plus your reward function and runs the RL update against the serving model. Your agent code never imports an RL library, never manages a replay buffer, and never knows training is happening.

The number that matters

On Qwen3.5-9B, Microsoft’s team reports a 14.6-point absolute improvement on SWE-bench Verified using this pipeline — a meaningful jump for a benchmark where most gains now come in single digits. That’s not a toy result; it’s evidence the decoupled architecture doesn’t leave performance on the table relative to tightly-coupled RL setups.

Where this actually fits — and where it doesn’t

I’d frame Agent Lightning as infrastructure for teams past the “does our agent work” stage and into the “our agent works most of the time and we have thousands of real traces we’re not using” stage. If you’re still iterating on prompts and tool definitions, RL training is premature — you don’t have a stable enough task distribution yet, and the reward function you’d write today won’t match the one you’ll want in three months.

The proxy architecture also isn’t free: every model call now hops through an extra service, which means added latency and a new operational dependency you have to monitor and scale. That’s a reasonable trade for training capability, but it’s a real cost, not a rounding error, especially for latency-sensitive user-facing agents.

And the hardest part of RL — designing a reward function that actually captures “did the agent do the right thing” without being gameable — is completely unsolved by this framework, on purpose. Agent Lightning gives you the plumbing to apply reinforcement learning cheaply; it does nothing to help you specify what you’re rewarding. Teams that skip the reward-design work and just wire up the gateway will train their agent to be confidently good at whatever proxy metric they picked, which is a well-documented way to make an agent worse while every internal dashboard says it’s improving.

My take

The right way to read this release isn’t “install Agent Lightning,” it’s “notice that the execution/training separation it demonstrates is the correct shape for this problem, and evaluate whether your own agent traces are clean enough to train on at all.” If you’re logging tool calls and outcomes in a structured way already, you’re most of the way to being able to use something like this. If your agent’s “logs” are unstructured chat transcripts, that’s the actual prerequisite work — and it’s worth doing regardless of which training framework you eventually pick.

Repo: github.com/microsoft/agent-lightning

Export for reading

Comments