Replit is a vibe-coding tool one of the most popular out there and has exploded for people building apps. now with agent 4, people are using replit to build automations and agents but find themselves needing a purpose-built solution that can handle two-way back and forth conversations while keeping threads and message history intact.
We’re thrilled to share AgentMail is now live on Replit as a connector, gives every agent built there its own inbox to send, receive, and remember email threads
What you can build now
With this integration, every Replit project can use real, programmable email inboxes. You can now send, receive, thread, reply to, and label emails. Here’s what you can do with these features:
You can build your own Gmail. Set up thousands of inboxes for users, agents, or workflows, all managed under one organization. With AgentMail's Pods, you get built-in multi-tenancy, keeping each customer's email separate. It also includes behavior control and abuse prevention. Enjoy the features of a mature email product without having to build the infrastructure yourself.
You can build an outreach tool that handles replies. Send personalized emails, read the responses, continue the thread - no human intervention needed. Works well for cold outreach, lead follow-up, waitlist drips, or tracking recruiter responses on job applications.
You can plug email into workflows where critical things happen. For example, you can forward a receipt and have it automatically added to a spreadsheet. Email a contract to start a review process. Send an invoice to begin an approval chain. Share a status update in a thread, and the agent will pull out action items and assign them. People already rely on email for these tasks. AgentMail lets your Replit app work directly within these familiar workflows, so users don’t have to switch to a new interface.
A monitoring app that acts on replies. Your app sends an alert when something needs attention. The user replies “snooze” or “fix it” and the app actually does something with that response instead of ignoring it.
Each agent gets its own isolated inbox. Nothing bleeds between workflows.
Want to see a quick example of the integration in action? Here's a forkable AI SDR agent - it sends cold emails from a dedicated AgentMail inbox, watches for replies, classifies intent, auto-responds in-thread, and CC's you when someone is interested. Fork it on Replit.
How the integration works
In Replit, go to your project’s Integrations tab, find AgentMail, click Connect, and paste your API key from the AgentMail console. That’s the entire setup.
Replit uses Mastra, a TypeScript agent framework, to read the AgentMail API and automatically generate a complete set of tools for your project. You don’t have to write any wiring code.
Here’s exactly what gets generated:
import { createTool } from '@mastra/core/tools'
import { z } from 'zod'
import { AgentMailClient } from 'agentmail'
const listInboxesTool = createTool({
id: 'list-inboxes',
description: 'List inboxes',
inputSchema: z.object({
limit: z.number().optional(),
pageToken: z.string().optional(),
}),
execute: ({ context }) => {
const client = new AgentMailClient()
return client.inboxes.list(context)
},
})
const createInboxTool = createTool({
id: 'create-inbox',
description: 'Create inbox',
inputSchema: z.object({
username: z.string().optional(),
domain: z.string().optional(),
displayName: z.string().optional(),
}),
execute: ({ context }) => {
const client = new AgentMailClient()
return client.inboxes.create(context)
},
})
const sendMessageTool = createTool({
id: 'send-message',
description: 'Send message',
inputSchema: z.object({
inboxId: z.string(),
to: z.union([z.string(), z.array(z.string())]),
subject: z.string().optional(),
text: z.string().optional(),
html: z.string().optional(),
}),
execute: ({ context }) => {
const client = new AgentMailClient()
return client.inboxes.messages.send(context.inboxId, context)
},
})
const replyToMessageTool = createTool({
id: 'reply-to-message',
description: 'Reply to message',
inputSchema: z.object({
inboxId: z.string(),
messageId: z.string(),
text: z.string().optional(),
html: z.string().optional(),
}),
execute: ({ context }) => {
const client = new AgentMailClient()
return client.inboxes.messages.reply(context.inboxId, context.messageId, context)
},
})
// + deleteInbox, listThreads, getThread, updateMessage
export const tools = {
listInboxesTool,
createInboxTool,
sendMessageTool,
replyToMessageTool,
// ...
}
All eight tools are typed and ready to use. Drop them in and start building, Mastra handles everything underneath.
Full documentation: docs.agentmail.to/integrations/replit
Get started
- Sign up for Replit
- Sign up for AgentMail
- In your Replit project, go to Integrations → find AgentMail → Connect → paste your API key.
- Mastra auto-generates the eight tools — start using them immediately.
About AgentMail
We built AgentMail because agents need email infrastructure designed for them. Gmail wasn’t built for programmatic inbox creation. We built something where creating an inbox is a single API call, threads are queryable, messages arrive via webhooks, and pricing scales with what you actually use.
Replit is the ideal platform for this. Many agent-native apps are being built there quickly by people who want to launch products, not manage infrastructure. AgentMail fits naturally into this workflow.
If you build something interesting, we’d love to see it.


