New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

agentisend

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agentisend

AgentiSend: the transactional email API an AI agent can hold the key to. A send budget on every key, a preflight that sends nothing, refusals that name the fix, one call that stops every sender.

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source
AgentiSend AgentiSend

agentisend

AgentiSend is a transactional email API for AI agents and the products they run inside. Every API key carries a send budget, a preflight call runs every gate without sending, a refusal names the call that repairs it, and one request pauses every sender. Node 20 or newer, ESM, no runtime dependencies.

npm install agentisend

An agent that sends, and can be stopped

import { AgentiSend } from 'agentisend';

const mail = new AgentiSend(process.env.AGENTISEND_API_KEY);

const message = {
  from: 'receipts@yourdomain.com',
  to: 'customer@example.com',
  subject: 'Your receipt',
  text: 'Thanks. The details are attached to your account.',
};

// Runs every gate (domain, budget, loop guard, suppression, content) and sends nothing.
const check = await mail.emails.preflight(message);
if (!check.ok) throw new Error(`${check.error?.code}: ${check.error?.fix}`);

// The key this agent holds was created with a budget. Past it, the send is refused
// with `agent_budget_exceeded` and a `fix` that names the call which raises it.
const { id } = await mail.emails.send(message, { idempotencyKey: `receipt/${message.to}` });
console.log(id);

The idempotency key is derived from the thing being done, never from the moment: a retry after a timeout replays the first send instead of mailing someone twice.

Give the agent its own key, with a ceiling

const owner = new AgentiSend(process.env.AGENTISEND_API_KEY); // your key, never the agent's

const key = await owner.apiKeys.create({ name: 'support-agent', permission: 'sending_access' });
await owner.limits.update(key.id, { budget_per_period: 50, period: 'daily', rate_ceiling_per_minute: 10 });

const agent = new AgentiSend(key.token); // holds only its own key

POST /limits/keys/{id}/kill stops that key immediately; POST /limits/kill-all stops every key on the account. Both are one request from anywhere, and both write an audit row.

What a refusal looks like

Errors throw AgentiSendError, which carries code, message, fix and docsUrl; on a 429 it also carries retryAfterSeconds. A looping agent that sends the same message to the same person a fourth time inside the window reads approval_required: nothing was delivered, the send waits in an approval queue for a person, and fix says so.

try {
  await agent.emails.send(message);
} catch (err) {
  if (err instanceof AgentiSendError) console.error(err.code, err.fix);
}

Coming from Resend

agentisend/compat-resend exports a Resend class with every method the Resend SDK has and its { data, error } return shape, so the migration is the import line. Where AgentiSend is stricter, the shim warns on stderr instead of changing what it does.

Everything else

The full client (emails, domains, webhooks, apiKeys, limits, templates, contacts, broadcasts, trust), the CLI and the MCP server are documented at agentisend.com/docs. The MCP server is https://api.agentisend.com/mcp; the API contract is agentisend.com/openapi.json. This package re-exports @agentisend/sdk-node, which also installs the agentisend command-line tool.

Keywords

email

FAQs

Package last updated on 22 Sep 2026

Related posts