Invoice Extraction
ivy.agent.invoice-extraction · v1.0.0
ivyx
Reads an invoice PDF, has a model extract its fields, checks them against a schema and writes a summary when they pass.
Steps
In the order the agent's file lists them, each with where its inputs come from and the values the file fixes. A branch or a loop is a step too.
- 01Ivy NodeRead the PDFivy.node.pdf-text
Extracts the text of a PDF file, page by page and as one text, with the page count.
- takes
pathfrom the agent's input
- 02Model turnExtract the invoice fields
Extract these fields from the invoice text as a JSON object: invoice_number (string), invoice_date (string, as YYYY-MM-DD), due_date (string, as YYYY-MM-DD), seller (the company that issued the invoice), buyer (the company that is billed), currency (the three-letter code) and total (the total amount due, as a number without thousands separators). Use only what the text says.
- takes
contextfrom step 1,text- returns
invoice
- 03Ivy NodeCheck the fieldsivy.node.schema-validator
Checks a payload against a JSON Schema subset and reports every problem it finds, not just the first.
- takes
payloadfrom step 2,output.invoice- set
schema{"type":"object","properties":{"invoice_number":{"type":"string"},"invoice_date":{"type":"string"},"due_date":{"type"...modereport- returns
valid,problems
- 04BranchOnly when the fields pass
Lets what follows run only when valid of step 3 is true.
- 05Ivy NodeLay out the summaryivy.node.template-render
Fills {{ name }} placeholders in a text template from a mapping, and reports which names were missing.
Runs only on the then branch of step 4.
- takes
values.invoicefrom step 2,output.invoicevalues.sourcefrom the agent's input,path- set
template# Invoice {{ invoice.invoice_number }} | Field | Value | | --- | --- | | Seller | {{ invoice.seller }} | | Buyer | {{...on_missingempty
- 06Ivy NodeWrite the summaryivy.node.file-write
Writes text to a file, creating its folder, and returns the absolute path and the number of bytes written.
- takes
textfrom step 5- set
pathreports/invoice.mdoverwritetrue- returns
report_path
Nodes it brings
Adding this agent in IVYX Studio adds these nodes with it. A node your workspace already has is kept as it is, even at another version.
What it touches
Collected from what each of its nodes declares and what the agent's own file declares, such as moving a robot, plus the model call when a step is a model turn. A declaration is the author's statement, and it is what policy rules select on.
Inputs
| Field | Type | Description |
|---|---|---|
| pathrequired | string | Path to the invoice PDF. |
Outputs
| Field | Type | Description |
|---|---|---|
| invoice | object | The extracted fields: invoice_number, invoice_date, due_date, seller, buyer, currency and total. |
| valid | boolean | True when every field is there and the total is a number. |
| problems | array | One sentence per problem the check found. |
| report_path | string | The summary file, written only when the fields pass. |
Tests
2 of 2 test cases passed on Oct 4, 2026, in the publisher's own environment, before this version was published. The registry keeps that record; it does not run the cases again.
Requires: python:3.9, a model core
- maintenance-plan
A one-page invoice in euros: the number, the currency and the total are read and the summary is written.
- given
pathdata/showcase/invoice-a.pdf- expects
validequals trueinvoice.invoice_numberequals INV-2026-0417invoice.currencyequals EURinvoice.totalequals 1428report_pathmatches reports/invoice\.md$
- consulting-days
Another invoice, two pages, in dollars, gives other values.
- given
pathdata/showcase/invoice-b.pdf- expects
validequals trueinvoice.invoice_numberequals NW-88213invoice.currencyequals USDinvoice.totalequals 1950