Work sample 08 / 14AI agent integration

Private Ollama bill coding into Xero or QuickBooks Online

How I'd approach supplier bills for a multi-branch service group whose owner will not send financial documents to an outside AI service: a model running on the group's own hardware proposes the coding, a person approves it, and nothing posts on its own.

Worked example on representative data.

Area
AI agent integration
Tools
Ollama (Qwen, Nemotron) · Xero · QuickBooks Online
Typical scope
US$3,500–5,000
Timeline
About 6 weeks · 4 fixed milestones

01Context

A multi-branch service group whose owner will not send financial documents to an outside AI service. Supplier bills arrive by email and as scans, and are keyed into the ledger by hand.

The systems in play

In the example each operating company has its own ledger, in Xero or QuickBooks Online. A bookkeeper enters the bills, branch managers approve them, and an outside accountant reviews the books.

Table 1Who uses what
SystemWhat it does for the business
Bill inbox or shared folderWhere supplier bills arrive, as PDFs, photos and scans.
Ollama on the group’s own hardwareRuns the language models locally. No bill, supplier detail or bank detail is sent to an outside AI service.
Approval queueA page where a person sees the bill beside the proposed coding, then approves or edits it.
Xero or QuickBooks OnlineThe ledger. Receives a bill only after approval.

02Problem

What the owner sees

  1. Hours spent keying bills by hand
  2. Bills coded to the wrong account or branch
  3. The same bill paid twice
  4. Bills that wait for the one person who understands them

Faster bill entry is easy to promise. The harder part is that every number and every code has to be right, and a person has to stay accountable for what posts.

Table 2Where bill entry goes wrong
Everyday situationWhat goes wrong
Re-keyed amountsA typo changes the total or the tax
Duplicate billsThe same bill is emailed twice, or arrives again with a statement
Wrong account or tax codeThe same supplier is coded differently by different people
Missing job or branchCost cannot be traced to where it was incurred
Credit notes entered as billsA credit increases what is owed
Split billsOne bill covers two jobs or two branches
Poor scansFields are unreadable and are guessed

03Approach

Four steps, in this order. The model only proposes. Checks in code and a person decide.

  1. LookA sample of past bills is collected with how each was coded. The supplier list, chart of accounts and coding rules are reviewed.
  2. BuildA local pipeline reads each bill, checks it in code and proposes coding. The model may only choose from your existing accounts, tax codes and branches.
  3. Shadow runThe pipeline runs beside manual entry for a few weeks. Each field is compared with what the bookkeeper entered, and every difference is reviewed.
  4. Go live with approvalProposals go to the approval queue. Nothing posts without an approver, and anything the checks flag goes to a person first.

How a bill moves

  1. Bill arrives
  2. Text read, or scan read by a vision model
  3. Fields saved in a fixed format
  4. Checks in code
  5. Coding proposed
  6. Approval queue
  7. Posted with the PDF attached
  8. Audit log

04What the setup includes

What the setup includes, and why each piece is there. The detail of how it is configured is agreed in the scoping call.

Show the setup, layer by layer
Table 3The setup, layer by layer
LayerWhat is set up and why
Hosting and modelsOne workstation or small server on the group’s network runs Ollama. Qwen is used for reading and Nemotron is compared for proposals, and the shadow run decides which is kept. Models and bills stay on the group’s hardware.
IntakeA mailbox or shared folder. Each file is hashed on arrival, so the same file is never processed twice.
ReadingThe text layer of the PDF first. A vision model for scans. Output goes into fixed fields in a strict format, and anything that does not fit the format is rejected.
Checks in codeLines plus tax equal the total. The date is plausible. The supplier matches the contact list, including bank details. The duplicate key is supplier, bill number and total. Credit notes are detected. These are code, not the model.
Coding proposalSupplier, account, tax code, and branch or job, based on how that supplier was coded before and the chart of accounts. The model can only choose from existing lists.
Approval queueThe PDF beside the proposal, the reasons, and any flags. An approver edits or approves. Role limits apply, so bills above a set amount need a second approver.
PostingA Xero bill, or a QuickBooks Online bill, with the PDF attached, created only after approval. A retry key means a failed attempt can never post twice.
Audit logWho approved, what they changed from the proposal, the model and prompt version, and a hash of the original file.
Rules from editsEdits made by approvers are reviewed monthly and turned into written rules. There is no automatic retraining.

05Edge cases

These are agreed with the bookkeeper and tested on real past bills during the shadow run.

