Skip to content

multimail-dev/ai-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@multimail/ai-sdk

MultiMail tools for the Vercel AI SDK. Give any AI agent the ability to send and read email through MultiMail.

Installation

npm install @multimail/ai-sdk ai zod

Quick Start

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { createMultiMailTools } from '@multimail/ai-sdk';

const tools = createMultiMailTools(process.env.MULTIMAIL_API_KEY!);

const { text } = await generateText({
  model: openai('gpt-4o'),
  tools,
  maxSteps: 5,
  prompt: 'Check my inbox for unread emails and summarize them.',
});

Streaming

import { streamText } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
import { createMultiMailTools } from '@multimail/ai-sdk';

const tools = createMultiMailTools(process.env.MULTIMAIL_API_KEY!);

const result = streamText({
  model: anthropic('claude-sonnet-4-20250514'),
  tools,
  maxSteps: 5,
  prompt: 'Reply to the latest email from alice@example.com saying thanks.',
});

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

Tools

Tool Description
listMailboxes List all mailboxes on the account
checkInbox List emails with filtering (status, sender, subject, direction, dates)
readEmail Read full email content (markdown body, attachments, tags)
sendEmail Send a new email with markdown body
replyEmail Reply to an existing email (auto-threads)
searchContacts Search contacts by name or email
listPending List emails awaiting human approval
decideEmail Approve or reject a pending email
getThread Get all emails in a conversation thread
tagEmail Add key-value tags to an email

Configuration

const tools = createMultiMailTools('mm_live_...', {
  baseUrl: 'https://api-staging.multimail.dev', // optional: override API URL
});

Oversight Modes

MultiMail enforces graduated trust through oversight modes. Depending on the mailbox configuration, outbound emails may require human approval before delivery. The listPending and decideEmail tools let agents participate in the approval workflow.

Learn more at multimail.dev/docs.

Compliance

MultiMail handles regulatory compliance at the infrastructure layer — no SDK-side code changes needed:

  • EU AI Act Article 50: Every AI-sent email includes a cryptographically signed ai_generated disclosure in the X-MultiMail-Identity header
  • US State Laws: Maine, New York, California, Illinois — AI disclosure built into email delivery
  • CAN-SPAM: Unsubscribe headers and physical address footers on all outbound email
  • Formally Verified: Lean 4 proofs of identity header tamper evidence

See multimail.dev/use-cases/eu-ai-act-email-compliance for details.

License

MIT

About

Vercel AI SDK tools for MultiMail — email capabilities for AI SDK agents

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors