Agent-operated CRM with Gmail as the communication layer.
MailPilot manages contacts, companies, and communication workflows through Gmail API. It is designed to be operated by AI agents -- Claude Code as the strategic orchestrator and an internal Pydantic AI agent for real-time reactive work.
- Claude Code -- strategic orchestrator. Creates workflows, assigns contacts, reviews outcomes, generates reports. Operates the system via CLI.
- Internal Pydantic AI agent -- subordinate tactical executor. Handles inbound email classification, auto-replies, and follow-up scheduling within workflows.
- Contact and company management -- track relationships, tag for segmentation, annotate with notes
- Activity timeline -- unified chronological log of all interactions per contact
- Email workflows -- inbound auto-reply and outbound campaigns via Gmail API with service account delegation
- Task scheduling -- deferred agent work with scheduled execution for long-running processes
- Reporting -- Claude Code queries the database and generates activity summaries, relationship health, and campaign effectiveness reports
MailPilot ships on PyPI as mailpilot-crm. The package installs the mailpilot command. Python 3.14 or later is required.
Install with uv:
uv tool install mailpilot-crmOr install with pip:
pip install mailpilot-crmVerify the install:
mailpilot --versionMailPilot needs PostgreSQL 18 and a Google service account with domain-wide delegation for the Gmail API.
Create the database. MailPilot provisions the schema on first connection:
createdb mailpilotPoint MailPilot at the database:
mailpilot config set database_url postgresql://localhost/mailpilotSet the Google service account credentials:
mailpilot config set google_application_credentials /path/to/service-account.jsonSet the Anthropic API key:
mailpilot config set anthropic_api_key sk-ant-...Create the Gmail account MailPilot operates:
mailpilot account create --email user@example.com --display-name "User Name"Sync the inbox:
mailpilot account syncStart the event-driven sync loop:
mailpilot run