# Agentic Inbox

> Self-hosted email client with a built-in AI agent, running entirely on Cloudflare Workers

- Category: Agents & Automation / Assistants & Chatbots
- Language: TypeScript
- Licence: Apache-2.0
- Repository: https://github.com/cloudflare/agentic-inbox
- Canonical page: https://ai-tldr.dev/tools/agentic-inbox/
- Updated: 2026-04-16

## In short

Agentic Inbox is an open-source email client that runs on your own Cloudflare account. It sits in the Assistants & Chatbots category of the Agents & Automation tools and is open-source, written in TypeScript and licensed Apache-2.0. To get started: run it locally first.

## Overview

Agentic Inbox is an open-source email client that runs on your own Cloudflare account. Incoming mail arrives through Cloudflare Email Routing, each mailbox lives in its own Durable Object with a SQLite database, attachments go to R2, and the whole thing — API, server-side rendering and UI — is served by a single Hono Worker. The result is a full webmail app with a rich-text composer, reply and forward threading, folders, search and attachments, without a mail server to operate.

What makes it more than a webmail client is the agent panel beside the message list. Built on the Cloudflare Agents SDK (`AIChatAgent`) and Workers AI, the agent has nine email tools for reading, searching, drafting and sending. It can auto-draft a reply the moment a message lands, keep a persistent chat history per mailbox, take a custom system prompt, and stream markdown responses with its tool calls visible. Sending always requires explicit confirmation.

The project accompanies Cloudflare's Email for Agents launch and doubles as the reference application for it: it exercises Email Routing for inbound, Email Service for outbound, Durable Objects for per-mailbox state, and an MCP server at `/mcp` so external tools such as Claude Code or Cursor can operate on a mailbox. Cloudflare Access is the trust boundary — the app refuses to run in production without it, and any user who passes the Access policy can reach every mailbox in the deployment.

## What it does

- Full email client on Cloudflare Workers: send and receive via Email Routing with threading, folders, search and attachments
- Per-mailbox isolation — every mailbox is its own Durable Object with SQLite storage, with attachments in R2
- Built-in AI agent side panel with nine email tools for reading, searching, drafting and sending
- Auto-draft on new mail: the agent reads inbound messages and prepares a reply, always requiring explicit confirmation before sending
- Per-mailbox custom system prompts, persistent chat history, streaming markdown and visible tool calls
- MCP server at /mcp so external AI tools can operate on mailboxes
- Cloudflare Access JWT validation enforced outside local development

## Getting started

Agentic Inbox deploys to your own Cloudflare account. You need a Cloudflare account with a domain, Email Routing enabled for receiving, Email Service enabled for sending, Workers AI enabled for the agent, and Cloudflare Access configured for any deployed environment. The Deploy button is only the first half of setup — the post-deploy steps are required.

1. Run it locally first

   Install dependencies and start the dev server to see the app before you deploy.

```bash
npm install
npm run dev
```

2. Configure your domain and storage

   Set your domain in wrangler.jsonc, then create the R2 bucket the app expects for attachments.

```bash
wrangler r2 bucket create agentic-inbox
```

3. Deploy to Cloudflare

   Deploying provisions R2, Durable Objects and Workers AI. You can also use the Deploy to Cloudflare button in the README, which prompts for the DOMAINS value — the domain you want to receive mail for.

```bash
npm run deploy
```

4. Turn on Cloudflare Access

   Enable one-click Cloudflare Access on the Worker under Settings > Domains & Routes. The modal shows POLICY_AUD and TEAM_DOMAIN — set both as Worker secrets. The app intentionally refuses to serve production traffic without Access, so your inbox is never exposed to the internet.

5. Wire up mail routing and create a mailbox

   In the Cloudflare dashboard, open your domain's Email Routing and create a catch-all rule forwarding to this Worker. Enable Email Service so the Worker gets the send_email binding for outbound mail. Then visit the deployed app and create a mailbox for any address on your domain.

## When to use it

- Run a private, self-hosted inbox on your own domain with no mail server and no third-party mail provider reading your messages
- Give an agent a real mailbox so it can triage inbound mail and prepare drafts you approve before anything is sent
- Use it as a working reference for Cloudflare's Agents SDK, Email Routing and Durable Objects when building your own email-driven agent
- Expose a mailbox over MCP so a coding agent or desktop assistant can search and draft mail as part of a larger workflow

## Version history

- 2026-04-16: Cloudflare opened Email for Agents in public beta — Workers-based agents can send and receive mail natively with an SDK onEmail hook, HMAC-signed reply routing and Durable Objects state. Agentic Inbox is the reference application published alongside it.
