Skip to content

kborovik/mailpilot

Repository files navigation

MailPilot

Agent-operated CRM with Gmail as the communication layer.

See it in action

Overview

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.

Two-Layer Intelligence

  1. Claude Code -- strategic orchestrator. Creates workflows, assigns contacts, reviews outcomes, generates reports. Operates the system via CLI.
  2. Internal Pydantic AI agent -- subordinate tactical executor. Handles inbound email classification, auto-replies, and follow-up scheduling within workflows.

Key Capabilities

  • 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

Install

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-crm

Or install with pip:

pip install mailpilot-crm

Verify the install:

mailpilot --version

Quick Start

MailPilot 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 mailpilot

Point MailPilot at the database:

mailpilot config set database_url postgresql://localhost/mailpilot

Set the Google service account credentials:

mailpilot config set google_application_credentials /path/to/service-account.json

Set 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 sync

Start the event-driven sync loop:

mailpilot run