Key facts
| Endpoint | POST /v1/chat/completions with JSON mode for extraction and tools for lookups |
| Schema first | Define fields, types, formats and confidence before writing prompts |
| Validation | Validate every field against schema and business rules; retry once, then queue for review |
| Models | 30+ models; cheap aliases for uniform documents and stronger ones for messy inputs |
| Pricing model | Flat monthly self-serve plans with unlimited fair-use usage |
| Free tier | Free plan with 2 free AI models, no card required |
| Governance | Audit logs track extraction decisions and model versions |
| Roadmap | Batch and files endpoints are coming soon |
TL;DR
- The schema is the product: define fields, formats and nullability before prompting.
- Validate every field; valid JSON is not valid data.
- Use tools to resolve reference data instead of trusting model recall.
- Queue low-confidence fields for review instead of guessing.
- Measure per-field accuracy and straight-through processing, not aggregate accuracy.
How it works, step by step
- List target fields with types, formats, allowed values and whether null is acceptable.
- Split the document into logical sections and identify which sections carry which fields.
- Extract with JSON mode, requesting a value and a confidence marker per field.
- Validate each value against schema, format and business rules; resolve reference data with tools.
- Retry once with the exact validation error, then route unresolved fields to a review queue.
- Store values with provenance — page, section and model version — and monitor per-field accuracy.
Original data
Try it yourself
Architecture of an extraction agent
Six stages, each independently testable:
- Intake: classify the document type and select the matching schema.
- Normalize: convert the document to clean text and preserve page or section markers.
- Extract: JSON-mode call for the fields present in the current section.
- Validate: schema, format and business-rule checks per field.
- Resolve: tools for reference lookups — customer ids, product codes, currency conversion.
- Review: fields that fail validation or fall below confidence go to a human queue.
When to add the agent loop
Plain extraction is one call. Add agent behavior when the document fights back:
- Inconsistent layouts: invoices from dozens of vendors put the same field in different places.
- Cross-references: a purchase order number that must be looked up against an ERP before it can be confirmed.
- Multi-section reasoning: totals that only make sense when compared against line items.
- Missing fields: the agent searches other sections explicitly rather than inventing a value.
Each added step raises cost and latency, so add them only for document classes that show measurable failures.
Implementation and evaluation
Discipline that keeps extracted data trustworthy:
- Ask for an explicit null rather than omitting a field; absence and empty mean different things in downstream systems.
- Require confidence per field and calibrate thresholds against reviewed data.
- Make writes idempotent with a document hash key, so retries never create duplicate records.
- Keep a golden set per document type with exact expected values, and re-run it on every change.
Metrics: per-field precision and recall, exact-match rate for formatted values such as dates and amounts, invalid-output rate, review-queue yield and straight-through processing share. A 99% aggregate score can hide a 60% failure rate on one important field.
Limitations
Extraction accuracy depends on input quality:
- Scanned and handwritten documents need OCR quality checks before extraction; no model recovers text that was never captured.
- Ambiguous fields — 'total' versus 'subtotal', ship date versus invoice date — need explicit definitions in the schema.
- Agent loops multiply cost on high-volume, uniform documents where a single call would suffice.
- The files and batch endpoints are coming soon, so document storage and bulk processing remain your responsibility today.
- Never let extracted values drive payments or irreversible actions without a validation or review gate.
Honest comparison
| Capability | Extraction agent on Plugsky | Single-call extraction | Template and regex parsing |
|---|---|---|---|
| Layout variation | Handles inconsistent documents | Works on uniform inputs | Breaks on any change |
| Reference lookups | Tools resolve codes and ids | Not possible | Custom code |
| Confidence | Per-field markers with review queue | Optional | None |
| Validation | Schema plus business rules | Schema only | Format rules |
| Cost | Higher per document | Low | Low but engineering-heavy |
Frequently asked questions
When do I need an agent instead of a single extraction call?
When document layouts vary, fields need cross-referencing, or values require lookups. Uniform, single-template documents are cheaper and more consistent with one JSON-mode call.
How do I define the extraction schema?
List each field with its type, format, allowed values and whether null is acceptable, then map which document sections typically contain it.
What should a missing field look like?
An explicit null with a confidence marker. Omitting the field silently makes downstream validation impossible.
How do I handle reference data?
Expose lookup tools for customer ids, product codes and similar values instead of trusting the model to remember them correctly.
How do I evaluate extraction quality?
Per-field precision and recall against a golden set, plus invalid-output rate, review-queue yield and straight-through processing share.
Can it process scanned documents?
Only after OCR. Validate extraction quality on the OCR text, because normalization cannot recover characters the scanner missed.
Can I prototype extraction for free?
Yes. JSON mode is live, the free plan includes two free models with no card, and the 14-day full-access trial supports evaluation on your document types.