Skip to content

Supplier invoices ​

Every invoice that arrives in a folder is read, matched to its order and approved for payment.

In words ​

The wishEvery supplier invoice that arrives is read, checked against its order and ready to pay

Step 1 · read

What to doRead the new invoices in invoices/inbox and write each as a line of invoices/new.csv: supplier, number, date, total and order number.
Who does itAn agent
What proves it
  • These must be there: invoices/new.csv
  • Another agent must find this true: “Each line of invoices/new.csv has the same supplier, number, date and total as its PDF.”

Step 2 · match

What to doMatch each line of invoices/new.csv to its purchase order.
Who does itAn algorithm runs orders-match invoices/new.csv --out invoices/matched.csv
What proves itThe command ends without an error.

Step 3 · approve

What to doApprove the invoices in invoices/matched.csv for payment.
Who does itA person
What proves itTheir word stands.

The file ​

json
{
  "$schema": "vpf/1",
  "wish": "Every supplier invoice that arrives is read, checked against its order and ready to pay",
  "start": {
    "on": "files",
    "paths": [
      "invoices/inbox/*.pdf"
    ]
  },
  "limits": {
    "minutes": 20,
    "cost": 0.5,
    "month": 30
  },
  "steps": [
    {
      "id": "read",
      "do": "Read the new invoices in invoices/inbox and write each as a line of invoices/new.csv: supplier, number, date, total and order number.",
      "by": "agent",
      "tools": [
        "read",
        "write"
      ],
      "proof": [
        {
          "by": "algorithm",
          "needs": [
            {
              "need": "files",
              "path": "invoices/new.csv"
            }
          ]
        },
        {
          "by": "agent",
          "check": "Each line of invoices/new.csv has the same supplier, number, date and total as its PDF."
        }
      ]
    },
    {
      "id": "match",
      "do": "Match each line of invoices/new.csv to its purchase order.",
      "by": "algorithm",
      "run": "orders-match invoices/new.csv --out invoices/matched.csv"
    },
    {
      "id": "approve",
      "do": "Approve the invoices in invoices/matched.csv for payment.",
      "by": "person"
    }
  ]
}

Why it is written this way ​

The plan starts when a file arrives. Its limits keep each run under 20 minutes and its cost low, by run and by month. Another agent compares each line with its PDF.

Code, schema and examples under the Apache License 2.0. Guide text also under CC BY 4.0.