The scenario
A mid-sized manufacturer (Example Manufacturing, fictional) receives several thousand supplier invoices a month by email, through a supplier portal and by SFTP (SSH File Transfer Protocol) from a few large vendors. Today, clerks key each one into the ERP (Enterprise Resource Planning), chase purchase orders and goods receipts by hand, and email approvers. Invoices wait a week, duplicates slip through, and month-end accruals are guesswork.
The goal is an accounts-payable invoicing system that reads each invoice, checks it against what was ordered and received, applies approval policy, posts it to the ERP and schedules payment — with a person deciding only what the rules cannot.
Everything here is fictional and illustrative: the company, vendors, invoices, document numbers, tolerances and targets are invented for the demo. The architecture and the tradeoffs are the point.
Architecture
Each component has one job. A DAG orchestrator sequences the pipeline and owns retries. Document AI turns PDFs (Portable Document Formats) into schema-checked fields. Deterministic rules decide matching and approval. An exception agent handles only the cases the rules reject, using enterprise tools through an MCP gateway and clauses from a RAG index. Human reviewers decide what remains.
The parts, and where each is covered
DAG orchestrator
Ordered steps, retries, idempotency keys and a run history. See DAG orchestration.
Architecture decisions
Why each choice was made, what it cost, and what was rejected. See the ADR (Architecture Decision Record) log.
AI-driven lifecycle
How the system was specified, built, verified and is operated with AI in the loop. See the AI-DLC (AI-Driven Development Lifecycle) page.
Enterprise MCP gateway
The only door to ERP, vendor master, POs (Purchase Orders), receipts and approvals, with scopes and audit. See the MCP page.
RAG over contracts
Retrieves the clause that governs a disputed charge, with citations and grounding checks. See the RAG page.
End-to-end walkthrough
One invoice followed through every stage, with the data at each step.
Requirements and targets
These are the requirements the design was built against. The targets are planning figures for this demo, not measured results.
| Area | Requirement | Illustrative target |
|---|---|---|
| Intake | Accept email, portal and SFTP invoices; keep the original file | 100% of inbound documents recorded |
| Accuracy | Extracted fields checked against schema and totals | Zero invoices posted with failed schema checks |
| Matching | Three-way match to PO and goods receipt, with tolerances | Clean matches need no human touch |
| Exceptions | Explain each exception with the governing contract clause | Every exception carries at least one citation |
| Approval | Approval bands by amount, cost centre and exception type | Routing decided by rules, never by the model |
| Cycle time | Receipt to ERP posting | Median under one business day for clean invoices |
| Audit | Every step, tool call and decision traceable | Complete trace for 100% of posted invoices |
| Security | No agent holds system credentials; PII (Personally Identifiable Information) minimised | Agents reach systems only through the gateway |
Suggested reading order
1 · Walkthrough
Follow one invoice from arrival to payment to see the system working.
2 · ADRs
Read the decisions behind the shape of the system.
3 · DAG
See how the pipeline is sequenced and where retries and humans sit.
4 · MCP
See how the agent and workers reach enterprise systems safely.
5 · RAG
See how contract and policy answers are grounded and checked.
6 · AI-DLC
See how the whole system was delivered and is run.
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