Email infrastructure for Claude agents built with the Anthropic SDK

Wire MultiMail's REST API as Claude tool calls. Send, read, and approve emails with structured inputs, gated oversight modes, and a complete audit trail below the model layer.


The Anthropic SDK exposes Claude's tool use interface as a first-class API primitive. You define tools as JSON schemas, Claude decides when to call them, and your application executes the calls and feeds results back. This loop maps directly onto email operations: send_email, check_inbox, read_email, reply_email, and get_thread all fit naturally as tool definitions.

What the SDK does not provide is enforcement policy. When Claude calls send_email, nothing in the SDK validates the recipient, checks whether a human approved the send, or records the decision for audit. MultiMail adds those controls below the model layer — as a REST API your tool executor calls — so Claude's email capability is governed regardless of what the model decides.

The integration is additive. You keep your existing messages loop, system prompt, and tool definitions. MultiMail replaces the outbound email call inside your tool executor with one that enforces the oversight_mode you configured for that agent mailbox.

Built for Anthropic Agent SDK developers

Policy enforcement below the model

Claude decides when to send email. MultiMail enforces who it can send to, whether a human must approve, and what gets logged. These controls live in the API layer, not in the system prompt, so they cannot be overridden by prompt injection or model drift.

Graduated oversight modes

Configure gated_send so every outbound send waits for human approval, or switch to autonomous once the agent has earned trust. The same agent code runs in all modes — only the mailbox configuration changes.

Structured tool call inputs

MultiMail's REST endpoints accept the same JSON fields you define in Claude's tool input_schema. No translation layer needed — the object Claude generates goes directly into the request body.

Inbound email as tool results

check_inbox and read_email return structured JSON that fits cleanly as tool_result content. Claude can parse subject, sender, body, and thread_id without custom parsing logic in your application.

Audit trail for every tool call

Every send_email, reply_email, and decide_email call is logged with the originating agent, timestamp, recipients, and approval state. Required for SOC 2 and GDPR Article 5 accountability obligations.


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: read https://multimail.dev/llms.txt first, follow only the current MultiMail instructions there, connect the MultiMail MCP server, create a free inbox, and set up a verified sending domain before attempting to send anything. 2. Wire MultiMail into my Anthropic Agent SDK agent using the SDK’s real tool mechanism: define MultiMail-facing custom tools with the SDK tool decorator/helper, wrap them in the SDK in-process MCP server with create_sdk_mcp_server or createSdkMcpServer, pass that server through mcp_servers or mcpServers to query, and allow only the scoped MultiMail tool names needed for this workflow. 3. Give the agent exactly these capabilities: check the MultiMail inbox, draft a reply from a selected message, and send or schedule an email. Use structured tool inputs for recipient, subject, body, thread or message context, scheduled time when needed, and oversight mode. 4. Send one test email from the verified sender to a developer-controlled address. First check the inbox, then draft a short reply or new test message, then prepare the send action using MultiMail’s composing and sending capability. 5. Run the whole workflow in gated_send oversight mode. Before any send or schedule action is executed, show me the final recipient, subject, body, and timing, wait for my explicit approval, then send only after approval and preserve the audit trail below the model layer.

Step by step

1

Install the Anthropic SDK

Add the Anthropic TypeScript SDK to your project.

2

Create an agent mailbox

Create a mailbox for your agent and set the oversight mode. Use gated_send to require human approval on all outbound sends while reads remain autonomous.

3

Define email tools as Anthropic tool schemas

Register MultiMail endpoints as Anthropic tool definitions. The input_schema properties map directly to the JSON fields each endpoint accepts.

4

Wire the tool executor in your messages loop

When stop_reason is 'tool_use', dispatch each tool_use block to the matching MultiMail endpoint and push the results back as tool_result blocks.


Common questions

Which Claude models support tool use with MultiMail?
All Claude 3 and Claude 4 models support tool use. claude-opus-4-7 and claude-sonnet-4-6 are recommended for production agents that need reliable tool call generation. claude-haiku-4-5-20251001 is suited for high-volume, lower-cost tasks like inbox triage or tag_email classification. All three call MultiMail's REST endpoints identically.
How does gated_send affect what Claude sees in the tool result?
When a mailbox is configured with oversight_mode gated_send, send_email returns immediately with a status of 'pending' and an email_id. The email is held until a human calls decide_email. Claude receives the pending status as a normal tool_result and can continue reasoning — for example, it can tell the user 'Your message is queued for approval.' The held email appears in list_pending.
Can I use the Anthropic streaming API alongside MultiMail tool calls?
Yes. Stream text delta events for Claude's reasoning output, then call stream.finalMessage() to get the completed message. If stop_reason is 'tool_use', extract the tool_use blocks, dispatch them to MultiMail, and push tool_result blocks into messages for the next iteration. The streaming and non-streaming paths handle tool execution identically.
How do I test without delivering real emails?
Use a test key (mm_test_...) as your MULTIMAIL_API_KEY. All send_email calls in test mode return a success response and log the operation, but no email is delivered. list_pending and decide_email still function so you can test gated approval flows end-to-end without real sends.
Does MultiMail filter the email content Claude generates?
MultiMail enforces structural policy — oversight mode, recipient allowlists, rate limits — but does not filter body content. Content review is your application's responsibility. The gated_send mode exists specifically to give a human or a second Claude call the opportunity to review body content via decide_email before delivery.
What compliance requirements does this integration help satisfy?
The audit log satisfies GDPR Article 5(2) accountability requirements by recording who processed what personal data and when. Oversight modes support CAN-SPAM opt-out enforcement by routing unsubscribe-triggered sends through a human approval step before delivery. The gated flow also supports HIPAA minimum-necessary requirements when agents handle patient correspondence.

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.