Connect Superagent's managed AI assistants to MultiMail for sending, reading, and managing email — with human oversight for production-deployed agents.
Superagent is a platform for building and deploying AI assistants with tool use, memory, and RAG capabilities. MultiMail provides the email infrastructure layer that gives Superagent assistants the ability to send, receive, and manage email on behalf of users in production environments.
When agents run in production without direct developer supervision, email oversight becomes critical. MultiMail's default gated_send mode ensures every email drafted by a Superagent assistant requires human approval before delivery, providing the safety layer that production-deployed agents need.
Connect Superagent to MultiMail by configuring MultiMail API endpoints as custom tools in your Superagent assistant. The REST API approach works with Superagent's tool registration system, giving your assistant structured email capabilities.
Superagent assistants run in production without direct supervision. MultiMail's oversight modes provide the email safety layer that production agents need — from human approval for every send to fully autonomous operation.
Superagent supports custom tools that call external APIs. Register MultiMail's send_email, check_inbox, and reply_email as tools in your assistant for structured email capabilities.
Start with gated_send (assistant composes, human approves) and progress to autonomous as your Superagent assistant proves reliable. MultiMail's five oversight modes let you scale agent autonomy safely.
Superagent's built-in observability shows you how your assistant uses tools. Combined with MultiMail's audit logs, you get full visibility into every email action your agent takes.
Superagent supports multiple LLM providers. Your MultiMail email tools work the same regardless of which model powers your assistant, so you can switch providers without changing the email integration.
import requests
SUPERAGENT_API = "https://api.superagent.sh/api/v1"
SA_HEADERS = {"Authorization": "Bearer your_superagent_api_key"}
"cm"># Create a MultiMail send_email tool
requests.post(f"{SUPERAGENT_API}/tools", headers=SA_HEADERS, json={
"name": "send_email",
"description": "Send an email through MultiMail. In gated_send mode, "
"emails queue for human approval before delivery.",
"type": "FUNCTION",
"metadata": {
"url": "https://api.multimail.dev/v1/send",
"method": "POST",
"headers": {"Authorization": "Bearer mm_live_your_api_key"},
"parameters": {
"mailbox_id": {"type": "string", "description": "Mailbox to send from"},
"to": {"type": "string", "description": "Recipient email"},
"subject": {"type": "string", "description": "Subject line"},
"body": {"type": "string", "description": "Email body"}
}
}
})
"cm"># Create a MultiMail check_inbox tool
requests.post(f"{SUPERAGENT_API}/tools", headers=SA_HEADERS, json={
"name": "check_inbox",
"description": "Check inbox for recent messages.",
"type": "FUNCTION",
"metadata": {
"url": "https://api.multimail.dev/v1/mailboxes/{mailbox_id}/inbox",
"method": "GET",
"headers": {"Authorization": "Bearer mm_live_your_api_key"},
"parameters": {
"mailbox_id": {"type": "string", "description": "Mailbox to check"},
"limit": {"type": "integer", "description": "Max messages"}
}
}
})Configure MultiMail email endpoints as custom tools in your Superagent assistant using the API.
"cm"># Create an assistant with email capabilities
assistant_resp = requests.post(f"{SUPERAGENT_API}/assistants", headers=SA_HEADERS, json={
"name": "Email Assistant",
"description": "An AI assistant that manages email through MultiMail.",
"llmModel": "GPT_4O",
"prompt": "You are a professional email assistant. You can send, read, and "
"reply to emails using the provided tools. Emails are sent in "
"gated_send mode, which means they queue for human approval "
"before delivery. Always confirm the recipient and content "
"before sending. Be concise and professional in email drafts."
})
assistant_id = assistant_resp.json()["data"]["id"]
"cm"># Attach email tools to the assistant
for tool_name in ["send_email", "check_inbox"]:
tool_id = get_tool_id(tool_name) "cm"># Retrieve from previous step
requests.post(
f"{SUPERAGENT_API}/assistants/{assistant_id}/tools",
headers=SA_HEADERS,
json={"toolId": tool_id}
)
"cm"># Invoke the assistant
response = requests.post(
f"{SUPERAGENT_API}/assistants/{assistant_id}/invoke",
headers=SA_HEADERS,
json={"input": "Check my inbox and summarize any urgent messages"}
)
print(response.json()["data"]["output"])Set up a Superagent assistant with MultiMail email tools and a system prompt for email handling.
import requests
import json
MULTIMAIL_API = "https://api.multimail.dev/v1"
MM_HEADERS = {"Authorization": "Bearer mm_live_your_api_key"}
def send_email(mailbox_id: str, to: str, subject: str, body: str) -> dict:
"""Send an email via MultiMail. Queues for approval in gated_send mode."""
resp = requests.post(f"{MULTIMAIL_API}/send", headers=MM_HEADERS, json={
"mailbox_id": mailbox_id, "to": to, "subject": subject, "body": body
})
return resp.json()
def check_inbox(mailbox_id: str, limit: int = 10) -> dict:
"""Check inbox for recent messages."""
resp = requests.get(
f"{MULTIMAIL_API}/mailboxes/{mailbox_id}/inbox",
headers=MM_HEADERS, params={"limit": limit}
)
return resp.json()
def reply_email(message_id: str, body: str) -> dict:
"""Reply to an email, maintaining thread context."""
resp = requests.post(f"{MULTIMAIL_API}/reply", headers=MM_HEADERS, json={
"message_id": message_id, "body": body
})
return resp.json()
"cm"># Use these functions as tool implementations
"cm"># in your Superagent workflow or custom agent loop
result = check_inbox("mbx_abc123", limit=5)
print(f"Found {len(result.get(&"cm">#039;messages', []))} messages")For more control, build a custom agent loop using Superagent's SDK with MultiMail API calls.
Sign up at multimail.dev, create a mailbox, and generate an API key from your dashboard. Your key will start with mm_live_.
Sign up for Superagent and obtain your API key. You can use the hosted platform or self-host the open-source version.
pip install superagent-pyCreate custom tools in Superagent that map to MultiMail's API endpoints — send_email, check_inbox, reply_email, and others.
Create a Superagent assistant with a system prompt that explains email oversight modes. Attach the MultiMail tools to the assistant.
If your mailbox uses gated_send mode (the default), review and approve pending emails in the MultiMail dashboard before they are delivered.
Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 38-tool MCP server. Formally verified in Lean 4.