Live Production System

Enterprise Accounts Payable
Automation Agent

Zero manual data entry. GPT-4o invoice extraction, three-way matching, configurable approval routing, direct ERP sync, and AI-powered Word document standardization — processing 500+ invoices per month and normalizing enterprise documents in under 60 seconds.

Live Demo API Docs GitHub Repo Deploy for My Business
System: Healthy
|
Deployed: ap.datawebify.com/docx-ui
|
Model: GPT-4o Vision
|
ERP: QuickBooks / Xero / SAP / NetSuite
Before
5-15 days
After
<24h
Invoice processing time
Before
$15-$40
After
<$2
Cost per invoice
Before
40-60 hrs/wk
After
~0 hrs
Staff time on AP
Measured Business Outcomes

Before vs. After

Every number reflects the documented performance gap between a manual AP team and this system running at scale.

Metric Before After Change
Invoice processing time 5-15 days < 24 hours 95% faster
Cost per invoice $15-$40 < $2 -87% cost
Three-way match accuracy 70-80% 98%+ +25pp
Exception rate 20-30% < 5% -83%
On-time payment rate 60-75% 95%+ +35pp
Staff time per week on AP 40-60 hrs ~0 hrs 100% automated
Agent Architecture

Nine Agents. One Pipeline.

LangGraph orchestrates a deterministic workflow where each agent has exactly one responsibility. GPT-4o handles document intelligence. The graph handles control flow.

Invoice Processing Pipeline
01
Ingestion Agent
Monitors Gmail and Outlook for invoices. Accepts PDF uploads via REST endpoint. Parses EDI 810 feeds. Classifies documents and stores raw files with metadata.
02
Extraction Agent
GPT-4o vision extracts all invoice fields: vendor, invoice number, dates, line items, quantities, unit prices, totals, PO number, and payment terms. pytesseract OCR fallback for scanned documents.
03
Validation Agent
Checks required fields, amount tolerances, due dates, vendor master, duplicate invoices, and currency matching. Flags exceptions with specific error codes for downstream routing.
04
Three-Way Match Agent
Compares invoice against purchase order and goods receipt within a configurable tolerance (default 2%). Returns full match, partial match, or mismatch. Routes mismatches to the exception handler.
05
Approval Router Agent
Applies a configurable approval matrix. Below-threshold invoices auto-approve. Above-threshold routes to the designated approver via email and SMS with a one-click approve or reject link. Escalates after configurable timeout.
06
Exception Handler Agent
Creates exception records. Drafts vendor communications using GPT-4o. Queues for human review with full context. Tracks resolution status in Supabase.
07
Payment Scheduler Agent
Prioritizes by due date. Groups payments for batch processing. Generates payment run reports. Triggers ERP payment entries on schedule.
08
ERP Sync Agent
Writes approved invoices and payments to QuickBooks, Xero, SAP, or NetSuite. Handles field mapping per ERP schema. Retries on transient failures. Logs transaction IDs back to Supabase.
09
Audit Logger Agent
Writes a complete audit trail entry for every state transition. Sends email and SMS notifications to the AP manager. Generates daily summary reports automatically.
10
Schedule Extractor (Document Intelligence)
Classifies pages in multi-page architectural PDFs using Claude vision. Routes schedule pages to a dedicated extraction agent that pulls window and door data — type, size, quantity, location, finish, elevation reference — and exports a formatted Excel takeoff file for non-technical users via a browser upload interface.
11
Email Order Processing Layer
Ingests sales orders from email bodies and attachments in English and French. GPT-4o extracts SKUs, quantities, delivery dates, customer references, and line items into a structured SalesOrder model. Extractions below a 0.70 confidence threshold are automatically routed to a human review queue. Validated orders are mapped to the target ERP schema and pushed via the Order ERP Sync Agent with retry logic and a full audit log of every attempt, source email, extracted fields, and outcome.
12
DOCX Extractor Agent
Reads raw .docx files using python-docx. Extracts full heading hierarchy, section content, table structure, and document metadata including title, author, and creation date. Outputs a structured dict ready for AI normalization. Handles files with missing or inconsistent heading styles gracefully.
13
OpenAI Normalization Agent
Sends extracted document content to GPT-4o with a strict JSON schema prompt. Maps content to a master 10-section structure: Title, Document Control, Purpose, Scope, Definitions, Responsibilities, Procedure, Records, References, and Revision History. Returns confidence scores per section. Documents below 0.70 overall confidence are automatically flagged and routed to a human review queue.
14
DOCX Builder Agent
Rebuilds a clean, formatted Word document from normalized JSON content. Python controls all Word styling via python-docx: Title style, Heading 1, Heading 2, Normal, Table Grid, headers, footers, margins, and page numbering. OpenAI never controls formatting. Outputs clean .docx files to the output folder with a confidence footer note on every document.
15
Batch Processor + Logging Layer
Processes entire input folders in batch. Logs each file as successful, failed, or partially processed with per-file confidence scores and processing time. Includes retry logic for OpenAI API failures (up to 3 attempts). Generates a JSON summary report after each batch run. Wired to FastAPI via /docx endpoints and accessible through a non-technical browser UI at ap.datawebify.com/docx-ui.
Technology

