We raised $6M in Seed FundingRead more
VercelVercel + AgentMail

Add email to your Vercel AI app

AgentMail is the fastest way to give a Vercel AI agent its own email inbox. Every user or agent gets a dedicated inbox, created programmatically from any Next.js route.

[ Install ]

One command

The AgentMail TypeScript SDK works seamlessly in Next.js API routes and serverless functions. Add email to any Vercel-hosted AI application in minutes.

1. Install the SDK
npm install agentmail
2. Add to Vercel environment variables
# vercel env add AGENTMAIL_API_KEY
# Or in the Vercel dashboard: Settings -> Environment Variables
3. Import in your Next.js route
import AgentMail from "agentmail";

const client = new AgentMail({
  apiKey: process.env.AGENTMAIL_API_KEY!,
});
[ Why email ]

Why your Vercel agent needs its own inbox

Multi-tenant by default

Create one inbox per user, per agent session, or per customer. AgentMail handles the namespace - you just pass a username. No DNS config, no email provider setup.

Works in serverless and Edge

The AgentMail SDK makes standard HTTPS requests. It works in Vercel serverless functions, Edge functions, and App Router route handlers without modification.

Programmatic inbox creation

Create 1,000 inboxes in a loop or create them on-demand when users sign up. There's no manual setup, no form to fill out - just an API call.

[ Code ]

Working code

// app/api/agent/inbox/route.ts
import AgentMail from "agentmail";
import { NextResponse } from "next/server";

const client = new AgentMail({ apiKey: process.env.AGENTMAIL_API_KEY! });

export async function POST(request: Request) {
  const { userId } = await request.json();
  const inbox = await client.inboxes.create();
  return NextResponse.json({ inboxId: inbox.inboxId, email: inbox.inboxId });
}
[ FAQ ]

FAQ

Common questions about AgentMail and Vercel.

Does AgentMail work with Next.js and the Vercel AI SDK?
Yes. The AgentMail TypeScript SDK works in any Node.js or Edge environment. Use it in Next.js API routes, route handlers, server actions, or as a tool in the Vercel AI SDK.
Can I create inboxes per user in a multi-tenant app?
Yes. AgentMail is designed for programmatic inbox creation at scale. Create one inbox per user on signup, or on-demand per agent session. Each inbox is isolated and has its own email address.
Does it work in Vercel Edge functions?
Yes. The AgentMail SDK makes standard HTTPS requests with no native dependencies. It is compatible with Edge runtimes.
How do I receive emails in a Vercel-hosted app?
Register a webhook endpoint pointing to your Vercel deployment. AgentMail will POST to it whenever a new email arrives. Your Next.js route handler processes it in real time.
Can I use custom domains for agent inboxes in a production app?
Yes. On the Developer plan and above, you can configure custom domains. Inboxes on your domain look like agent@yourcompany.com instead of agent@agentmail.to.
Why not just use the Gmail API or SendGrid?
Gmail API requires OAuth and was built for human accounts, not programmatic agent use. SendGrid handles sending only - no receiving, no threading, no reply parsing. AgentMail gives your Vercel agent a dedicated inbox it can create on demand, send from, receive on, and read - with full thread context and no credential sharing.

Give your Vercel agent its own inbox

Free tier. No credit card required. Inboxes ready in under a second.

Start for free

© 2026 AgentMail, Inc. All rights reserved.

Privacy PolicyTerms of ServiceSOC 2Subprocessors