
Most coding is obvious, and the rest is a judgment nobody wrote down
Coding invoices looks repetitive at first, but that changes. 80% of invoices go to the obvious account. The rest raise real questions: whether a charge is a subscription or a personal service, and whether a shared tool belongs to the department that bought it or the one that uses it.
The person who usually codes invoices keeps those decisions in their head. The decisions are consistent, but nobody has written them down. You cannot hand the task to a new person or to a set of rules without trouble.
The agent must know the pattern and must detect when an invoice does not follow it. A new supplier, an amount well outside that supplier's normal range, or a description that fits two accounts: each of these is a reason to ask rather than to assign a code.
Miscoding is costly in a specific way. It only becomes obvious when the report looks wrong at the end of the quarter. Fixing it then costs more than the original question would have.
How the agent is built in Agent Studio
Prompt skills hold the coding rules: your chart of accounts, your cost centers, and the conventions nobody has written down. Those conventions include which supplier maps where and how shared costs are split.
The system prompt tells the agent when to ask rather than to assign a code. Ask when the supplier is new, when the amount is outside the supplier's normal range, when the description fits more than one account, or when the value exceeds the threshold you set.
The invoice extraction flow sends its structured output to the Agent Chat node. The agent then reasons about the parsed invoice rather than the PDF.
A PostgreSQL node supplies the supplier's coding history. That history is the strongest signal available. A rules table cannot use it.
Coded invoices go back to the ledger through an HTTP Request node. Questions go to the finance lead through Slack, with the two possible accounts and the reason for the ambiguity.
Google Sheets logs every coding decision and its justification. Monthly review of the corrections is how informal conventions become written ones. That process is worth more than the time saved.
What this agent is built from
- Prompt skills: hold the chart of accounts, cost centers, and the conventions nobody had written down.
- System prompt: states the conditions that require a question rather than a coding decision.
- PostgreSQL (Data): supplies the supplier's coding history as the strongest available signal.
- Agent Chat (Util): receives the parsed invoice from the extraction flow.
- Slack (Communication): carries ambiguous invoices with both candidate accounts and the reason.
- Google Sheets (Integration): logs decisions and corrections, which is how conventions get documented.
- When an ActionFlow is enough: If supplier-to-account mapping is fixed and complete, a lookup workflow codes them with no ambiguity at all.
Frequently asked questions
Start building AI workflows
Create a free account, open a template or a blank canvas, and run your first ActionFlow.
Newsletter
Get product updates
New nodes, agents, and product notes. We send mail only when we have something worth opening.