# Send Agent Lightning to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "agent-lightning",
    "name": "Agent Lightning",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/olmmlo-cmd/agent-lightning",
    "canonicalUrl": "https://clawhub.ai/olmmlo-cmd/agent-lightning",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/agent-lightning",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=agent-lightning",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "_meta.json",
      "examples/config.yaml",
      "examples/train_agent.py"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "agent-lightning",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-29T12:13:05.276Z",
      "expiresAt": "2026-05-06T12:13:05.276Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=agent-lightning",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=agent-lightning",
        "contentDisposition": "attachment; filename=\"agent-lightning-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "agent-lightning"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/agent-lightning"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/agent-lightning",
    "downloadUrl": "https://openagent3.xyz/downloads/agent-lightning",
    "agentUrl": "https://openagent3.xyz/skills/agent-lightning/agent",
    "manifestUrl": "https://openagent3.xyz/skills/agent-lightning/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/agent-lightning/agent.md"
  }
}
```
## Documentation

### Agent Lightning ⚡

Microsoft Research's agent training framework. Turn your AI agents into optimizable beasts with (almost) zero code changes.

### Core Features

🔌 Universal Compatibility: Works with LangChain, OpenAI Agent SDK, AutoGen, CrewAI, Microsoft Agent Framework, or plain Python OpenAI
🎯 Selective Optimization: Optimize one or more agents in a multi-agent system
🧠 Multiple Algorithms: Reinforcement Learning (RL), Automatic Prompt Optimization (APO), Supervised Fine-tuning (SFT)
⚡ Zero Code Change: Add agl.emit_xxx() helpers or use tracer — your agent keeps running as usual

### Installation

pip install agentlightning

For latest nightly build:

pip install --upgrade --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ --pre agentlightning

### 1. Instrument Your Agent

Option A: Add emit helpers (recommended)

import agentlightning as agl

# In your agent's tool calls
response = agl.emit_tool_call(
    model=model,
    messages=messages,
    tools=tools,
    context={"task": "search"}
)

Option B: Use tracer (zero code change)

from agentlightning import tracer

# Wrap your agent with tracer
with tracer.trace("my-agent", input_data):
    result = your_agent.run(user_query)

### 2. Create Training Config

# config.yaml
agent:
  name: "my-agent"
  type: "openai"  # openai, langchain, autogen, crewai

training:
  algorithm: "grpo"  # grpo, apo, sft, rloo
  episodes: 100
  batch_size: 16
  
environment:
  eval_tasks:
    - "math"
    - "coding"
    - "reasoning"

### 3. Run Training

agent-lightning train --config config.yaml

### Algorithms

AlgorithmUse CaseDescriptionGRPOGeneral RLGroup Relative Policy Optimization — stable, works well for most agentsAPOPrompt TuningAutomatic Prompt Optimization — improves system promptsSFTSupervised Fine-tuningSupervised Fine-tuning with preference dataRLOOLong-horizonRLOO for tasks with sparse rewards

### agent-lightning train

Train your agent with configured algorithm.

### agent-lightning eval

Evaluate agent on benchmark tasks.

### agent-lightning export

Export trained model/prompts for deployment.

### agent-lightning serve

Launch serving endpoint for trained agent.

### Example: SQL Agent Training

See full example: Train SQL Agent with RL

from agentlightning import Agent, RLConfig, GRPOTrainer

# 1. Define your agent
sql_agent = Agent(
    name="sql-agent",
    system_prompt="You are a SQL expert...",
    tools=[execute_sql, query_schema]
)

# 2. Configure RL training
config = RLConfig(
    algorithm="grpo",
    episodes=500,
    learning_rate=1e-4
)

# 3. Train
trainer = GRPOTrainer(config=config)
trainer.train(sql_agent, eval_tasks=["sql-generation"])

### Environment Variables

# Required for training
export OPENAI_API_KEY="sk-..."

# Optional: for remote storage
export AGL_STORAGE="s3://my-bucket/agent-lightning/"

### Python API

from agentlightning import LightningStore, GRPOTrainer

# LightningStore keeps tasks, resources, and traces in sync
store = LightningStore()

# Read traces, learn, and update prompts
trainer = GRPOTrainer(store=store)
trainer.train(agent=my_agent)

### Monitoring Training

# Launch dashboard
agent-lightning dashboard --port 8080

# View logs
tail -f ~/.agent-lightning/logs/training.log

### Best Practices

Start Small: Begin with 10-50 episodes to verify setup
Define Clear Rewards: Design reward functions that match your goal
Use Evaluation Tasks: Always eval on held-out tasks
Checkpoint Frequently: Save model every N episodes
Monitor Convergence: Watch loss curves in dashboard

### Resources

Documentation
Examples
API Reference
ArXiv Paper
Discord Community

### Citation

If you use Agent Lightning in research:

@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}
}
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: olmmlo-cmd
- Version: 1.0.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-04-29T12:13:05.276Z
- Expires at: 2026-05-06T12:13:05.276Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/agent-lightning)
- [Send to Agent page](https://openagent3.xyz/skills/agent-lightning/agent)
- [JSON manifest](https://openagent3.xyz/skills/agent-lightning/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/agent-lightning/agent.md)
- [Download page](https://openagent3.xyz/downloads/agent-lightning)