How do I set up allowlists and blocklists?
Allowlists and blocklists let you control who your AI agent can communicate with. This is a critical safety feature for autonomous agents running in production with minimal human oversight.
How Lists work
AgentMail provides four list types based on two dimensions, direction (send or receive) and type (allow or block):
Each entry can be either a full email address (e.g., partner@example.com) or an entire domain (e.g., example.com).
Setting up lists via the SDK
Add an entry
List entries
Remove an entry
Common patterns for agents
Outreach agent: Use a send allowlist to restrict your agent to only email verified prospects. This prevents the agent from accidentally emailing the wrong people.
Personal Agent (Openclaw, Manus, etc.): Use a receive allowlist to restrict your agent to only respond to emails from specific people or domains.
Anti-spam: Use a receive blocklist to filter out known spam senders or unwanted automated emails.
Why this matters for agents
Without guardrails, an autonomous agent could email the wrong people, respond to phishing attempts, or get caught in infinite email loops with another bot. Lists are your safety rails. They are especially important for:
- Production agents operating with minimal human oversight
- Outreach agents that should only contact approved recipients
- Support agents that should only respond to known customers
- Any agent that needs protection from spam, phishing, or abuse
For more details on the Lists API, see the Lists core concept documentation.
