CALIBER
Quickstart

Cookbook 04 · Build

Document-to-JSON Pipeline

Turn invoice documents into schema-checked JSON, and hold every invalid one for a second person to approve or reject.

BuildCore20–30 min
What you build. A workflow that reads one invoice from the doc-intake bucket, extracts JSON with a deterministic python_code node, and checks it against a JSON Schema with a data_transform json_schema node. A valid record is written to doc-extracted under invoices/<invoice number>.json; an invalid one stops at review_gate, where a second person approves it (written under reviewed/) or rejects it (nothing is written). No model is called, so simulated and real providers give the same result.
Surfaces: Object Store Cookbooks Workflows Administration
What you learn
  • Create the doc-intake and doc-extracted buckets, upload the 30 sample documents under incoming/ and preview one in Object Store
  • Install the Document-to-JSON Pipeline cookbook as a paused draft from Cookbooks, then Resume it
  • Run one document per queued run, with the object key as the run input, and read each step in the Execution Debugger
  • See a duplicate invoice refused by the output bucket, and hold a document that fails the schema at an approval gate
  • Approve and reject as the reviewer account; the account that started a run is refused (403)
  • Check what reached the output bucket: exactly 17 objects, and nothing for the rejected document

Implementation flow

flowchart LR
  IN[("Bucket doc-intake: incoming/")] --> RD["read_document"]
  RD --> EX["extract_fields: python_code"]
  EX --> VS["validate_schema: JSON Schema"]
  VS --> PK["package_result"]
  PK --> RT{"route"}
  RT -->|valid| EE["emit_extracted"]
  EE --> WE[("write_extracted: doc-extracted/invoices/")]
  RT -->|invalid| RG{{"review_gate: second person"}}
  RG -->|approve and resume| WR[("write_reviewed: doc-extracted/reviewed/")]
  RG -->|reject| FAIL["run fails, nothing written"]

Step-by-step UI only

