Mastra gives you the primitives to build agent workflows. MultiMail adds the email delivery controls those workflows need — including graduated oversight when agents send customer-facing messages.
Mastra is a TypeScript framework that treats agents, tools, workflows, and memory as first-class application primitives. It's designed to make production AI systems feel like ordinary application code — typed, testable, and deployable alongside your existing stack.
Email is a natural fit for Mastra workflows: outreach sequences, notification pipelines, customer support drafts, and approval chains all involve sending or reading messages on behalf of a user or product. But Mastra itself doesn't provide email infrastructure — it expects you to wire in the services your workflow needs.
MultiMail fills that gap. You expose the MultiMail REST API as Mastra tools, and your agents call `send_email`, `check_inbox`, `read_email`, or `decide_email` the same way they call any other tool. If the workflow touches customer-facing messages, you configure oversight modes so humans approve sends before they leave.
Mastra workflows can run without a human in the loop. When those workflows draft emails, MultiMail's `gated_send` mode routes sends to an approval queue before delivery. Your workflow continues; the message waits. When the human approves via the MultiMail dashboard or API, the send completes and a webhook fires back to your workflow.
MultiMail provisions actual mailboxes — your own domain or `@multimail.dev`. Inbound email arrives as structured JSON via webhook, so your Mastra agent can call `check_inbox` or receive push events without parsing raw MIME. Threads, metadata, and attachment references are all first-class fields.
Every MultiMail operation maps cleanly to a Mastra tool: `send_email`, `reply_email`, `read_email`, `get_thread`, `set_tags`, `search_contacts`. Each takes a JSON input and returns a JSON result, which is exactly what Mastra's tool executor expects. No adapters, no glue layers.
You can set oversight mode per mailbox or per API call. Start a new agent workflow in `gated_all` mode — every action requires approval — then promote to `gated_send` or `monitored` as confidence grows. The mode is a parameter you control in code, not a global setting you change in a dashboard.
MultiMail's authorization and oversight models are proven correct in Lean 4. That means the invariants you rely on — an agent cannot send without approval in `gated_send` mode, a `read_only` agent cannot call `send_email` — are machine-checked, not just documented.
No code, no dashboard. Paste this to your AI agent — it connects MultiMail, creates an inbox, and builds the flow for you.
Sign up at multimail.dev. Your API key starts with `mm_live_` for production or `mm_test_` for sandbox. Set it as an environment variable in your Mastra project.
Mastra has a CLI that generates a project with agents, tools, and workflows pre-wired. No separate SDK install is needed for MultiMail — you call the REST API directly from your tools.
Create a `src/tools/multimail.ts` file that wraps the MultiMail REST endpoints as Mastra tools with Zod schemas. Export the tools you need: `sendEmailTool`, `checkInboxTool`, `readEmailTool`, `decideEmailTool`.
Import your MultiMail tools into a Mastra Agent definition. The agent's system prompt should explain what oversight mode to expect so it handles `pending_scan` responses (held for approval) correctly.
In the MultiMail dashboard, set your inbound webhook URL to your server's `/webhooks/multimail/inbound` endpoint. MultiMail will POST structured JSON for each received message, which you can use to trigger Mastra workflow runs.
Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a hosted MCP server. Formally verified in Lean 4.