Agent Lightning: Train ANY AI Agents with Reinforcement Learning

2508.03680v1 cs.AI, cs.LG 2025-08-06
Авторы:

Xufang Luo, Yuge Zhang, Zhiyuan He, Zilong Wang, Siyun Zhao, Dongsheng Li, Luna K. Qiu, Yuqing Yang

Резюме на русском

Современные методы дообучения LLM-агентов через RL требуют либо глубокой переработки кода агента, либо громоздкого конкатенирования последовательностей с маскированием. Авторы предлагают фреймворк Agent Lightning, который полностью развязывает исполнение агента от процесса обучения. Система представляет выполнение агента как марковский процесс принятия решений и через единый интерфейс преобразует любые траектории (LangChain, OpenAI Agents SDK, AutoGen или «самописные» агенты) в обучающие переходы без изменения кода агента. Введённый RL-алгоритм LightningRL с модулем кредитного присвоения справляется со сложными сценариями: мульти-агентные взаимодействия, динамические workflow. Эксперименты на задачах text-to-SQL, RAG и использовании математических инструментов показали стабильный рост качества, подтверждая пригодность фреймворка для практического дообучения и развёртывания агентов.

Abstract

We present Agent Lightning, a flexible and extensible framework that enables Reinforcement Learning (RL)-based training of Large Language Models (LLMs) for any AI agent. Unlike existing methods that tightly couple RL training with agent or rely on sequence concatenation with masking, Agent Lightning achieves complete decoupling between agent execution and training, allowing seamless integration with existing agents developed via diverse ways (e.g., using frameworks like LangChain, OpenAI Agents SDK, AutoGen, and building from scratch) with almost ZERO code modifications. By formulating agent execution as Markov decision process, we define an unified data interface and propose a hierarchical RL algorithm, LightningRL, which contains a credit assignment module, allowing us to decompose trajectories generated by ANY agents into training transition. This enables RL to handle complex interaction logic, such as multi-agent scenarios and dynamic workflows. For the system design, we introduce a Training-Agent Disaggregation architecture, and brings agent observability frameworks into agent runtime, providing a standardized agent finetuning interface. Experiments across text-to-SQL, retrieval-augmented generation, and math tool-use tasks demonstrate stable, continuous improvements, showcasing the framework's potential for real-world agent training and deployment.

Ссылки и действия