For the complete site index, see llms.txt. Docs index: llms-docs.txt. Marketing corpus: llms-full.txt. Docs corpus: llms-full-docs.txt. Prefer markdown URLs where available (append .md).. Product skill: skill.md. Pricing: pricing.md. Docs MCP: /docs/mcp. Site MCP: /mcp.

AI & Automation/

Build an AI Agent That Sends Emails on Your Behalf

9 MINUTES READ

Summary

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

typescript
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.

W: 320.0px180R20∠45.0°

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.

Reloop