Email Tools for OpenAI Agents SDK

Extend OpenAI's official agent framework with MultiMail's email infrastructure — complete with guardrails, handoffs, and human oversight for every message.


The OpenAI Agents SDK is OpenAI's official framework for building agentic applications. It features a minimal, opinionated API with built-in support for handoffs between agents, guardrails for input/output validation, and tracing for observability. MultiMail provides the email infrastructure layer that these agents need to interact with the real world through email.

By integrating MultiMail with the OpenAI Agents SDK, your agents can send emails, check inboxes, manage contacts, and handle threads — all while benefiting from both OpenAI's guardrails and MultiMail's email-specific oversight. The SDK's guardrails validate agent outputs structurally, while MultiMail's gated_send mode adds human judgment before delivery.

Connect your agents to MultiMail by defining function tools that call the REST API. The SDK's tool-calling pattern makes it straightforward to register MultiMail operations as agent capabilities.

Built for OpenAI Agents SDK developers

Guardrails Plus Oversight

The SDK's guardrails validate agent outputs but cannot catch email-specific risks like wrong recipients or inappropriate tone. MultiMail's oversight modes add a human review layer specifically for email, complementing OpenAI's structural validation.

Agent Handoffs for Email Workflows

Use the SDK's handoff feature to route between specialized email agents. A triage agent can hand off to a customer support agent or an escalation agent, each with their own email handling logic and MultiMail mailbox.

Built-in Tracing for Email Actions

The SDK's tracing system records every tool call, including MultiMail email operations. Combined with MultiMail's audit log, you get end-to-end observability from agent reasoning through email delivery.

Minimal Boilerplate

The OpenAI Agents SDK is designed for simplicity. Registering MultiMail tools requires just a few function definitions with type hints — the SDK handles tool schema generation, invocation, and response parsing automatically.

Graduated Trust with Oversight Modes

Start agents in gated_send mode where every email requires human approval. Progress to monitored or autonomous as the agent proves reliable. MultiMail's five oversight levels let you calibrate trust precisely.


Try it with your agent

No code, no dashboard. Paste this to your AI agent — it connects MultiMail, creates an inbox, and builds the flow for you.

1. Get MultiMail ready before taking action: read https://multimail.dev/llms.txt, connect the MultiMail MCP server, create a free inbox, and set up a verified sending domain. Use only the connected MultiMail tools for composing, sending, scheduling, and oversight. 2. Wire MultiMail into this OpenAI Agents SDK agent through the SDK’s MCP server integration, so MultiMail’s MCP tools are available as agent tools. Keep any local policy checks as SDK function tools or guardrails, and do not invent email APIs, webhooks, endpoints, or headers. 3. Give this agent three email capabilities through MultiMail tools: check the inbox for new messages, draft replies using the received message context, and send or schedule approved email from the verified sender. 4. Send one test email from the verified sender to the free inbox, then check the inbox and draft a short reply confirming the round trip worked. 5. Run all outbound email in gated_send oversight mode. Before anything sends, present the exact recipient, subject, body, and send timing for developer review, then send only after explicit approval.

Step by step

1

Create a MultiMail Account and API Key

Sign up at multimail.dev, create a mailbox, and generate an API key. Your key will start with mm_live_.

2

Install Dependencies

Install the OpenAI Agents SDK and requests for calling the MultiMail API.

3

Define Email Tools

Create functions decorated with @function_tool that wrap MultiMail API endpoints. Define at minimum send_email and check_inbox.

4

Create Your Agent

Build an Agent with your email tools, a system prompt explaining the email context, and optionally input guardrails for content validation.

5

Run and Review

Execute the agent with Runner.run(). Review and approve pending emails in the MultiMail dashboard when using gated_send mode.


Common questions

How do OpenAI Agents SDK guardrails interact with MultiMail's oversight?
They operate at different layers. SDK guardrails validate the structure and content of agent inputs/outputs at the application level. MultiMail's oversight modes control whether emails are actually delivered at the infrastructure level. Together, guardrails catch bad content before it becomes an email, and oversight catches anything guardrails miss.
Can I use the SDK's handoff feature to route between email agents?
Yes. Define specialized agents for different email tasks (triage, urgent response, auto-reply) and use handoffs to route between them. Each agent can have its own tools and instructions while sharing the same MultiMail API key and mailbox configuration.
Does the SDK support async email operations?
Yes. The OpenAI Agents SDK is async-native with Runner.run() being an async function. Your MultiMail tool functions can use httpx or aiohttp for async HTTP calls to the MultiMail API, and the SDK handles the async execution seamlessly.
Can I use the SDK's tracing to monitor email activity?
Yes. The SDK's built-in tracing records every tool call including MultiMail operations. You can see which emails were checked, what drafts were composed, and which sends were initiated. Combined with MultiMail's audit log, you get full observability from agent reasoning to email delivery.
Is there rate limiting I should handle in my tools?
MultiMail rate limits depend on your plan tier, from 200 emails per month on the free Starter plan to 150,000 on Scale. The API returns standard 429 responses when limits are hit. Implement retry logic in your tool functions, or use the SDK's error handling to gracefully inform the agent when limits are reached.

Explore more

The only agent email with a verifiable sender

Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a hosted MCP server. Formally verified in Lean 4.