Every agent workflow follows the same optimistic arc. Log in, call an API, parse JSON, move on. Then at step four it hits a signup form that wants an email address.
For a human that is thirty seconds. For a headless process it is a hard stop: something has to create a mailbox, wait for an SMTP delivery from a provider that has no reason to trust you, pull a six digit code out of HTML that changes every release, and get it back into the running job before the code expires.
I wrote the same mailbox scraping loop twice before admitting the obvious: the inbox is infrastructure, and infrastructure belongs behind an interface.
What it looks like when the mailbox is just another API call:
POST /api/v1/mailbox
{ "label": "signup-stripe" }
=> { "address": "q7k2@kakan.email", "id": "mbx_..." }
POST /api/signup # whatever you are onboarding to
{ "email": "q7k2@kakan.email" }
GET /api/v1/mailbox/mbx_.../latest
=> { "subject": "Verify your email", "code": "418302" }
Three calls. No browser, no human in the loop. The address is the identity, the inbox is the queue.
Things that actually cost me time, in order:
Timing. Codes arrive in 2 to 30 seconds depending on the sender. Poll with backoff instead of sleeping ten seconds and hoping. Each provider has a different tolerance for polling, so keep the interval in config, not in a constant.
The code is not always the biggest number in the email. Some senders put order IDs, ticket numbers or timestamps above the verification code. A regex for six digits alone will bite you. Anchor on the sentence that mentions verification and keep a per-sender fallback.
Multipart bodies. The HTML part is prettier and usually where the code is styled, but the text/plain part is the one that survives template changes. Read plain first, fall back to HTML with tags stripped.
Disposability is a security decision, not a convenience. A throwaway inbox anyone can read is fine for a smoke test and wrong for anything holding a session token. Decide which one you are building before you pick a provider.
Cleanup. Inboxes leak. If nothing deletes them you end up with tens of thousands of dead addresses and a domain that starts appearing in abuse lists, which then hurts deliverability for the legitimate use too.
None of this is exotic. It is unglamorous plumbing that every agent project re-implements because it sits outside the interesting part of the problem.
The short version: stop writing an email client inside your agent. Make the mailbox a resource with a URL, a lifetime and a read endpoint, then let the agent treat it like any other API. That is what kakan.email is - a mailbox over HTTP with a create call, a read call and a TTL. It will not make your agent smarter. It just stops it from dying at step four.
Top comments (0)