Connect MultiMail to any Prefect workflow to send, receive, and gate email with human approval steps — without restructuring your pipeline's retry, scheduling, or observability logic.
Prefect is a Python workflow orchestration platform built for production reliability: retries, scheduling, observability, and deployments on any compute infrastructure. It is a natural fit for AI agent systems that process data, call external services, and need durable execution around those calls.
Email sits at the edge of many agent workflows — notifying stakeholders, parsing inbound requests, routing decisions to humans for review. Without a purpose-built API, agents reach for SMTP libraries or transactional email services designed for marketing teams, not for programmatic agents that need to read replies, wait for approvals, and maintain audit trails.
MultiMail provides a REST API designed for this pattern. Each endpoint maps directly to the operations a Prefect task would perform: send, reply, check inbox, read a message, tag for routing, or pause and wait for a human decision. Oversight modes let you configure how much autonomy the agent has at each stage of the flow, and changing the mode requires no flow restructuring.
MultiMail's gated_send and gated_all oversight modes hold a message in a pending queue until a human approves it. A Prefect task can poll GET /v1/oversight/pending on a retry schedule and raise until the message drops out of the queue — this is standard Prefect retry behavior with no custom webhook infrastructure required.
Prefect retries failed tasks automatically. MultiMail's send endpoint is idempotent when you pass an idempotency_key — if a task retries after a transient error, resubmitting the same request returns the existing message id rather than queuing a duplicate. Retry logic in your flow needs no deduplication guard.
MultiMail webhooks emit a structured payload on every inbound message, including sender, parsed body, thread ID, and tags. Point the webhook at a Prefect deployment's HTTP trigger endpoint to start a new flow run automatically for each incoming message.
Every MultiMail API call produces a structured audit event — sender, recipient, oversight mode, approval status, and timestamps. These surface in the MultiMail dashboard alongside delivery and approval history, and can be exported to the same observability stack your Prefect flows report to.
A single Prefect flow may need different email policies for different audiences: a gated_send mailbox for external customer mail, an autonomous mailbox for internal status messages. Send each class of mail from the mailbox whose oversight mode matches, so one deployment covers all of them without environment-specific branching.
No code, no dashboard. Paste this to your AI agent — it connects MultiMail, creates an inbox, and builds the flow for you.
Install Prefect and the requests library. Store your MultiMail API key as an environment variable for local development, or as a Prefect secret block for deployed flows.
Create a mailbox using MultiMail's POST /v1/mailboxes endpoint (admin scope). Set the mailbox's oversight_mode — it governs every message sent from this mailbox. AI disclosure is locked on and cannot be disabled.
Define each email operation as a Prefect task with a retry policy. Tasks raise on non-2xx responses so Prefect records failures and retries automatically.
Deploy the flow to a Prefect work pool with a schedule. The MULTIMAIL_API_KEY environment variable must be available in the worker environment.
Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a hosted MCP server. Formally verified in Lean 4.