The invoice
An illustrative run, following one real-shaped invoice through the system. Amounts are net of tax to keep the arithmetic clear.
Supplier: Example Supplies Ltd (vendor V-10442). Invoice INV-2026-04417, dated 14 October 2026, terms net 45. Purchase order PO-88213 for $12,480.00. The invoice arrives by email on 15 October 2026.
| Line | Item | Invoiced | PO (Purchase Order) value | Received / accepted |
|---|---|---|---|---|
| 1 | Widget A | 10 × $310.00 = $3,100.00 | 10 × $310.00 | 10 |
| 2 | Bracket B | 40 × $180.00 = $7,200.00 | 40 × $180.00 | 36 (goods receipt GRN-70211) |
| 3 | Calibration service | 2 × $1,090.00 = $2,180.00 | 2 × $1,090.00 | 2 (service entry SES-5531 accepted) |
| Total | $12,480.00 | $12,480.00 | Quantity short on line 2: 4 units |
Stage by stage
09:14 · Ingest
The mailbox connector stores the PDF (Portable Document Format) unchanged in immutable storage and records the sender, received time and SHA-256 (Secure Hash Algorithm, 256-bit) hash.
09:15 · Normalize
The PDF is converted to page images and text. The hash is checked against earlier documents; no duplicate is found.
09:15 · Classify
The LLM (Large Language Model) labels the document as an invoice with confidence 0.98. Non-invoices would route to a review queue here.
09:16 · Extract
Document AI returns header and line fields as JSON (JavaScript Object Notation) that must match the invoice schema. Each field carries a confidence score.
09:16 · Validate
Schema passes. Line amounts sum to the stated total, and the currency and tax fields are present.
09:17 · Enrich
Vendor V-10442 is active, its bank details are unchanged since 2025, and it is approved for direct posting.
09:17 · Match
Header total matches PO-88213. Line 2 is invoiced for 40 units, but only 36 were received, so the excess 4 units ($720.00) fail the zero-tolerance quantity rule. The DAG (Directed Acyclic Graph) routes the invoice to the exception agent.
09:18 · Resolve
The agent calls grn.search and po.get through the MCP (Model Context Protocol) gateway, retrieves clause 7.3 of the supplier contract, and drafts a resolution: approve $11,760.00 for accepted quantities and open a dispute for $720.00.
09:44 · Approve
The rules place $11,760.00 in the $5,000–$25,000 band, so the AP (Accounts Payable) Manager is asked to approve. The reviewer sees the draft, the clause and the match table, then approves the partial amount.
11:03 · Post
The DAG posts AP invoice AP-2026-0091287 for $11,760.00 with an idempotency key. The $720.00 dispute is recorded as an open query against the vendor.
11:03 · Schedule
Payment is scheduled for the 27 November 2026 payment run, one day before the net-45 due date of 28 November 2026.
11:04 · Archive
The trace, the extraction, the match result, the clause citation, the approval and the ERP (Enterprise Resource Planning) document ID (identifier) are written to the audit store under one trace ID.
What the extraction looked like
The model returns data, never free text, and the orchestrator rejects anything that does not validate against the schema. Excerpt:
{
"document_type": "invoice",
"invoice_number": "INV-2026-04417",
"vendor_id": "V-10442",
"invoice_date": "2026-10-14",
"payment_terms_days": 45,
"currency": "USD",
"po_number": "PO-88213",
"total_net": 12480.00,
"lines": [
{ "line": 1, "item": "Widget A", "qty": 10, "unit_price": 310.00, "amount": 3100.00, "confidence": 0.99 },
{ "line": 2, "item": "Bracket B", "qty": 40, "unit_price": 180.00, "amount": 7200.00, "confidence": 0.97 },
{ "line": 3, "item": "Calibration service", "qty": 2, "unit_price": 1090.00, "amount": 2180.00, "confidence": 0.95 }
],
"extraction_confidence": 0.97
}Outcome and time
Elapsed time from receipt to posting was about two hours, of which roughly 75 minutes was waiting for the approver. Without the exception path, a clean invoice of the same shape goes straight to posting once the approval band clears. The dispute stays open in the ERP, so the vendor sees one clear question instead of an unexplained short payment.
Build this for your business
This example uses a generic invoicing system, but the same pattern — orchestrated steps, governed tools, grounded knowledge and a documented lifecycle — fits most back-office processes. We can scope a pilot on your own documents and systems.
Book a discovery call