AgentMail Skill
AgentMail gives an agent its own email inbox for sending mail, receiving
replies, completing email OTP flows, and running inbound email loops. Use it for
agent-owned inboxes, not a user's existing IMAP/SMTP mailbox.
Use the agentmail CLI first. Use MCP only when the harness expects MCP tools;
use REST only when the CLI is missing a required operation.
When to Use
- The agent needs an email address it owns.
- The task involves email OTP flows, replies, threads, labels, or attachments.
- The agent needs webhook or WebSocket delivery for inbound mail.
Prerequisites
- Run commands through the
terminal tool.
- Install the CLI:
npm install -g agentmail-cli@latest
export AGENTMAIL_API_KEY="am_..."
No API key yet? Use signup.md.
How to Run
Use --format json whenever another command or script needs IDs.
agentmail inboxes list --format json
Quick Reference
- AgentMail agent reference: hosted copy.
- AgentMail: product landing page.
- Console: API keys and account management.
- Docs: full product documentation.
- signup.md: self-signup and OTP verification.
- core.md: inboxes, messages, threads, labels, attachments.
- webhooks.md: events to a public HTTPS server.
- websockets.md: events to a local agent process.
- mcp.md: MCP integration.
Procedure
- Install
agentmail-cli@latest and verify agentmail inboxes list --format json.
- If no API key is available, complete signup.md.
- Use core.md for inbox, send, read, reply, forward,
label, thread, and attachment flows.
- Add webhooks.md or
websockets.md only when polling is not enough.
Pitfalls
- Prefer
AGENTMAIL_API_KEY over --api-key.
- Never expose
AGENTMAIL_API_KEY in prompts, logs, URLs, or committed files.
- Use stable
client_id values for retried create operations.
- Prefer
extracted_text or extracted_html for LLM input when present.
- React to
message.received, not messages the agent sent.
Verification
agentmail inboxes list --format json
1---2name: agentmail3description: Use when an agent needs AgentMail CLI email inboxes.4license: MIT5---67# AgentMail Skill89AgentMail gives an agent its own email inbox for sending mail, receiving10replies, completing email OTP flows, and running inbound email loops. Use it for11agent-owned inboxes, not a user's existing IMAP/SMTP mailbox.1213Use the `agentmail` CLI first. Use MCP only when the harness expects MCP tools;14use REST only when the CLI is missing a required operation.1516## When to Use1718- The agent needs an email address it owns.19- The task involves email OTP flows, replies, threads, labels, or attachments.20- The agent needs webhook or WebSocket delivery for inbound mail.2122## Prerequisites2324- Run commands through the `terminal` tool.25- Install the CLI:2627```bash28npm install -g agentmail-cli@latest29```3031- Export an API key:3233```bash34export AGENTMAIL_API_KEY="am_..."35```3637No API key yet? Use [signup.md](references/signup.md).3839## How to Run4041Use `--format json` whenever another command or script needs IDs.4243```bash44agentmail inboxes list --format json45```4647## Quick Reference4849- [AgentMail agent reference](https://agentmail.md): hosted copy.50- [AgentMail](https://agentmail.to): product landing page.51- [Console](https://console.agentmail.to): API keys and account management.52- [Docs](https://docs.agentmail.to): full product documentation.53- [signup.md](references/signup.md): self-signup and OTP verification.54- [core.md](references/core.md): inboxes, messages, threads, labels, attachments.55- [webhooks.md](references/webhooks.md): events to a public HTTPS server.56- [websockets.md](references/websockets.md): events to a local agent process.57- [mcp.md](references/mcp.md): MCP integration.5859## Procedure60611. Install `agentmail-cli@latest` and verify `agentmail inboxes list --format json`.622. If no API key is available, complete [signup.md](references/signup.md).633. Use [core.md](references/core.md) for inbox, send, read, reply, forward,64 label, thread, and attachment flows.654. Add [webhooks.md](references/webhooks.md) or66 [websockets.md](references/websockets.md) only when polling is not enough.6768## Pitfalls6970- Prefer `AGENTMAIL_API_KEY` over `--api-key`.71- Never expose `AGENTMAIL_API_KEY` in prompts, logs, URLs, or committed files.72- Use stable `client_id` values for retried create operations.73- Prefer `extracted_text` or `extracted_html` for LLM input when present.74- React to `message.received`, not messages the agent sent.7576## Verification7778```bash79agentmail inboxes list --format json80```