Production-ready system for automating sales email responses, intent detection, follow-ups, and meeting scheduling.
Features:
- Real-time email ingestion (mock SMTP; easy Gmail API swap)
- AI intent classification & auto-reply generation (OpenAI)
- Automated follow-ups & conversation tracking
- Mock meeting scheduler
- FastAPI dashboard APIs
- SQLite DB (Postgres ready)
-
cd ai_sales_agent pip install -r requirements.txt cp .env.example .env # Edit .env: Add OPENAI_API_KEY or set USE_MOCK_AI=true
-
Run API + Scheduler:
python run.py
- API: http://localhost:8000/docs
- Mock SMTP: Connect to localhost:1025 (use any email client or
swaks)
-
Test Flow:
- Send email to mock SMTP (e.g.,
swaks --to test@example.com --server localhost:1025) - Check
GET /api/v1/leads POST /api/v1/emails/processwith sample payload- Wait for scheduler or
GET /api/v1/pending-followups - Test replies/meetings via API docs
- Send email to mock SMTP (e.g.,
See TODO.md for implementation status.
Modules:
email_ingestion: Parses incoming emailsai_layer: Intent & response AIfollow_up: Scheduler logicmeeting_scheduler: Calendar mock- DB: Leads → Emails → Conversations → Meetings
- Set
DB_URL=postgresql://... - Replace mock email with Gmail API (
google-api-python-client) - Use Celery + Redis for production scheduling
- Docker: See
docker-compose.yml
/api/v1/leads- Manage leads/api/v1/emails/process- Process incoming email/api/v1/followups/pending- View pending FUs/api/v1/meetings/schedule- Book meetings
# Process email
curl -X POST "http://localhost:8000/api/v1/emails/process" \
-H "Content-Type: application/json" \
-d '{
"sender_email": "lead@example.com",
"subject": "Pricing inquiry",
"body": "How much does it cost?"
}'
# List leads
curl "http://localhost:8000/api/v1/leads"pytest tests/See .env.example.
- Gmail API integration
- Google Calendar
- React dashboard
- Rate limiting
- Webhooks for real-time