Questions · Updated 2026-09-23
How do I stop an AI agent from sending too many emails?
Stop an AI agent from sending too many emails by setting budget_per_period on its own key with PATCH /limits/keys/{id}. A send past that budget is refused with agent_budget_exceeded, and the key cannot raise the ceiling.
Stop an AI agent from sending too many emails by giving it a key of its own and setting budget_per_period with PATCH /limits/keys/{id}. The ceiling is checked before the send. A send past it is refused with agent_budget_exceeded. The error catalogue fix says to wait for the period to reset, and that raising a budget is a person's decision: the key cannot raise its own. GET /limits/keys/{id} returns the ceiling and what the key has spent.
Set the ceiling
period is hourly, daily, or monthly. rate_ceiling_per_minute is a separate per-minute cap. Send only the fields you want to change.
curl -sS -X PATCH https://api.agentisend.com/limits/keys/9c8f8f0e-3d1a-4d3f-9a1e-2b7c1a0f5e42 \
-H "Authorization: Bearer $AGENTISEND_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"200
{
"api_key_id": "9c8f8f0e-3d1a-4d3f-9a1e-2b7c1a0f5e42",
"budget_per_period": "string",
"consumed_in_period": 1,
"consumed_in_window": 1,
"paused": true,
"paused_at": "2026-09-04T09:14:00Z",
"paused_reason": "string",
"period": "hourly"
}Create that key with POST /api-keys and permission sending_access. It can send. It cannot edit the ceiling.
Stop it now
POST /limits/keys/{id}/kill pauses one key. POST /limits/kill-all pauses every key on the account. A paused key's send is refused with kill_switch_active. Nothing resumes until a person calls POST /limits/keys/{id}/resume or POST /limits/resume-all.
A looping sender is a different refusal. The loop guard holds a candidate that would be the 4th near-identical message to the same recipient inside 60 minutes, and the code is approval_required. GET /agent-actions lists it. The longer page is loop detection.