A PDF extraction agent is useful when it produces structured records that a reviewer can trace back to the document. Valid JSON alone is insufficient. The system needs to distinguish missing information from unreadable information, preserve units, and flag contradictions instead of filling gaps with plausible values.
This reference design covers document inspection, extraction, validation, and exception review. It can be implemented with direct provider APIs or a shared tool layer such as o11. It is not a report of an executed extraction run, and it does not establish that every document service discussed here is active under a particular o11 account.
Specify the record you need
Begin with the downstream use. An invoice workflow might need supplier name, invoice number, issue date, currency, subtotal, tax, total, and line items. A research workflow might need title, authors, publication date, findings, and page references. These require different validation rules and different tolerances for uncertainty.
Define the field names, types, units, permitted null values, and evidence requirements before choosing a parser. Avoid a single “amount” field when documents can express multiple currencies or reporting periods. A date needs a clear role: invoice date, service period, and due date are not interchangeable.
Add status information alongside values. A field might be present, absent, unreadable, conflicting, or not applicable. Null without an explanation forces a later user to guess why the value is missing. Keep extracted observations separate from normalized values so corrections do not erase the original evidence.
Inspect the document before paying for every page
Identify file type, page count, encryption, rotation, text availability, and layout complexity. A born-digital invoice with selectable text may need a different path from a scanned annual report containing tables and charts. Process the pages that answer the task rather than indiscriminately sending the whole document to every service.
Claude’s PDF guide describes processing text and visual content. OpenAI’s file-input guide also documents PDF inputs. Verify the selected model, platform, and request limits before implementation; a tool wrapper may impose additional bounds.
Keep a stable document identifier, content hash, original filename, and acquisition date. Record whether page numbers refer to physical PDF pages or printed labels. A reference to “page 12” is ambiguous when the report has a cover, contents pages, and Roman-numeral front matter.
For sensitive documents, confirm the permitted processing account and retention requirements before uploading. Do not send private documents to a service simply because the agent can discover its endpoint.
Extract small records with page evidence
Extract one logical record or section at a time. Keep page references and short supporting passages next to important fields. For tables, preserve row labels, column headings, footnotes, and units. An isolated number loses meaning quickly when its reporting period or scale is omitted.
An illustrative record might contain document ID, field name, raw text, normalized value, unit, page index, printed page label, and review status. The exact schema depends on the task. Keep an optional bounding box or region reference when the extraction tool provides one and visual review benefits from it.
Do not ask the model to complete patterns from general knowledge. If a subtotal is missing, it may calculate a candidate from visible line items, but that candidate must be labeled calculated and carry its formula. It must not appear as an extracted subtotal.
Use the source-checking approach for high-impact fields: split the proposed claim, locate the supporting material, and decide whether it establishes the value. This is especially important when the PDF includes revised figures or multiple versions of the same table.
Validate structure and meaning separately
JSON Schema documents object properties and required fields. Use structural validation to reject malformed records, unexpected fields, and invalid types. Then run task-specific semantic checks.
For an invoice, arithmetic might require subtotal plus tax minus discounts to equal total within the chosen rounding tolerance. For a fund report, units and reporting dates may need to match across fields. For a research paper, a publication date should not be silently substituted with the date a PDF was downloaded.
A schema-valid record can still be factually wrong. For example, a currency enum can accept USD even if the document says EUR. A numeric type can accept 1200000 when a table states figures in thousands and the workflow applied the scale twice.
Keep validation failures visible and specific. “Total mismatch of $1.20” gives a reviewer a useful task. “Low confidence” without a reason does not. Structured-output evaluation can help separate format compliance from evidence quality.
Design an exception queue
The workflow should produce accepted records and a bounded queue of unresolved fields. Prioritize by consequence: a missing optional subtitle is different from an ambiguous payment amount. Let a reviewer open the relevant page and see the raw extraction beside the proposed value.
Useful exception categories include unreadable text, conflicting values, ambiguous units, failed arithmetic, missing required fields, and unsupported document structure. Each category needs a next action: reprocess the page, inspect the image, request a clearer file, or accept a documented correction.
Preserve corrections as new evidence rather than overwriting history. Record the prior value, corrected value, reason, reviewer identity where available, and time. A later rerun should retain approved corrections unless new evidence explicitly invalidates them.
Keep failures local. If three pages are unreadable in a 100-page report, preserve the useful extractions and flag the affected records. Do not manufacture completeness, and do not discard correct work because one appendix requires manual review.
Estimate cost by pages and review work
Estimate the actual units used by the selected services: pages, tokens, images, extraction jobs, or another documented measure. A PDF’s file size is not a reliable proxy for inference cost or parsing complexity.
For an illustrative workflow, assume 30 pages require processing at $0.02 per page, four pages need a second pass at the same assumed rate, and one validation step costs $0.05. Tool usage totals $0.60 + $0.08 + $0.05 = $0.73. These are hypothetical inputs, not current provider prices. Upload, model inference if billed separately, storage, and human review may add cost.
Track accepted records and correction time. If a cheaper parser produces many errors in the fields that matter, its apparent page-price advantage can disappear. Conversely, a costly visual model may be unnecessary for clear, consistent text documents.
Compare a small representative set before scaling. Include difficult layouts and known exceptions, not only clean samples. The workflow cost guide explains how to budget conditional second passes and retries.
Handle files and retries deliberately
Keep upload ownership and download authorization explicit. A document identifier from one workspace must not become usable by another merely because a model repeated it. Expiring download links should be refreshed through the authorized file service rather than copied into permanent public content.
Persist extraction job identifiers and resume existing work after interruption. If a response is lost, determine whether the provider accepted the job before resubmitting. Reprocessing a page may be appropriate after a genuine failure, but it is a new, intentional operation with a recorded reason.
When using o11, inspect the current file-input contract, account mode, and size limits. Local source audits do not establish live supplier access. Customer-owned accounts may be required for file and job management, and wallet funding must be available for the particular operation before it can be used.
Delete temporary material according to the document’s retention policy, while preserving the evidence needed for approved records. Do not let abandoned prototype uploads become an undocumented document archive.
Accept the output with a reproducible review
Build a manually reviewed reference set for the fields that determine success. Measure exact field accuracy where appropriate, evidence completeness, unresolved exceptions, and correction time. For numerical records, include arithmetic and unit errors as separate categories so a high overall accuracy number cannot hide expensive mistakes.
Review both accepted and rejected outputs. An agent that fills every field may be guessing; an agent that marks everything unknown is safe but unhelpful. The useful system extracts what the document supports and routes genuine ambiguity efficiently.
Begin with one document family and a narrow schema. Once the evidence trail and correction path work, expand to more layouts. Faster access to parsing and inference tools helps the developer experiment, while disciplined validation turns that experiment into reliable structured data.
Example: resolving a table unit error
Consider a fictional report whose table heading says “Amounts in thousands of USD” and whose revenue row contains 1,250. The raw observation is 1,250 with a thousands-of-USD unit. A normalized dollar value is 1,250,000, calculated by multiplying by 1,000. Preserve both representations and the heading evidence.
If another section states 1.25 million, the two observations agree after normalization. If it states 1.35 million for the same period and definition, the workflow should flag a conflict rather than choose the more convenient value. The explanation may be a restatement, a different business segment, or a document error.
A reviewer needs the relevant pages, row labels, dates, and normalization formula. They do not need an unexplained model confidence score. Once the conflict is resolved, retain the decision and its reason with the record.
This example yields a useful evaluation case: include tables with unit labels in headings, footnotes, and repeated page headers. Check whether the agent preserves the correct scale when a table continues onto another page. Those are proposed checks for the implementation, not measured accuracy results from this article.





