Skip to content

Cookbook

Each page below is a self-contained recipe. They build a Worker and an Orchestrator, plug them together, and run. The shape is always the same — only the steps change.

If you have not read Quickstart, Concepts, Worker, and Orchestrator yet, start there. Five minutes of those four and every recipe here reads as a small adjustment to the same chain.

RecipeWhy this page exists
InvoicesLine items, tax, vendor normalisation, currency awareness.
Receipts (phone photos)Glare, skew, low-DPI, merchant + total.
IDs & passportsMRZ parsing, PII redaction before sending to the VLM.
ContractsClause segmentation, parties, signature blocks.
Bank statementsMulti-page tables, balance reconciliation, currency.
Handwritten notesBlock detection, per-line confidence, mixed print + cursive.
Long PDFsPage streaming, cross-page coordination, partial failure.
RecipeWhat it covers
Batch & watch ingestscriva.batch, scriva.watch, idempotent restart, sinks.
Rebuilding ocr-agent on scrivaA full case study porting a Japanese-forms / P&ID / annotation app — tabular forms, agentic discovery, P&ID symbols, annotation loop, FastAPI.

Each page follows the same shape so you know where to look:

  1. What you want — one paragraph, one screenshot of the input.
  2. The recipe — Worker + Orchestrator, the smallest chain that does the job.
  3. Customising — the two or three knobs that matter for this document kind.
  4. Production notes — caching, cost, retries, validation gates.
  5. Custom Workers and steps — small additions worth lifting into your own codebase. Only present where there is something genuine to write.

The recipes do not repeat reference material — they link out to the canonical doc pages. If a recipe makes a claim about a Worker or step and you want the full picture, follow the link.

You have…Start with…
One PDF and want JSONInvoices
Thousands of PDFs and a directoryBatch & watch
A folder of mobile photosReceipts
A scanned form with a known gridCookbook › ocr-agent §1
A bank statement that wraps across pagesBank statements
Ground-truth annotations and want to score a recipeEvaluation
A FastAPI app and want progress events / cancellationCookbook › ocr-agent §5
A trained classifier you want to swap inCookbook › ocr-agent §4
A bespoke Worker (proprietary VLM, hosted endpoint)Worker › Writing a custom Worker