用结构化日志实现大模型智能体的全流程开发与优化
TapeAgents: a Holistic Framework for Agent Development and Optimization
- 以结构化日志为核心,构建可恢复、可调试的智能体运行状态
- 用历史日志微调模型,使8B小模型性能接近GPT-4o且成本极低
- 适合需要调试、复现、优化智能体的开发者和研究者
我们提出TapeAgents,一个以细粒度结构化日志为核心的智能体框架,该日志既是会话记录,也是可恢复的状态。在TapeAgents中,智能体通过处理日志和大模型输出生成新步骤并追加到日志中,环境也通过追加观测步骤更新日志。这一设计支持智能体全生命周期:开发阶段实现会话持久化、审计与逐步调试;部署后可复用日志进行评估、提示词微调与模型微调;还可引入其他智能体的历史日志或修改后的旧日志。我们展示了构建单智能体与多智能体团队的应用实例,并报告了使用TapeAgents微调Llama-3.1-8B表单填写助手的案例,其性能达到GPT-4o水平,但成本低多个数量级。对比分析表明,TapeAgents的优势源于将大模型智能体设计为可恢复、模块化的状态机,具备结构化配置、生成细粒度日志并可转换为训练文本的独特组合。
原文摘要 · Abstract (English)
We present TapeAgents, an agent framework built around a granular, structured log tape of the agent session that also plays the role of the session's resumable state. In TapeAgents we leverage tapes to facilitate all stages of the LLM Agent development lifecycle. The agent reasons by processing the tape and the LLM output to produce new thought and action steps and append them to the tape. The environment then reacts to the agent's actions by likewise appending observation steps to the tape. By virtue of this tape-centred design, TapeAgents can provide AI practitioners with holistic end-to-end support. At the development stage, tapes facilitate session persistence, agent auditing, and step-by-step debugging. Post-deployment, one can reuse tapes for evaluation, fine-tuning, and prompt-tuning; crucially, one can adapt tapes from other agents or use revised historical tapes. In this report, we explain the TapeAgents design in detail. We demonstrate possible applications of TapeAgents with several concrete examples of building monolithic agents and multi-agent teams, of optimizing agent prompts and finetuning the agent's LLM. We present tooling prototypes and report a case study where we use TapeAgents to finetune a Llama-3.1-8B form-filling assistant to perform as well as GPT-4o while being orders of magnitude cheaper. Lastly, our comparative analysis shows that TapeAgents's advantages over prior frameworks stem from our novel design of the LLM agent as a resumable, modular state machine with a structured configuration, that generates granular, structured logs and that can transform these logs into training text -- a unique combination of features absent in previous work.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。