Skip to main content
Give your agents email superpowers. Just set env vars — tools auto-detect the right backend.
The user asks about mail; the agent reads or sends email through the configured inbox tool.

Quick Start

1

Simple Usage

Set either backend via env vars — same code works for both:

2

With Configuration

Use the same tool with an agent — see Usage with Agent below, or pass env vars and options from the sections above.

Available Tools

These work with both backends. Just set env vars and go.

AgentMail-Only Tools

When a tool isn’t supported on the active backend, it returns a friendly fallback message — no errors.

Using Tool Profiles


Backward-Compatible Aliases

These still work but the auto-detect tools above are preferred:

Environment Variables

If both AGENTMAIL_API_KEY and EMAIL_ADDRESS are set, AgentMail is preferred.

Gmail Setup

  1. Enable 2-Factor Authentication
  2. Generate App Password at Google Account
  3. Use App Password as EMAIL_PASSWORD

How It Works


Best Practices

For Gmail and Outlook, generate an App Password and set it as EMAIL_PASSWORD. Never store your real account password.
Set the env vars for one backend and use the auto-detect tools — the same agent code works for AgentMail or SMTP/IMAP.
Give the agent only the email tools it needs. A read-only assistant should not include send_email.
Use search_emails with from_addr, subject, or date filters so the agent processes a focused set of messages.

Email Bot

Deploy always-on email bots with event-driven modes

Messaging Bots

All supported messaging platforms