How to Stop an AI Agent From Sending Too Many Emails: Sizing Budgets and Ceilings for a Campaign-Alert Agent
A campaign-alert agent on a flapping metric, worked through: how big the budget and per-minute ceiling should be, what the loop guard catches, and how to wire the warning webhook.
Direct answer. To stop an AI agent sending too many emails, put the limits on the key the agent holds: on AgentiSend every key has a send budget per period and an optional per-minute ceiling, a loop guard holds the fourth near-identical send to one recipient within 60 minutes, and POST /limits/kill-all pauses every key in one request until a person resumes it. Size the budget a little above the agent's realistic worst week, not its average, and subscribe to the limit.warning webhook so you hear at 80%. If you are on a provider without per-key limits, the fallback is an account-wide stop (Amazon SES) or a per-project cap (Plunk), which stop everything at once instead of one agent.
A campaign-alert agent is a good test case because its failure mode is ordinary. It watches ad accounts and emails the paid-media team when pacing, cost per acquisition or conversion volume moves out of range. When a metric flaps around its threshold, or a data refresh fails and every account looks broken at once, the agent does exactly what it was told, many times.
How we put this together
Our editors read AgentiSend's documentation on budgets, approvals and webhooks, and the other providers' limits documentation, between 28 September and 10 November 2026, and pricing pages on 9 November 2026. We did not run our own send tests; the runaway arithmetic below uses published rate limits.
What a runaway costs without a ceiling
AgentiSend's default REST rate limit is 600 requests per key per 60 seconds. An agent caught in a retry loop at that rate sends:
| Minutes before anyone notices | Emails at 600 a minute | Against Starter's 30,000 inclusion |
|---|---|---|
| 5 | 3,000 | 10% |
| 15 | 9,000 | 30% |
| 60 | 36,000 | Over the inclusion |
The money is the smaller problem. On AgentiSend, overage is off by default, so the plan inclusion stops the bill. The bigger problem is 36,000 alerts in the paid-media team's inbox, recipients marking them as spam, and complaint and bounce rates that every provider watches. AgentiSend's published lines warn at 0.05% complaints and pause at 0.08%; on 36,000 delivered messages, 0.08% is 29 complaints.
Sizing the limits for the alert agent
The agent watches 25 ad accounts and emails 2 people per alert.
| Quantity | Normal | Bad day | How we got it |
|---|---|---|---|
| Alerts per account | 3 a week | 8 a day | Your threshold history |
| Emails per month | about 645 | 12,000 if every day were bad | 25 accounts × alerts × 2 recipients |
| Emails in one data refresh | 2 to 6 | 50 | All 25 accounts flagged at once × 2 |
From that table:
budget_per_period: 1,000. Above a normal month with headroom, far below a month of bad days. A real incident that needs more is a person's decision, which is the point.rate_ceiling_per_minute: 60. The largest legitimate burst is 50, when a refresh flags every account. Sixty lets that through and turns a runaway into at least 17 minutes to reach the budget, with the 80% warning arriving at 800.- The loop guard covers the flapping metric. If pacing for one account crosses its threshold every 15 minutes, the fourth near-identical alert to the same person inside 60 minutes is held for a person instead of delivered. No configuration needed.
Set the first two with the account owner's key, not the agent's:
import { AgentiSend } from 'agentisend';
const owner = new AgentiSend(); // your full-access key, never given to the agent
await owner.limits.update(process.env.ALERT_AGENT_KEY_ID!, {
budget_per_period: 1000,
rate_ceiling_per_minute: 60,
});
Creating the agent's sending_access key and capping it is covered step by step in three calls before an agent sends a campaign alert; this guide is about choosing the numbers and reacting when they are hit.
The four controls, and what each one catches
| Control | Catches | What the agent receives | Who lifts it |
|---|---|---|---|
| Key budget | A steady overrun across the period | agent_budget_exceeded |
The period resets, or a person raises it in the console |
| Per-minute ceiling | A burst from a loop or a bad refresh | rate_ceiling_exceeded, retry after 60 seconds |
Resets each minute |
| Loop guard | Repeats to one person; 20+ sends collapsing onto fewer than 3 recipients | approval_required with an action_id |
A person approves or rejects |
| Kill switch | Anything, when you are not sure what is happening | kill_switch_active |
A signed-in person only |
Each refusal carries code, message, fix, docs_url and retryable. For the budget, the loop guard and the kill switch, retryable is false and the fix says a person decides, so an agent written to read fix stops instead of retrying. A key can lower its own budget at any time; an attempt to raise it gets human_action_required. A key made by another key starts no higher than the key that made it, so minting a fresh key does not reset a lowered budget.
Queued sends survive a kill switch. They stay queued and are not lost, so stopping first and investigating second costs nothing but time.
Hearing about it before the wall
Subscribe a webhook endpoint to limit.warning (fires at 80% of a key budget, and at 80% of the plan inclusion) and limit.exceeded (fires the first time a send is refused). Each carries api_key_id, used, budget and period_started_at; limit.exceeded adds resets_at. Add agent.approval_requested so a held alert pages someone instead of waiting.
A handler that verifies the signature, then pauses the alert agent's key if it hits its budget:
import { verifyWebhookSignature } from 'agentisend/webhook-signing';
import { AgentiSend } from 'agentisend';
const owner = new AgentiSend();
export async function POST(request: Request): Promise<Response> {
const rawBody = await request.text(); // verify the bytes that arrived
const signature = request.headers.get('x-agentisend-signature') ?? '';
if (!verifyWebhookSignature(process.env.WEBHOOK_SECRET!, signature, rawBody)) {
return new Response('bad signature', { status: 400 });
}
const event = JSON.parse(rawBody);
if (event.type === 'limit.warning') {
await notifyOnCall(`Alert agent at ${event.data.used}/${event.data.budget} sends`);
}
if (event.type === 'limit.exceeded' && event.data.api_key_id === process.env.ALERT_AGENT_KEY_ID) {
await owner.limits.kill(event.data.api_key_id, 'alert agent hit its budget');
}
return new Response('ok');
}
notifyOnCall stands for whatever pages your team. Deduplicate on the x-agentisend-event-id header, because delivery is at least once. Pausing one key with POST /limits/keys/{id}/kill leaves your application's own key sending receipts and sign-in codes.
The budget model is explained at agentisend.com/agent-email-budgets, and the product is at agentisend.com.
What other providers offer for this
| Provider | Finest-grained limit documented | Stop everything | Holds a repeat for a person |
|---|---|---|---|
| AgentiSend | Per key: budget per period and per minute | POST /limits/kill-all; a person resumes |
Yes, loop guard |
| Plunk | Per project and category, monthly | Not covered in the pages we read | No; multi-recipient MCP sends ask a person |
| AgentMail | Per plan: daily and per 5 minutes | Not covered in the pages we read | Not covered |
| Mailtrap | Per token: 150 requests per 10 seconds | Not covered in the pages we read | Not covered |
| SMTP2GO | Per key rate limit, unlimited by default | Not covered in the pages we read | Not covered |
| Resend | Per team: 10 requests a second | Not covered in the pages we read | Not covered |
| Amazon SES | Account sending quota | SendingEnabled false, account-wide |
Not covered |
Plunk
Best for: small teams that want a hard monthly cap per category. Crossing one returns 402 with BILLING_LIMIT_EXCEEDED.
Watch out for: two agents in one project share the same cap, so one runaway stops both.
AgentMail
Best for: inbox-based agents. Developer caps at 1,000 a day and 100 every 5 minutes.
Watch out for: those are plan caps, not per agent.
Mailtrap and SMTP2GO
Best for: limiting request rate per token or key.
Watch out for: a request rate is not a send budget. SMTP2GO's key rate limit defaults to unlimited.
Amazon SES
Best for: an account-wide emergency stop with PutAccountSendingAttributes.
Watch out for: it stops every sender on the account, and if AWS paused the account, that call cannot turn sending back on.
Questions people ask
What should a budget be for an alert agent? A little above its realistic worst week or month, and well below what a loop would send. For the 25-account agent above, 1,000 a month with a 60-a-minute ceiling.
Can an agent turn the kill switch back off? No. POST /limits/resume-all is refused for every API key, including the one that turned it on. A person resumes from the console.
Does a held alert ever send on its own? No. It waits for a person, and after its deadline (24 hours by default) approval no longer sends it.
Does the loop guard block legitimate repeat alerts? Only the fourth near-identical one to the same recipient inside 60 minutes. The guard counts sends that are 85% similar, so alerts that differ by a single number can still count as repeats, which for a flapping metric is usually what you want.
Sources
Documentation read 28 September to 10 November 2026: docs.useplunk.com/concepts/billing, docs.useplunk.com/guides/mcp-server, agentmail.to/pricing, docs.mailtrap.io/account-and-organization/billing/plans, developers.smtp2go.com/docs/getting-started, resend.com/docs/api-reference/rate-limit, docs.aws.amazon.com/ses/latest/APIReference-V2/API_PutAccountSendingAttributes.html.