I re-engineered bank reconciliation using an autonomous agent workflow. Here is the exact architecture and the API costs.
Reconciling 45,000 bank statement lines a month for a UAE group with rules and four Claude agents costs about $361 a month in API fees, modelled to save around 680 hours.
Bank reconciliation is the close task everyone thinks is solved. The ERP has an auto-match. The bank sends a file. And yet in the first week of every month, a group finance team still spends days on the lines the auto-match didn't take: a customer who paid three invoices in one transfer and deducted a bank charge, a receipt with only "TRF FROM ABC TRADING" in the narrative, an intercompany transfer booked in one entity and not the other, an FX difference nobody posted.
The firm here is a UAE group with 14 legal entities and about 40 bank accounts across five banks, in AED, USD and EUR. Those accounts produce about 45,000 statement lines a month. The ERP's rules match about 82% of them. The other 18% are where the hours go, and they pile up at month end, when the same accountants are also closing.
Most of the redesign is better rules and better data. The models only handle what rules cannot: read free-text narratives and remittance emails, reason about partial and bundled payments, and decide which exceptions a person must see.
The group here is a composite: the volumes are typical for a mid-sized UAE trading or services group, and every cost below is computed from Claude API list prices on 10 November 2026.
the process today
| step | who | minutes |
|---|---|---|
| Download statements from each bank portal and import them into the ERP | Treasury analyst | 0.05 |
| Run the ERP auto-match and check the proposed matches | Accountant | 0.10 |
| Identify the customer behind unmatched receipts from narratives and remittance emails | AR accountant | 0.45 |
| Trace unmatched payments, bank charges and FX differences | AP accountant | 0.25 |
| Post journals for bank charges, interest and FX adjustments | Accountant | 0.10 |
| Pair intercompany transfers across entities and banks | GL accountant | 0.10 |
| Prepare the reconciliation statement and age the reconciling items | Accountant | 0.08 |
| Review and sign off each account's reconciliation | Finance manager | 0.02 |
| Total per statement line (blended) | 1.15 |
These are blended averages across all 45,000 lines. A line the auto-match takes costs a few seconds of checking. An unmatched receipt costs five to ten minutes of searching, and those are about one line in five. At 45,000 lines that is about 863 hours a month, or five to six people, and most of it lands in the five working days after month end.
The time goes into the gap between what the bank says and what the ERP (SAP, Oracle, Dynamics 365 or NetSuite) knows. Bank narratives are truncated and inconsistent across banks. Customers pay several invoices at once, net off a credit note, or lose a bank charge on the way. Remittance advices arrive in a shared inbox as PDFs or plain emails, if they arrive at all. The errors come from the same place: a receipt applied to the wrong customer, an FX difference parked in suspense, an intercompany leg left open across a month end.
the agent architecture
The pattern is a pipeline with a router after the rules. Every line goes through intake and the rules matcher in the same order. What the rules don't match is routed by type: receipts to remittance reading and match investigation, everything else to classification and the exception reviewer. I chose a pipeline over an orchestrator because the order never changes, and every step needs to leave an audit trail an external auditor can follow.
Statement parsing, the rules matcher, intercompany pairing, fee and interest journals, the reconciliation statement and the ageing are all ordinary code. If a reference and an amount match, code should take it, every time.
statement intake (deterministic)
Where the bank offers it, statements arrive as ISO 20022 CAMT.053 or SWIFT MT940 files by host-to-host or SFTP, daily. Most large UAE banks offer one or both for corporate accounts; some smaller relationships still mean a portal export or a PDF. Files are parsed into one canonical line: account, value date, amount, currency, bank reference, end-to-end ID and narrative. PDFs go through an OCR service (Azure Document Intelligence, AWS Textract or Google Document AI). Opening and closing balances must tie to the previous day's file, or the whole file is held.
rules matcher (deterministic)
The matcher replaces the ERP's auto-match with rules the finance team can read: exact reference, amount and currency within a value-date window; one receipt to several invoices where the amounts sum exactly; intercompany legs paired by amount, date and the counterparty entity's account. Known patterns are booked by rule: bank charges, VAT on charges, interest, standing orders and card settlements. In this group, the rules take about 82% of lines.
classifier agent
- Job: label each unmatched line by type (customer receipt, supplier payment, bank charge, FX, payroll, tax payment, intercompany, card settlement, unknown) and suggest a likely counterparty from the narrative.
- Model: Haiku 5.5. It is short-text classification against a cached customer and supplier list, about 8,100 times a month.
- Inputs and outputs: the canonical line and a cached mapping of narrative patterns to counterparties; returns a type, a counterparty ID or none, and a confidence score. No tools.
- Guardrails: the counterparty must exist in the master data. Under 0.85 confidence the line goes to the exception reviewer with the label marked uncertain.
remittance reader agent
- Job: turn remittance advices from the AR inbox into invoice numbers, amounts and deductions, linked to the receipt they explain.
- Model: Sonnet 5.5. Remittances come as PDFs, spreadsheets and plain emails, often in a customer's own format. That is extraction with some judgement.
- Inputs and outputs: the email or attachment text and a cached schema; returns a list of invoice references with amounts, any deduction with its stated reason, and a confidence per field. No tools.
- Guardrails: code checks that the listed amounts minus deductions equal the receipt. A mismatch is passed on as a lead, not a match.
match investigator agent
- Job: propose a match for the receipts rules could not take: partial payments, several invoices in one transfer, a credit note netted off, a bank charge deducted, an invoice paid by a related company.
- Model: Sonnet 5.5, in a short tool loop of about five calls. It needs to search, compare and try combinations, and Sonnet handles that well at a third of the Opus price.
- Tools: read-only queries on open AR items by customer, amount range and date; read-only customer master lookup; the remittance reader's output. It cannot post anything.
- Outputs: a proposed allocation (invoices and amounts), the difference and its likely reason, a confidence score, and the evidence it used.
- Guardrails: code re-checks the allocation sums to the receipt within tolerance. Proposals at 0.9 confidence or more and under AED 50,000 are queued for one-click approval. The rest go to the AR accountant with the evidence.
exception reviewer agent
- Job: rule on what is left: lines nobody could match, residual differences after a match, suspected wrong-entity receipts, and FX differences above tolerance.
- Model: Opus 5.5. This is the judgement step. A wrong call writes off money or hides a customer dispute. It runs on about 3% of lines, so the top tier is affordable.
- Inputs: the line, the investigator's attempts, the customer's recent history, and a cached policy covering write-off limits, tolerance per currency and when to raise a query with the customer.
- Outputs: one of: post a difference under the write-off limit, raise a customer query, transfer to another entity, book an FX difference, or escalate as unresolved. Each comes with reasoning and a draft journal where relevant.
- Guardrails: it proposes and never posts. Every write-off goes to a person, whatever the amount.
reconciliation memo (deterministic, with one model call)
At month end, code builds each account's reconciliation statement: the bank balance, the ERP balance, and the aged reconciling items. One Sonnet 5.5 call per account drafts a short memo on what is open and why, from the items and the reviewer's rulings. The finance manager edits and signs it.
human checkpoints
- AR accountant: approves proposed matches under 0.9 confidence or at AED 50,000 and above, every write-off, and every customer query before it is sent.
- Finance manager: signs off each account's reconciliation. No reconciliation closes without a named person, which is what auditors and most internal control frameworks expect.
Policy rules escalate too: an item open more than 30 days, any line on a blocked or dormant account, and any unexplained difference in the opening balance. UAE corporate tax and VAT law both require businesses to keep accounting records for a number of years, so every match, proposal and approval is logged with the evidence it used. Check the exact retention periods with your tax adviser.
the exact flow
- Statement files arrive daily. Intake parses them and checks balances against the previous day. A gap holds the file and alerts treasury.
- The rules matcher runs on every line. Matches, intercompany pairs and rule-booked fees go to the ERP.
- Unmatched lines join the classifier's overnight Batch API job.
- New remittance advices from the AR inbox join the remittance reader's overnight batch. Each is linked to candidate receipts by amount and payer.
- In the morning, the match investigator runs in real time on each unmatched receipt, with the remittances and classifier labels as leads. A tool error is retried twice, then the receipt goes to the reviewer.
- Code re-checks every proposed allocation. Proposals that fail the check go to the reviewer with the failure.
- Unresolved lines and residual differences join the exception reviewer's batch. It runs in the afternoon, so results are back the next morning.
- Approved matches and journals are posted through the ERP's API by a service account with no rights beyond posting to cash and suspense.
- Proposals and rulings that need a person appear in the AR accountant's queue each morning, ordered by amount and age.
- Customer queries are sent only after a person approves them. Replies are matched back to the item.
- At month end, code builds each reconciliation, the memo drafter writes the commentary, and the finance manager signs off.
If the API or the Batch API is unavailable, lines wait in the queue and the rules keep matching. Daily reconciliation can slip a day without harm. The month-end close can't, so the batch jobs for the last three working days run with a real-time fallback.
the api costs
The classifier, remittance reader, exception reviewer and memo drafter can all wait hours, so they run through the Batch API at 50% off. The match investigator runs in real time, because it is a tool loop and the AR team wants proposals by mid-morning. The cached prefixes (counterparty mappings, schema, tool definitions, policy) are stable. I assume one cache write for every 20 calls. Batch cache hits are best effort, so treat that as a modelling assumption.
Token counts are per call, and for the investigator per receipt across its five-call loop. Cost per unit is the per-call cost times the share of lines reaching that agent, so the column sums to the cost of an average statement line. Output includes thinking: 300 tokens for the remittance reader, 1,000 for the investigator and 1,500 for the exception reviewer.
| agent | model | input tokens | cached input tokens | output tokens | cost per unit |
|---|---|---|---|---|---|
| Classifier (18%, batch) | Haiku 5.5 | 1,200 | 3,000 | 120 | $0.0000205 |
| Remittance reader (6%, batch) | Sonnet 5.5 | 4,000 | 2,500 | 800 | $0.0004965 |
| Match investigator (9%, real time) | Sonnet 5.5 | 18,000 | 30,000 | 2,500 | $0.0060840 |
| Exception reviewer (3%, batch) | Opus 5.5 | 10,000 | 6,000 | 2,500 | $0.0013896 |
| Reconciliation memo (40 a month, batch) | Sonnet 5.5 | 20,000 | 3,000 | 1,500 | $0.0000247 |
| Total per statement line | $0.0080153 |
The match investigator row, worked through: 18,000 uncached input tokens at $2.00 per million is $0.036. The 30,000 cached tokens bill at 95% cache reads ($0.10 per million) and 5% writes ($2.50), an effective $0.22 per million, so $0.0066. The 2,500 output tokens at $10.00 per million are $0.025. That is $0.0676 per receipt, with no batch discount. On 9% of lines it adds $0.006084 per line, or $273.78 a month.
At 45,000 lines the API bill is about $361 a month: match investigator $273.78, exception reviewer $62.53, remittance reader $22.34, reconciliation memos $1.11, classifier $0.92. Without caching or batching the same workload would cost about $707. The investigator is three quarters of the bill. Cutting its loop from five calls to four, or moving the simple cases to Haiku, is the first lever if the bill matters.
| item | monthly |
|---|---|
| Claude API (all agents) | $361 |
| OCR for PDF statements and remittances (estimate) | $10 |
| Hosting: queue, workers, database (estimate) | $250 |
| Document and evidence storage (estimate) | $15 |
| Observability and logging (estimate) | $120 |
| Total running cost | $756 |
| Staff time today (1.15 min × 45,000) | 863 hours |
| Staff time after (0.24 min × 45,000) | 178 hours |
| Modelled hours saved | 684 hours |
| Labour value at $30/hour | $20,525 |
The $30 an hour is about AED 110, a fully loaded rate for a mid-level accountant in Dubai. The 0.24 minutes is modelled as approving proposals on 6% of lines at 1.5 minutes, resolving the reviewer's escalations on 2% at 6 minutes, approving journals on 1% at 1 minute, and 20 minutes of sign-off per account per month. The table leaves out what is often worth more: a close that finishes on day three instead of day eight, and less cash sitting unapplied, which keeps customers off the overdue list by mistake.
what it will get wrong
- A receipt applied to the right amount but the wrong customer. Two customers owe the same amount. The investigator must cite a remittance, a payer name match or a reference before it proposes; an amount alone is never enough, and the golden set includes these pairs.
- A plausible but wrong combination of invoices. Several subsets of open items can sum to the same receipt. Code flags any receipt with more than one exact combination, and those always go to a person.
- A write-off that hides a dispute. A customer short-pays because they dispute a line. The reviewer's policy sends any short payment with a stated reason to a customer query, not a write-off.
- A narrative in Arabic or a transliterated name. Payer names arrive in different spellings across banks. The counterparty mapping keeps known variants, and every accountant's correction is added to it.
- A stale FX rate. The FX difference is computed in code from the rate table, which refuses to run if the day's rates are missing.
- Instructions hidden in a remittance email. Remittance text is data. No agent can post, pay or send, so the worst case is a wrong proposal that code or a person catches.
how you know it works
Build a golden set of 1,200 historical unmatched lines from the last six months, stratified by bank, currency and type, with at least 300 partial or bundled receipts and 100 intercompany items. Include every write-off and every misapplied receipt found after the fact. Two accountants label the correct outcome independently and settle disagreements before testing.
The bar for go-live:
- Proposal precision: at least 98% of proposals at 0.9 confidence or more are correct, measured on the golden set.
- Coverage: at least 60% of unmatched receipts get a proposal at 0.9 confidence or more.
- Wrong-customer rate: zero on the seeded same-amount pairs. Pass or fail.
- Remittance extraction: 99% on invoice numbers and amounts.
- Reviewer agreement: 90% with the accountants' rulings, and every write-off routed to a person.
- Escalation rate: 10% or fewer of all lines reach a person, falling toward 7%.
- Close time: every bank account reconciled by working day three.
After go-live, the accountants' approvals and corrections feed the golden set monthly, and it is re-run after any prompt, model or rule change.
the build plan
- Week 1: inventory accounts, banks and file formats. Request CAMT.053 or MT940 where missing. Pull six months of statements, matches and write-offs for the golden set.
- Week 2: statement intake and the canonical line, with balance checks, on all 40 accounts.
- Week 3: the rules matcher and intercompany pairing, measured against the ERP's current auto-match with no LLM.
- Week 4: classifier and remittance reader, tuned on the golden set.
- Week 5: match investigator with read-only ERP tools; review every golden-set proposal with the AR team.
- Week 6: exception reviewer, write-off policy and the approval queue; posting through the ERP API in a test company.
- Week 7: shadow mode on live statements, compared daily with the team's matches.
- Week 8: live for the two largest entities, with every proposal approved by a person.
- Week 9: all entities. Move to one-click approval at 0.9 confidence once precision holds above 98% for two weeks.
- Week 10: month-end memo, handover, runbook, dashboards and the monthly golden-set run.
run your own numbers
The AI token cost estimator is pre-filled with this workload averaged across agents: 16,240 calls a month, 16,533 input and 1,028 output tokens per call, 60% of input cached, 75% of calls batched. It prices every call at Sonnet 5.5, so it reads higher than the mixed-model table above.
To check whether the proposal precision on your golden set is strong enough for your controller to sign off, use the AI accuracy proof calculator. And because the backlog lands at month end, the LLM rate limit planner shows whether your API limits clear it in a morning or in two days.
If you want this mapped to your banks, entities and ERP, book a 20-minute call.
Want this mapped onto your own process? Book a 20-minute call, or run the numbers with the free tools.