Pandora's Toolbox Or Why Agent Safety Cannot Be Verified

Mario Franco, Carlos GershensonarXiv 2026 · arXiv

TL;DR

This paper mathematically proves that verifying the safety of AI agents is fundamentally impossible in the general case and computationally intractable even under strict finite constraints. It demonstrates that common safety measures like guardrails, blacklists, and whitelists are inherently "leaky" and that individually "safe" agents can exhibit dangerous behavior when they interact.

What Problem Does This Paper Address?

As AI moves from static models to autonomous agents, we are increasingly "harnessing" language models to external tools—allowing them to write and run code, browse the web, and operate software. This coupling transforms a bounded language model into a computationally universal system.

The authors tackle the fundamental question: Can we ever truly verify, certify, or enforce the safety of these agents? Current industry practice relies on a mix of input filters, tool whitelists, and "guardrail" models. This paper investigates whether these methods can ever provide a complete guarantee of safety, or if we are facing inherent theoretical limits.

Methods

The authors use the formal framework of computability and complexity theory. They model an AI agent as a loop between a policy $\pi$ (the language model) and a computing device $U$ (the external tools).

Figure 1: The loop. In each round the agent reads its context and asks the computing device U to run a machine q on an input i; the output o is appended to the context. If q runs forever, U never answers and the run is stuck. A run is unsafe if the agent ever requests a machine in D.

By defining "danger" as the execution of any program semantically equivalent to a known harmful one, they apply Rice’s Theorem to show that safety is undecidable. They further employ "relay policies"—simple agents designed to execute a dangerous tool only if a certain mathematical condition is met—to prove that safety verification is as hard as the Halting Problem.

Figure 2: The run of Rp,q on input x. The dangerous request is made exactly when the tool returns, i.e. when p halts on x.

Datasets

Not discussed in the paper. This is a theoretical work focused on mathematical proofs rather than empirical benchmarks.

Key Insights and Ideas

  • The "Toolbox" Trap: The moment an agent is given access to a universal computing device (like a Python interpreter), the entire system becomes Turing-complete. This brings all the "undecidability" baggage of computer science into the realm of AI safety.
  • Whitelists are Futile: Even if you only allow "safe" tools, if one of those tools is an interpreter, the agent can simply pass dangerous logic as data to that tool. The "danger" moves from the program channel to the data channel.
  • Safety is Not Compositional: This is perhaps the most alarming insight. The authors prove that you can have two agents, $A$ and $B$, both of which are provably safe in isolation. However, when they are allowed to communicate, they can collaborate to execute a dangerous task that neither could (or would) do alone.
  • The Intractability of Finiteness: While safety becomes technically "decidable" if you strictly limit an agent's memory and running time, the authors show the problem is $\mathsf{PSPACE}$-complete. In practice, this means that for any reasonably complex agent, verifying its safety would take an astronomical amount of time, effectively making it impossible.

Key Results

  • General Undecidability: No algorithm can exist that takes an arbitrary agent and an input and correctly decides if the agent will behave dangerously.
  • Adversarial Agents: For any safety-predicting algorithm $f$, there exists a "total agent" $h$ that will always behave in the exact opposite way of what $f$ predicts (Proposition 3.13).
  • Verification Depth: For a black-box verifier to be certain of a finite agent's safety, it must explore a number of contexts that is exponential relative to the agent's memory window ($L$) and value bounds ($B$).
  • $\epsilon$-safety: Since absolute safety is impossible, the authors propose moving toward probabilistic or complexity-based definitions, such as "hazard rates" (the probability of failure over time) or "Levin complexity" (how hard it is for a malicious actor to find a dangerous prompt).

Limitations and Future Work

The paper's primary limitation is its reliance on a "pragmatic" but abstract definition of danger. In the real world, defining what is "dangerous" is often subjective and context-dependent, which only makes the verification problem harder than the authors' mathematical model suggests.

The authors conclude that we must abandon the hope for "perfect" safety verification. Instead, future research should focus on $\epsilon$-safety: developing actionable metrics that quantify risk and provide "guarantees about the shape of the failure" rather than promising that failure will never occur. They suggest that as agents become more autonomous, we should treat safety more like "disease spreading models" where we monitor how dangerous behaviors might propagate through a population of interacting agents.

Summary updated

Abstract

Present artificial intelligence agents are constructed by means of a coupling between a fixed language model with a general computing device. We show that this coupling makes safety undecidable. In particular, we show that given some dangerous program, no algorithm can predict whether an agent will run such a program that is semantically equivalent. In general, guardrails, blacklists, whitelists and certifications can only lead to imperfect safety solutions. Under finite constraints (bounded context, values and running time) safety is decidable but still intractable. Specifically, the problem is $\mathsf{PSPACE}$-complete even when the description of the agent is known. Finally, safety is not a compositional property, i.e., agents that can be proven safe on their own can still produce unsafe behavior when grouped together. We also discuss relaxed notions of safety that could be used in practice.
BibTeX
@misc{franco2026pandora,
  author = {Mario Franco and Carlos Gershenson},
  title = {{Pandora's Toolbox Or Why Agent Safety Cannot Be Verified}},
  year = {2026},
  eprint = {2611.25325},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.25325},
}
Figure