Skip to content

Demo · Published 2026-11-10 · Updated 2026-11-10 · AgentiSend

The agent that tried to send 400 receipts

The agent that tried to send 400 receipts lets 5 copies through when the guard is on, and all 400 when the guard is off.

Nothing leaves this browser. The transport is an in-memory list, and the guard is the published library with its in-memory store.

Ready

Attempted
0
Sent
0
Refused
0

Policy

{
  "version": 1,
  "budgets": {
    "per_hour": 12
  },
  "rate": {
    "per_minute": 60
  },
  "loop": {
    "mode": "full",
    "max_identical_sends": 5
  }
}

Decision log

    The agent that tried to send 400 receipts lets 5 copies through when the guard is on, and all 400 when the guard is off.

    The loop offers one receipt, to one address, 400 times. With the guard on, 5 copies are accepted and 395 are refused as repeats (loop_repetition_detected). With the guard off, the in-memory list takes all 400. Nothing leaves this browser: there is no network call and no mailbox.

    The check runs in the page. Code that can edit the page can skip it. On an AgentiSend key the budget and the loop hold run at the API, where that key cannot turn them off. The same scenario is tabulated on the runaway-agent benchmark. The Claude Code hook applies a policy file before a matched send tool runs.

    Policy

    {
      "version": 1,
      "budgets": { "per_hour": 12 },
      "rate": { "per_minute": 60 },
      "loop": { "mode": "full", "max_identical_sends": 5 }
    }

    max_identical_sends is why the sixth copy is refused. The hourly budget on this policy is higher than the number of copies that get through, so the repeat rule is the one that stops the loop.

    Twelve lines

    import { createGuard, MemoryStore } from "agent-email-guard";
    const receipt = { to: "buyer@example.com", subject: "Receipt R-1001", text: "Order R-1001 total 42.00 USD. Test string." };
    const sent: unknown[] = [];
    const guard = createGuard({ store: new MemoryStore(), budgets: { perHour: 12 }, rate: { perMinute: 60 }, loop: { mode: "full", maxIdenticalSends: 5 } });
    const send = guard.wrap(async () => { sent.push(receipt); });
    for (let n = 0; n < 400; n++) {
      try {
        await send(receipt);
      } catch {
        /* refused, not sent */
      }
    }

    Install

    npm install agent-email-guard
    pip install agent-email-guard
    composer require agentisend/agent-email-guard
    go get github.com/agentisend/agent-email-guard/go

    Next