Production AI platform for a chemicals distributor — two integrated halves. (1) Email automation: a Celery Beat dispatcher polls inbound mail every 60s, acquires PG advisory locks per email for crash-safe mutual exclusion, hands off to a Unified Email Agent (Claude) that classifies, extracts, and routes; a companion Email Response Agent drafts replies. A truth-set eval harness keyed by Sage OR# regression-tests every Claude prompt change against curated real-world cases before promotion. (2) Data platform: unifies legacy Sage product/customer data with semantic search (Vertex AI Search), AI trip-report generation, and a document pipeline that extracts SDS/TDS PDFs via GCP Document AI. MCP server and REST APIs expose the unified data to AI agents and a Slack/React surface.
Inbound order/inquiry email volume mixed with replies, forwards, and noise — needed reliable classification + extraction
Celery Beat dispatcher (60s) with orphan recovery + dispatch + auto-queue phases
Worker crashes / retries could double-process the same email — needed strict mutual exclusion
PG advisory locks per-email — workers can crash safely without double-processing
Prompt changes risked silent regression on real-world cases — needed a regression gate
Unified Email Agent (Claude) for classify / extract / route in a single pass over raw mail
Legacy Sage MySQL database with inconsistent data formats
Email Response Agent drafts replies; humans approve before send
Hundreds of SDS/TDS PDFs with varying layouts
Truth-set eval harness keyed by Sage OR# (e.g. AU00165) — every Claude change is run against curated real-world cases before promotion
Sales team needed fast product search across thousands of chemicals
GCP Document AI pipeline for automated SDS/TDS extraction and classification