Skip to main content

Agent-operated CRM with Gmail as the comms layer

Project description

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

Architecture

  • CLI-first -- JSON output, meaningful exit codes, actionable errors. Designed for LLM agent consumption.
  • PostgreSQL -- contacts, companies, workflows, emails, activities, tags, notes. Raw SQL via psycopg, no ORM.
  • Gmail API -- service account domain-wide delegation. Pub/Sub for real-time notifications. History API for incremental sync.
  • Pydantic AI -- stateless agent invocations with tool access. Per-contact advisory locks for concurrency.
  • Observability -- Pydantic Logfire (OpenTelemetry-based) for tracing and logging.

Tech Stack

  • Python 3.14
  • PostgreSQL 18
  • Gmail API (google-api-python-client)
  • Pydantic AI (agent framework)
  • Pydantic Logfire (observability)
  • Click (CLI)
  • basedpyright (strict type checking)
  • ruff (formatting and linting)
  • pytest (testing)

Quick Start

# Install dependencies
uv sync

# Configure
mailpilot config set database_url postgresql://localhost/mailpilot
mailpilot config set google_application_credentials /path/to/service-account.json
mailpilot config set anthropic_api_key sk-ant-...

# Create an account
mailpilot account create --email user@example.com --display-name "User Name"

# Sync emails
mailpilot account sync

# Start the sync loop
mailpilot run

Development

make check    # lint + tests
make lint     # ruff format + ruff check + basedpyright
make py-test  # pytest -x

Documentation

  • SPEC.md -- single source of truth (goals, constraints, invariants, tasks, bugs).
  • CLAUDE.md -- operator/agent guide.

License

Private.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mailpilot_crm-0.18.0.tar.gz (173.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mailpilot_crm-0.18.0-py3-none-any.whl (191.1 kB view details)

Uploaded Python 3

File details

Details for the file mailpilot_crm-0.18.0.tar.gz.

File metadata

  • Download URL: mailpilot_crm-0.18.0.tar.gz
  • Upload date:
  • Size: 173.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mailpilot_crm-0.18.0.tar.gz
Algorithm Hash digest
SHA256 19f10ac52a3ea7dfb328952c19254f872c3edc20ffecefca61aeab79cf46a4b3
MD5 360ed84143a8798e54500a9111a19664
BLAKE2b-256 e8574e71d2a4c4ffe292d64300be7edf5dde591d001bf23f8a2629b9cfb7fa26

See more details on using hashes here.

Provenance

The following attestation bundles were made for mailpilot_crm-0.18.0.tar.gz:

Publisher: release.yml on kborovik/mailpilot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mailpilot_crm-0.18.0-py3-none-any.whl.

File metadata

  • Download URL: mailpilot_crm-0.18.0-py3-none-any.whl
  • Upload date:
  • Size: 191.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mailpilot_crm-0.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab7b1309c0116cff17edf78e943320cadcd4b649fea7dc09076a6b2bf50287f3
MD5 0ccd32650190881a0783f2b0b124d93f
BLAKE2b-256 6dd8a4b46fa62b0c2aad8c3d46b314289d94adfd59aff69eeebf15d0bb02ec35

See more details on using hashes here.

Provenance

The following attestation bundles were made for mailpilot_crm-0.18.0-py3-none-any.whl:

Publisher: release.yml on kborovik/mailpilot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page