My Claude Code agent had everything except an email address. Repo access. Shell. MCP tools. But the moment any task hit "verify your account" or "we sent you a code", it stalled and asked me to paste the link.
So I gave it an inbox. The whole setup was two commands. The change to its workflow was bigger than I expected.
The problem agents actually hit
Most "agentic" tasks fail at one of three points:
- Signup walls — agent registers for an API, has no inbox to confirm
- OTP loops — 2FA code lands in my inbox, not the agent's
- Async replies — agent sends a request, the response arrives by email, agent never sees it
The fix is not a smarter prompt. It is an actual email address the agent can read from and send to. Think of it as a real identity, not a CLI flag.
The setup
Two commands. No OAuth, no Gmail tenant, no Workspace seat.
# Install
brew install nylas/nylas-cli/nylas
# Auth with API key
nylas auth config --api-key YOUR_KEY
# Provision the agent's address
nylas agent account create coder@yourapp.nylas.email
That last command provisions a managed mailbox under your Nylas application's *.nylas.email zone. The grant uses provider=nylas — no third-party mailbox, no Workspace charges, no IMAP setup unless you want it.
If you want IMAP/SMTP for legacy tooling:
nylas agent account update coder@yourapp.nylas.email \
--app-password 'ValidAgentPass123ABC!'
Per the agent docs, the password must be 18-40 printable ASCII chars with at least one uppercase, lowercase, and digit.
What changed in my agent's workflow
Once Claude Code had access to the inbox, three things shifted:
1. Signups stopped being a manual handoff
I added one line to the agent's prompt:
When a service emails a confirmation link to coder@yourapp.nylas.email, run
nylas email list --unread --jsonto find it, extract the URL, andcurlit.
That replaced a 20-message chat loop where I'd paste links back and forth.
2. OTP codes route to the right place
The CLI ships an OTP extractor that returns the code straight to stdout:
nylas email list --unread --json | jq -r '.[] | select(.subject | test("verification|code"; "i")) | .body_text' | grep -oE '[0-9]{6}' | head -1
Or use the dedicated nylas otp get workflow. Either way the code never touches my inbox.
3. Agent-to-agent messaging works
When two of my agents need to coordinate, they email. It is the only protocol both sides already speak. No queue, no shared DB, no webhook setup.
Why not a Gmail account
I tried this first. The full Google OAuth setup for an agent identity took 45 minutes:
| Step | Time |
|---|---|
| Create dedicated Google account | 5 min |
| Enable 2FA | 3 min |
| Generate app password | 4 min |
| Set up OAuth consent screen | 12 min |
| Configure scopes | 6 min |
| Test send/receive | 8 min |
| Hit a Gmail throttle, debug | 7 min |
Compare to one nylas agent account create command, taking under 2 seconds.
The cost calculus
Gmail Workspace: $6 per user per month, plus the engineering overhead of managing OAuth refresh.
A managed agent account: no per-seat fee, no OAuth refresh, no per-user setup. The CLI handles the entire identity surface.
What I'd do next
Three concrete moves once the inbox is live:
-
Set policy + rules —
nylas agent policy createandnylas agent rule createlet you cap outbound volume and auto-archive inbound noise. Rules apply server-side, before your agent sees the message. -
Wire MCP —
nylas mcp installexposes email/calendar/contacts as MCP tools to Claude Code, Cursor, and Codex. -
Add a webhook —
nylas webhook create --triggers message.createdfires your endpoint the instant inbound mail arrives, no polling needed.
Next steps
- Create an AI agent email identity — the full agent-account walkthrough
- Give your AI coding agent an email address — Claude Code, Cursor, Codex setup over MCP
- Why AI agents need email — the longer argument for agent email identity
- Full command reference
Top comments (0)