Quick Start
Enable email communication for your agents with a few lines of code.Set Environment Variables
Configure your email service credentials. For Gmail, use an App Password.
Key Features
- Bidirectional Support: Uses IMAP to poll for new messages and SMTP to send responses.
- Thread Management: Correlates responses using
In-Reply-ToandReferencesheaders to maintain conversation context. - Auto-Reply Prevention: Built-in detection for
Auto-Submittedheaders and common bot addresses to prevent infinite loops. - Command Handling: Supports subject-based commands (e.g.,
START:,STOP:) alongside natural language. - Session Isolation: Each sender gets a dedicated
AgentStatefor personalized interactions.
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
EMAIL_ADDRESS | — | The email address of the bot |
EMAIL_APP_PASSWORD | — | Authentication password (App Password recommended) |
EMAIL_IMAP_SERVER | imap.gmail.com | IMAP server for reading emails |
EMAIL_IMAP_PORT | 993 | IMAP SSL port |
EMAIL_SMTP_SERVER | smtp.gmail.com | SMTP server for sending emails |
EMAIL_SMTP_PORT | 465 | SMTP SSL port |
EMAIL_POLL_INTERVAL | 60 | Seconds between email checks |
BotConfig Options
Deployment Modes
CLI Mode
Deploy directly from youragents.yaml file:
Script Mode
Full control over headers and attachment handling by extending theEmailBot class.
Best Practices
Use Dedicated App Passwords
Use Dedicated App Passwords
Never use your main account password. Generate a platform-specific App Password for the bot.
Configure Blocked Senders
Configure Blocked Senders
Use
BotConfig.blocked_users to exclude noreply addresses or known marketing domains.Subject Line Clarity
Subject Line Clarity
Tell your users to keep subject lines consistent for better thread correlation.

