agent-lightning

Train and optimize AI agents with reinforcement learning and prompt optimization.

264|11|Updated Apr 25, 2026
One-click install
npx skills add https://github.com/coco-research/coco --skill agent-lightning-coco-research
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agent-lightning
Source: https://github.com/coco-research/coco/tree/main/skills/agent-lightning
Command: npx skills add https://github.com/coco-research/coco --skill agent-lightning-coco-research

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Agent Lightning removes the complexity of training AI agents by turning execution traces, rewards, and rollout data into a structured optimization workflow. It helps teams move from ad hoc prompting to measurable agent improvement with reinforcement learning and prompt optimization.

Core Features & Use Cases

  • Agent Instrumentation: Add lightweight emission hooks to capture inputs, outputs, tool calls, rewards, and execution spans from existing agents.
  • Training Orchestration: Manage rollouts, runners, algorithms, and resource updates through LightningStore and the Trainer loop.
  • Optimization Workflows: Support reinforcement learning, automatic prompt optimization, and supervised fine-tuning for agents built with Python or JavaScript.
  • Observability and Debugging: Integrate OpenTelemetry, query traces, inspect rollout status, and validate training performance with metrics.
  • Use Case: A team building a customer-support agent can trace every interaction, score responses with a reward function, and continuously improve prompts and policies across repeated training runs.

Quick Start

Use Agent Lightning to instrument your agent, connect it to a LightningStore, and run a training loop that collects traces and optimizes responses.

Frequently Asked Questions about agent-lightning

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize AI agent prompts with reinforcement learning?

You optimize AI agent prompts with reinforcement learning by collecting execution traces and rewards, then running structured training loops to automatically improve agent policies and responses. Agent Lightning orchestrates this rollout and optimization workflow.

What is automatic prompt optimization for production agents?

Automatic prompt optimization for production agents is the process of using execution traces and reward functions to iteratively refine agent instructions. Agent Lightning turns rollout data into measurable improvements without manual prompting adjustments.

How do I collect execution traces from AI agents for training?

You collect execution traces from AI agents by adding lightweight emission hooks that capture inputs, outputs, tool calls, and rewards. Agent Lightning instruments agents to record these execution spans for subsequent training workflows.

Can I use OpenTelemetry for agent tracing and observability?

Yes, you can use OpenTelemetry for agent tracing and observability. Agent Lightning integrates OpenTelemetry to query execution traces, inspect rollout status, and validate training performance metrics across Python and JavaScript agent stacks.

Does reinforcement learning training for agents work with JavaScript and Python stacks?

Yes, reinforcement learning training for agents works with both JavaScript and Python stacks. Agent Lightning supports configurable runners, algorithm workers, and LightningStore coordination to manage training loops across these environments.

What are the limitations of training agents with automatic prompt optimization?

Training agents with automatic prompt optimization requires designing effective reward functions and managing rollout data via LightningStore. Limitations include the need for proper instrumentation and the complexity of configuring RL, APO, and supervised fine-tuning workers.