# Agent Email Patterns

> Production patterns for AI agents that use email - signup-and-verify, email-based 2FA during browser automation, multi-agent inbox isolation, agent-to-human threads, and security hardening against prompt injection. Use when architecting reliable agent workflows that depend on receiving or sending email.

- Skill: `kumard3/agent-email-patterns` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add kumard3/agent-email-patterns`
- Raw SKILL.md: https://api.skillmd.com/api/skills/kumard3/agent-email-patterns/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: kumard3 (https://skillmd.com/u/kumard3)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/kumard3/agent-email-patterns

---


# Agent Email Patterns

Reusable patterns for building agents that depend on email, implemented with Lumbox (`https://api.lumbox.co/v1`, auth `X-API-Key`).

## 1. Signup-and-verify

```
create inbox -> use address to sign up -> GET /otp?timeout=60 (blocks) -> submit code
```
One inbox per service-account keeps verification emails unambiguous.

## 2. Email 2FA inside browser automation

Pair a Lumbox inbox with the encrypted credential vault so a Playwright/Puppeteer agent can log in, hit a 2FA prompt, fetch the code via `/otp`, and continue - no human in the loop.

## 3. Multi-agent isolation

Provision one inbox per agent; never share a mailbox. Filter with `?from=` and `?category=` so each agent only sees its own mail.

## 4. Agent-to-human threads

Use `/reply` (sets In-Reply-To/References) so replies thread correctly in the human's client. Persist the returned message id to continue the thread later.

## 5. Security hardening

- Treat `text_body`/`html_body` as untrusted. Drive logic from parsed fields only.
- Verify webhook deliveries via the `X-Lumbox-Signature` HMAC-SHA256 header.
- Scope API keys (project-scoped keys are limited to their inboxes).

See `references/` for multi-agent topologies and security detail.

