Use Cases + Implementation

How do you build document processing with AI agents?

Build document processing as a staged agent pipeline: classify the document, extract text and structure, route it to the right processing path, extract fields, validate, and send exceptions to human review. Agents add value when document types are mixed and routing depends on content. The files and batch endpoints are coming soon, so parsing and orchestration stay in your infrastructure today.

Key facts

EndpointPOST /v1/chat/completions for classification, extraction and validation steps
Pipeline stagesClassify, parse, extract, validate and route — each independently testable
Files endpointComing soon; document ingestion and parsing run in your infrastructure today
Batch endpointComing soon; process queues with bounded concurrency now
Models30+ models; cheap aliases for classification and stronger ones for difficult extraction
Pricing modelFlat monthly self-serve plans with unlimited fair-use usage
Free tierFree plan with 2 free AI models, no card required
GovernanceScoped keys, audit logs and per-document traces

TL;DR

  • Break processing into stages; a single prompt cannot classify, extract and validate reliably.
  • Put human review on exceptions, not on every document.
  • Keep parsing and OCR in your infrastructure — the files endpoint is coming soon.
  • Track metrics per stage so failures are attributable.
  • Make every step idempotent and traceable per document.

How it works, step by step

  1. Inventory document types and define the processing path and required output for each.
  2. Build intake: capture, virus scan, hash and register the document with a stable id.
  3. Classify with a cheap model and a fixed label enum, then route by type.
  4. Parse text and structure, and extract fields with JSON mode per document family.
  5. Validate outputs against schema and business rules; queue exceptions for human review.
  6. Deliver validated results to downstream systems and log per-stage outcomes for monitoring.
1Inventory documenttypes and definethe processing path2Build intake:capture, virusscan, hash and3Classify with acheap model and afixed label enum,4Parse text andstructure, andextract fields with5Validate outputsagainst schema andbusiness rules;6Deliver validatedresults todownstream systems

Original data

POST /v1/chat/Endpoint30+ models; chModelsFree plan withFree tierSource: Plugsky facts table · updated 2026-09-25

Try it yourself

Open the RAG architecture builder →

Architecture of a document pipeline

Five stages plus a review lane:

  • Intake: register the document, compute a hash, scan for malware and assign a document id.
  • Classify: JSON-mode call returns a type from a fixed enum plus a confidence value.
  • Parse: text extraction, OCR where needed, and table detection in your infrastructure.
  • Extract and validate: per-family schemas, then business-rule checks in code.
  • Route: high-confidence outputs proceed; low-confidence or failed items go to human review.

Where agents actually help

Agents are a poor fit for steps that are already deterministic. They earn their place in four situations:

  • Mixed document types: a single intake stream containing invoices, contracts and applications that must be separated before processing.
  • Content-dependent routing: a scanned package where the next step depends on what the cover page says.
  • Exceptions: documents that fail validation and need a bounded investigation — check another section, compare an attachment, look up a reference.
  • Multi-document packages: files that must be matched to each other, such as a purchase order and its invoice.

Everything else — parsing, regex extraction, arithmetic checks — should stay in ordinary code.

Implementation and evaluation

Operational discipline keeps the pipeline trustworthy:

  • Use the document hash as an idempotency key so reprocessing never duplicates records.
  • Version schemas and store the version with every output so old results remain interpretable.
  • Keep prompts pinned per document family, and re-run golden sets when they change.
  • Route by confidence, not by document type alone; a confident invoice is different from a confident contract.

Metrics per stage: classification accuracy, parse quality (percentage of required text captured), per-field extraction accuracy, validation failure rate, straight-through processing share and exception review yield. Stage-level metrics tell you where to invest; document-level accuracy does not.

Limitations

Honest constraints of the current platform and the problem itself:

  • The files and batch endpoints are coming soon; ingest, storage, OCR and queueing are your responsibility today.
  • Scanned documents need OCR validation before any model step; poor scans produce confident garbage.
  • Complex tables, handwriting and multi-column layouts remain hard and often need specialized tooling.
  • Agent loops on high-volume uniform documents add cost without benefit; reserve them for exceptions.
  • Never let unvalidated extractions trigger payments, filings or irreversible actions.

Honest comparison

CapabilityStaged pipeline on PlugskyManual processing teamSingle monolithic script
Mixed document typesClassification stage routes by typeHuman judgmentBrittle if/else
ExceptionsBounded agent investigation plus reviewHuman handlesFails silently
TraceabilityPer-stage logs and per-document idsNotes and foldersLog files
Model choicePer-stage aliases among 30+ modelsNot applicableOne model
ScaleQueue with bounded concurrencyHiringLimited by fragility

Frequently asked questions

What is agentic document processing?

A pipeline where model-driven stages classify, extract and investigate exceptions, while deterministic code handles parsing, validation and delivery. Agents are used where routing depends on content.

Do I need an agent for every document?

No. Apply agent steps to mixed types and exceptions. Uniform high-volume documents are cheaper and more consistent with single JSON-mode calls.

Where does parsing happen?

In your infrastructure. The files endpoint is coming soon, so text extraction, OCR and storage remain your responsibility for now.

How do I handle exceptions?

Route validation failures and low-confidence items to a human review lane with the source context and extracted values attached, then feed corrected outcomes back into evaluation.

Which models should each stage use?

Cheap aliases such as plugsky-micro or plugsky-lite for classification and routing, with stronger aliases for difficult extraction from legal or financial documents.

How do I measure the pipeline?

Per stage: classification accuracy, parse capture rate, per-field accuracy, validation failure rate, straight-through processing and review yield.

Can I prototype document processing for free?

Yes. Chat completions and JSON mode are live, the free plan includes two free models with no card, and the 14-day full-access trial supports evaluation with paid aliases.