Use case · Purchase orders

Every invoice, matched three ways.Here's how the agent is built.

Before an invoice is paid, someone finds its purchase order and proof the goods shipped, then checks every line. The agent matches every invoice to its purchase order and shipping order, says pay or hold, and cites the files.

Free to start. No credit card.

The goal

Pay what was ordered and shipped.Hold the rest.

A three-way match answers four questions for every invoice. Each answer sits in a different document.

Is there a purchase order?Every invoice needs an order behind it, with the same order ID.78 purchase orders
Does every line match?Product, quantity and unit price, line by line, against the purchase order.215 invoice lines
Did it ship?A shipping order with the same products and quantities, or the invoice waits.57 shipping orders
Does the total add up?The printed total against the sum of the lines, to the cent.78 invoices

Today someone opens three documents for every invoice and checks them side by side. The agent checks every invoice the same way and cites the files.

Data sources

Every document, as it arrived.

The build uses a public sample dataset built on the Northwind sample database, a fictional food distributor, published under the Apache-2.0 license. We took its last 78 orders: 78 purchase orders, 78 invoices and 57 shipping orders, 213 PDFs in one data source.

  • Create a data source.
  • Upload every PDF as it came.
  • Start ingestion.

At scaleEvery purchase order, receipt and invoice, as each one arrives. Built for millions of documents.

Datasource metadataIn the docs
The order-documents data source in Meibel: purchase orders, shipping orders and invoices for orders 11000 to 11077, each marked Ready.

Parse

Every line comes back as a table.

A purchase order lists products in columns. A shipping order lists each product with its quantity, price and line total. An invoice adds the customer's address and a printed total. Meibel reads each page into its tables and text, so every line keeps its product, quantity and price.

  • Nothing to configure.
  • Open any document to see each table and what was read from it.

At scaleA new supplier's layout is read the same way. No template per supplier.

Charts, formulas and vision modelsIn the docs
Invoice 11040 in Meibel next to its parsed product table: Sir Rodney's Scones, quantity 20, unit price 10.0, and the printed total 200.0.

Schema

One row per document, every line as printed.

The Order Document schema records the document type, order ID, dates, customer and shipper, then every product line: product ID, product, quantity, unit price and the line total when printed, plus the printed total.

  • Record values exactly as printed.
  • Leave a field empty when the document doesn't print it.

At scaleOne schema for purchase orders, shipping orders and invoices. Every document lands in the same table.

TipDon't let the extractor match documents. Record what each one says, and let the agent compare them.

Prompts and schemasIn the docs
The Order Document schema in Meibel, required by the agent: a lines list with product, quantity, line total, product ID and unit price for each line, and the printed total.

Extract

The extractor reads one document at a time.

An extractor is an agent with the schema switched on as required and no data sources attached. It reads only the document it's given and returns the header and every line.

  • Attach the schema and mark it required.
  • Leave the knowledge base empty.
  • Pick a fast model.

At scaleBecause it reads one document at a time, it runs in parallel across every file you load.

AgentsIn the docs
The Order Document Extractor in the Meibel Agent Builder: Deepseek V4p1 Flash, an empty knowledge base, no tools, and the Order Document schema marked Required by Agent.

Batch

Run every PDF into one table.

A batch runs the published extractor once per document and writes every result into one table. Here: 213 of 213 documents in 1 minute, none failed.

  • Choose the extractor and the documents data source.
  • Write every document into the same table.
  • Open any row to see the lines it holds.

At scaleEach day's documents are one upload plus one batch, run in parallel. Refine it on one document. Run it on millions.

Batch jobsIn the docs
The order-documents-extraction batch in Meibel: completed, 213 of 213 files, 0 failed, with one output per document.

Multiple data sources

Give the agent both.

The agent works from two sources. The table holds every line of every document, so the agent joins each invoice to its purchase order and shipping order by order ID and compares them line by line. The PDFs are there to confirm what was printed: when one extracted invoice had no total, the agent read it from the PDF, 200.00, and checked it against 20 × 10.00.

  • Attach both in the knowledge base.
  • Write the three checks into the prompt: purchase order, shipment, total.

At scaleMany agents can read the same table without reloading the files: payment runs, spend by supplier, open orders.

TipTell the agent a missing document is a reason to hold. It should never assume the document exists.

Building agentsIn the docs
The AP Match Desk in the Meibel Agent Builder: Claude Sonnet 5.5 with order-documents and the batch output in its knowledge base.

Confidence scoring

The checks asked for the evidence.

This agent is scored on completeness, correctness and grounding in its data. Its first answer had every count right, 8.0 for correctness, but showed no lines side by side, so completeness scored 5.0. A second answer said one invoice printed no total, because the table had none. Two prompt changes later, the agent reads the PDF when the table is empty and shows two invoices line by line across all three documents: completeness 9.0.

  • Switch on the checks before an answer reaches a payment run.
  • Read why a score is low, fix the prompt and ask again.

