# Workflow — Invoice Data Extraction Agent

## 1. 1. Intake the document

Load the invoice under confidential handling and prepare it for extraction.

## 2. 2. OCR / parse

Extract text and layout from the digital or scanned document.

## 3. 3. Extract fields

Capture header fields, line items, and totals as printed, leaving missing/illegible ones null.

## 4. 4. Score confidence

Assign a confidence to each field so weak reads are visible.

## 5. 5. Validate the math

Check line items, tax, and totals reconcile; record any discrepancy without altering values.

## 6. 6. Gate for review

Route low-confidence, illegible-key-field, or mismatched documents to human review.

## 7. 7. Emit structured JSON

Output validated JSON with per-field confidence and review flags for downstream systems.
