Permissions & safetyAntipatternEmerging

Agent trap

Also called: agent honeypot, bait content

An agent trap is content placed where an agent will find it, designed to work on an agent rather than a human reader. The target is not a person browsing but an automated reader that acts on what it reads.

James Phoenix
Understanding Data Updated July 26, 2026

Traditional web attacks target humans: something must look convincing enough to click. An agent trap inverts the audience. It does not need to look convincing to anyone, because the reader is a model that will read the whole page, including the parts a human would never see.

That changes what an attack looks like. A trap can be invisible text, an HTML comment, white-on-white, a hidden element, or a plausible-looking config block. None of it needs to survive human scrutiny, because no human is scheduled to look.

Where they get placed

Anywhere an agent is likely to go unattended:

  • Pages that answer common developer questions. If your agent browses for a fix, the trap sits in the answer.
  • Package and dependency metadata. READMEs, changelogs, and post-install notes get read by agents auditing dependencies.
  • Issue and PR comments in repositories an agent is asked to triage.
  • Files an agent is likely to open by convention, which is why an unfamiliar AGENTS.md or .cursorrules in a cloned repository deserves a read before you point an agent at it.

Why this is emerging rather than proven

The mechanism is real and demonstrated. What is not yet settled is how common deliberate, in-the-wild traps are versus accidental instruction-shaped text doing the same damage. Treat the distinction as unimportant operationally: an agent that follows instructions from a page it read is exposed either way, and the accidental version is already everywhere.

Defences

The honest answer is that content-level detection is weak, because the attacker writes the content and can rewrite it. What holds is limiting consequences:

  • Assume any fetched page may contain instructions. Design so that being fooled produces a wrong summary, not an action.
  • Human approval on consequential actions, especially anything triggered shortly after reading external content.
  • [Least privilege](/ai-coding-dictionary/least-privilege) and [egress control](/ai-coding-dictionary/egress-control), so a successful trap has nowhere useful to go.
  • Read unfamiliar instruction files before running an agent in a repository you did not write.
Watch out
An agent running unattended is the intended victim. AFK operation and broad tool access are exactly the combination a trap is written for, so the guardrails matter most precisely when nobody is watching.

Related terms

Building with AI agents?

This dictionary is part of how I think about agentic engineering. If you want the same thinking applied to your codebase, that is what I do.

See how I can help