Table 4Edge cases and how each is handled
SituationHow it is handled
Credit noteDetected from the document and the sign. Posted as a supplier credit and never as a bill.
Bill split across jobs or branchesThe split is proposed and shown. A manager approves the split.
Supplier not in the contact listGoes to the queue. A contact is never created automatically.
Same bill twiceThe file hash or the supplier, number and total match. It is flagged and rejected as a duplicate.
Poor scan or totals that do not add upMarked as not read. Entered by hand, and kept as a test case.
Bill addressed to another company in the groupDetected from the bill-to name and routed to that company’s queue, or flagged if unsure.
Tax-inclusive and tax-exclusive totalsBoth are checked against the lines. A mismatch is flagged.
Model is offlineThe queue shows bills as not read and manual entry continues. Nothing is lost.
Approver edits the proposalThe change is saved in the audit log with the user and the reason.

06Worked example

The tables below use representative data. They show the shape of the queue and the shadow run, not a client result. No accuracy figure is claimed.

Table 5Approval queue (sample data, US$)
BillTotalProposed codingFlagResult
Supply house, INV-204181,284.50Parts and materials, North branch, standard rateNoneApproved as proposed
Equipment hire, H-7731612.00Equipment hire, job 4821, standard rateJob taken from the bill notesApproved, branch corrected to South
Supply house, INV-20418 (again)1,284.50Same as aboveDuplicate: same supplier, number and totalRejected as a duplicate
Subcontractor, 00933,900.00Subcontractors, split across two jobsSplit billSplit approved by the branch manager
Supply house, CN-552-240.00Parts and materials, North branchCredit notePosted as a supplier credit
Unnamed scanNot proposedLow quality, totals do not add upEntered by hand
New supplierNot proposedNot in the contact listContact created by the bookkeeper, then re-run
Table 6Shadow run, sample rows
BillFieldBookkeeper enteredModel proposedMatch
INV-20418AccountParts and materialsParts and materialsYes
0093AccountSubcontractorsSubcontractorsYes
0093Job4821 and 48304821 onlyNo: reviewed, split rule added
H-7731Tax codeStandard rateNo taxNo: reviewed, supplier rule added

07How the result is checked

The checks that matter are the ones in code, because a model can be confidently wrong. A person approves everything that posts.

Table 7Checks and pass conditions
CheckHowPass condition
TotalsRecomputed in code from the lines and taxEqual to the stated total
DuplicatesThe same bill sent twice, and a statement copySecond copy rejected
Shadow runField-by-field comparison beside manual entry over a few weeksEvery difference reviewed and either a rule is added or the field stays with a person
PermissionsApprovers tested against the role limitsA bill over the limit cannot post on one approval
FailureModel switched offQueue shows not read and manual entry continues
After go-liveEvery flagged bill plus a regular sample of the restReviewed and logged

08Scope and milestones

A fixed scope agreed in writing before anything starts. Each milestone is paid when you sign off its deliverable.

Table 8Scope: what a project like this covers
AreaIncluded
Health CheckReview of bill flow, the chart of accounts and the hardware available, a 45-minute call, written findings and a fixed quote
Reading pipelineIntake, reading, fixed fields and the checks in code
Coding proposalProposal from your own lists, with reasons
Approval queueA page for approvers, with role limits and the audit log
PostingXero or QuickBooks Online bills created after approval, with the PDF attached
Shadow runA few weeks beside manual entry, with a written review of every difference
HandoverWritten SOPs, a recorded walkthrough and files you own, plus 14 days of fixes after go-live
Not includedTax filing or payroll.
Also outside the scopeBuying and hosting the hardware. Accounting software subscriptions (billed to you by the vendors). Training a custom model.
Table 9Fixed milestones
MilestoneDeliverableTimingShare
M1 Health Check and sample setFindings, rules and a sample set of past billsWeek 120%
M2 Pipeline reads billsChecks pass on the sample setWeeks 2 to 330%
M3 Shadow runCompared with manual entry, differences reviewedWeeks 4 to 530%
M4 Approval queue live and handoverQueue live, SOPs, walkthrough, 14 days of fixesWeek 620%

Typical scope for this kind of project: US$3,500–5,000

About 6 weeks across 4 fixed milestones. The Systems Health Check (US$300, fixed) comes first and confirms the scope.

Describe the process you want handled, and I'll say where I'd start.

Send a short note through the form on the home page. I will reply with where I would start, and whether the US$300 Systems Health Check is the right first step.