cs.AISep 30, 2026

Sapien: A Stateful Policy Engine for Autonomous AI Agents

Authors: Corinn Tiffany, Wen Zhang, Eugene Bagdasarian, Lillian Tsai

Organizations: Google · University of Massachusetts Amherst

Abstract

Contextual security defenses prevent AI agents from taking rogue actions by synthesizing a task-specific policy and enforcing it on the agent's tool calls. In multi-step tasks, however, which actions are valid often depends on what the agent has already done and learned. We present Sapien, a policy engine for enforcing stateful contextual policies. A Sapien policy specifies permitted tool-call sequences using a regular expression extended with stateful predicates, deferred policy generation, and scoped semantic checks. We show that Sapien stays within a few percent of an unconstrained agent's utility. Even if the agent is fully hijacked, Sapien's policies rule out 93-95% of attacks on AgentDojo and 62-85% on Toolathlon (twice as many as tool allowlists on long-horizon tasks).

Figures & tables

Explore similar work

CardsList
  1. ToolGuardian: Declarative Security for AI Agent-Tool Interactions

    Jul 23, 2026Arun Ravindran, Saurabh DeochakeAuthorizationAgentic Deployments

  2. Agent Security Needs Redefinition through a Holistic Framework

    Jul 24, 2026Vincent Siu, Jingxuan He, Kyle Montgomery +3SecurityAuthorization