Skip to main content

Resend

Give agents tools to send email and broadcasts, and manage contacts, segments, domains, templates, and webhooks in Resend through Mastra Connect. Each tool call goes through the Mastra platform, which adds the connection's credential. Your application never stores Resend credentials.

Connect
Direct link to Connect

Before you start, complete the Connect setup to install @mastra/connect and configure your platform project.

note

Connect Resend with an API key that has Full access permission. A Sending access key fails to connect because Mastra checks a new key by listing your domains, which sending access keys can't do.

Connect an account
Direct link to Connect an account

Run this command from the directory that contains your .env file:

mastra connect add resend

The CLI guides you through Resend's authorization and waits until the connection is active.

Add tools to an agent
Direct link to Add tools to an agent

Pass tools() to the agent and select the resend provider:

src/mastra/agents/resend-agent.ts
import { Agent } from '@mastra/core/agent'
import { tools } from '@mastra/connect'

export const resendAgent = new Agent({
id: 'resend-agent',
name: 'Resend agent',
instructions:
'You help people send email and broadcasts, and manage contacts, segments, domains, templates, and webhooks in Resend.',
model: 'openai/gpt-6-luna',
tools: tools({ providers: ['resend'] }),
})

The agent gets 80 Resend tools, with keys such as resend_add_contact_to_segment. See Resend tools for the full list, and the tools() parameters to restrict tools or require approval before a call runs.

On this page