Anthropic honeytokens: bait that stops an agent on read
Anthropic pairs decoy secrets with Claude Enterprise inference hooks to halt agents that stray, for teams running agents close to real infrastructure.
Say you run the platform team at a mid-size SaaS company and you've handed routine DevOps chores to a coding agent: fix the flaky CI job, bump a Helm chart, clean up a stale namespace. It works inside a container you set up last quarter. Containers have weak spots, such as a mounted socket or an over-broad service account, so you also planted a fake AWS key in the agent's home directory. That key does nothing until someone tries to use it, and even then the alert lands minutes later. If the agent wanders into a Kubernetes secret it was never meant to see, reads it and carries on with the real credential sitting next to the bait, your tripwire stays silent.
Anthropic's technique removes both gaps by making the bait stop the model the moment it reads it. Its research post of December 3, 2026 pairs classic honeytokens with refusal strings checked by Claude Enterprise inference hooks, and releases an open-source Rust server that does the check. Replayed against Anthropic's own sandbox-escape evaluation, the tokens would have stopped about 93% of escapes.
What it is
Three pieces fit together.
- Honeytokens. Small random strings planted where an agent should never operate. The post lists directories not shared with sandboxes, keys inside Kubernetes secrets, hostnames of servers where agents should never run, and network services agents aren't meant to reach. That maps straight onto the lede: the Kubernetes secret the agent shouldn't open is exactly where a token goes.
- Refusal strings. Anthropic describes these as data the serving infrastructure recognizes; detecting one triggers an error and aborts the model's response. A honeytoken that works as a refusal string fixes both limits of the classic kind: the model is stopped, not just reported, and the token fires as soon as it is read, even if the agent never uses it.
- Inference hooks. The post calls them "a publicly available mechanism, built on an open specification, that intercepts every prompt before inference," available to Claude Enterprise users.
The released server is small. According to AI/TLDR's write-up of the project, Anthropic sends the transcript of each governed request to your server before Claude sees it; if the transcript contains any string from your token list, the server answers deny and the request is blocked, otherwise allow. Matching is exact and case-sensitive, every request's signature is checked against the whsec_... secret from the hooks settings (two secrets at once for rotation), and the code is about 400 lines of Rust with five dependencies under the Apache-2.0 license. Anthropic's post says it handles up to hundreds of megabytes of request data per second per core.
Two design details matter for real deployments. Tokens are per organization, which the post says limits the risk of someone replaying them to cause a denial of service, and they can be rotated if they leak. And because a subagent that hits a token may fail while its parent tries to route around the error, for example by encoding outputs, the reference tool by default echoes the matched token in its error output so the parent stops too. A --no-echo-token flag hides it from the user-visible deny reason, AI/TLDR notes.
Alternatives and their trade-offs, each from its own source:
- Thinkst Canarytokens. Free hosted decoys (AWS keys, kubeconfig files, documents, DNS names, URLs) that alert by email or webhook, as AI Learning Guides describes them. They fire on use, so they catch a leaked key tried from attacker infrastructure, and they work the same for closed models, open-weight models and third-party agent services. The guide is blunt that they detect prompt injection rather than stop it, and that AWS key alerts wait on CloudTrail delivery.
- Sandboxing, network allowlists and scoped credentials. urgent.news puts the trade-off plainly: these controls limit what a compromised run can do, but they don't tell you a run was compromised.
- Agent-side hooks such as Failproof AI and dcg. In AI/TLDR's listing, Failproof AI is a hook-based command-line tool and Rust daemon that listens to events from 12 agent harnesses, Claude Code, Codex and Cursor among them, and blocks, warns or steers the agent; dcg is a Rust pre-tool hook that inspects each shell or git command and blocks destructive ones. Our reading: these watch what the agent does in the harness, while honeytokens on inference hooks watch what the model is about to read.
Who it's for
Pick this up if your organization is on Claude Enterprise, your agents run near real infrastructure (clusters, internal services, secret stores) inside a sandbox you don't fully trust, and you can keep a small public HTTPS endpoint running. The cost is low: a tokens file, a tiny server and a proxy. The payoff is a stop on exactly the exploratory behaviour Anthropic measured.
Skip it, for now, if you're a solo developer or small team without Claude Enterprise. The post names only that plan, and the sources don't say whether Team plans or plain API keys get inference hooks. Skip it too if your agents run on other vendors' models: the server is built for Claude's hooks, and Canarytokens or harness-level hooks fit a mixed stack better. And skip it if you were hoping to replace your sandbox. Anthropic frames honeytokens as working "in tandem with existing sandboxing and security mechanisms."
Before and after
Before, with a sandbox plus a classic canary:
- The agent hits a weakness in its sandbox, say a misconfigured mount.
- It lists a directory or reads a secret outside its task. Nothing happens on read.
- If it later uses a decoy AWS key, an alert arrives, but urgent.news reports a delay of 2 to 30 minutes from Amazon's logging.
- Meanwhile the run has kept going, and you reconstruct what happened from the transcript afterwards.
After, with honeytokens on inference hooks:
- You plant several random tokens in the places the post lists: an unshared directory, a key name in a Kubernetes secret, a decoy hostname.
- The agent reads one. Its tool output, now carrying the token, goes into the next request.
- Before Claude sees that request, your server finds the token and answers
deny; the request is blocked and the completion stops. - If a subagent tripped it, the echoed token in the error stops the parent too.
- You investigate a halted run instead of a finished one. For canaries generally, urgent.news suggests a unique token per run or per day of runs, recorded in structured logs, so an alert points to its source.
The post adds a placement detail that's easy to miss: tokens should be at least eight characters but short enough not to be clipped in file listings, and several tokens per folder, with different datestamps and starting characters, raise the odds that a sorted, truncated listing shows one.
Try it
Check your plan first. The hook server needs a Claude organization with inference hooks turned on and Rust 1.75 or newer, per AI/TLDR's summary of the README, and Anthropic only calls public https:// URLs on port 443, so the server needs a TLS proxy in front. Anthropic's post names Claude Enterprise as the place hooks are available.
If you're on Claude Enterprise, the setup AI/TLDR distils from the project docs runs like this:
- Create a tokens file: one token per line, 8 to 256 printable ASCII characters, no spaces; blank lines and lines starting with
#are ignored. - Build and run the server with
HONEYTOKENS_SECRETset to the signing secret shown when you save the endpoint in the inference hooks settings. It listens on127.0.0.1:8000by default. Run the tests with:
cargo test
- Put TLS in front. The README's Caddy example terminates TLS and rejects every caller outside Anthropic's range
160.79.106.0/24; the signature check stays on regardless. - In Organization settings → Data and privacy → Inference hooks, allow hooks for your organization, save the endpoint URL and press "Test connection". You should see an allow verdict. Then turn on "Enforce verdicts".
Our own suggested check, not from the README or AI/TLDR: plant one of your tokens as a file name in a directory your agent's tasks never need, then in a test session ask the agent to list that directory. The request should be blocked, with the token shown in the deny reason unless you started the server with --no-echo-token.
If you're not on Enterprise, you can still put the placement half of the idea to work with a detection-only tripwire. You need the AWS command-line tool and an email address; AI Learning Guides says the hosted Canarytokens service is free and needs no account. Its steps, applied to one sandbox:
- Go to canarytokens.org, choose "AWS API keys", add an alert email, and write a memo naming the location (the guide's example is
agent-runner-03 ~/.aws/credentials). - Put the generated keys in a profile with a tempting name inside the agent's sandbox. The guide's layout, with your canary values in place of the placeholders:
# ~/.aws/credentials inside the agent sandbox
[default]
aws_access_key_id = AKIA_REAL_SANDBOX_KEY
aws_secret_access_key = ...
[prod-admin]
aws_access_key_id = AKIAXXXXXXXXCANARY01
aws_secret_access_key = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
region = us-east-1
- Trigger it yourself:
aws sts get-caller-identity --profile prod-admin
- Confirm the alert email arrives. The guide warns to expect a delay of minutes, not seconds, because AWS key alerts depend on CloudTrail. If nothing arrives, the tripwire is decoration.
Keep the decoy out of any run that does real AWS work; urgent.news warns that's how canaries produce false alarms. This version only fires on use, so it won't catch the read-and-carry-on case from the lede.
As our own example, a placement checklist drawn from Anthropic's guidance, for either path:
- Plant tokens only where the agent's task never needs to go, so a hit means it left scope.
- Use several tokens per sensitive folder, with different datestamps and first characters.
- Keep each token short enough to survive a clipped listing.
- Record which token lives where.
Where it breaks
Agents that don't explore. Anthropic counts about 4% of escapes as fundamental misses. In 33 cases the agent already knew what it would do outside the sandbox, such as reading a specific path, or ran a script that finished the task without probing. In 21 it probed without meeting a token, because tokens were truncated, services could be probed without listing them, or its searches didn't reveal other files. Another 2% came from the test setup: 20 cases had no simple place to plant a token, and 11 escapes never completed their goal or reached a token.
The 93% is Anthropic's own replay. In its Siren evaluation, an escape was recorded when a separate tripwire outside the sandbox fired, such as after the agent read a secret file, which the post says is slightly narrower than Siren's own "reached outside" measure. Anthropic then replayed those recorded sessions to see how often a honeytoken reached the model's context. Anthropic says real-world effectiveness "will depend largely on the specific context" and on what the model is trying to achieve. AI Weekly points out that the zero-false-positive result is bounded by design: the tokens were only visible to a model that had already left its task.
Fail-open by default. AI Weekly reports that if the hook server fails, the default handling is to allow the request, so prompts reach the model unscreened. A crashed server or a broken proxy quietly turns the tripwire off.
You own the code. AI/TLDR notes that Anthropic marks the server as a reference implementation that isn't maintained and doesn't accept contributions, and Anthropic itself calls it "simple and specific to our own inference hooks."
Adversaries adapt. AI Learning Guides warns that someone can instruct a capable agent to skip anything that looks like a canary, and that Canarytokens AWS keys have traits tooling already checks for.
Unconfirmed reach. The post names only Claude Enterprise as the home of inference hooks; whether Team plans or plain API keys get them isn't covered by any source here. Anthropic says building the same idea for other agentic systems is "straightforward enough that models can do it themselves," yet a refusal-string check in front of another vendor's model, or inside Claude Code's local hooks on a solo developer's laptop, is a setup none of these sources reports testing.
Sources
- Containing AI agents with honeytokens · Anthropic
- honeytokens - Anthropic's Tripwire Server for Claude Agents · AI/TLDR
- Canary tokens in agent sandboxes: tripwires that tell you when a run goes rogue · urgent.news
- Anthropic: Honeytokens Caught 93% of Agent Sandbox Escapes | AI Weekly · AI Weekly
- Honeytokens for AI Agents 2026: Trap Rogue Agents With Canarytokens - AI Learning Guides · AI Learning Guides