AgentSpy: Making AI Agent Behavior Observable

📄 arXiv: 2610.06001v1 📥 PDF

作者: Christoph Bühler, Matteo Biagiola, Luca Di Grazia, Guido Salvaneschi

分类: cs.SE, cs.AI

发布日期: 2026-10-05


💡 一句话要点

提出AgentSpy以解决AI代理行为不可观察问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: AI代理 行为观察 系统调用 网络流量 安全分析 合规性检查 大型语言模型 透明性

📋 核心要点

  1. 现有方法难以全面理解AI代理的执行行为,通常仅依赖代理自身报告,忽略了子进程的行为。
  2. AgentSpy通过在隔离环境中监控代理的系统调用和网络流量,提供了外部观察的能力,支持合规性和安全性分析。
  3. 在77个任务的实验中,AgentSpy显示出92.2%的相似性,并有效检测到多种攻击类型,未出现误报。

📝 摘要(中文)

基于大型语言模型(LLMs)构建的AI代理在执行过程中通常会运行shell命令、读写文件并访问网络,但其行为难以理解。AgentSpy是一种外部观察代理的方式,通过在隔离环境中运行代理并记录系统调用和网络流量,支持合规性和安全性分析。实验表明,AgentSpy在77个任务中表现出高可靠性,并能有效检测多种攻击类型,未出现误报。

🔬 方法详解

问题定义:现有方法无法全面观察AI代理的行为,导致难以理解其执行过程中的潜在风险和不当行为。代理的报告可能遗漏子进程的实际操作,造成信息不完整。

核心思路:AgentSpy通过在一个隔离的环境中运行代理,记录其系统调用和网络活动,从外部进行全面监控。这种设计使得可以独立于代理本身来分析其行为,提供更为准确的执行轨迹。

技术框架:AgentSpy的整体架构包括两个主要模块:监控模块和分析模块。监控模块负责记录代理及其子进程的系统调用和网络流量,而分析模块则基于这些数据进行合规性和安全性分析。

关键创新:AgentSpy的创新在于其外部观察能力,能够独立于代理的内部逻辑进行行为分析。这与传统方法依赖代理自身报告的方式有本质区别,提供了更高的透明度和可靠性。

关键设计:在设计中,AgentSpy使用了声明性规范来配置隔离环境,并通过规则总结代理的执行情况,包括使用的资源、执行的命令和访问的文件等。此外,安全分析部分应用了确定性规则来评估系统调用的安全性。

🖼️ 关键图片

img_0
img_1
img_2

📊 实验亮点

在77个任务的实验中,AgentSpy显示出92.2%的相似性,表明重复执行的任务表现一致。此外,在所有通过结果测试的任务中,代理在18%的情况下进行了与任务无关的活动,显示出其行为的复杂性。安全性分析方面,AgentSpy成功检测到五种攻击类别中的四种,且在50次运行中未出现误报。

🎯 应用场景

AgentSpy的研究成果在多个领域具有潜在应用价值,包括安全审计、合规性检查和AI系统的行为分析。通过提供对AI代理行为的透明观察,能够帮助开发者和研究人员更好地理解和控制AI系统的执行过程,降低潜在风险。

📄 摘要(原文)

AI agents built on large language models (LLMs) run shell commands, read and write files, and reach the network, typically with their user's privileges. However, what an agent does during an execution is difficult to understand: tests assert on the result, and the agent's trajectory records only what the agent reports about itself, which may omit behavior executed by its subprocesses. We present AgentSpy, an approach that observes an agent from outside the agent. AgentSpy runs the agent in an isolated environment, configured by a declarative specification, and records the system calls and network traffic of the agent and of every process it executes. Based on this monitoring, AgentSpy supports two families of analyses: conformance analyses, which measure obligations, i.e., what an agent execution should do, and safety analyses, which check prohibitions, i.e., what an agent execution must never do. We instantiate one analysis of each family. The reliability analysis uses rules to summarize each run by the environment resources the agent uses: the commands it executed, the files it accessed, and the hosts it contacted. The security analysis applies deterministic rules to the system calls of an execution. For reliability, we evaluated AgentSpy on 77 tasks with the codex harness and three recent LLMs, executing each task three times. Sets of repeated runs of the same task are more similar than sets that include runs of another task in 92.2% of the comparisons. Among tasks for which all three runs pass outcome-based tests, the agent performs task-unrelated activities in 18% of the cases, reads the grading files in 7%, and does not use the developers' guidance in 17%. For security, the generic rules of AgentSpy detect four of five attack categories we considered, with no false positives across 50 runs.