PDF Parsing for AI Agents: Test Scans and Tables Before Records
Learn how to test an AI agent's PDF parsing on scanned files and tables, and which extracted fields a person should verify before they enter company records.

An AI agent can read a PDF in two ways: by extracting the text layer that already exists in the file, or by recognizing characters in an image of the page. Both routes can return values that look confident and are still wrong. Testing that extraction means building a set of real documents, scoring each field against a known answer, and deciding in advance which fields a person must confirm before anything reaches an accounting system, a customer file or a contract register.
Key takeaways
- Test with your own scans, phone photos and multi-page tables, not with clean samples from a vendor.
- Score each field against a known answer, and record the source page for every value the agent returns.
- Check table structure and reconcile totals before trusting any number pulled from a table.
- A person confirms money, legal identity, obligation dates and any value the agent cannot tie to a page.
- Keep the checks running after launch, because new layouts and new scanners arrive without warning.
Why scans and tables fail in different ways
A text-layer PDF usually gives the agent characters that were already typed. The main risks there are structural: a field name changed, a value sits in the wrong place, or a page was added as an image inside an otherwise digital file. A scan is different. The agent has to recognize characters, and common errors include a zero read as the letter O, a one read as a lowercase l, a dropped decimal point, a skewed page that shifts a column, and a faint stamp that hides a due date.
Tables add a second problem. Columns can shift when a description wraps onto two lines. Merged header cells can make one heading apply to several columns. A totals row can be read as if it were a line item, and a table that continues onto the next page may repeat no header at all. In each case the output can still be valid JSON with the right field names. Schema validation catches wrong types, but it does not catch a correct-looking amount that belongs to the neighboring row. For a useful way to define those outputs, see Structured Outputs for AI Agents: Schemas Your Systems Accept.
The practical consequence is that a successful parse is not the same as a correct parse. Your test has to measure the second.
Build a test set from your own documents
A test set is a folder of real documents with expected answers written by a person. Vendor demonstrations are usually clean, so they tell you little about the files your company receives. Build the set from the documents that actually arrive, then follow these steps:
- Collect documents from every intake route: email attachments, uploads from a phone, faxed copies, and scans from the office copier.
- Include the difficult ones: rotated pages, low contrast, stamps over text, handwritten corrections, and multi-page tables.
- Do not remove a document because it is hard to read. Those are the cases that show where the agent needs a person.
- Write the expected value for each field from the original file, with the page and location noted, before running the agent.
- Label each document by type and by scan quality, so failures can be grouped and understood.
- Store the set privately and version it, so a new parser, model or prompt can be compared against exactly the same files.
A set of a few dozen documents per document type is a practical starting point for a first role. It will grow as new layouts appear, and every new failure should be added to it.
Score extraction field by field
Grading a whole document as pass or fail hides the details you need. Score each field separately, and use a rule that fits the field type:
- Identifiers, amounts, dates and tax numbers should match exactly after removing formatting such as spaces or thousands separators.
- Names and addresses should be compared with a written normalization rule, for example ignoring case and punctuation, and that rule should be agreed before testing.
- Table cells should be matched by row key and column header, not by position on the page.
- A missing field and a wrong field must be counted separately. Missing is recoverable. Wrong values that enter a record are the expensive failure.
- Compare the agent's confidence signals with its actual accuracy. If high-confidence values are often wrong, the confidence signal cannot be used to skip review.
Evaluation guidance from [Anthropic on demystifying evals for AI agents](https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents) and the [OpenAI evals guide](https://platform.openai.com/docs/guides/evals) both rely on a fixed set of cases and clear grading rules as the basis for repeatable measurement. Apply the same discipline to documents.
Tables: check structure before values
For tables, check the structure first and the values second. A table that is mapped to the wrong columns will produce plausible numbers, so the structure check is the one that catches the most serious errors.
- Confirm that the header mapping is correct for every page, including pages with no repeated header.
- Confirm that the number of columns detected matches the number expected for the document type.
- Reconcile the totals: the sum of line items should equal the stated total, and each line total should equal quantity multiplied by unit value where both are shown.
- Check merged cells and multi-line descriptions, which often produce a row that is split or joined incorrectly.
- Flag any table that continues across a page break and confirm that its rows were not duplicated or dropped.
Illustrative scenario: a supplier statement runs across three pages, and the second page repeats no column headers. The agent treats the first numeric column on that page as the reference column, so every amount on that page moves one column. The line items no longer sum to the statement total, the reconciliation fails, and the document is held for a person to review instead of being posted. Reconciliation turned a silent error into a visible one.
Which fields must a person check before records change
Not every field needs the same review. The fields below carry the most risk when wrong, and each should be confirmed by a person against the source image before it changes a company record:
- Money: totals, tax amounts, discounts and any bank or payment details, because these move funds or affect reported figures.
- Legal identity: tax numbers, legal names of customers and suppliers, and account numbers, because a near-match can attach a document to the wrong party.
- Obligation dates: due dates, renewal dates and notice periods, because a misread date can cause a missed payment or an unintended renewal.
- Any value read from a handwritten field, a stamp or a low-contrast area of the scan.
- Any value the agent cannot tie to a specific page and location in the source.
- Any change to an existing record. Creating a new record is easier to reverse than overwriting a field that someone already relies on.
The reviewer should see the source image next to the extracted value, not only the extracted text. Without the source, a person can only check that the value looks reasonable, which is not the same as checking that it is correct. For how this applies when an agent writes to finance software, read Accounting Software Write Limits for AI Agents: Read, Draft, Approve.
For the lower-risk fields, a sensible routing rule is: if every field reconciles and the document quality is within the range tested, prepare a draft record for one-step approval. If a reconciliation fails, hold the whole document rather than the single field, because one failure often means the layout was misread. If the scan quality falls below what was tested, ask for a new copy. Do not let the agent overwrite any field silently.
How Be Human keeps extraction checks running
Be Human designs and operates AI agents with their memory, tools, permissions and approval boundaries under human control. For document work, a first engagement usually defines one role, such as reading supplier statements, and limits that role to the document types and fields in scope. The test set is built from the company's own files, the review fields and reconciliation rules are written into the tool, and the agent drafts records rather than posting them. Managed operations then include recurring evaluations on the same test set, review of new layouts when they appear, and controlled changes when the parser or model is updated. Take the free Be Human AI diagnostic to find the first document task worth handing to an agent.
Frequently asked questions
Can an AI agent read handwritten fields in a scanned PDF? It can read some handwriting, but accuracy varies widely with the writing style and scan quality. Treat handwritten fields as a separate test category, measure them on their own, and route every handwritten value for person review until the results are consistent. Handwritten dates, amounts and names should always be confirmed against the source image.
Is a PDF with a text layer always safe to parse? No. A text layer removes the character recognition step, but it does not remove structural errors such as shifted table columns, missing headers on continuation pages or values placed in the wrong region of the page. Test text-layer PDFs with the same field and table checks as scans, and do not skip reconciliation because the text looks clean.
Does the test set need to be large before the agent can start? It needs to cover every document type and every scan quality you expect to receive, not an arbitrary volume. Begin with a small set of real documents for the first role, run it before launch, and add every new failure to it. A set that grows with real cases is more useful than a large set of clean examples.
Should the agent write directly to our accounting or ERP system after parsing? For a first phase, it should not. Let the agent prepare draft records that a person approves after seeing the source page next to the extracted values. Direct writes can be considered later, for specific document types and fields, once the test results and the review history support them, and the write permission should be narrower than the read permission that came before it.
Your next step
See where an AI agent fits in your company first.
Take the free Be Human AI diagnostic. A few questions about your work show which task to hand to an agent first, what it needs to know and where a person approves.
Be Human editorial guidance. Examples are illustrative unless explicitly attributed. Sources provide background; implementation choices depend on your workflow.


