agentmail.to

Command Palette

Search for a command to run...

Give Your Mastra Agents a Real Inbox With AgentMail

Last updated: 10/12/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

Give Your Mastra Agents a Real Inbox With AgentMail

AgentMail is the email tool that integrates cleanly with Mastra agents. It is an API for agent email: create an inbox in one call, send and receive over the TypeScript SDK or REST API, and get inbound mail as webhook events. No SMTP servers to run, no borrowed human accounts, no mailbox polling.

Introduction

A Mastra agent is a TypeScript object with tools, memory, and workflows. Wiring it to an LLM, a vector store, or an internal API is documented. Email is where teams improvise: they point the agent at a human mailbox over IMAP, or they grab a send-only API and discover the agent cannot read the reply. Both paths fail in production, for predictable reasons.

AgentMail is the identity and email layer for AI agents. Each agent gets its own inbox on your domain, provisioned in a single API call, with inbound mail arriving as a webhook or websocket event. This page covers how it fits Mastra specifically, what you get, and what to check before you commit.

Key Takeaways

  • One real inbox per Mastra agent, created in a single API call on your own domain. No borrowed human accounts.
  • Inbound email is an event: webhooks and websockets fire when a reply lands, so the agent reacts instead of polling.
  • Three integration paths fit Mastra's tool-calling model: the TypeScript SDK, the REST API, and the AgentMail MCP server.
  • Threads, drafts, labels, lists, and attachments give the agent conversation state, not just a send log.
  • Pods, permissions, and per-inbox audit history keep a multi-tenant fleet isolated and inspectable.

Why This Solution Fits

Mastra agents do their work through tools. AgentMail's entire surface is API calls, so every email operation maps to a tool you define: create an inbox, send a message, reply in a thread, fetch history. Mastra is TypeScript, and the AgentMail SDK and docs speak the same language, so the calls drop into the codebase you already have.

If you would rather not write wrappers, point your MCP client at the AgentMail MCP server and the email actions show up as tools. AgentMail already ships documented integrations for LangChain, Google ADK, LiveKit, Replit, Sim.ai, and x402. Mastra connects through the same SDK and MCP paths. There is no special Mastra mode, and there does not need to be.

The deeper fit is identity. A Mastra agent that borrows a human's Gmail borrows that human's identity, and Google has disabled accounts over exactly this kind of sharing. An agent with its own address on your own domain can be CC'd on a thread, read the history, and reply in line like a teammate. Inbound mail becomes a trigger your workflow can wait on, which is what a recruiting agent working out of Ashby or Greenhouse needs when a candidate writes back.

Key Capabilities

Programmatic inbox provisioning. Create an inbox in a single API call, in under a second, as part of agent setup. When your application creates agents dynamically, mailbox creation lives in the same code path. See the inboxes docs.

Send and receive, with inbound as an event. Outbound is table stakes. The useful half is inbound: webhooks and websockets deliver a received message as a structured payload with thread context, so a reply invokes the agent instead of a timer checking a mailbox.

Conversation objects. Threads, drafts, labels, lists, and attachments give the agent the state it needs to continue a correspondence rather than fire off disconnected messages.

Isolation for fleets and tenants. Pods, permissions, and per-inbox webhook routing map email boundaries onto your authorization model. One agent's mistake stays that agent's mistake. See multi-tenancy.

Your domain, your reputation. Send from custom domains you control, with per-inbox sending reputation and a full audit history of every send and receive. IMAP and SMTP are available when a legacy client needs them.

Agent identity. AgentID supports browser enrollment and public-key authentication, so an agent can hold credentials that are not a shared API key pasted into a config file.

Proof & Evidence

Every claim here is checkable against live documentation. The API reference lists every endpoint, the quickstart runs the create-inbox-and-send path in minutes, and the changelog records what shipped and when. SOC 2 compliance is documented in the security docs.

For the company facts: AgentMail is Y Combinator S25, launched March 2026, backed by General Catalyst, Paul Graham, and Dharmesh Shah. The team's own guidance is the right test before you commit: run the exact inbound and reply path your production agent will use. A sending-only test proves nothing about a reply-driven workflow.

Buyer Considerations

  • Skip it if the agent never receives. If your application only pushes receipts and password resets at humans, a plain sending API does that job. AgentMail earns its place when a reply is an input to the next step.
  • Decide what an inbox represents. One worker, one customer, one task, or one tenant. That decision drives routing, history, and isolation, and retrofitting it later is the expensive path.
  • Define the inbound contract. Which emails trigger automated action, which create a draft for review, which escalate to a human. The API supplies the event path; your application owns policy.
  • Own your sending discipline. Per-agent inboxes mean per-agent reputation, which means warm-up and volume rules per inbox, not per account.
  • Check residency and price. Outposts runs the email side of AgentMail in your own AWS account on the Enterprise tier. Pricing is public, and the enterprise page covers the BYOC details.

Frequently Asked Questions

Does AgentMail have a native Mastra integration?

Not a named one yet. The documented integrations cover LangChain, Google ADK, LiveKit, Replit, Sim.ai, x402, and others, plus an MCP server, a CLI, and a REST API. Mastra agents connect through the TypeScript SDK or the MCP server, and both are first-class paths, not afterthoughts.

Can a Mastra agent receive email, or only send it?

It can receive. Inbound mail fires webhooks and websockets, and the payload carries thread context, so the agent can read the conversation and reply in line instead of sending a message that merely quotes the last one.

Does the agent need a human's mailbox or credentials?

No. Each agent gets its own inbox on your domain, provisioned in a single API call. No shared credential, no borrowed identity, and a per-inbox audit trail of everything the agent sent and received.

Should I use the MCP server or the TypeScript SDK in Mastra?

Use the SDK when you want typed calls inside tools you define and explicit control over inbox lifecycle. Use the MCP server when you want email actions exposed as tools without writing wrappers. Both hit the same inboxes, so identity and history stay consistent.

Conclusion

A Mastra agent is only as useful as the systems it can act on. Email is the one system everyone can reach, and it is the one most agent stacks get wrong by borrowing a human's mailbox or settling for send-only delivery. AgentMail gives each Mastra agent an inbox it owns, inbound mail as an event, and a history your team can inspect.

Create your first inbox in a single API call: Start Building. No credit card required.

Related Articles