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).

Keywords

Subject

Publication details

Journal
Not available
Open access
Green open access

Cite this article

APA 7

Tiffany, C., Zhang, W., Bagdasarian, E., & Tsai, L. (2026). Sapien: A Stateful Policy Engine for Autonomous AI Agents. https://omanscience.com/en/articles/sapien-a-stateful-policy-engine-for-autonomous-ai-agents

MLA 9

Tiffany, Corinn, et al. "Sapien: A Stateful Policy Engine for Autonomous AI Agents." https://omanscience.com/en/articles/sapien-a-stateful-policy-engine-for-autonomous-ai-agents.

Chicago (author–date)

Tiffany, Corinn, Wen Zhang, Eugene Bagdasarian, and Lillian Tsai. 2026. "Sapien: A Stateful Policy Engine for Autonomous AI Agents." https://omanscience.com/en/articles/sapien-a-stateful-policy-engine-for-autonomous-ai-agents.

Harvard

Tiffany, C., Zhang, W., Bagdasarian, E. and Tsai, L. (2026) 'Sapien: A Stateful Policy Engine for Autonomous AI Agents', Available at: https://omanscience.com/en/articles/sapien-a-stateful-policy-engine-for-autonomous-ai-agents.

Vancouver

Tiffany C, Zhang W, Bagdasarian E, Tsai L. Sapien: A Stateful Policy Engine for Autonomous AI Agents. https://omanscience.com/en/articles/sapien-a-stateful-policy-engine-for-autonomous-ai-agents

IEEE

C. Tiffany, W. Zhang, E. Bagdasarian, and L. Tsai, "Sapien: A Stateful Policy Engine for Autonomous AI Agents," https://omanscience.com/en/articles/sapien-a-stateful-policy-engine-for-autonomous-ai-agents.