By the end of this guide, an AI agent built with the Vercel AI SDK can send transactional emails on its own: you expose aDocumentation Index
Fetch the complete documentation index at: https://docs.senderkit.com/llms.txt
Use this file to discover all available pages before exploring further.
sendEmail tool backed by
SenderKit, and the model decides when to call it and dispatches a real templated send.
This is the inverse of the MCP server — there, an assistant operates
SenderKit for you in your editor. Here, your own app’s agent sends through SenderKit
as part of whatever it’s doing: an onboarding bot that emails a setup guide, a support
agent that confirms a resolution, a workflow that notifies on completion.
You’ll need: a SenderKit account with an API key, a model
provider key (the example uses OpenAI), and a Node.js or Next.js app. Use an
sk_test_
key — an agent deciding to email people is exactly when you want sends going nowhere
real until you trust it.Author a template for the agent to send
Give the agent a template to target rather than letting it
compose raw HTML — the copy stays controlled and editable while the agent only chooses
who and what variables. For this example, reuse a
welcome template with a name
variable (see Send a welcome email).Define the sendEmail tool
A tool is a typed function the model can call. Constrain its inputs tightly — a
The value
zod enum of known template slugs, a validated email — so the model can’t send
anything you didn’t intend.lib/tools/send-email.ts
execute returns is fed back to the model, so it can confirm what it did
(“queued message msg_… to ada@example.com”).Wire the tool into the agent
Pass the tool to
generateText (or streamText) and allow multiple steps so the model
can call the tool, read the result, and reply.app/agent.ts
Verify it works
Run it with your
sk_test_ key. The agent calls sendEmail, SenderKit accepts the
send, and in test mode runs the full lifecycle without touching a
provider. Confirm it landed:What’s next
MCP Server
The other direction — operate SenderKit from your AI editor.
Sending
Idempotency, raw sends, and the async model.
Welcome on signup
The template this agent sends, authored end to end.
TypeScript SDK
The full
send() surface the tool wraps.