让大模型变成能持续运行的程序,解决长任务记忆丢失问题。
CaveAgent: Transforming LLMs into Stateful Runtime Operators
- 用持久化运行时替代文本上下文,实现跨轮次状态保持。
- 可操作数据框等复杂对象,支持循环、条件等逻辑结构。
- 适合需要长期记忆与自动化评估的智能体开发场景。
基于大模型的智能体在执行复杂任务方面能力日益增强,但现有系统受限于以文本为中心的范式,在处理长周期任务时易受多轮依赖脆弱性和上下文漂移影响。我们提出CaveAgent框架,将工具使用从“大模型作为文本生成器”转变为“大模型作为运行时操作者”。该框架采用双流架构:将持久化的Python运行时作为状态核心,轻量语义流作为调度器。通过代码生成一次性解决嵌套子任务(如循环、条件),并引入“有状态运行时管理”,可在多轮中注入、操作和检索复杂对象(如数据框、数据库连接),突破传统代码方法仅限文本的局限。此外,集成技能管理系统,扩展了开放标准的智能体技能接口,支持生态互操作性。此持久化机制作为高保真外部记忆,显著减少多轮交互中的上下文漂移,完整保留处理数据用于下游应用。实验表明,在挑战性基准上持续提升性能,处理的数据规模远超基于JSON和代码的代理,避免上下文溢出。可编程的运行时状态支持自动反馈验证,无需人工标注即可实现自动化评估与奖励信号生成,为可验证奖励强化学习(RLVR)奠定结构基础。
原文摘要 · Abstract (English)
LLM-based agents are increasingly capable of complex task execution, yet current agentic systems remain constrained by text-centric paradigms that struggle with long-horizon tasks due to fragile multi-turn dependencies and context drift. We present CaveAgent, a framework that shifts tool use from ``LLM-as-Text-Generator'' to ``LLM-as-Runtime-Operator.'' CaveAgent introduces a dual-stream architecture that inverts the conventional paradigm: rather than treating the LLM's text context as the primary workspace with tools as auxiliary, CaveAgent elevates the persistent Python runtime as the central locus of state, with a lightweight semantic stream serving as its orchestrator. Beyond leveraging code generation to resolve interdependent sub-tasks (e.g., loops, conditionals) in a single step, CaveAgent introduces \textit{Stateful Runtime Management}: it injects, manipulates, and retrieves complex Python objects (e.g., DataFrames, database connections) that persist across turns, unlike existing code-based approaches that remain text-bound. CaveAgent further provides a runtime-integrated skill management system that extends the Agent Skills open standard, enabling ecosystem interoperability through executable skill injections. This persistence mechanism serves as a high-fidelity external memory that reduces context drift in multi-turn interactions and preserves processed data for downstream applications without information loss. Evaluations show consistent improvement across challenging benchmarks, enabling CaveAgent to handle data scales that cause context overflow in both JSON-based and code-based agents. The accessible runtime state further provides programmatically verifiable feedback, enabling automated evaluation and reward signal generation without human annotation and establishing a structural foundation for future research in Reinforcement Learning with Verifiable Rewards (RLVR).
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。