The Inbox That Inboxed Your AI: Self-Host Email with an Agent on Cloudflare Workers
You know that feeling when you have an email client, but you also want to build something that acts on those emails? Maybe you want to auto-archive newsletters, classify support tickets, or have an AI summarize your unread threads. You could cobble together a dozen APIs, fiddle with OAuth, and host it all on a VPS. Or, you could just deploy this.
Meet Agentic Inbox — a self-hosted, full-featured email client that comes with its own AI agent, and runs entirely on Cloudflare Workers. No servers. No containers. Just an email client that also does things for you.
What It Does
Agentic Inbox is an open source email client built for Cloudflare Workers + D1 (their serverless SQLite). But it’s not just any email client. It comes with an embedded AI agent that you can talk to. You can ask it to search emails, summarize threads, or even trigger actions like “reply to this” or “move to folder.” The agent lives in the same edge environment as your email client, so it’s fast and cheap.
In short: it’s a personal, private email assistant that runs at the edge, and you control every line of code.
Why It’s Cool
- No backend to manage. Deploy to Cloudflare Workers, and it just works. Email is fetched via IMAP/SMTP (or Gmail API), and the agent talks to an LLM of your choice (OpenAI, Anthropic, etc.) via Workers AI or an external API.
- AI is built right in. The agent understands your inbox context. It can answer questions like “What did Sarah say about the deploy timeline?” or “Summarize unread threads from today.” You can even chain actions: “Find the invoice from last month and reply asking for an update.”
- Batteries included. It has a modern UI (composable, component-based), OAuth for email providers, and the agent runs as a worker script. No Docker, no Nginx, no cron jobs.
- Self-hosted and private. Your emails stay on your Workers account. The only external calls are to your email provider and the LLM API. You can swap the model, rate-limit requests, or even rewire the agent logic.
How to Try It
The repo is at github.com/cloudflare/agentic-inbox. To get running:
- Fork the repo and open it with
npm create cloudflare@latestor clone it directly. - Run
npm installin both thefrontendandworkerdirectories. - Set up a D1 database and bind it to your Worker.
- Configure your email provider (Gmail or generic IMAP) – the README has per-provider steps.
- Deploy with
npx wrangler deploy(orwrangler devfor local testing).
There’s no hosted demo, but the setup takes about 15 minutes if you have a Cloudflare account. The README is excellent and walks through every step, including agent configuration and customizations.
Final Thoughts
This is the kind of project that makes you rethink what a “serverless email client” can be. It’s not trying to replace Gmail. It’s a playground for building email automations that live right next to your data. If you’re tired of glueing together Zapier, Gmail filters, and a separate LLM backend, this is your antidote.
The code is clean, the architecture is simple (Worker + D1 + agent), and it’s perfect for tinkering. Add a command like “archive everything from this sender” or wire it into your own AI stack. It’s the sort of project that delivers way more value than its 15-minute setup suggests.
Give it a spin. Your inbox (and your future self) will thank you.
Follow @githubprojects for more open source discoveries.