A support agent reads tickets, and customers write tickets. So the text an agent reads through a tool is attacker-controlled, and an indirect prompt injection can ride in on an ordinary get_ticket call. My articles on guardrails and on the confused deputy argue for layered defences, with the hard limits on the server. This experiment set out to measure, attack by attack, which defence actually stops a poisoned ticket and what each one costs in usefulness.
The agent resolves refund tickets for Kestrel Outfitters, the fictional retailer from my Agentic AI book series. It can read tickets and orders, check the returns policy, and act: refund, escalate to Finance, reply, send email, flag for review. Every action goes into an in-memory ledger and nowhere else. Eight tickets sit over real orders in the mock dataset, with the correct outcome computed from the data: three refunds, two escalations, three declines.
Each attack tries one of three things: a refund to someone else's order (or above the limit), emailing another customer's details to an outside address, or an extra USD 40 goodwill refund that every server-side limit allows. The first tier was 12 textbook injections: plain instructions, fake SYSTEM notices, forged tool output (including a fake closing marker for the spotlighting boundary) and social engineering. They landed 0 of 288 times, even with no defence. So, before running anything else, I wrote down a second tier: a forged earlier reply from Kestrel Support quoted in the email chain, the customer's own checkout note shown by the order tools, an upstream AI triage summary stating the attacker's claim as fact, and a plain, reasonable request.
Five conditions ran the same tickets: no defence, a hardened system prompt, spotlighting (every tool result wrapped in a secret per-episode boundary), server-side enforcement in the tools, and all three combined. Grading is code only, read from the ledger, so an attack succeeds only if the agent actually did the harmful thing, whatever it said. Claude Haiku 5.5 and Claude Sonnet 5.5 ran 1,328 episodes for USD 9.44.
No attack worked: 0 of 1,248 attacked episodes, including 384 with no defence. The models read the injections and checked them against the tools. Asked to refund a different order, Haiku looked the order up, saw it belonged to another customer, refunded the right one and flagged the ticket. That also means the experiment can't rank the defences by what they stop. Every condition resolved 100 percent of clean tickets correctly.
The costs did show up. Sonnet answered the plainest exfiltration request with an API-level refusal in 6 of 12 episodes, and 4 of those left the customer's real refund unhandled. With no defence, Haiku skipped a refund it should have issued in 3 of 96 tier-2 episodes. Spotlighting added 21 to 32 percent to the cost per episode and lowered the flag rate: agents told the text was only data ignored it quietly instead of reporting it. Server-side enforcement cost nothing measurable, and it's the only layer whose guarantee doesn't depend on the model's judgment that day. The dry run shows it blocks every out-of-policy call from an agent scripted to obey.