> WHAT IT DOES
An AI agent that reads merchant contracts (PDF), reconciles them against billing records (Excel, CSV or PostgreSQL/MySQL), detects revenue shortfalls, classifies their root cause, and drafts targeted recovery emails — automatically.
Each shortfall is analysed for financial materiality and collection urgency across monthly, annual, and multi-year minimum volume commitments (MVC). The result is a prioritised discrepancy summary your finance team can act on immediately.
> HOW THE PIPELINE WORKS
STEP 01
LOAD
Connect to your PostgreSQL or MySQL database via a SELECT query, or upload a billing file (CSV or Excel). The agent normalises any schema to merchant_id, year, month, billing_amount.
STEP 02
PARSE
pdfplumber extracts contract terms from each merchant PDF: MVC amounts, billing cadence (monthly / annual / 2-year), effective dates, and merchant name.
STEP 03
ANALYSE
Claude reconciles cumulative billing against contractual commitments, then classifies each shortfall — genuine leakage, seasonal variance, data error, or ramp-up — with a severity rating.
STEP 04
ACT
Review the discrepancy summary, filter by time period and status, then generate targeted recovery emails for selected merchants with one click.
> KEY FEATURES
- Reads merchant contracts from PDF using pdfplumber — no manual data entry
- Connects to PostgreSQL / MySQL, or ingests CSV / Excel billing files
- Monthly, annual, and multi-year MVC reconciliation with correct period arithmetic
- Five root-cause classifications: genuine leakage, seasonal variance, data error, ramp-up, recognition difference
- Two-dimensional prioritisation: financial materiality × collection urgency
- Discrepancy summary table with time-period filter, optional columns, and action status tracking
- Action states — open / resolved / written off — for workflow governance and audit trail
- One-click recovery email generation for selected shortfalls
- Real-time progress via Server-Sent Events (SSE) — no polling
- Demo mode with pre-computed results and fake SSE timing — evaluable with no API key or database
> TRYING THE DEMO
// DEMO MODE
The live demo runs on pre-computed sample data covering 10 merchants across monthly, annual, and 2-year contracts. No database connection or API key is required — all results are served from a cached analysis with realistic SSE progress timing.
To deploy with a live pipeline (real database, real Claude API calls, real contracts),
set DEMO_MODE=false and provide an ANTHROPIC_API_KEY
in the hosting environment.
Interested in a private deployment for your finance team? Get in touch.
> HOW IT WAS BUILT
The idea came from a real finance workflow: a team manually comparing PDF contracts against billing exports in spreadsheets to find merchants underbilling against their minimum volume commitments. The process was slow, error-prone, and easy to deprioritise. This agent automates the entire loop.
The backend is a Flask app with a full agentic tool-use pipeline: pdfplumber extracts contract terms, pandas handles billing reconciliation, and the Claude API classifies each shortfall and drafts recovery emails. Progress is streamed to the browser via Server-Sent Events so the UI stays responsive during analysis. The demo mode re-plays pre-computed results with realistic timing so the tool can be evaluated without a live database or API key.
- Claude API — agentic tool-use for classification and email drafting
- pdfplumber — contract term extraction from PDF
- pandas — billing data normalisation and MVC reconciliation
- Flask + Server-Sent Events — real-time progress streaming
- SQLAlchemy — PostgreSQL and MySQL support via a single SELECT query
Projects on this website are free to download for charities and non-profit organisations — please get in touch via the contact page.