Cookbook
Cookbook
Section titled “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.
By document kind
Section titled “By document kind”| Recipe | Why this page exists |
|---|---|
| Invoices | Line items, tax, vendor normalisation, currency awareness. |
| Receipts (phone photos) | Glare, skew, low-DPI, merchant + total. |
| IDs & passports | MRZ parsing, PII redaction before sending to the VLM. |
| Contracts | Clause segmentation, parties, signature blocks. |
| Bank statements | Multi-page tables, balance reconciliation, currency. |
| Handwritten notes | Block detection, per-line confidence, mixed print + cursive. |
| Long PDFs | Page streaming, cross-page coordination, partial failure. |
By workflow
Section titled “By workflow”| Recipe | What it covers |
|---|---|
| Batch & watch ingest | scriva.batch, scriva.watch, idempotent restart, sinks. |
| Rebuilding ocr-agent on scriva | A full case study porting a Japanese-forms / P&ID / annotation app — tabular forms, agentic discovery, P&ID symbols, annotation loop, FastAPI. |
How recipes are structured
Section titled “How recipes are structured”Each page follows the same shape so you know where to look:
- What you want — one paragraph, one screenshot of the input.
- The recipe — Worker + Orchestrator, the smallest chain that does the job.
- Customising — the two or three knobs that matter for this document kind.
- Production notes — caching, cost, retries, validation gates.
- 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.
Pick by what you have
Section titled “Pick by what you have”| You have… | Start with… |
|---|---|
| One PDF and want JSON | Invoices |
| Thousands of PDFs and a directory | Batch & watch |
| A folder of mobile photos | Receipts |
| A scanned form with a known grid | Cookbook › ocr-agent §1 |
| A bank statement that wraps across pages | Bank statements |
| Ground-truth annotations and want to score a recipe | Evaluation |
| A FastAPI app and want progress events / cancellation | Cookbook › ocr-agent §5 |
| A trained classifier you want to swap in | Cookbook › ocr-agent §4 |
| A bespoke Worker (proprietary VLM, hosted endpoint) | Worker › Writing a custom Worker |