Automations ยท Issue 01 ยท Kindling

From inbox to ledger: uploading invoices into your accounting system

A small team of agents that watch your supplier inbox, read every PDF, code it, ask a human only when it matters, and post the draft bill to your accounting system โ€” built in Kindling in an afternoon.

The problem

Supplier invoices are a tax on growth

Accounts payable opens each file, eyeballs supplier and VAT, hunts for a PO, and keys lines into Xero or FreeAgent by hand. The cost isn't the typing โ€” it's the delay, the rework when a line is coded wrong, and the lack of visibility into what's still sitting in the inbox.

Messy inputs

PDFs, scans, phone photos, credit notes forwarded into the same thread.

Brittle middle

Manual matching to suppliers and nominal codes; duplicates slip through.

No visibility

No one knows what's been done, what's pending, or where a bill got stuck.

The thinking

A small team of agents, not one big prompt

A single LLM call can't be trusted to both read an invoice and post it. We split the work across four cooperating agents โ€” each with a narrow job, the right tools, and a single point where a human can step in if confidence drops.

Narrow agents with the right tools beat one giant prompt that tries to do everything at once.

Agent 1

Invoice Parser

Reads the email + PDF text, extracts supplier, dates, line items, VAT, total.

No tools

Agent 2

Supplier & Coder

Looks up the supplier in FreeAgent, picks a nominal code, flags duplicates.

freeagent_search_contacts

Agent 3 ยท HITL

Exception Reviewer

Pauses for a human only when something is off โ€” new supplier, VAT mismatch, low confidence.

Human in the loop

Agent 4

FreeAgent Poster

Creates the draft bill, attaches the PDF, moves the email to "Processed".

freeagent_create_bill ยท freeagent_attach_file ยท email_move

The build

Building it in Kindling

Kindling gives us the four building blocks we need: connected integrations (Gmail + FreeAgent), agents with tools, a workflow that chains them, and a trigger that watches the inbox. Here's how it comes together. Screenshots on this page are a bit narrower on large screens; tap or click any of them to open at full resolution.

01

Connect Gmail and FreeAgent

One-click OAuth from Project Settings โ†’ Integrations. This is what unlocks every tool the agents will use downstream.

Project Settings โ†’ Integrations. First-class OAuth connectors for Gmail and FreeAgent โ€” a click each to wire them in.
02

Build the four agents

Each agent gets a tight system prompt and only the tools it needs. The Exception Reviewer has "Requires human input" toggled on.

The four agents in this project, each carrying only the tools it actually needs. Agent 3 wears the "Human in loop" badge.
03

Anatomy of an agent

The Supplier & Coder is the most interesting one โ€” it reads the parsed invoice, calls freeagent_search_contacts to confirm the supplier exists, then proposes a nominal code based on the line items.

Inside the Supplier & Coder agent โ€” a tight system prompt and just the FreeAgent lookup tools.
04

Chain them into a workflow

A workflow is just an ordered list of agents. Output of each step becomes the input of the next. We call this one "Invoice โ†’ FreeAgent".

The workflow stitches the four agents into a single chain. Output of each becomes input of the next.
05

Watch the inbox with a Gmail trigger

An "App" wraps the workflow with a webhook and a Gmail trigger. We use label-as-queue mode: anything that lands in the to-process-invoices label gets a workflow run; the Poster agent removes the label at the end. One run per email, PDF attachments saved to disk automatically.

The App Runner's Triggers panel โ€” where a Gmail trigger fires the workflow once Gmail is connected, in label-as-queue mode.
Agent 3 paused for review. The human refines the supplier or category in chat; the agent revises and the run continues.

The refinement

Refining it in practice

The first run was 80% right. The next ten runs got us to 99% โ€” and we did it without redeploying anything. Every disagreement between the agents and the human reviewer became a few-shot example pasted into a system prompt, or a tighter rule about when to pause. The HITL refinement chat is where most of that learning happens.

In the room where it improves

HITL is not a failure mode โ€” it is where the workflow learns your finance team's judgement.

The result

What "live" looks like

A supplier emails an invoice. Within five minutes a draft bill is sitting in FreeAgent with the PDF attached, coded to the right nominal, and the email is moved to "Processed". The team only sees the ones that genuinely need them.

4

Agents in the chain

<5 min

Email to draft bill

1

Human checkpoint

100%

Auditable steps

Every completed run leaves a one-line summary on the project dashboard โ€” instant audit trail, no extra plumbing.

More editions

Back to Automations

Want Kindling or a bespoke build for your stack?

Get in touch