Production Stack

Every component chosen for reliability at enterprise scale, not convenience.

Agent Framework
LangGraph
AI Model
GPT-4o Vision
AI Model
Claude API
Document Processing
PyMuPDF + OCR
Backend API
FastAPI + Uvicorn
Database
Supabase (PostgreSQL)
Task Queue
Celery + Redis
Notifications
Twilio + SendGrid
Deployment
Docker + Railway
Document Rebuild
python-docx
Export
openpyxl (Excel)


ERP Integrations
QB
QuickBooks Online
OAuth2 - Bill creation - Payment entry
XRO
Xero
OAuth2 - ACCPAY invoices - Payment sync
SAP
SAP
RFC/REST - Field mapping ready
NS
NetSuite
REST API - Field mapping ready
Live API

Every Endpoint Production-Ready

Interactive documentation at ap.datawebify.com/docs

GET /metrics/health System health check GET /metrics Real-time AP KPIs and processing stats POST /ingest/pdf Upload invoice PDF for processing POST /ingest/email-webhook Email webhook receiver (Gmail / Outlook) POST /ingest/edi EDI 810 invoice file upload GET /approval/decide One-click approve or reject via token link GET /approval/status/{invoice_number} Query current approval status POST /extract/upload Upload PDF, classify pages, extract schedule, return Excel POST /extract/download/{job_id} Download generated Excel takeoff file POST /orders/ingest Submit email text or attachment for order extraction GET /orders/review-queue List orders pending human review (confidence < 0.70) GET /docx-ui Non-technical browser UI for document standardization POST /docx/upload Upload a .docx file to the standardization queue POST /docx/batch Process all queued files through extract, normalize, rebuild pipeline GET /docx/download/{file_name} Download standardized .docx output file
ap.datawebify.com / health response
// GET https://ap.datawebify.com/metrics/health
{
  "status": "healthy",
  "service": "AP-AI Accounts Payable Automation Agent",
  "brand": "Datawebify",
  "timestamp": "2026-03-25T00:17:24.868648+00:00"
}

200 OK - System live and processing
Portfolio

More Enterprise Systems

Part of a 50-project series of production-grade agentic AI solutions built for enterprise clients.

Project 01 / 50
WhatsApp Business Automation
73% cost reduction, 175% ROI, 3-language support. Live in production.
Project 07 / 50
Voice & Chat Scheduling Agent
85% faster booking, 90% staff hour reduction, 24/7 coverage for field service businesses.
Project 09 / 50
AI Immigration Receptionist
100% call coverage, 2x booking rate, bilingual intake for immigration law firms.

Want This for Your Business?

I design and deploy custom enterprise AP automation systems. Typical engagement: $15K-$35K. 4-6 week delivery. Production-ready.

Start a Conversation Review the Code See It Live
Chat on WhatsApp