Agent-operated CRM with Gmail as the comms layer
Project description
MailPilot
Agent-operated CRM with Gmail as the communication layer.
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
- 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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19f10ac52a3ea7dfb328952c19254f872c3edc20ffecefca61aeab79cf46a4b3
|
|
| MD5 |
360ed84143a8798e54500a9111a19664
|
|
| BLAKE2b-256 |
e8574e71d2a4c4ffe292d64300be7edf5dde591d001bf23f8a2629b9cfb7fa26
|
Provenance
The following attestation bundles were made for mailpilot_crm-0.18.0.tar.gz:
Publisher:
release.yml on kborovik/mailpilot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mailpilot_crm-0.18.0.tar.gz -
Subject digest:
19f10ac52a3ea7dfb328952c19254f872c3edc20ffecefca61aeab79cf46a4b3 - Sigstore transparency entry: 2146607539
- Sigstore integration time:
-
Permalink:
kborovik/mailpilot@eb9da7a8e0a8f5bac33b018f6d07b35a2f09e158 -
Branch / Tag:
refs/tags/v0.18.0 - Owner: https://github.com/kborovik
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@eb9da7a8e0a8f5bac33b018f6d07b35a2f09e158 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab7b1309c0116cff17edf78e943320cadcd4b649fea7dc09076a6b2bf50287f3
|
|
| MD5 |
0ccd32650190881a0783f2b0b124d93f
|
|
| BLAKE2b-256 |
6dd8a4b46fa62b0c2aad8c3d46b314289d94adfd59aff69eeebf15d0bb02ec35
|
Provenance
The following attestation bundles were made for mailpilot_crm-0.18.0-py3-none-any.whl:
Publisher:
release.yml on kborovik/mailpilot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mailpilot_crm-0.18.0-py3-none-any.whl -
Subject digest:
ab7b1309c0116cff17edf78e943320cadcd4b649fea7dc09076a6b2bf50287f3 - Sigstore transparency entry: 2146607545
- Sigstore integration time:
-
Permalink:
kborovik/mailpilot@eb9da7a8e0a8f5bac33b018f6d07b35a2f09e158 -
Branch / Tag:
refs/tags/v0.18.0 - Owner: https://github.com/kborovik
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@eb9da7a8e0a8f5bac33b018f6d07b35a2f09e158 -
Trigger Event:
release
-
Statement type: