Anthropic has published a practical technique for containing AI agents that wander beyond their assigned task: decoy strings, known as honeytokens, that halt a model the moment it reads one. In a research post dated December 3, the company reports that in replays of an internal sandbox-escape evaluation, the tokens would have stopped about 93% of the escapes it recorded, and it has released an open-source Rust implementation on GitHub.

Honeytokens are an old idea in computer security. Defenders scatter fake API keys, passwords or crypto wallet keys around a system and watch the services they point to; if an intruder uses one, an alarm goes off. Anthropic notes two weaknesses of the classic version: it only raises an alert rather than stopping anyone, and it only fires if the intruder actually tries the stolen credential.

The company's twist is to turn each honeytoken into a refusal string, a piece of text the serving infrastructure recognizes and responds to by throwing an error and cutting off the model's output. Because the check happens when the token enters the model's context, the agent is stopped as soon as it sees the bait, whether or not it ever uses it. Claude Enterprise customers can set this up themselves with inference hooks, a mechanism built on an open specification that inspects every prompt before inference. Tokens can be unique to each organization, which keeps outsiders from replaying them to knock a service offline, and they can be rotated if they leak. Anthropic says it retired an older single global refusal string for exactly that reason, after malicious actors began embedding it in content to disrupt Claude-based systems such as malware analysis tools.

Suggested hiding places include folders the sandbox cannot see, entries inside Kubernetes secrets, hostnames of machines where agents should never run and network services agents have no business touching. Anthropic recommends random tokens of at least eight characters, short enough not to be cut off in file listings, and spreading several per folder with varied dates and first characters so sorted, truncated output still reveals one. Its reference tool also repeats any detected token in its error message, so a parent agent that spawned a misbehaving subagent is stopped too, rather than trying to route around the failure.

To measure the effect, Anthropic used Siren, an evaluation designed to test whether models break out of a sandbox when doing so helps them finish a task. It contains more than 1,700 scenarios built from over 200 ordinary DevOps tasks in 26 environments, each with a deliberate flaw such as a misconfiguration or a known vulnerability, and many include a tempting artifact that nudges the agent toward escaping without telling it to. Each weakened sandbox ran inside a locked-down Firecracker virtual machine with no internet access. Because the decoys were only visible to agents that exceeded their scope, there were no false positives.

The misses are instructive. About 2% of escapes slipped through because of the test setup, for instance where no sensible spot existed to plant a token. Roughly 4% reflect real limits: agents that knew exactly which path to read and never explored, or that probed in ways that did not list the decoys.

Anthropic presents honeytokens as one inexpensive layer alongside sandboxing, not a replacement for it. The results come from the company's own evaluation and have not been independently replicated, and a capable agent that knows to avoid listings could still evade them.

References