Skip to content

⚡ AgentLightning

Enterprise Agent RL Training & Self-Verification Platform

AgentLightning turns the two most important agent-engineering ideas of August 2026 into a self-hosted platform:

  1. Train agents with RL inside the real deployment harness — Microsoft's Agent Lightning v1.0 (Aug 25, 2026) showed that 6,000 samples of harness-based RL lifted Qwen3.5-9B from 41.8% → 56.4% on SWE-bench Verified, with zero changes to business code.
  2. Let the model judge itselfLLM-as-a-Verifier topped GitHub trending by demonstrating that best-of-N self-verification lets a 0.11-dollar open-source model beat a closed frontier model.

AgentLightning packages both into a zero-dependency core (pure Python standard library) with a FastAPI control plane, CLI, Python/TypeScript SDKs, a React console, and Docker/K8s/Helm deployment assets.

License Python


Why AgentLightning?

Problem AgentLightning's answer
Simulated environments don't transfer to production Rollout runs the agent in real harnesses (Codex, DeepSeek Harness, Claude Code, local, mock)
Hand-tuned prompts plateau PPO / GRPO optimize policy parameters against real reward signals
"What is a good answer?" is fuzzy Pluggable reward functions: verifier (test pass rate), rule-based, LLM-as-a-verifier, safety
A single model is an unreliable judge of itself Cross-model self-verification: best-of-N + majority voting + verifier-as-judge

Architecture

                ┌─────────────────────────────────────────────┐
                │              Control Plane (FastAPI)         │
                │  /train  /verify  /runs  /harnesses  /healthz │
                └───────────────┬─────────────────────────────┘
        ┌───────────────────────┼────────────────────────┐
        │  CLI (agentlightning) │  Python SDK  │  TS SDK  │  React Console
        └───────────────────────┴──────────────┴──────────┘
                                  │
        ┌─────────────────────────▼─────────────────────────────┐
        │                    Rollout Engine                       │
        │   policy ──► harness (codex/dsh/claude/local/mock) ──►  │
        │              trajectory (steps / observations)          │
        └─────────────────────────┬─────────────────────────────┘
                                  │
        ┌─────────────────────────▼─────────────────────────────┐
        │   Reward (verifier/rule/safety/swebench/composite)     │
        │   Trainer (PPO / GRPO, GAE, LR schedule, early stop)   │
        │   Self-Verify (best-of-N, majority, verifier-as-judge) │
        └─────────────────────────┬─────────────────────────────┘
                                  │
        ┌─────────────────────────▼─────────────────────────────┐
        │  Storage (SQLite) · Observability (Prometheus+W3C)    │
        │  Security (policy/audit/redact) · Sandbox (subprocess/docker) │
        └───────────────────────────────────────────────────────┘

Quick Start

# 1. Clone
git clone https://github.com/huzjie/agentlightning.git
cd agentlightning

# 2. (optional) create a virtualenv and install the API layer
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

# 3. Self-check (works fully offline, no keys required)
python -m agentlightning doctor

# 4. Run a training loop in mock mode
python -m agentlightning train --task "Solve: implement a function that sums two integers"

# 5. Self-verify a set of candidate answers
python -m agentlightning verify --task "capital of France" --n 4

# 6. Start the control plane + console
python -m agentlightning serve --port 8000
# open http://localhost:8000/

Configuring Real Providers

Set environment variables (or edit config.json) to use real harnesses and judge models. Double-underscore nesting is supported:

export AGENTLIGHTNING_HARNESS=codex
export AGENTLIGHTNING_PROVIDER=deepseek
export DEEPSEEK_API_KEY=sk-...
export AGENTLIGHTNING_TRAIN__EPOCHS=5
export AGENTLIGHTNING_REWARD__FUNCTIONS='["rule","safety","verifier"]'

Project Structure

agentlightning/          # zero-dependency kernel
  harness/               # codex / deepseek / claude_code / local / mock
  reward/                # verifier / rule / safety / swebench / composite
  policy/                # PolicyModel + checkpoint
  rollout/               # RolloutEngine + sampler
  trainer/               # PPO / GRPO / GAE / scheduler / early-stop
  verify/                # SelfVerifier / best-of-N / majority
  providers/             # 9 LLM providers + mock
  storage/               # SQLite store
  observability/         # Prometheus metrics + W3C trace
  security/              # policy / audit / redact
  sandbox/               # subprocess / docker
  cli/                   # doctor / train / rollout / verify / serve / config
  api/                   # FastAPI control plane (routes/)
  sdk/                   # Python client
sdk/typescript/          # TypeScript SDK
web/                     # React console (zero-build)
k8s/  helm/  Dockerfile  # deployment
docs/                    # guides
tests/                   # pytest suite

Documentation

License

Apache-2.0. See LICENSE.


AgentLightning is an independent project. It is inspired by, but not affiliated with, Microsoft's Agent Lightning or any vendor's Harness products.

About

Enterprise Agent RL Training & Self-Verification Platform - train agents with PPO/GRPO inside real harnesses, with LLM-as-a-Verifier self-verification

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages