The instinct to "let an AI agent handle reconciliation" undersells what reconciliation actually is: mostly exact matching (which code does perfectly), with a smaller residue of genuinely ambiguous cases (where an LLM's judgment can help, but shouldn't have final say). A reliable framework makes that split explicit instead of routing every transaction through a model's reasoning.
A three-tier reconciliation framework
1. Tier 1 — exact match on hard keys. Match transactions where amount, date, and reference number all align precisely — this is pure code, no model involvement, and should resolve most of the volume.
2. Tier 2 — LLM-suggested fuzzy match for the remainder. For transactions that don't exact-match (a $0.02 rounding difference, a reference number with extra characters), an LLM can propose a likely pairing with a stated confidence and reasoning.
3. Tier 3 — human review before any Tier 2 suggestion is applied. No LLM-suggested match should update the books automatically — a human confirms it, and the confirmation (or rejection) gets logged as part of the audit trail.
# Tier 1: deterministic exact-key matching (runs first, no LLM)
def exact_match(ledger_row, bank_row) -> bool:
return (
ledger_row["amount"] == bank_row["amount"]
and ledger_row["date"] == bank_row["date"]
and ledger_row["reference"] == bank_row["reference"]
)
# Tier 2: only unmatched rows reach this step -- LLM suggests, never decides
def suggest_fuzzy_match(unmatched_ledger_row, candidate_bank_rows):
# Returns a suggested match + confidence + reasoning --
# status stays "pending_human_review" until confirmed (Tier 3)
return {"status": "pending_human_review", "suggested_match": None}
| Approach | Error Risk |
|---|---|
| LLM reconciles all transactions from raw text | Higher — subtle mismatches can be missed or misjudged at scale |
| Exact-match code first, LLM-suggest + human-confirm for the rest | Lower — the bulk is deterministic, and the risky remainder gets human oversight |
This tiered structure is the same principle threaded through every "AI + finance" topic in this course: automate the deterministic bulk, and route genuine ambiguity to a human decision rather than an autonomous one. Reconciliation is a good test case precisely because the cost of a silent, wrong match compounds — an unaudited AI "fix" to the books is exactly the failure mode this framework is built to prevent.
Practical Challenge
Implement the exact_match function above against two sample transaction lists (a ledger and a bank feed), and identify which rows fall through to Tier 2 as genuinely ambiguous cases.
Concept Check
Sources & Further Reading
- pandas Documentation: pandas.merge — the underlying join/merge operation typically used for Tier 1 exact-key matching in a reconciliation pipeline.
AI