At scaleEvery answer is scored, so at volume your team reads the low scores, not every invoice. You choose the checks, and you decide what a low score triggers.

Confidence scoringIn the docs
Evaluation checks in the Meibel Agent Builder with Completeness, Correctness and Data Grounding switched on.

Ask it

78 invoices in.57 to pay.

One question to the agent: which invoices can we pay. It matches each one to its purchase order and shipping order, checks every line and the total, and cites the files.

AP Match DeskData grounding 0.84

Which of the 78 invoices can we pay, and which do we hold? Check each one against its purchase order and shipping order.

Pay 57 invoices, 106,014.61. Hold 21, 27,443.76. Every invoice ties to its purchase order line for line, and every total adds up. 21 have no shipping order.

InvoiceDecisionWhy
invoice-11000.pdfPayThree lines match purchase-order-11000.pdf and shipping-order-11000.pdf. 1,075.00 adds up.
invoice-11030.pdfPayFour lines match both documents. 16,321.90 adds up, the largest paid invoice.
invoice-11008.pdfHoldNo shipping order for order 11008. 4,903.50.
invoice-11040.pdfHoldNo shipping order. The table had no total, so it read the PDF: 200.00, which equals 20 × 10.00.
invoice-11072.pdfHoldNo shipping order for order 11072. 5,218.00, the largest hold.
invoice-11077.pdfHoldNo shipping order for order 11077. 1,374.60.

Sources: 78 invoices, 78 purchase orders and 57 shipping orders, each cited by file name. 6 of 78 rows shown.

Held21 invoices wait for a shipping order. All 21 are among the latest orders, 11008 to 11077. Pay each one when its shipping order arrives.

It answers the next questions the same way

Which customer has the most on hold?Customer ERNSH: 10,121.50 on invoice-11008.pdf and invoice-11072.pdf, both waiting for a shipping order. Next is LINOD, at 3,090.00.
Which shipper carried the most?United Package carried 27 of the 57 shipped orders, 57,519.58 of invoice value. With Speedy Express and Federal Shipping, the three add up to the 106,014.61 cleared to pay.
Which products are waiting most?Chang and Camembert Pierrot, each on 4 of the 21 held invoices: 62 and 73 units, at the same unit price every time.

Run it at scale

Refine it on one invoice.Run it on every payment run.

This build is small on purpose. At volume every step stays the same: more documents in the data source, the same schema and extractor, the same batch, and more agents on the same table.

In this buildAt scale
Documents213 public PDFs for 78 ordersEvery purchase order, receipt and invoice, as each one arrives
ExtractionOne batch, 213 of 213The same schema and extractor on every new document, in parallel
AgentsOne AP match deskMany agents on the same table: payment runs, spend by supplier, open orders
Questions78 invoices, three waysEvery invoice before every payment run, in a batch or as an MCP tool

Make it yours

Swap in your documents.Keep the steps.

Your documentsYour purchase orders, receipts, delivery tickets and supplier invoices, from every supplier.
Your recordAdd the fields your match needs, such as PO line numbers, tolerances, freight and tax, and your GL codes.
Your measureRun a month of invoices your team has already paid. Compare the decisions, and the time per invoice.

Try Meibel

Build the match desk.Start with one month of invoices.

Load a month of purchase orders, receipts and invoices, and ask which to pay.

  • Every document, read as data.
  • Same steps for one invoice or millions of documents.
  • Every line checked three ways.
  • Every answer scored and sourced.

Questions

What AP teams ask first.

Why not just ask an assistant to check the invoice?

Read one at a time, an invoice is checked against itself. The table lets the agent join every invoice to its purchase order and shipping order and check every line, across every order.

How many documents can it handle?

It's built for millions of documents. Batches run in parallel, and every new document goes through the same schema and extractor, into the same table.

Which documents can it read?

Purchase orders, receipts, packing slips, delivery tickets and invoices, as clean PDFs or scans, in each supplier's own layout.

What happens when a document is missing?

The invoice is held, with the reason. In this build, 21 invoices had no shipping order, so the agent held all 21 and listed them.

Is this a real company's data?

No. It's a public sample dataset built on the Northwind sample database, a fictional company, published under the Apache-2.0 license. Your own documents work the same way.

Can I limit what an agent can read?

Yes. An agent policy sets what it can read, and a session policy narrows that further for one conversation, by data source, file or any field.

Is Meibel SOC 2 compliant?

Yes. Meibel is SOC 2 Type II and HIPAA compliant.

How do I know an answer is right?

Every answer cites the documents it used, and is scored on the checks you choose. You decide what a low score triggers.

PALETTE