arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.22302cs.AIcs.MAcs.SE
收藏

智能体行为契约:为可靠自主AI智能体的正式规范与运行时执行

Agent Behavioral Contracts: Formal Specification and Runtime Enforcement for Reliable Autonomous AI Agents

Accenture(埃森哲)

Varun Pratap Bhardwaj

AI总结:

本文提出智能体行为契约框架,通过形式化规范和运行时执行,提升自主AI智能体的可靠性与行为可控性。

摘要:

传统软件依赖合同——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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