Document extraction
Extraction is where most agent money is made and lost. Made, because the manual version costs a person a day a week. Lost, because a wrong number entered confidently is worse than an empty field, and only one of those is easy to spot.
The job on one screen
| Runs when | A document arrives by email, upload, or scan. |
|---|---|
| Reads | The document, the target schema, and the vendor-specific quirks you have learned. |
| Decides | What each field is, how confident it is, and whether a human must check it. |
| Produces | A structured record with per-field confidence, plus the page region each value came from. |
| Stops when | All required fields found above the confidence bar, or it escalates the document. |
| Tools it needs | OCR, layout parser, schema validator, storage. |
| Autonomy to start at | Approve. It does the work and stops before the irreversible step. |
Optional: load a real model
Run it
The fields it pulls
Required fields are never guessed. If one is missing the run stops and a person gets the document, which is the difference between an extraction agent and a wrong database row.
| Field | Required | How it is found |
|---|---|---|
| Invoice number | yes | (?:invoice\s*(?:number|no|#)?[:\s]*)([A-Z0-9-]{4,}) |
| Invoice date | yes | (\d{4}-\d{2}-\d{2}) |
| Total | yes | total[:\s]*([A-Z]{3}\s?[\d,]+\.?\d{0,2}) |
| Tax | optional | (?:vat|tax)[:\s]*([\d,]+\.?\d{0,2}) |
| Purchase order | optional | \b(PO-?\d{3,})\b |
| Payment terms | optional | \b(net-?\d+)\b |
Where this one goes wrong
Confident misreads
A 3 read as an 8 in a total is invisible downstream. Cross-check totals against line items and reject on mismatch.
Template drift
A supplier redesigns their invoice and your extraction quietly degrades. Monitor per-supplier confidence over time.
Right value, wrong field
The tax amount landing in the total field passes every format check. Validate relationships, not just formats.
How you would know it is working
| Measure | Why that one |
|---|---|
| Straight through rate | Documents processed with no human touch. The saving lives here. |
| Field level accuracy on a sample | Audit fifty documents a month by hand, forever. |
| Escalation rate by supplier | One supplier eating your review queue is a template problem with a name. |
Earning more rope
| Assist | Extract into a review screen where a person confirms each field. |
| Approve | Auto-accept fields above a confidence bar, review the rest. Where most systems live. |
| Auto | Straight through for known templates with automatic reconciliation, escalating anything unusual. |
Related: Invoice matching · Spreadsheet cleanup · Contract review · all agent jobs · Agent Lab home
Free from AI School - no signup, everything runs in your browser.