Been building agentic workflows and kept running into the same problem: 2FA walls.
When an agent tries to sign up or log into a service that sends an email OTP, the options are terrible. You either dump the full email HTML into your LLM context (slow, expensive, fragile) or you write a polling loop that constantly checks for new emails.
AgentMailr solves this with long-polling. You create a named inbox for your agent, then call waitForOtp() which hangs the HTTP request open until the email arrives and returns just the extracted code.
const inbox = await client.createInbox({ "my-agent" })
// my-agent@agentmailr.com
const otp = await inbox.waitForOtp({ timeout: 60000 })
// returns "847291" automatically
Supports 4-digit, 6-digit, alphanumeric codes, and magic links.
Built this because I needed it. Would love feedback especially from people running agents at scale.
a few things people usually ask:
- yes it handles plain text, HTML, and subject line extraction. the parser picks the most likely OTP code across all three so you're not locked to a specific email format
- you can pass a `from` filter to only match emails from a specific sender domain, which helps avoid picking up the wrong code if your agent has multiple services sending to the same inbox
- the long-polling approach means your agent just blocks on one call instead of polling. no webhook server to maintain, no correlation logic to wire up
also wanted to mention - OTP/2FA is just the first thing we're solving. we're building out bulk email sending and marketing email support as well, so agents can do the full email loop: receive OTPs, send outreach at scale, run campaigns. the goal is to be the complete email layer for AI agents.
if you're running agents at scale and hitting edge cases, would love to hear what you're running into.