传统软件依赖合同——API、类型系统、断言——来指定和强制正确行为。相比之下,AI智能体基于提示和自然语言指令运行,没有正式的行为规范。这种差距是代理AI部署中漂移、治理失败和频繁项目失败的根本原因。我们引入了智能体行为契约(ABC),这是一种将设计-by-合同原则引入自主AI智能体的正式框架。一个ABC合同C = (P, I, G, R)将预条件、不变式、治理政策和恢复机制作为第一类、运行时可执行的组件。我们定义了(p, delta, k)-满足度——一种概率性的合同合规概念,考虑了LLM非确定性和恢复——并证明了漂移界限定理,显示具有恢复率gamma > alpha(自然漂移率)的合同可将行为漂移限制在D* = alpha/gamma的期望范围内,在随机情况下具有高斯集中性。我们建立了多智能体链中安全合同组合的充分条件,并推导了概率退化界限。我们将在AgentAssert中实现ABC,一个运行时执行库,并在AgentContract-Bench上评估,该基准包含来自6个供应商的7种模型的200种场景。1980次会话的结果显示,合同智能体每会话检测到5.2-6.8次软违规,而无合同基线完全遗漏(p < 0.0001,Cohen's d = 6.7-33.8),实现了88-100%的硬约束合规性,并将行为漂移限制在D* < 0.27的扩展会话中,前沿模型100%恢复,其他模型17-100%恢复,运行时开销小于10毫秒每动作。
英文摘要:
Traditional software relies on contracts -- APIs, type systems, assertions -- to specify and enforce correct behavior. AI agents, by contrast, operate on prompts and natural language instructions with no formal behavioral specification. This gap is the root cause of drift, governance failures, and frequent project failures in agentic AI deployments. We introduce Agent Behavioral Contracts (ABC), a formal framework that brings Design-by-Contract principles to autonomous AI agents. An ABC contract C = (P, I, G, R) specifies Preconditions, Invariants, Governance policies, and Recovery mechanisms as first-class, runtime-enforceable components. We define (p, delta, k)-satisfaction -- a probabilistic notion of contract compliance that accounts for LLM non-determinism and recovery -- and prove a Drift Bounds Theorem showing that contracts with recovery rate gamma > alpha (the natural drift rate) bound behavioral drift to D* = alpha/gamma in expectation, with Gaussian concentration in the stochastic setting. We establish sufficient conditions for safe contract composition in multi-agent chains and derive probabilistic degradation bounds. We implement ABC in AgentAssert, a runtime enforcement library, and evaluate on AgentContract-Bench, a benchmark of 200 scenarios across 7 models from 6 vendors. Results across 1,980 sessions show that contracted agents detect 5.2-6.8 soft violations per session that uncontracted baselines miss entirely (p < 0.0001, Cohen's d = 6.7-33.8), achieve 88-100% hard constraint compliance, and bound behavioral drift to D* < 0.27 across extended sessions, with 100% recovery for frontier models and 17-100% across all models, at overhead < 10 ms per action.
The Granularity Mismatch in Agent Security: Argument-Level Provenance Solves Enforcement and Isolates the LLM Reasoning Bottleneck
Gaoling School of Artificial Intelligence, Renmin University of China(中国人民大学人工智能学院 Gallagher 学院);King Abdullah University of Science and Technology(国王 Abdullah 科学技术大学);Dongbei University of Finance and Economics(东北财经大学);University of Science and Technology of China(中国科学技术大学)
ECM Contracts: Contract-Aware, Versioned, and Governable Capability Interfaces for Embodied Agents
School of Software, Harbin Institute of Technology(哈尔滨工业大学软件学院);School of Computer Science and Technology, Harbin Institute of Technology(哈尔滨工业大学计算机科学与技术学院);School of Mathematical and Computer Sciences, Heriot-Watt University(赫瑞-瓦特大学数学与计算机科学学院);School of Future Science and Engineering, Soochow University(苏州大学未来科学与工程学院)
PACE: Provenance-Aware Capability Enforcement for Tool-Using LLM Agents
King Abdullah University of Science and Technology(阿卜杜拉国王科技大学);RIKEN Center for Advanced Intelligence Project(理化学研究所先进智能项目中心);University of Macau(澳门大学);National Institute of Informatics(国立信息学研究所);University of Electronic Science and Technology of China(电子科技大学)