← All ivy-agents
IVYXSTUDIO · IVY AGENT
I

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.

  1. 01
    Read the PDF
    ivy.node.pdf-text

    Extracts the text of a PDF file, page by page and as one text, with the page count.

    takes
    path from the agent's input
    Ivy Node
  2. 02
    Extract 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
    context from step 1, text
    returns
    invoice
    Model turn
  3. 03
    Check the fields
    ivy.node.schema-validator

    Checks a payload against a JSON Schema subset and reports every problem it finds, not just the first.

    takes
    payload from step 2, output.invoice
    set
    schema {"type":"object","properties":{"invoice_number":{"type":"string"},"invoice_date":{"type":"string"},"due_date":{"type"...
    mode report
    returns
    valid, problems
    Ivy Node
  4. 04
    Only when the fields pass

    Lets what follows run only when valid of step 3 is true.

    Branch
  5. 05
    Lay out the summary
    ivy.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.invoice from step 2, output.invoice
    values.source from the agent's input, path
    set
    template # Invoice {{ invoice.invoice_number }} | Field | Value | | --- | --- | | Seller | {{ invoice.seller }} | | Buyer | {{...
    on_missing empty
    Ivy Node
  6. 06
    Write the summary
    ivy.node.file-write

    Writes text to a file, creating its folder, and returns the absolute path and the number of bytes written.

    takes
    text from step 5
    set
    path reports/invoice.md
    overwrite true
    returns
    report_path
    Ivy Node

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, 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.

Writes filesCalls a model

Inputs

FieldTypeDescription
pathrequiredstringPath to the invoice PDF.

Outputs

FieldTypeDescription
invoiceobjectThe extracted fields: invoice_number, invoice_date, due_date, seller, buyer, currency and total.
validbooleanTrue when every field is there and the total is a number.
problemsarrayOne sentence per problem the check found.
report_pathstringThe 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
    path data/showcase/invoice-a.pdf
    expects
    valid equals true
    invoice.invoice_number equals INV-2026-0417
    invoice.currency equals EUR
    invoice.total equals 1428
    report_path matches reports/invoice\.md$
  • consulting-days

    Another invoice, two pages, in dollars, gives other values.

    given
    path data/showcase/invoice-b.pdf
    expects
    valid equals true
    invoice.invoice_number equals NW-88213
    invoice.currency equals USD
    invoice.total equals 1950