# Workflow — Purchase Order Matching Agent

## 1. 1. Intake the invoice

Load the invoice and its PO reference and normalize the line items.

## 2. 2. Retrieve PO and receipt

Pull the purchase order and the goods receipt the invoice must match against.

## 3. 3. Run the three-way match

Compare quantity ordered/received/invoiced, unit price vs PO, and terms for each line.

## 4. 4. Apply tolerance & duplicate checks

Test each variance against tolerance and check for a duplicate invoice in history.

## 5. 5. Decide per line and invoice

Approve clean lines, hold lines over tolerance, and decide the invoice outcome within the cap.

## 6. 6. Act through the gate

Auto-approve clean matches for payment; hold variance lines; escalate duplicates, no-PO, and large variances with evidence.

## 7. 7. Record the trail

Log the match result with cited variances for finance controls and audit.
