Agent safety

How to let an AI agent send email safely.

Let an AI agent send email safely by putting the limits on the API key it holds: a daily send cap, a recipient allowlist and an approval hold, checked on every send before anything goes out.

A limit in the prompt is a request the model can be talked out of. A limit on the key is enforced by the API whatever the model was told, and the key cannot raise its own limits or approve its own drafts.

An agent’s keyPOST /v1/api-keys
{
  "name": "support-agent",
  "scopes": ["emails:send", "threads:read"],
  "daily_send_limit": 200,
  "allowed_recipients": ["@customer.com"],
  "requires_approval": false
}
When it oversteps
429 daily_limit            the cap for today is spent
403 recipient_not_allowed  outside the allowlist
202 pending_approval       held for a person (not an error)

What goes wrong

Three ways an agent with email goes wrong.

It loops

A retry bug or a misread instruction sends the same message hundreds of times before anyone looks.

It mails the wrong people

A test run reaches real customers, or a hallucinated address reaches a stranger.

It is told to by an email

A received message carries instructions, and the agent follows them with your sending credential.

The controls

One control for each.

An agent’s key
{
  "name": "support-agent",
  "scopes": ["emails:send", "threads:read"],
  "daily_send_limit": 200,
  "allowed_recipients": ["@customer.com"],
  "requires_approval": false
}

daily_send_limit stops the loop: it counts recipients per UTC day, including scheduled and held sends, and refuses past the ceiling.

allowed_recipients stops the wrong people: full addresses or whole domains, matched exactly, so a lookalike or a subdomain does not get through.

requires_approval stops the injected instruction from becoming a sent email: every send is a draft until a person releases it.

scopes keep the key to what the job needs. A key that sends and reads threads cannot add domains, import contacts or start a campaign.

What the agent sees

Refusals an agent can act on.

Responses
429 daily_limit            the cap for today is spent
403 recipient_not_allowed  outside the allowlist
202 pending_approval       held for a person (not an error)

Each limit answers with its own error type, so an agent can tell “stop for today” from “wrong recipient” from “waiting on a person” and say so, instead of retrying. A held send is a 202, not an error: retrying it queues a second draft.

What the agent cannot do

The limits cannot be removed by the thing they limit.

A key may not edit itself, mint a looser key, or approve its own drafts.

Key management has no MCP tool at all, and a key carrying any limit cannot decide anyone’s approval. Approvals are decided by a person in the dashboard, or by a key with no limits that you keep for yourself.

A browser sign-in through OAuth carries none of the three limits. Use it to work alongside an agent, and a key for anything that runs while you are away.

Also on by default

What protects the domain whatever the key says.

Suppression

Hard bounces and complaints are never mailed again, and an unsubscribe stops the mail it applies to, checked on every recipient of every send.

Two sending identities

Transactional and marketing mail go out on separate subdomains, so a campaign gone wrong cannot stop password resets.

A warm-up for new domains

A new marketing subdomain is held to a daily ramp, so an agent cannot send its first day’s mail as one burst.

Why not just Resend?

Resend has an MCP server too. The difference is what happens after the send.

The reply is a thread, not a webhook

SendRaven: Joined on Message-ID to the message it answers. Resend: a received-email event; you fetch the message and set reply headers yourself.

Per-key daily cap and recipient allowlist

SendRaven: daily_send_limit and allowed_recipients on the key, checked on every send. Resend: keys scope to a domain and to send-only; no cap or allowlist.

Human approval hold on a key

SendRaven: requires_approval drafts the message and waits for a person. Resend: not offered.

From resend.com, last checked 16 September 2026. The full comparison, including where Resend is the better choice.

Questions

How do I stop an AI agent from sending too many emails?

Give the agent's API key a daily_send_limit. SendRaven counts every recipient the key sends, schedules or holds in the UTC day and refuses past the limit with 429 daily_limit, which tells the agent to stop rather than retry.

Can I restrict which addresses an AI agent can email?

Yes. A recipient allowlist on the key takes full addresses or whole domains, and any recipient outside it, in to, cc or bcc, is refused with 403 recipient_not_allowed before anything is sent.

Can an AI agent remove its own email limits?

No. A key may not edit itself or create a key looser than itself, key management has no MCP tool, and a key with any limit cannot approve drafts, its own or anyone else's.

Is a system prompt enough to keep an AI agent's email safe?

No. A prompt is an instruction the model can be argued out of, including by the text of an email it reads. Limits on the API key are enforced by the email API whatever the model decides.

How do I protect an email agent from prompt injection?

Treat every received email as data, never as instructions, and put an approval hold or an allowlist on the key so the worst an injected message can cause is a draft a person reads or a send that is refused.

Let the agent send. Decide how much.

Every limit is on every plan, including Free with 3,000 emails a month, which is never charged without an upgrade.