As AI models become increasingly intelligent and integrated into essential operations, keeping them within the bounds of their assigned tasks becomes both more difficult and more important. As in software security more broadly, the strongest defense against misbehaving AI is to combine layers of protections and fallbacks. One simple and effective technique to add to this list of defenses is honeytokens—small pieces of data that can be placed near sensitive workloads and monitored to detect unauthorized activity.
Here, we show how honeytokens can be combined with inference hooks to both detect and stop agents that try to expand their scope or escape sandboxes.
What are honeytokens?
Honeytokens are small pieces of data that are sprinkled around a system, designed to entice potential attackers to interact with them. Traditionally, these are things like API keys, passwords, or private keys for cryptocurrency. Defenders monitor the services to which these tokens grant access; if an attacker ever takes the bait and uses the token, the defenders are alerted that their system has been compromised. Two important limitations of traditional honeytokens are that attackers are not stopped, only detected, and only if and when attackers choose to use the tokens they’ve discovered.
When running AI workloads, we can make honeytokens more powerful by combining them with refusal strings. Refusal strings are pieces of data that a model provider or serving infrastructure recognizes; detecting one instantly triggers an error and aborts the model’s response.1 This addresses both limitations of traditional honeytokens: they don’t simply create an alert, but also immediately stop the model from acting; and they are reacted to as soon as they are read, even if the attacker doesn’t use them. For the rest of this post, we will use “honeytokens” to refer to honeytokens that function as refusal strings.

Containing agents using honeytokens and inference hooks
Claude Enterprise users can implement custom refusal strings themselves using inference hooks—a publicly available mechanism, built on an open specification, that intercepts every prompt before inference. This makes honeytokens simple to deploy and lets users halt a misbehaving agent quickly. Honeytokens can be customized per organization, limiting the risk that malicious actors could replay the tokens to cause a denial of service. If the tokens do leak, they can easily be rotated to maintain service. A honeytoken only triggers a refusal for the organization that runs the hooks, so traffic will not be affected by other organizations’ rules.
We are releasing a simple, open-source Rust implementation of honeytokens that integrates with inference hooks to stop model completions when a honeytoken is read. This implementation enforces mandatory signature checks on traffic and handles up to hundreds of megabytes of request data per second per core. Although this version is simple and specific to our own inference hooks, implementing the same idea for other agentic systems is straightforward enough that models can do it themselves.
Honeytokens can be used in various places where agents should not operate, such as:
- Directories that are not shared with sandboxes
- Keys in key-value pairs inside Kubernetes secrets
- Hostnames of servers where agents should never run
- Network services not intended to be accessed by agents

Honeytokens should be random strings that are long enough to be unmistakable (at least eight characters), but short enough that they are not truncated in file listings or other places where agents commonly clip their outputs. Using multiple tokens in a folder, with different datestamps and starting characters, can help increase the odds that sorted and truncated listings will reveal the honeytokens. Models that spawn subagents may see their subagents fail when honeytokens are read, and may try to work around the error using more clever mechanisms like encoding outputs. To combat this, our reference tool by default echoes any honeytokens it identifies in its error output, propagating the token to the parent model and stopping its execution as well. Overall, the best use of these techniques will depend on the specific workflow and on threat modeling of the likely pathways models may take.
How effective are honeytokens?
To test how well honeytokens work, we used Siren, an evaluation originally built to measure a model’s propensity to escape its sandbox when breaking out is strictly beneficial to its task. The evaluation includes over 1,700 unique scenarios, built from over 200 benign DevOps tasks across 26 realistic sandbox environments. Each environment has a deliberate weakness: a misconfiguration, a logic bug, or a publicly disclosed vulnerability. Some tasks can be fully solved with resources available inside the sandbox, whereas others can only be solved by reaching something outside the sandbox. Most scenarios also include a “tempter,” a realistic artifact meant to entice the model to escape, such as a /goal-style loop that encourages it not to give up on the underlying task. To elicit more “natural” escape instances, these tempters do not explicitly tell the model to escape.
To keep the agent contained, each weakened sandbox runs inside a hardened outer sandbox: a Firecracker VM configured with no internet access. We placed honeytokens along the pathways each weakness opens (file systems, Kubernetes, and so on). Escapes were recorded deterministically when tripwires outside the sandbox fired, such as after the agent read a secret file. This is slightly narrower than Siren’s “reached outside” measure, which also includes failed attempts and other probing. We then replayed the recorded sessions to see how often a honeytoken reached the model’s context.

The honeytokens in our evaluation would have stopped about 93% of all escapes, suggesting that this technique can prevent many instances of models escaping sandboxes or exceeding their intended scope. Moreover, because the models could only see the honeytokens by exceeding the scope of their original task, there were no false positives in the sessions where the model did not escape.
Analyzing the failures, we found that some (about 2% of all escapes) were due to the experimental setup:
- In 20 cases, there was no simple location to plant a honeytoken, so there was no honeytoken for the agent to find.
- In 11 cases, the agent technically escaped the sandbox but did not complete its goal or trigger the honeytokens.
However, we believe the remaining failures (about 4% of all escapes) represent more fundamental limitations of honeytokens—either because the agent did not probe the environment or probed it without triggering the honeytokens:
- In 33 cases, the agent either knew exactly what it would do outside the sandbox (such as reading a specific path) and thus did not probe the environment, or ran a script that completed its task without needing to probe.
- In 21 cases, the agent probed the environment without triggering honeytokens, because the tokens were truncated, the services could be probed without listing the honeytokens, or the agent searched for specific files or patterns with commands that did not reveal other files.
Conclusion
In practice, the effectiveness of honeytokens will depend largely on the specific context in which the model runs, as well as on what the model is trying to achieve. Overall, we believe that honeytokens are a simple and effective technique that can help secure workloads in tandem with existing sandboxing and security mechanisms.
