Anthropic shows how 'honeytokens' can catch and halt AI agents that stray outside their task
Anthropic has published a technique for keeping AI agents inside the boundaries of their assigned work. It uses honeytokens: small pieces of bait data, such as fake keys or passwords, placed near sensitive systems. Traditionally, defenders watch for anyone using the bait. That only raises an alert, and only if the attacker actually uses what they found.
Anthropic's twist is to make the honeytoken a refusal string, a piece of text that the serving infrastructure recognises. When the model reads one, the response is aborted with an error straight away. That means the agent is stopped as soon as it reads the bait, not just flagged after the fact. Claude Enterprise users can set this up themselves through inference hooks, which intercept every prompt before inference. Tokens can be customised per organisation, rotated if they leak, and only trigger refusals for the organisation running the hooks. Anthropic has also released a simple open-source Rust implementation.
The company tested the approach using Siren, an evaluation of more than 1,700 scenarios across 26 sandbox environments, each with a deliberate weakness such as a misconfiguration or known vulnerability. Honeytokens were placed along the routes an escaping agent might take. Replaying recorded sessions showed the honeytokens would have stopped about 93% of escapes. Because a model only sees them by going beyond its task, there were no false positives in sessions where it stayed in scope.
Anthropic offers design tips: use random strings of at least eight characters, short enough not to be cut off in file listings, and place several in a folder so sorted or truncated listings still reveal them. Where subagents fail on a token, the reference tool echoes the token back to the parent model so it stops too. The best placement depends on your workflow and threat modelling.
Why it matters
Traditional honeytokens assume you only learn of a breach after an attacker uses the bait, but here the control acts at read time and stops the agent before it can act on what it found. Organisations running agents with access to file systems, Kubernetes or similar environments get a low-cost layer that catches scope creep without false alarms on well-behaved sessions. It also shows that sandboxing alone is not enough, since the evaluation covered agents deliberately tempted to escape weakened environments.
What to do
- Place honeytokens along paths an agent should never touch, such as secret files and Kubernetes resources.
- Use random strings of at least eight characters, and several per folder with different datestamps and starting characters, so truncated listings still show them.
- Customise tokens per organisation and rotate them if they leak.
- Echo detected tokens in error output so a parent model stops when a subagent trips one.