Agentic Inbox: A Self-Hosted Email Client with AI on Cloudflare Workers

Summary
Agentic Inbox is an innovative self-hosted email client that integrates an AI agent, running entirely on Cloudflare Workers. It provides a modern web interface for managing emails, enhanced by AI capabilities for reading, searching, and drafting replies. This project leverages Cloudflare's robust ecosystem, including Email Routing, Durable Objects, R2, and Workers AI, to deliver a powerful and secure email solution.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
Agentic Inbox is an innovative open-source project from Cloudflare, offering a self-hosted email client powered entirely by Cloudflare Workers. This solution provides a modern web interface for sending, receiving, and managing emails, deeply integrated with an AI agent. It leverages Cloudflare's robust ecosystem, including Cloudflare Email Routing for incoming emails, Durable Objects for isolated mailboxes with SQLite databases, and R2 for attachment storage.
At its core, Agentic Inbox features an AI-powered Email Agent built with the Cloudflare Agents SDK and Workers AI. This agent can intelligently read your inbox, search conversations, and draft replies, significantly enhancing your email management experience.
Installation
Setting up Agentic Inbox involves a few key steps to integrate it with your Cloudflare account:
- Deploy to Cloudflare: Begin by clicking the "Deploy to Cloudflare" button. This process automatically provisions necessary Cloudflare services like R2, Durable Objects, and Workers AI. You will be prompted to specify the domain for which you want to receive emails.
- Configure Cloudflare Access: Enable one-click Cloudflare Access on your Worker via Settings > Domains & Routes. You must set the
POLICY_AUDandTEAM_DOMAINvalues, provided in the modal, as secrets for your Worker. - Set up Email Routing: In your Cloudflare dashboard, navigate to your domain's Email Routing settings and create a catch-all rule to forward emails to your deployed Worker.
- Enable Email Service: Ensure your Worker has the
send_emailbinding enabled to allow outbound email sending. Refer to the Email Service documentation for details. - Create a Mailbox: After deployment and configuration, visit your deployed application and create a mailbox for any address on your domain, for example,
hello@example.com.
For a comprehensive, step-by-step guide with screenshots, please refer to the detailed comment on GitHub: Setup Guide.
Key Features
Agentic Inbox is packed with features designed to provide a comprehensive and intelligent email experience:
- Full Email Client: Send and receive emails through Cloudflare Email Routing, featuring a rich text composer, reply/forward threading, folder organization, search capabilities, and attachment support.
- Per-Mailbox Isolation: Each mailbox operates within its own Durable Object, utilizing SQLite for storage and R2 for attachments, ensuring data isolation and scalability.
- Built-in AI Agent: A dedicated side panel offers 9 email tools, enabling the AI agent to read, search, draft, and send emails efficiently.
- Auto-Draft on New Email: The AI agent can automatically read incoming emails and generate draft replies, always requiring explicit user confirmation before sending.
- Configurable and Persistent: Enjoy custom system prompts per mailbox, persistent chat history, streaming markdown responses, and visibility into tool calls, allowing for a tailored AI experience.
Why Use It
Agentic Inbox offers a compelling solution for those seeking a powerful, private, and customizable email client. By self-hosting on Cloudflare Workers, you gain full control over your email data and infrastructure, benefiting from Cloudflare's global network and serverless architecture. The integration of an AI agent transforms email management, automating routine tasks and providing intelligent assistance for drafting responses and organizing your inbox. It's an excellent choice for developers and organizations looking to leverage modern cloud technologies and AI to enhance their communication workflows.
Links
- GitHub Repository: https://github.com/cloudflare/agentic-inbox
- Cloudflare Blog Post: Email for Agents
- Cloudflare Email Service Docs: Send Email with Workers