⚠️ IMPORTANT: This is a demo application by Anthropic. It is intended for local development only and should NOT be deployed to production or used at scale.
This is an in-development IMAP email assistant powered by Claude and the Claude Code SDK.
This agent will be continually developed over time. Currently it can:
- display your inbox
- do agentic search to find emails
- display a 'profile' of you
We'll be building more features and sharing them here as we go.
This application should ONLY be run locally on your personal machine. It:
- Stores email credentials in plain text environment variables
- Has no authentication or multi-user support
- Is not designed for production security standards
- Bun runtime (or Node.js 18+)
- An Anthropic API key (get one here)
- Email account with IMAP access enabled
git clone https://github.com/anthropics/claude-code-sdk-demos.git
cd claude-code-sdk-demos/email-agentbun install
# or npm installcp .env.example .envEdit .env with your credentials (see IMAP Setup below).
bun run dev
# or npm run devNavigate to http://localhost:3000
Gmail requires an App Password instead of your regular password:
-
Enable 2-Factor Authentication (required for app passwords):
- Go to Google Account Security
- Click on "2-Step Verification" and follow the setup
-
Generate an App Password:
- Go to Google App Passwords
- Select "Mail" from the dropdown
- Select your device (or choose "Other" and name it "Email Agent")
- Click "Generate"
- Copy the 16-character password (you won't see it again!)
-
Configure
.env:
ANTHROPIC_API_KEY=your-anthropic-api-key
EMAIL_USER=[email protected]
EMAIL_PASSWORD=your-16-char-app-password # NOT your regular password!
IMAP_HOST=imap.gmail.com
IMAP_PORT=993- Natural Language Search: Find emails using conversational queries
- AI-Powered Assistance: Claude helps draft replies, summarize threads, and extract information
- SQLite Integration: Fast local email caching and search
- Real-time Streaming: WebSocket-based UI updates
- Multi-turn Conversations: Complex email workflows with context retention
This is a demo application provided as-is. For issues related to:
- Claude Code SDK: SDK Documentation
- Demo Issues: GitHub Issues
- API Questions: Anthropic Support
MIT - This is sample code for demonstration purposes.