agentmail.to

Command Palette

Search for a command to run...

On-Demand Inbox Creation: How Teams Give Agents a New Address Mid-Workflow

Last updated: 11/9/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

On-Demand Inbox Creation: How Teams Give Agents a New Address Mid-Workflow

Teams hit the same wall mid-workflow: an agent discovers it needs a new email address right now, and the options are a human mailbox, a pre-made pool, or an IT ticket. The teams that solve this treat an inbox as an API resource. One call provisions a real, working inbox, no DNS setup or domain verification required, and the agent keeps moving. AgentMail is built for exactly this: one API call returns an inbox with its own address, ready to send and receive, in under a second. See the inboxes docs or the quickstart.

Introduction

Most agent workflows assume the agent already has an address. Then reality shows up: a recruiting agent picks up a new client and should not mix that client's candidates into a shared mailbox. A research agent hits a site requiring an email signup, and the workflow stalls until someone provisions an address by hand.

The old answers are bad. Sharing a human's personal mailbox means borrowing that human's identity, and providers have disabled accounts over exactly this. Custom SMTP means weeks of engineering on a problem that should not exist. An IT ticket means the agent stops mid-workflow.

The pattern that works: treat an inbox as a primitive. Create it when you need it, use it, delete it when you are done. This article explains how the pattern works and where the failure modes are.

Key Takeaways

  • On-demand inbox creation means provisioning a real, send-and-receive-capable address through an API call at runtime, not a dashboard or IT request.
  • The bar is speed and completeness: creation in under a second, no DNS verification, and the inbox immediately able to send, receive, thread, and fire webhooks.
  • Per-agent or per-task inboxes give isolation by default: separate threads, credentials, and audit history.
  • Naming conventions and lifecycle management (create, use, delete) keep large inbox fleets manageable.
  • AgentMail does this with a single API call, works with LangChain, CrewAI, Google ADK, the Vercel AI SDK, the OpenAI and Claude Agent SDKs, MCP, or your own framework, and offers a free tier with 3 inboxes and 3,000 messages.

What On-Demand Inbox Creation Actually Means

An inbox created on demand is a real mailbox, not an alias and not a send-only address. The distinction matters because the whole point of giving an agent an address is that mail comes back: verification codes, replies, CCs on threads, webhook events.

A real on-demand inbox needs four things:

  1. A working address. The inbox can send and receive the moment it exists. No MX records to configure, no verification email to click.
  2. Programmatic control. Your code, not a dashboard, decides when the inbox exists. The same API that creates it can list messages, read threads, reply, and delete it.
  3. Event delivery. Inbound mail reaches your agent as a webhook or WebSocket event, not as something it polls for. See the webhooks overview and WebSockets docs.
  4. An identity trail. Everything the inbox sends and receives is logged, so you can audit the agent later.

If any of the four is missing, you do not have on-demand creation. You have a provisioning bottleneck with extra steps.

Why Agents Need a New Address Mid-Workflow

The common cases fall into a few buckets:

  • Per-client isolation. A recruiting agent working Ashby or Greenhouse pipelines for multiple clients should not share one mailbox across all of them. One inbox per client keeps threads and audit trails separate.
  • Per-task addresses. An agent doing signups or outreach can burn an address per task and discard it. Nothing links back to a shared identity.
  • Listener addresses. An address with a listener behind it becomes a write API: any system that can send email can hand work to your agent.
  • Tenant provisioning. In a multi-tenant product, a new tenant means new inboxes. If creation requires a human, onboarding has a manual step in an automated flow.

In every case the trigger is mid-workflow: the agent is running, it discovers the need, and the next step is an API call, not a ticket.

The Failure Modes Teams Hit Without It

Before the API-driven pattern, teams tried one of these:

  • Impersonating a human account. The agent sends from a person's personal mailbox. Replies land there, credentials are shared, and the account is one bad day from being disabled.
  • One shared agent mailbox. Every agent, every client, every task in one inbox. Threads collide, and there is no way to tell which agent sent what without reading headers.
  • Custom SMTP infrastructure. Months of engineering on deliverability, inbound parsing, and threading for a problem that is not your product.
  • Pre-provisioned pools. Someone creates 50 inboxes in advance and the workflow grabs the next free one. It works until the pool runs dry mid-run with nobody around to refill it.

All four share one root cause: email was not something the workflow could provision itself.

How the Pattern Works With AgentMail

AgentMail treats an inbox as a resource your code creates and owns. The flow:

  1. Create. One API call provisions an inbox on a managed domain, no DNS or domain verification required to get started. For addresses on your own domain, attach a custom domain once and new inboxes can use it.
  2. Use. The inbox sends and receives like any mailbox. Your agent replies in thread, attaches files, applies labels, and reads thread history. The API reference covers the operations.
  3. Listen. Inbound mail fires a webhook or arrives over a WebSocket, so the agent reacts in real time.
  4. Clean up. When the task or tenant ends, delete the inbox. The audit history of what it sent and received stays.

Because creation is a plain API call, it fits anywhere an agent runs: a LangChain tool, a CrewAI task, an MCP server, a Claude Code session, or a plain script. It is one piece of the stack, not the stack.

A few practical rules teams converge on:

  • Name inboxes deterministically. Encode the tenant, client, or task in the inbox ID or display name so an engineer can map an address back to its owner without querying anything.
  • Scope API keys. Use pod- and inbox-scoped keys so a compromised credential exposes one inbox, not the fleet. Pods isolate inboxes, threads, drafts, and keys per tenant.
  • Separate domains for reputation isolation. Sending reputation is per domain, not per inbox. Inboxes sharing a domain share its reputation, so put tenants that must not affect each other's deliverability on separate domains or subdomains.
  • Plan the lifecycle. Decide which inboxes are permanent (a tenant's main address) and which are ephemeral (a per-task signup address), and delete the ephemeral ones on a schedule.

What to Look For in an Implementation

If you are evaluating this, the checklist is short:

  • Creation latency measured in milliseconds, not minutes, with no verification steps before first send.
  • Receiving is first-class: webhooks, WebSockets, threads, and attachments, not a send-only API with a forwarding hack.
  • Isolation primitives (pods, scoped keys, per-inbox webhook routing) so per-tenant inboxes stay secure.
  • A free tier to prototype on. AgentMail's is 3 inboxes and 3,000 messages, with paid tiers on the pricing page.
  • SOC 2 Type II compliance if the inboxes touch customer data.

Frequently Asked Questions

How fast can an agent actually create a new inbox? Provisioning is a single API call and completes in under a second, with no DNS or domain verification required to get started. The inbox can send and receive immediately after the call returns.

Do we need our own domain before agents can send mail? No. Inboxes start on a managed domain so you can build and test with zero setup. When you want addresses on your own domain, attach it once through the custom domains flow and new inboxes can use it.

How do we keep one agent's mail separate from another's? Give each agent, client, or task its own inbox, and use pods with scoped API keys for per-tenant data isolation. Remember that sending reputation follows the domain, so use separate domains or subdomains when tenants must not share deliverability.

What happens to the mail when a task ends? Delete the inbox when the task or tenant is done. The record of what that inbox sent and received remains available for audit, so cleanup does not cost you the history.

Conclusion

On-demand inbox creation stops being hard the moment an inbox is an API resource instead of an infrastructure project. Create the address when the workflow needs it, let inbound mail arrive as events, keep identities isolated per agent or tenant, and delete what you no longer need. That is the whole pattern.

If your agents are still borrowing a human's mailbox or waiting on a provisioning ticket, fix it this afternoon: the quickstart gets you a working inbox in minutes, and you can start building. No credit card required.

Related Articles