Each step shows the exact navigation path, the fields to fill, the button to click, and a snapshot of the CALIBER screen you'll be on.

  1. Admin › Administration (Accounts), top bar › Create workspace, then Project access creates · account: reviewer, workspace: invoice-intake, member: reviewer
    Create the second person, a workspace for the lab, and put them in it. On Administration enter reviewer as User ID and reviewer-pass-123 as Password and click Create account. Click the + next to the workspace selector in the top bar, name the workspace, and click Create and select. Back on Administration, choose the workspace under Project for access management, enter the reviewer's user id, pick the Reviewer role and click Add member. (The reviewer's platform scopes come from the environment variables in the README's setup section.)
    Fill in
    Account User ID / Passwordreviewer / reviewer-pass-123
    Workspace nameinvoice-intake
    User IDreviewer
    RoleReviewer
    Click Create account, Create and select, then Add member
    You'll see: The top bar shows the new workspace as active, and the Project members table lists reviewer with the role reviewer.
    Screen snapshot
    caliber · Admin › Administration (Accounts), top bar › Create workspace, then Project access
    Create workspace, then Project access
    Create account, Create and select, then Add member
  2. Agent resources › Object Store › Bucket browser creates · buckets: doc-intake, doc-extracted
    Create the two buckets the pipeline reads from and writes to. Type the bucket name into the new-bucket-name field and click + (Create bucket). Do it twice.
    Fill in
    new-bucket-namedoc-intake
    new-bucket-namedoc-extracted
    Click + (Create bucket)
    You'll see: Both buckets appear in the Bucket browser next to caliber-workspaces, the bucket the server keeps for itself.
    Screen snapshot
    caliber · Agent resources › Object Store › Bucket browser
    Object StoreBucket browser
    + (Create bucket)
  3. Agent resources › Object Store › doc-intake creates · 30 objects under doc-intake/incoming/ inv-2026-0101-acme.txt ↓ extraction-cases.jsonl ↓
    Open doc-intake, click New folder, name it incoming and click Create. Open the folder and click Upload; select all 30 files from the sources folder at once. The upload keeps each file name, so the keys become incoming/<file name>.
    Fill in
    folder nameincoming
    Filesall 30 files in assets/dataset/sources/
    Click Upload
    You'll see: The folder lists 30 objects, from empty.txt (0 B) to inv-2026-0123-oversized.txt (about 120 KB).
    Screen snapshot
    caliber · Agent resources › Object Store › doc-intake
    Object Storedoc-intake
    Upload
  4. Agent resources › Object Store › doc-intake › incoming creates · preview of a stored document
    Check the pipeline will see what you think it will. Click the View preview (eye) action on inv-2026-0101-acme.txt.
    Click View preview
    You'll see: The preview dialog shows the invoice text, starting Acme Industrial Supply Co. and containing Invoice No: INV-2026-0101. This is the text the workflow's Input Bucket node will read.
    Screen snapshot
    caliber · Agent resources › Object Store › doc-intake › incoming
    Object Storeincoming
    View preview
  5. Get started › Cookbooks creates · workflow: doc-intake-to-json (paused, draft v1)
    Install the pipeline. On Document-to-JSON Pipeline click Install, give the workflow a name, tick the prerequisites acknowledgement and click Install paused draft. The Studio opens on the draft with every node on the canvas.
    Fill in
    Workflow namedoc-intake-to-json
    Click Install paused draft
    You'll see: The editor outline lists read_document, extract_fields, validate_schema, package_result, route, emit_extracted, write_extracted, review_gate, emit_reviewed, write_reviewed and final. Validate answers Valid.
    Screen snapshot
    caliber · Get started › Cookbooks
    Cookbooks
    Install paused draft
  6. Agent resources › Workflows › doc-intake-to-json creates · workflow active
    The cookbook installs paused. Open the workflow's page and click Resume, then open the editor again and click Run monitor.
    Click Resume
    You'll see: The button now reads Pause, and the run monitor opens without the This workflow is paused note.
    Screen snapshot
    caliber · Agent resources › Workflows › doc-intake-to-json
    Workflowsdoc-intake-to-json
    Resume
  7. Agent resources › Workflows › doc-intake-to-json › Run monitor creates · runs: completed, doc-extracted/invoices/INV-2026-0101.json and TP-20260317-02.json
    Run a valid invoice. Type the object key into the run input and click Run. Then run the yen invoice; it is valid under this version too.
    Fill in
    Run inputincoming/inv-2026-0101-acme.txt
    Run input (second run)incoming/inv-2026-0107-tokyo.txt
    Click Run
    You'll see: The status badge reaches Completed within a few seconds and the Execution Debugger's step map lists write_extracted. The yen invoice also completes and its JSON is written.
    Screen snapshot
    caliber · Agent resources › Workflows › doc-intake-to-json › Run monitor
    WorkflowsRun monitor
    Run
  8. Agent resources › Workflows › doc-intake-to-json › Run monitor creates · run: failed (duplicate refused)
    Run the same invoice sent again under another file name.
    Fill in
    Run inputincoming/inv-2026-0101-acme-resend.txt
    Click Run
    You'll see: The run ends Failed and the monitor shows output_bucket write failed for 'invoices/INV-2026-0101.json': object already exists. The first invoice's JSON is not touched.
    Screen snapshot
    caliber · Agent resources › Workflows › doc-intake-to-json › Run monitor
    WorkflowsRun monitor
    Run
  9. Agent resources › Workflows › doc-intake-to-json › Run monitor creates · two runs awaiting approval
    Run an invoice whose total is missing, then try to approve your own run, then start a second invalid invoice (no vendor) that you will reject.
    Fill in
    Run inputincoming/inv-2026-0115-no-total.txt
    Run input (second run)incoming/inv-2026-0117-no-vendor.txt
    Click Run, then Approve
    You'll see: The badge reads Awaiting approval at review_gate. Clicking Approve as the account that started the run shows the account that triggered this run cannot approve it; a second person must decide and the run stays awaiting approval.
    Screen snapshot
    caliber · Agent resources › Workflows › doc-intake-to-json › Run monitor
    WorkflowsRun monitor
    Run, then Approve
  10. Top bar › Log out, then sign in as reviewer creates · runs: one approved and completed, one rejected
    Sign in as reviewer, select the workspace, open the workflow editor and the run monitor, select the first held run, click Approve, then Resume. Select the second held run and click Reject.
    Click Approve, Resume, Reject
    You'll see: The first run ends Completed and the step map lists write_reviewed. The second ends Failed.
    Screen snapshot
    caliber · Top bar › Log out, then sign in as reviewer
    Log out, then sign in as reviewer
    Approve, Resume, Reject
  11. Agent resources › Object Store › doc-extracted creates · doc-extracted/invoices/INV-2026-0101.json, doc-extracted/reviewed/inv-2026-0115-no-total.json
    Check what reached the output bucket. Open invoices and preview INV-2026-0101.json; open reviewed.
    Click View preview
    You'll see: The preview contains "invoice_number": "INV-2026-0101" and "total": 646.92. The reviewed folder holds inv-2026-0115-no-total.json and nothing for the rejected document.
    Screen snapshot
    caliber · Agent resources › Object Store › doc-extracted
    Object Storedoc-extracted
    View preview
  12. Agent resources › Workflows › doc-intake-to-json › editor creates · workflow version v1 published
    Version 1 is final. Sign in as admin again, select the workspace, open the workflow's editor and click Publish: run validation, tick the acknowledgement if shown, Next, Next, Publish.
    Click Publish
    You'll see: The message reads Published., the header changes from v1 · draft to v1 · published and a banner says the version is read-only.
    Screen snapshot
    caliber · Agent resources › Workflows › doc-intake-to-json › editor
    Workflowseditor
    Publish
  13. Agent resources › Workflows › doc-intake-to-json › editor creates · workflow version v2 published (JPY removed from the schema's currency list)
    Finance wants yen invoices checked by a person. Click Restore as draft in the banner, select the validate_schema node, delete "JPY" from the currency list in its config, click Save, then publish as before.
    Click Restore as draft, Save, Publish
    You'll see: The editor opens v2 · draft, shows Saved, and after publishing reads v2 · published.
    Screen snapshot
    caliber · Agent resources › Workflows › doc-intake-to-json › editor
    Workflowseditor
    Restore as draft, Save, Publish
  14. Agent resources › Workflows › doc-intake-to-json › Run monitor creates · run: awaiting approval (v2)
    Re-run the yen invoice on version 2.
    Fill in
    Run inputincoming/inv-2026-0107-tokyo.txt
    Click Run
    You'll see: The badge reads Awaiting approval at review_gate: the same document that completed under version 1 is now held, and nothing new is written.
    Screen snapshot
    caliber · Agent resources › Workflows › doc-intake-to-json › Run monitor
    WorkflowsRun monitor
    Run
  15. Agent resources › Workflows › doc-intake-to-json › Versions creates · version diff v1 to v2
    Compare the versions. Open the workflow's page, the Versions tab, and pick v1 · published as the base and v2 · published to compare. Then open the Runs tab.
    Click Versions tab, Compare
    You'll see: The diff lists validate_schema as the modified node. The Runs tab shows the two yen runs: one Completed (v1), one Awaiting approval (v2).
    Screen snapshot
    caliber · Agent resources › Workflows › doc-intake-to-json › Versions
    WorkflowsVersions
    Versions tab, Compare

Assets (copy-paste)

The exact files this cookbook uses — copy each into the matching field. Source: docs-site/cookbooks/04-document-extraction-structuring-lab/assets/.

assets/dataset/sources/inv-2026-0101-acme.txt
Acme Industrial Supply Co.
1200 Foundry Road, Dayton OH 45402

INVOICE
Invoice No: INV-2026-0101
Invoice Date: 2026-03-04
Due Date: 2026-04-03
Bill To: Caliber Demo Co., 500 Market St, Seattle WA

Qty   Description                          Unit Price      Amount
----  -----------------------------------  ------------  ------------
4     Hydraulic hose assembly, 2 m               $86.50       $346.00
12    Quick-release coupling                     $14.25       $171.00
2     Pressure gauge 0-250 psi                   $41.00        $82.00

Subtotal                                            $599.00
Tax (8%)                                            $47.92
Total                                               $646.92

Payment terms: Net 30. Quote the invoice number on your remittance.
assets/dataset/extraction-cases.jsonl
{"id": "D01", "tags": ["valid", "text", "currency-symbol"], "note": "Clean aligned-text invoice; currency inferred from the $ symbols.", "inputs": {"key": "incoming/inv-2026-0101-acme.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "INV-2026-0101", "vendor": "Acme Industrial Supply Co.", "invoice_date": "2026-03-04", "currency": "USD", "line_items": [{"description": "Hydraulic hose assembly, 2 m", "quantity": 4, "unit_price": 86.5, "amount": 346.0}, {"description": "Quick-release coupling", "quantity": 12, "unit_price": 14.25, "amount": 171.0}, {"description": "Pressure gauge 0-250 psi", "quantity": 2, "unit_price": 41.0, "amount": 82.0}], "total": 646.92}}, "source_bytes": 792}
{"id": "D02", "tags": ["valid", "text", "multi-line-items", "currency-code"], "note": "Item descriptions wrap onto a second line; the currency is only the code USD beside the total.", "inputs": {"key": "incoming/inv-2026-0102-brightline.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "BL-77120", "vendor": "Brightline Cloud Services Ltd", "invoice_date": "2026-03-09", "currency": "USD", "line_items": [{"description": "Managed hosting, production cluster March 2026, 3 nodes", "quantity": 1, "unit_price": 3200.0, "amount": 3200.0}, {"description": "Premium support retainer includes 24x7 paging and quarterly review", "quantity": 1, "unit_price": 1200.0, "amount": 1200.0}, {"description": "Extra storage 500 GB", "quantity": 4, "unit_price": 105.13, "amount": 420.5}], "total": 4820.5}}, "source_bytes": 532}
{"id": "D03", "tags": ["valid", "csv"], "note": "Invoice exported as CSV: key,value header rows, then a line-item table.", "inputs": {"key": "incoming/inv-2026-0103-northwind.csv"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "INV-2026-0103", "vendor": "Northwind Traders GmbH", "invoice_date": "2026-03-11", "currency": "EUR", "line_items": [{"description": "Oak planks 2.4 m", "quantity": 40, "unit_price": 18.5, "amount": 740.0}, {"description": "Wood glue 5 L", "quantity": 6, "unit_price": 22.9, "amount": 137.4}, {"description": "Delivery pallet", "quantity": 1, "unit_price": 35.0, "amount": 35.0}], "total": 1085.76}}, "source_bytes": 268}
{"id": "D04", "tags": ["valid", "text", "currency-symbol", "european-number-format"], "note": "Euro amounts written the European way (1.250,00); the date is '14 March 2026'.", "inputs": {"key": "incoming/inv-2026-0104-kessler.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "KP-2026-554", "vendor": "Kessler Pumpen AG", "invoice_date": "2026-03-14", "currency": "EUR", "line_items": [{"description": "Pumpe Typ K-200", "quantity": 2, "unit_price": 1250.0, "amount": 2500.0}, {"description": "Dichtungssatz", "quantity": 5, "unit_price": 38.9, "amount": 194.5}], "total": 2694.5}}, "source_bytes": 465}
{"id": "D05", "tags": ["valid", "text", "currency-symbol"], "note": "Pound sterling with VAT; the number follows 'INVOICE #'.", "inputs": {"key": "incoming/inv-2026-0105-harrow.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "HB-8812", "vendor": "Harrow & Bell Surveyors", "invoice_date": "2026-03-02", "currency": "GBP", "line_items": [{"description": "Site survey and report", "quantity": 1, "unit_price": 950.0, "amount": 950.0}, {"description": "Soil sampling kit", "quantity": 3, "unit_price": 120.0, "amount": 360.0}], "total": 1572.0}}, "source_bytes": 539}
{"id": "D06", "tags": ["valid", "markdown"], "note": "Markdown invoice with a pipe table and a bold total.", "inputs": {"key": "incoming/inv-2026-0106-lumen.md"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "LW-30415", "vendor": "Lumen Wholesale", "invoice_date": "2026-03-16", "currency": "USD", "line_items": [{"description": "LED panel 600x600", "quantity": 20, "unit_price": 31.4, "amount": 628.0}, {"description": "Mounting kit", "quantity": 20, "unit_price": 4.75, "amount": 95.0}], "total": 773.61}}, "source_bytes": 298}
{"id": "D07", "tags": ["valid", "text", "currency-symbol", "no-decimals"], "note": "Yen amounts without decimals.", "inputs": {"key": "incoming/inv-2026-0107-tokyo.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "TP-20260317-02", "vendor": "Tokyo Precision Parts KK", "invoice_date": "2026-03-17", "currency": "JPY", "line_items": [{"description": "Precision bearing set", "quantity": 10, "unit_price": 4800, "amount": 48000}, {"description": "Spindle oil 1 L", "quantity": 6, "unit_price": 1250, "amount": 7500}], "total": 55500.0}}, "source_bytes": 427}
{"id": "D08", "tags": ["valid", "text", "discount"], "note": "A negative discount line; currency given by an explicit Currency: CAD row.", "inputs": {"key": "incoming/inv-2026-0108-maple.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "MLT-4410", "vendor": "Maple Leaf Tire Depot", "invoice_date": "2026-03-18", "currency": "CAD", "line_items": [{"description": "Snow tires 205/55R16", "quantity": 4, "unit_price": 142.0, "amount": 568.0}, {"description": "Mount and balance", "quantity": 4, "unit_price": 25.0, "amount": 100.0}], "total": 618.0}}, "source_bytes": 542}
{"id": "D09", "tags": ["valid", "text", "shipping"], "note": "Tax percentage in the label and a shipping line; the total reconciles only if both are counted.", "inputs": {"key": "incoming/inv-2026-0109-ridge.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "RO-2201", "vendor": "Ridge Office Interiors", "invoice_date": "2026-03-19", "currency": "USD", "line_items": [{"description": "Ergonomic chair", "quantity": 3, "unit_price": 289.0, "amount": 867.0}, {"description": "Standing desk frame", "quantity": 3, "unit_price": 412.5, "amount": 1237.5}], "total": 2342.12}}, "source_bytes": 589}
{"id": "D10", "tags": ["valid", "text", "many-items"], "note": "24 line items, to show the table parser does not stop early.", "inputs": {"key": "incoming/inv-2026-0110-bulkparts.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "BP-60012", "vendor": "Bulkparts Direct", "invoice_date": "2026-03-20", "currency": "USD", "line_items": [{"description": "Fastener pack type 01", "quantity": 2, "unit_price": 2.75, "amount": 5.5}, {"description": "Fastener pack type 02", "quantity": 3, "unit_price": 3.0, "amount": 9.0}, {"description": "Fastener pack type 03", "quantity": 4, "unit_price": 3.25, "amount": 13.0}, {"description": "Fastener pack type 04", "quantity": 5, "unit_price": 3.5, "amount": 17.5}, {"description": "Fastener pack type 05", "quantity": 1, "unit_price": 3.75, "amount": 3.75}, {"description": "Fastener pack type 06", "quantity": 2, "unit_price": 4.0, "amount": 8.0}, {"description": "Fastener pack type 07", "quantity": 3, "unit_price": 4.25, "amount": 12.75}, {"description": "Fastener pack type 08", "quantity": 4, "unit_price": 4.5, "amount": 18.0}, {"description": "Fastener pack type 09", "quantity": 5, "unit_price": 4.75, "amount": 23.75}, {"description": "Fastener pack type 10", "quantity": 1, "unit_price": 5.0, "amount": 5.0}, {"description": "Fastener pack type 11", "quantity": 2, "unit_price": 5.25, "amount": 10.5}, {"description": "Fastener pack type 12", "quantity": 3, "unit_price": 5.5, "amount": 16.5}, {"description": "Fastener pack type 13", "quantity": 4, "unit_price": 5.75, "amount": 23.0}, {"description": "Fastener pack type 14", "quantity": 5, "unit_price": 6.0, "amount": 30.0}, {"description": "Fastener pack type 15", "quantity": 1, "unit_price": 6.25, "amount": 6.25}, {"description": "Fastener pack type 16", "quantity": 2, "unit_price": 6.5, "amount": 13.0}, {"description": "Fastener pack type 17", "quantity": 3, "unit_price": 6.75, "amount": 20.25}, {"description": "Fastener pack type 18", "quantity": 4, "unit_price": 7.0, "amount": 28.0}, {"description": "Fastener pack type 19", "quantity": 5, "unit_price": 7.25, "amount": 36.25}, {"description": "Fastener pack type 20", "quantity": 1, "unit_price": 7.5, "amount": 7.5}, {"description": "Fastener pack type 21", "quantity": 2, "unit_price": 7.75, "amount": 15.5}, {"description": "Fastener pack type 22", "quantity": 3, "unit_price": 8.0, "amount": 24.0}, {"description": "Fastener pack type 23", "quantity": 4, "unit_price": 8.25, "amount": 33.0}, {"description": "Fastener pack type 24", "quantity": 5, "unit_price": 8.5, "amount": 42.5}], "total": 422.5}}, "source_bytes": 1947}
{"id": "D11", "tags": ["valid", "text", "non-ascii", "utf-8"], "note": "Non-ASCII characters that ARE valid UTF-8 pass through intact (contrast with D22).", "inputs": {"key": "incoming/inv-2026-0111-mueller.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "MS-2026-031", "vendor": "Müller & Söhne GmbH", "invoice_date": "2026-03-21", "currency": "EUR", "line_items": [{"description": "Wartungsvertrag Q1", "quantity": 1, "unit_price": 2400.0, "amount": 2400.0}], "total": 2400.0}}, "source_bytes": 353}
{"id": "D12", "tags": ["valid", "csv", "quoted-comma"], "note": "CSV whose descriptions contain commas inside quotes.", "inputs": {"key": "incoming/inv-2026-0112-orchard.csv"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "OH-3009", "vendor": "Orchard Hardware LLC", "invoice_date": "2026-03-22", "currency": "USD", "line_items": [{"description": "Widget, large", "quantity": 10, "unit_price": 7.4, "amount": 74.0}, {"description": "Widget, small", "quantity": 25, "unit_price": 3.1, "amount": 77.5}], "total": 151.5}}, "source_bytes": 200}
{"id": "D13", "tags": ["valid", "text", "fractional-quantity"], "note": "Fractional quantity (7.5 hours) and labels 'Vendor:' / 'Inv. No:' / 'Issued:'.", "inputs": {"key": "incoming/inv-2026-0113-sable.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "SBL-5521", "vendor": "Sable Analytics", "invoice_date": "2026-03-23", "currency": "USD", "line_items": [{"description": "Consulting hours", "quantity": 7.5, "unit_price": 160.0, "amount": 1200.0}, {"description": "Travel expenses", "quantity": 1, "unit_price": 212.4, "amount": 212.4}], "total": 1412.4}}, "source_bytes": 415}
{"id": "D14", "tags": ["valid", "text"], "note": "Subtotal, tax and a 'Grand Total' label; the grand total (not the subtotal) is the invoice total.", "inputs": {"key": "incoming/inv-2026-0114-delta.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "DS-9004", "vendor": "Delta Software Inc.", "invoice_date": "2026-03-24", "currency": "USD", "line_items": [{"description": "Annual licence, 10 seats", "quantity": 10, "unit_price": 199.0, "amount": 1990.0}], "total": 2189.0}}, "source_bytes": 456}
{"id": "D15", "tags": ["valid", "text", "distractor-fields"], "note": "A PO number and a due date sit beside the invoice number and date and must not replace them.", "inputs": {"key": "incoming/inv-2026-0129-harbor.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "HM-1188", "vendor": "Harbor Metrology", "invoice_date": "2026-03-26", "currency": "USD", "line_items": [{"description": "Calibration service", "quantity": 2, "unit_price": 450.0, "amount": 900.0}], "total": 900.0}}, "source_bytes": 390}
{"id": "D16", "tags": ["valid", "text", "whole-amount"], "note": "A total written without cents.", "inputs": {"key": "incoming/inv-2026-0130-quillnet.txt"}, "expectations": {"outcome": "extracted", "record": {"invoice_number": "QN-0001", "vendor": "Quillnet Registrar", "invoice_date": "2026-03-27", "currency": "USD", "line_items": [{"description": "Domain renewal", "quantity": 1, "unit_price": 1000.0, "amount": 1000.0}], "total": 1000.0}}, "source_bytes": 294}
{"id": "D17", "tags": ["invalid", "missing-total"], "note": "The document never states a total, so the extractor leaves it null and the schema requires it.", "inputs": {"key": "incoming/inv-2026-0115-no-total.txt"}, "expectations": {"outcome": "needs_review", "errors": ["total"]}, "source_bytes": 378}
{"id": "D18", "tags": ["invalid", 
… truncated — open the file in the repo for the full content.

Evaluation & quality gates

Quality gateTarget
Valid invoices extracted and matching the expected JSON16 of 16
Invalid documents held at review_gate with exactly the listed schema errors13 of 13
Duplicate invoice refused by the output bucket1 of 1
Account that started a run cannot approve it403
Approved document written under reviewed/, rejected document writes nothingdoc-extracted holds exactly 17 objects
Developer notes & gotchas
  • Flags. CALIBER_FEATURE_COOKBOOKS=true opens the gallery (a preview area, off by default); no other flag is needed. The lab also needs an S3-compatible store: scripts/cookbook-env.sh up lab04 --flags cookbooks --s3 starts a private in-memory one, so objects do not survive restart.
  • Nothing in the pipeline is simulated, and no model is called. The simulated default LLM and evaluator providers are never used; the result is deterministic. The object store is real S3 protocol (moto), not a production service.
  • Second person required. Start with CALIBER_APPROVER_USERS=admin,reviewer CALIBER_OPERATOR_USERS=admin,reviewer (approver to approve or reject, operator to resume). Leave CALIBER_APPROVAL_ALLOW_SELF_APPROVAL unset, and keep runtime approvals and the run queue on.
  • Text only. input_bucket decodes UTF-8 with replacement characters and keeps 100,000 bytes per object, so binary .docx/.xlsx cannot flow through it, and the 120 KB oversized file is truncated.
  • Preview is blocked. The editor's Preview refuses this workflow (it cannot isolate python_code, input_bucket or output_bucket); run it for real, queued, through POST /workflow-runs.
  • Extractor is rules, not a model. It understands only the layouts in the corpus (aligned text, Markdown table, CSV) and writes null for anything a document does not state. A new layout is a new dataset case and a new rule. One run handles one document.
  • Keep the gate's shape. After an approval only what flows through the gate reaches later nodes; the installed workflow puts the record and its schema errors in one text (package_result) for that reason.
  • Runnable. sdk/caliber-sdk/examples/cookbooks/cookbook_04_document_to_json_pipeline.py (about 75 s, 30 runs); UI: caliber/caliber-ui/e2e/cookbooks/labs/04-document-extraction.spec.ts; environment: scripts/cookbook-env.sh up lab04.

CALIBER : Contextual Adaptive Lifecycle for Intelligent Build, Evaluation, and Refinement — Cookbooks — every recipe is UI-implementable on the shipped platform. Source + assets under docs-site/cookbooks/<nn>-…/. Regenerate with python3 docs-site/cookbooks/training/build.py.