← 返回 Skills 市场
olmmlo-cmd

Agent Lightning

作者 olmmlo-cmd · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
655
总下载
0
收藏
3
当前安装
1
版本数
在 OpenClaw 中安装
/install agent-lightning
功能描述
Microsoft Research's agent training framework. Optimizes AI agents with Reinforcement Learning, Automatic Prompt Optimization, and Supervised Fine-tuning. Ze...
使用说明 (SKILL.md)

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

Quick Start

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

Algorithm Use Case Description
GRPO General RL Group Relative Policy Optimization — stable, works well for most agents
APO Prompt Tuning Automatic Prompt Optimization — improves system prompts
SFT Supervised Fine-tuning Supervised Fine-tuning with preference data
RLOO Long-horizon RLOO for tasks with sparse rewards

Usage Commands

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"])

Integration with Clawdbot

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

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

Resources

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}
}
安全使用建议
This package appears to be a legitimate agent-training framework, but be aware of these points before installing or running it: - The SKILL.md expects an OPENAI_API_KEY and optionally an S3 storage URL (AGL_STORAGE), but the registry metadata lists no required environment variables. Treat this as a mismatch: you will need to provide credentials if you follow the examples. - If you plan to use AGL_STORAGE with an s3:// URL, that will typically require AWS credentials (access key/secret or an IAM role). Do not reuse high-privilege credentials; prefer a least-privilege IAM user or a sandboxed storage bucket. - The docs suggest installing nightly/pre-release builds from test.pypi. Prefer the official PyPI release (or inspect the package source code) rather than pre-release indexes when possible. - Verify the package source: confirm the GitHub repo and homepage links match the package you install, and review the package contents (or run in an isolated environment/container) before giving it secrets. - If you need assurance, ask the publisher for a reproducible release (hashes) or inspect the published agentlightning package contents before running training that will upload checkpoints or logs. Given the metadata/instruction mismatches, proceed with caution (use isolated environments and least-privilege credentials). Additional information that would raise my confidence to 'high': a declared requires.env that matches SKILL.md, a canonical PyPI release URL and package checksum, or the upstream repository/package code included for review.
功能分析
Type: OpenClaw Skill Name: agent-lightning Version: 1.0.0 The skill bundle describes and provides example code for 'Agent Lightning,' an AI agent training framework. The `SKILL.md` serves as documentation for a human user and does not contain any prompt injection attempts or malicious instructions for the AI agent. The Python script `examples/train_agent.py` uses `yaml.safe_load` for configuration, a good security practice, and performs standard ML training operations like loading configuration, creating an agent, and saving a trained model. The `examples/config.yaml` file contains typical parameters for an ML training setup. There is no evidence of data exfiltration, malicious execution, persistence mechanisms, or obfuscation within the provided files. The content is consistent with its stated purpose.
能力评估
Purpose & Capability
The name/description match the included examples and instructions (training agents via RL/APO/SFT). Example code and config are appropriate for that purpose. Minor metadata inconsistencies (ownerId in _meta.json vs registry owner id) are present but don't by themselves indicate malicious intent.
Instruction Scope
SKILL.md instructs typical operations for an agent-training library (instrumenting agents, running training/eval/serve, tailing logs). It explicitly references environment variables (OPENAI_API_KEY, optional AGL_STORAGE) and paths (~/.agent-lightning/logs) — these are reasonable for training but are not reflected in declared requirements. Instructions do not ask for unrelated files or system-wide secrets, but they do rely on external services (OpenAI, optional S3) and a dashboard.
Install Mechanism
This is instruction-only (no install spec). SKILL.md directs users to pip install agentlightning and offers a nightly install via test.pypi. Using a test.pypi index or pre-release packages is higher risk than stable PyPI releases because those packages are less vetted; there's no included package code to inspect beyond examples.
Credentials
The registry metadata declares no required env vars, but SKILL.md requires OPENAI_API_KEY and optionally uses an S3 storage URL (AGL_STORAGE). S3 usage implies additional cloud credentials (AWS) which are not mentioned. The mismatch between declared requirements and actual instructions is disproportionate and could lead to inadvertently granting cloud/secret access when following examples.
Persistence & Privilege
always:false and no install spec means the skill does not request forced persistent presence. The examples reference creating logs and checkpoints under user paths (./checkpoints, ~/.agent-lightning) which are expected for training. There is no attempt to modify other skills or system-wide agent settings in the provided files.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-lightning
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-lightning 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of agent-lightning. - Microsoft Research’s agent training framework for optimizing AI agents. - Supports reinforcement learning, automatic prompt optimization, and supervised fine-tuning. - Compatible with LangChain, AutoGen, CrewAI, OpenAI Agent SDK, and more. - Zero code change needed with tracer integration or emit helpers. - Command-line tools provided for training, evaluation, exporting, and serving agents. - Extensive documentation, quick start guide, and resources available.
元数据
Slug agent-lightning
版本 1.0.0
许可证
累计安装 3
当前安装数 3
历史版本数 1
常见问题

Agent Lightning 是什么?

Microsoft Research's agent training framework. Optimizes AI agents with Reinforcement Learning, Automatic Prompt Optimization, and Supervised Fine-tuning. Ze... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 655 次。

如何安装 Agent Lightning?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install agent-lightning」即可一键安装,无需额外配置。

Agent Lightning 是免费的吗?

是的,Agent Lightning 完全免费(开源免费),可自由下载、安装和使用。

Agent Lightning 支持哪些平台?

Agent Lightning 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Agent Lightning?

由 olmmlo-cmd(@olmmlo-cmd)开发并维护,当前版本 v1.0.0。

💬 留言讨论