Learn how to build an autonomous AI agent that composes and sends emails using tool calling, with Reloop handling delivery.
What an email-capable agent looks like
Modern LLMs support tool calling: you define a function, describe it in natural language, and the model decides when and how to call it. Wiring send_email as a tool turns any LLM into an agent that can compose, address, and dispatch email without a human in the loop.
Defining the send_email tool
1const tools = {2 send_email: {3 description: "Send an email to one or more recipients.",4 parameters: z.object({5 to: z.string().email(),6 subject: z.string(),7 body: z.string(),8 }),9 execute: async ({ to, subject, body }) => {10 await reloop.emails.send({11 from: "agent@yourdomain.com",12 to,13 subject,14 html: `<p>${body}</p>`,15 });16 return { sent: true };17 },18 },19};Building the agent loop
The agent loop runs until the model stops requesting tool calls. Each iteration feeds previous tool results back as context so the model can reason about whether the task is complete.
Guardrails you need
- Allowlist recipients: never let the agent send to arbitrary addresses without approval.
- Rate limiting: cap the number of emails per agent session.
- Human-in-the-loop for bulk: any send to more than one recipient should require confirmation.
Real-world use cases
- Customer support agent that drafts and sends resolution emails
- Scheduling assistant that confirms meetings via email
- Onboarding bot that triggers personalized welcome sequences
What's next
Combine this with Reloop's webhook events. When an email is opened or clicked, feed that signal back to the agent as context to trigger a follow-up action.
Read more
How to Use AI to Generate Transactional Email Templates
Use LLMs to generate, personalize, and iterate on transactional email templates, then send them reliably with Reloop.
Vercel AI SDK + Reloop: Send Smart Notifications from Your AI App
Combine the Vercel AI SDK's tool calling with Reloop to trigger intelligent, context-aware email notifications from any AI-powered Next.js application.
I Let an AI Agent Read and Reply to My Emails. Here's How the Infrastructure Works.
Building an AI agent that reads and replies to email is easy in LangChain. Owning the send-and-receive layer is the hard part, and why open-source email infrastructure matters.
How We Handle Email Bounce Processing Automatically
Inside Reloop's bounce processing pipeline: classifying hard vs soft bounces, updating suppression lists, and protecting sender reputation automatically.
Ship your first email with Reloop
in minutes.
Open-source, deliverability-focused, and yours to self-host or run on Reloop Cloud. No lock-in, no rewrite later.