Skip to main content

Overview

The Email Agent is a microservice that automates email handling, including reading, composing, sending, and responding to emails using AI. Location: scripts/email_agent_microservice/

Features

Email Reading

Fetch and parse emails from Gmail/Outlook

AI Composition

Generate email drafts with Claude

Smart Sending

Send emails with tracking

Auto-Response

Automated responses based on rules

Architecture

Service Structure

Email Processing Flow

Email Composition

AI-Powered Drafting

Template Variables

Email Reading

Fetch Emails

Email Parsing

Email Sending

Send Email

Track Sent Emails

Operating Modes

Draft Mode

User reviews all emails before sending:

Manual Mode

AI suggests responses, user selects:

Auto Mode

Fully automated for specific rules:

API Integration

Backend Endpoints

Configuration

Environment Variables

Examples

Frontend Integration

Troubleshooting

Causes:
  • OAuth token expired
  • Invalid recipient email
  • Rate limit exceeded
Solutions:
  • Reconnect OAuth account
  • Validate email addresses
  • Check provider rate limits
Cause: Large context or complex requirementsSolution:
  • Reduce context size
  • Use faster Claude model (haiku)
  • Implement timeout handling

Next Steps

OAuth Setup

Configure Gmail and Outlook OAuth

Email Bot API

API endpoint documentation

Composio Integration

Composio platform guide