The problem
An OCR invoice capture tool reads supplier invoices, but many still land in an error state: the vendor's item number does not match your item, or the vendor added text to the purchase order number so nothing matches. Each one waits for a person, and on an invoice with hundreds of lines that means correcting them line by line.
Architecture
- Channel
- Capture tool error queue
- Agent
- Rule based exception fixer
- Tools
- Copilot Studio
- Power Automate
- Dynamics 365 Finance
- Human
- AP team takes unresolved ones
Where the data stays: Invoices stay in the capture tool and Dynamics 365 Finance; the agent sees the header, lines and purchase order of one exception at a time and never touches payment data.
Design flow
- Capture tool flags an invoice in an error state
- Flow routes the details to the agent
- Agent fixes the item or purchase order number by the rules
- Flow reprocesses, invoice lands in the ERP
- No rule applies: invoice goes to the AP queueOnly sometimes
- AP clerk resolves it and reads the weekly touchless reportHuman checkpoint
Setup
Total time: 6 h 45 min our estimate
- 1 h 30 min
Done when: A sheet counts last quarter's capture exceptions by cause, and the two or three deterministic causes (item number format, purchase order number with extra characters) are marked as the agent's scope.
- 1 h
Done when: Each cause has a written rule with what the agent may change, what it must never change (quantities, prices, totals) and when it must answer unresolved.
- 1 h 30 min
Done when: A Power Automate flow picks up an invoice in an error state, extracts the header, lines, error reason and matching purchase order, and sends them to the Copilot Studio agent that holds the rules.
- 1 h
Done when: A follow up flow reprocesses the corrected data, the complete invoice appears in Dynamics 365 Finance, and an unresolved answer sends the invoice back to the accounts payable queue untouched.
- 1 h
Done when: For two vendors the agent runs live for a week, accounts payable receives a daily list of every field it changed with the reason, and the touchless share per vendor is measured before and after.
- 45 min
Done when: A new vendor or rule is added only after the weekly report shows no wrong correction for the current ones.
Ticks are saved on this browser.
Starter prompt
Written from how the use case works and its sources. Replace the parts in square brackets.
You resolve invoice capture exceptions for [company]. Input: the captured invoice header and lines, the error reason, and the matching purchase order with its item list. Rules: (1) if a vendor item number does not match, try removing prefixes, suffixes and spaces and compare it with the items on this purchase order; accept only an exact match after cleaning. (2) If the purchase order number contains extra characters, strip them and check that the result exists and belongs to this vendor. (3) Never change quantities, prices, totals or bank details. Output a JSON object with the corrected fields and a one line reason for each change, or the word unresolved with the reason, so the accounts payable team takes it from there.
Risks and data
Data
The agent reads supplier invoice headers and lines and the matching purchase orders, and writes corrected item and purchase order numbers. Keep bank details and payment approval out of its reach, let it change only the fields its rules name, and log every change with the reason.
How it goes wrong
It goes wrong when a cleaned item number matches the wrong line on the purchase order, or a stripped purchase order number happens to exist for another order; the invoice then posts against the wrong goods and you notice at the three way match or when a supplier queries a payment. Accept only exact matches after cleaning, never let the agent touch quantities or prices, and read the daily change report during the pilot.
How the agent works
It starts
Invoice capture flags an invoice in an error state.
The agent works
A Power Automate flow extracts the relevant details and routes them to the agent, built in Copilot Studio, which applies a defined set of instructions to the exception: it trims or adjusts the vendor item number, compares it with the specific purchase order and identifies the correct item, or removes the extra characters a vendor appended to the purchase order number. A follow up flow reprocesses the corrected data and the complete invoice moves into Dynamics 365 Finance for the usual downstream processing.
The result
The agent only handles the deterministic cases its rules cover; everything else stays in the accounts payable queue for a person, as before.
Worked example
Asurion, the device protection and repair company behind more than 600 uBreakiFix stores, processes about 30,000 direct purchase order invoices a year, roughly 90% of them with at least one exception, and about 25,000 indirect invoices, more than 75% with header level issues; touchless processing had fallen below 20% and vendor item numbers that did not map to internal SKUs were a main cause. Instead of buying another OCR tool it built the Invoice Capture Derivation agent in Copilot Studio, with proof points in about one week. Power Automate routes each error to the agent, the agent fixes the item or purchase order number, a flow reprocesses the invoice and it lands in Dynamics 365 Finance. Touchless went from under 20% for two vendors to over 55% within the first week for its North and South American vendors, and after refinement to more than 70% across North and South America, with a path toward 85% or more as MCP server work moves to production (Microsoft customer story, 8 October 2026).
Asurion kept its Microsoft stack: capture errors flow through Power Automate to a Copilot Studio agent and the corrected invoice lands in Dynamics 365 Finance. The correction logic is a written set of rules for deterministic cases, so n8n can run the same loop against your own capture tool and your ERP's API; what you lose is the native hand back into the Dynamics 365 invoice record, which you rebuild with your ERP's API.
Join the Agent OS Club
Get hours back with a team of AI agents for every department, set up step by step for the tools you use, with a person answering your questions. Founding member price: USD 14.95 a month or USD 150 a year, locked for as long as you stay. Cancel any time.
Founding offer, ends 31 December 2026 or at member 100
Join the Agent OS ClubBuilding this for an organization? Learn more at theagentiv.com
Sources
Published: 2026-11-12