Finance analysts were proving every line of every supplier invoice by hand, against contracts, purchase orders and meter data. Flick lets them ask in Teams instead. Specialist agents gather the evidence, a second AI model challenges the result, and anything that moves money in a way that is hard to undo waits for a named person.
Principal AI Engineer, forward-deployed. Architecture, agents, MCP servers, evaluation harness and production hardening, inside the client's Azure tenant.
Python 3.12 · LangGraph · Claude Opus (primary) · Azure OpenAI (fallback) · MCP · Copilot Studio · Azure Container Apps · AI Search · Azure SQL · Bicep · OpenTelemetry
Built for the sponsor, the architect and finance operations, with three tiers of approval. Nothing posts automatically above NZD 25,000 a line; disputes need an analyst, reversals need a manager.
Plain-English captions, no sound needed. Switch to For tech for the architecture, guardrails and evaluation detail.
A consumption invoice says: you used this much, at this rate, under this clause, in this billing window. To close one line, an analyst checks the reading against a meter, the rate against the latest contract amendment, the dates against the billing calendar and the total against a purchase order.
By hand, one invoice takes 30 to 90 minutes. The mistakes are quiet and expensive: paying money the business does not owe, or damaging a supplier relationship with a dispute that turns out to be wrong. And every analyst re-learns the same patterns, because the knowledge sits in inboxes rather than in a system.
In plain English: a manager agent hands the invoice to specialists with one job each. They read the evidence through tightly scoped connections to the systems of record, a second model argues with the result, and the invoice takes one of three routes.
Review is placed by blast radius, not by habit. Routine approvals take seconds because reviewers see a variance table and citations, not a transcript.
| Route | When | What happens | Who decides |
|---|---|---|---|
| Green | The evidence lines up and the amount is below the approval threshold | Posts to the ledger automatically. The write carries a key from the run, so a retry or a double click cannot post twice | The system, inside limits finance set; it is low-value and reversible |
| Amber | Something needs judgement: a variance, an ambiguous match, an unfamiliar invoice format | Waits in the analyst queue with the variance table and citations attached | An analyst |
| Red | The supplier appears to have billed wrongly | A dispute is drafted and held; nothing is sent | A named person releases it. Reversing a ledger posting needs a manager |
Each control is named after the failure it prevents, and each was walked before the pilot took live traffic.
No agent may state anything it cannot support with a source retrieved in this run, and no agent may edit another agent's citations.
The Critic runs on a different LLM vendor and starts from disagreement: unsupported claims, weak citations, a tier that is too generous.
The Parser reaches no system at all; the Matcher sees contracts and purchase orders; each MCP server has its own narrow service account.
Every write carries an idempotency key from the run, and is versioned and reversible. A re-run or a double click is a no-op.
Content Safety screens every prompt and response, personal data is redacted on the way in, and invoice text is tagged as data, never as instruction.
Every prompt, model or agent change is replayed overnight against past invoices the analysts labelled, then tried on a small slice of live traffic with automatic rollback.
For the engineers in the room. Each layer is replaceable in isolation: the Copilot front door can become a REST client, agents can move to a different LLM, MCP servers can be re-implemented against another system of record.
Each enterprise system is fronted by one MCP server with a small typed surface, four to eight tools, mapped to that system's bounded context. The model sees a stable schema; the server owns the source system's quirks.
Each agent sees only the servers its job needs: Parser sees none, Matcher sees contracts and purchase, Reconciler sees meter and ledger. Tool surfaces are audited for capability bloat before every release, because every unused tool is routing noise, attack surface and tokens.
Every write carries an idempotency key derived from the reconciliation run identifier, so a re-drive or a double click is a no-op, never a duplicate. A new tool version is a schema change the model can see; old versions keep serving until every caller has moved.
Agents reach servers via Managed Identity; each server holds its own least-privilege service account for the system behind it. Every call carries a correlation ID into Application Insights, so a failure three hops downstream is traced back to its cause.
The contract: no agent may emit a claim it cannot support with a cited chunk retrieved this run. No agent may edit another agent's citations. Every mutating action is idempotent, versioned and reversible.
Plans the agent chain, dispatches each stage, tracks state through a durable checkpoint, owns token budgets per run, per agent, per model.
Preserves page and paragraph anchors for every field; handles supplier quirks; returns per-field confidence. F1 0.94 across 40+ formats.
Emits a ranked list, not a hard pick, so downstream tiers can factor in ambiguity. Precision@1 0.91, recall@3 0.98.
Rules engine plus statistical classifier for tail cases. False-positive rate 3.1% at 95% recall.
Composes match strength, severity and historical calibration into green / amber / red. Brier 0.06, ECE 0.02.
Every factual claim carries a citation. Teams Adaptive Cards natively; Markdown elsewhere.
Runs on a different LLM vendor. Looks for unsupported claims, weak citations, tier inflation. True-reject 0.88, false-reject 0.04.
Every prompt change, model bump and agent revision runs against a golden set before it reaches production traffic.
Two hundred historical reconciliations hand-labelled by finance analysts across twelve months of production data. Weighted toward the tail: 40% straightforward, 40% amber-tier variances, 20% red-tier disputes. Each item carries ground-truth tier, variance category and a short human rationale.
| Agent | What is measured, on the golden set | Result |
|---|---|---|
| Parser | How accurately line items are extracted (F1, where 1.0 is perfect) | F1 0.94 |
| Matcher | How often the top candidate is the right evidence; how often it is in the top three | P@1 0.91 · R@3 0.98 |
| Anomaly | False alarms raised while still catching 95% of real variances | 3.1% false positives |
| Reconciler | Whether stated confidence matches reality (Brier and calibration error; lower is better) | Brier 0.06 · ECE 0.02 |
| Reporter | Rubric scoring across five dimensions for each of the four tiers | 5 × 4 rubric |
| Critic | How often it rejects what should be rejected, and wrongly rejects what is fine | 0.88 · 0.04 |
The unhappy paths decide whether a system is trusted with money. Every control below is named after the failure it prevents, and each one was walked before the pilot took live traffic.
The platform is run as a production service, not as a model with a chat window. It has latency and error-rate objectives per stage, a health check per agent, and breakers that degrade rather than fail: a tripped MCP server returns a cached read or defers the run, it never stalls the queue. Binary-correctness work, variance arithmetic, tier thresholds and ledger postings, is plain code. Model weights, prompt versions, tool definitions and runtime configuration are pinned per run, so any reconciliation can be replayed exactly.
A reconciliation that posts to a ledger can move real money. So the input is filtered, the prompt is constrained, the output is validated and the tools are limited in code, and the heaviest control sits where the action is hardest to undo.
Review is an architectural decision, not a checkbox. Green-tier OpEx posts automatically because it is reversible and low-value. Amber waits in an analyst queue with the evidence attached. Red, disputes and reversals need a named person's approval in a Teams card. Reviewers see the variance table and citations, not a transcript, so routine approvals take seconds and real decisions get attention.
Remaining: meter-market certification, CapEx ledger routing, supplier-portal handoff, reporter polish, a DR drill and a third-party penetration review.
Figures from the pilot, against the analysts working by hand.
How much it handles. In the pilot, the agents reconcile this many supplier invoices every month.
How often it is right first time. The share of invoices the agents reconcile correctly on their first pass. The target at general availability is 90%.
How long one invoice takes. From the request in Teams to a closed reconciliation, against about 47 minutes for an analyst working by hand.
How many real problems it catches. Of the variances the analysts marked in their labelled set, the share Flick detects.
What every change must pass first. Past invoices hand-labelled by the analysts, weighted toward the hard cases. Every prompt, model or agent change runs against all of them overnight.
How a change reaches everyone. It first serves this share of live traffic for 24 hours against the current version, then ramps to 100% with automatic rollback on any regression.