让多个AI代理并行操作时自动修复冲突,提升效率与正确性。
CoAgent: Concurrency Control for Multi-Agent Systems

- 代理通过自我判断冲突并修复计划,实现无锁并发控制。
- 在10个高竞争任务中,速度提升1.4倍且错误率低于5%。
- 适合需要并行执行复杂任务的开发、运维等自动化系统。
多智能体大模型系统(如编程、运维、文档代理)常需并行操作共享状态(如Git仓库、Kubernetes集群)。传统并发控制机制因不适应大模型特性而失效:单个代理事务持续数分钟,读集宽泛且不可静态推断,写操作立即生效且无法回滚。锁机制阻塞长时间推理,乐观并发控制则在冲突时丢弃数分钟工作。本文提出基于代理内LLM自判能力的新型并发控制机制——MTPO(单调轨迹预排序),在启动时确定串行化顺序,读取经排序过滤的数据,写操作按推测方式直接应用;冲突发生时,通过单向通知触发受影响读取者重新评估并修补计划,框架则通过工具预先注册的逆操作机械撤销并重排错误写入。在空闲状态下,整体执行可串行化。我们实现为CoAgent,一种特权工具中间件,其核心ToolSmith支持在线声明可撤销工具。在10个高竞争工作负载上,CoAgent保持接近串行正确性(误差<5%),速度提升1.4倍,令牌成本接近串行;2PL与OCC几乎丧失并发优势。在纯Bash目标系统中,成功在线构建25工具库,任务通过率从45/71提升至63/71,耗时降低至0.80倍,成本降至0.86倍。
原文摘要 · Abstract (English)
Multi-agent LLM systems -- coding agents, devops agents, document agents -- now routinely run several agents in parallel against the same git tree, Kubernetes cluster, or document. As soon as two of them mutate shared state, they enter the regime classical concurrency control has studied for decades, but classical mechanisms fit LLM agents poorly. A single agent transaction spans minutes of inference, read sets are broad and opaque rather than statically inferable, and the live state agents act on admits neither fork nor buffer, so writes take effect the moment they execute. Locks block long inference intervals; OCC abort-and-retry discards minutes of work on every conflict. This paper builds concurrency control on a capability classical transactions lack: the LLM inside each agent can judge whether a conflicting write invalidates its plan, and can repair exactly the operations that depended on it. Control therefore turns advisory: the runtime informs, the agent repairs. Our protocol, MTPO (Monotonic Trajectory Pre-Order), fixes a serialization order at launch, serves each read the order-filtered value, and applies writes speculatively in place; a one-way notification asks an affected reader to re-judge and patch its plan, while the framework mechanically undoes and reorders misplaced writes through the saga-style inverse each tool registers in advance. At quiescence the run is serializable in the pre-decided order. We realize MTPO as CoAgent, toolcall middleware whose privileged ToolSmith grows footprint-declared, undoable tools online. On ten contended workloads, CoAgent stays within 5\% of serial correctness at a $1.4\times$ speedup and near-serial token cost, where 2PL and OCC surrender nearly all concurrency gains; on a bash-only target system, it grows a 25-tool library online and lifts the task pass rate from 45/71 to 63/71 at $0.80\times$ the time and $0.86\times$ the cost.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。