让AI代理系统执行可复现,解决调试难题。
Deterministic Replay for AI Agent Systems
- 通过中间人代理截获外部请求,生成可重放的结构化日志。
- 5个任务250次重放均实现100%结果一致,单步延迟降低98.3%。
- 适合开发者调试大模型代理系统,支持完全隔离重放。
耦合大型语言模型(LLMs)与外部工具和API的AI代理系统本质上是非确定性的:语言模型采样差异、外部API状态、CDN基础设施头信息及运行环境噪声共同导致先前的代理执行无法被精确重现。现有可观测平台虽能记录执行日志,但无法在孤立环境中复现运行。本文提出agrepl,一个面向开发者的命令行框架,实现代理执行的确定性重放。agrepl通过中间人(MITM)代理在传输层拦截所有外部交互,将它们序列化为结构化执行轨迹,并在无出站网络访问的严格隔离环境中重放。我们形式化了代理执行模型,定义了请求键匹配函数K(s),并证明了确定性不变性。引入噪声感知差分算法,将HTTP头差异分为信号与噪声层级。在五个工作负载上(n = 250次重放实例)的实证评估表明,重放保真度F = 1.0,平均单步延迟降低98.3%。agrepl使用Go编写,打包为单一静态二进制文件,采用MIT许可开源。
原文摘要 · Abstract (English)
AI agent systems that couple large language models (LLMs) with external tools and APIs are inherently non-deterministic: LLM sampling variance, external API state, CDN infrastructure headers, and execution-environment noise collectively prevent any prior agent run from being faithfully re-executed. Existing observability platforms capture execution logs but cannot reproduce a run in isolation. We present agrepl, a developer-first CLI framework for deterministic replay of agent executions. agrepl intercepts all external interactions at the transport layer via a man-in-the-middle (MITM) proxy, serialises them as structured execution traces, and replays them in a strictly isolated environment with zero outbound network access. We formalise the agent execution model, define the request-key matching function K(s), and prove the determinism invariant. We introduce a noise-aware diff algorithm classifying HTTP header divergence into signal and noise tiers. Empirical evaluation across five workloads (n = 250 replay instances) demonstrates replay fidelity F = 1.0 and a median per-step latency reduction of 98.3%. agrepl is implemented in Go, ships as a single static binary, and is released under the MIT licence. Keywords: AI agents, deterministic replay, LLM debugging, reproducibility, MITM proxy, execution tracing, record/replay systems.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。