Skip to main content

The short answer

Give each agent its own inbox for clear ownership. When Agent A receives something it can’t handle, use Commune’s send API to forward the email to Agent B’s inbox, passing the thread_id so the receiving agent gets full conversation history. For complex routing, put a triage agent at the front that classifies every inbound email and routes to the right specialist.

Why routing matters

A single agent handling all email works until it doesn’t. The moment you have two types of work — support and billing, or English and Spanish, or simple and complex — you need routing. Without it, every agent sees every email and you’re writing if/else spaghetti inside one monolith. Good routing gives you:
  • Separation of concerns — each agent has a focused prompt and toolset
  • Independent scaling — the billing agent can be a different model than the support agent
  • Clear metrics — you know exactly which agent is slow, which has high bounce rates, which customers prefer
  • Graceful degradation — if one agent is down, the others keep working

Pattern 1: Inbox-per-agent

The simplest pattern. Each agent owns an inbox. Emails arrive at the right agent because the sender used the right address.
This works well when your users know which address to email. For customer-facing products, publish support@, billing@, etc. on your website.

Pattern 2: Triage agent

When all email arrives at a single address (like hello@yourdomain.com), you need a triage agent. It reads every inbound email, classifies the intent, and routes to the right specialist.
The triage agent never replies to the customer directly. It classifies and forwards. The specialist agent picks up the thread and responds.

Preserving thread context

When you forward an email between agents, pass the thread_id. This is the critical piece that makes multi-agent routing feel seamless to the customer. The receiving agent can fetch the full conversation history before generating its response:

Escalation to humans

Not every email should be handled by an agent. Build an escape hatch for cases where agent confidence is low, the customer is frustrated, or the request requires human judgment.
TypeScript

Choosing a pattern

Start with the simplest pattern that works. You can always add a triage layer later without changing your specialist agents — just point the triage agent’s forwarding at the existing inbox addresses.

Per-agent inboxes

Creating and managing one inbox per agent with reputation isolation.

How does Commune thread emails?

Thread resolution ensures forwarded emails maintain conversation context.

Structured Extraction

Auto-extract fields from inbound emails to power classification and routing.

Webhooks

Webhook event types and payload schemas for inbound email routing.
Last modified on March 19, 2026