Invoicing · 03 / 26

Architecture Decisions for the Receivables Platform

The overall decisions behind the receivables platform, recorded as ADRs (Architecture Decision Records): context, decision, consequences and alternatives.

How the decisions are recorded

Each decision is an architecture decision record (ADR): a short, dated document with its status, the context that forced the choice, the decision, the consequences and the alternatives rejected. These records cover the whole platform. The vendor pages that follow show how each choice is implemented.

Decision log

ADRDecisionStatusDate
ADR-001Billing, tax, credit and posting are deterministic code; models read, flag and draftAccepted2026-09-02
ADR-002All model traffic goes through one enterprise AI (artificial intelligence) gatewayAccepted2026-09-04
ADR-003Prisma AIRS scans every prompt, document, reply and tool call; writes fail closedAccepted2026-09-09
ADR-004Databricks is the data and AI platform, governed by Unity CatalogAccepted2026-09-11
ADR-005Propose, then approve: credits, write-offs, holds and customer messages need a personAccepted2026-09-15
ADR-006Bank details, contacts and customer financial data are classified and minimisedAccepted2026-09-18
ADR-007Keep the agent core portable: two reference builds behind one tool contractAccepted2026-09-23
ADR-008A release gate: no deploy unless the evaluation set passesAccepted2026-09-30
ADR-009Apply cash only above a match score, and always reversiblyAccepted2026-10-06
ADR-010Add a customer-facing dispute chatProposed2026-11-12

Status values: Proposed, Accepted, Superseded. Dates are the day the status last changed.

The records

ADR-001 Accepted

Billing, tax, credit and posting are deterministic code; models read, flag and draft

Context
Invoices, credits and cash postings are financial records that auditors must be able to reproduce. Models are probabilistic and their output varies between runs.
Decision
Pricing, tax, credit limits, matching rules and posting are code with unit tests and versioned rules. Models read remittances, flag anomalies against contract terms, retrieve clauses and draft explanations. A model never posts, credits or writes off.
Consequences
  • Results are reproducible for the same inputs.
  • Rule changes go through code review.
  • A model upgrade cannot silently change a financial outcome.
Alternatives considered
  • Let a model decide matches and credits (rejected: not reproducible, hard to audit)
  • No models at all (rejected: remittance reading and dispute evidence are the manual bottleneck)
ADR-002 Accepted

All model traffic goes through one enterprise AI gateway

Context
Teams would otherwise hold provider keys, pick models by name and log differently. Cost, scanning and provider changes would be solved many times, badly.
Decision
Applications call the gateway with a project key and a model alias. The gateway routes, retries, falls back, enforces budgets and rate limits, attaches metadata, applies guardrails and logs every call. Provider keys exist only in the gateway.
Consequences
  • One place to change a model or provider, validated by the evaluation set.
  • Budgets and guardrails apply by default.
  • The gateway is a critical dependency with its own availability target.
Alternatives considered
  • Direct provider SDKs (Software Development Kits) in each service (rejected: key sprawl, no shared controls)
  • A shared client library only (rejected: controls can be bypassed)
ADR-003 Accepted

Prisma AIRS scans every prompt, document, reply and tool call; writes fail closed

Context
Remittances and customer emails are untrusted input that a model will read. Prompt injection hidden in a PDF (Portable Document Format) could try to redirect a payment or release a credit.
Decision
Runtime scanning sits on the gateway path and at the tool boundary. Extracted document text, retrieved context, replies and tool arguments are scanned against a named profile. A block routes the item to a person. If scanning is unavailable, nothing that posts cash or issues a credit runs.
Consequences
  • Detection is consistent across every agent.
  • Added latency stays inside the batch and interactive budgets.
  • A scanning outage slows automation to manual, not to unsafe.
Alternatives considered
  • Prompt-only defences (rejected: not enforceable)
  • Scan replies only (rejected: misses injection through documents and tools)
ADR-004 Accepted

Databricks is the data and AI platform, governed by Unity Catalog

Context
Bank lines, remittances, invoices, match decisions, disputes, evaluation sets and the knowledge index are data with access rules. Splitting them splits the governance.
Decision
Keep operational copies, decisions and traces in Delta tables under Unity Catalog with masks on bank and contact data. Build the clause index with Vector Search from governed tables. Use MLflow for tracing and evaluation, and Lakeflow jobs for ingestion and nightly evaluation.
Consequences
  • One lineage and access model for data and AI assets.
  • Analysts and evaluators use the tables the product writes.
  • Vector Search sync latency and quotas are design inputs.
Alternatives considered
  • A separate search service plus a data warehouse (rejected: two access models)
ADR-005 Accepted

Propose, then approve: credits, write-offs, holds and customer messages need a person

Context
A wrong credit costs money and a wrong message costs a relationship. The decision cannot depend on how confident a model feels.
Decision
Agents draft and recommend. Credits above $500.00, every write-off, every credit hold and every customer message are applied or sent only after an approval recorded against a named person. Small, rule-based actions such as exact matches post automatically.
Consequences
  • Approval is explainable from the table of limits.
  • Limits are reviewed like any financial control.
  • Some low-risk work still waits for a person.
Alternatives considered
  • Confidence-based auto-approval (rejected: confidence is not authority)
ADR-006 Accepted

Bank details, contacts and customer financial data are classified and minimised

Context
Remittances carry bank account numbers, contact details and payment behaviour. Copying them into logs, prompts and analytics would multiply the exposure.
Decision
Classify account numbers, contacts and payment histories as restricted. Send the model only what a step needs, tokenise account numbers, mask by role in the lakehouse, keep raw documents for a short period and keep telemetry free of content.
Consequences
  • Lower exposure in logs, evaluations and vendor tools.
  • Evaluation data needs a masked copy.
  • Some debugging needs an approved, audited unmask step.
Alternatives considered
  • Log everything and restrict access later (rejected: the data would already be copied)
ADR-007 Accepted

Keep the agent core portable: two reference builds behind one tool contract

Context
Platform choices differ between teams and may change. The tool contracts and policies are what must stay stable.
Decision
Define the tools, policies and evaluation set once. Build a Microsoft Foundry version and a LangGraph version with LangSmith against the same contracts and run the same evaluation set on both.
Consequences
  • Switching or comparing frameworks is a measured change.
  • Two builds cost more to maintain, so one is primary and the other a reference.
  • Contracts must be strict enough to be portable.
Alternatives considered
  • Commit to one framework with no abstraction (rejected: lock-in on the least stable layer)
ADR-008 Accepted

A release gate: no deploy unless the evaluation set passes

Context
Prompt, model and rule changes can quietly make matching worse or less safe.
Decision
Every change runs offline evaluation on a versioned set of payments, remittances and disputes, including adversarial ones. Match accuracy, misapplication rate, groundedness and cost must meet thresholds. Production traces are sampled into new cases.
Consequences
  • Regressions are caught before they touch cash.
  • The evaluation set needs steady care.
  • Judge models used for scoring must themselves be spot-checked.
Alternatives considered
  • Manual spot checks before release (rejected: does not scale and misses regressions)
ADR-009 Accepted

Apply cash only above a match score, and always reversibly

Context
A misapplied payment shows a customer as unpaid when they paid, which damages trust and triggers wrong dunning.
Decision
Rules match on exact reference and amount. A scored match applies automatically only above a threshold, and every application is a reversible entry with the evidence that justified it. Anything below the threshold goes to the review desk with candidates.
Consequences
  • Mistakes are visible and reversible.
  • The threshold is a business control, reviewed monthly.
  • Some correct matches wait for a person.
Alternatives considered
  • Apply the top candidate always (rejected: too risky)
  • Never auto-apply scored matches (rejected: removes most of the benefit)
ADR-010 Proposed

Add a customer-facing dispute chat

Context
Customers want to raise and track disputes without email. A conversational channel could reduce handling time.
Decision
Proposed: reuse the dispute agent behind the customer portal, read-only on evidence and unable to promise credits. Not accepted yet: authentication, abuse resistance and the commitments the agent may make must be tested in a pilot.
Consequences
  • Same controls apply to a new channel.
  • Risk of implied commitments needs careful policy.
  • Pending a pilot with ten customers.
Alternatives considered
  • Email and portal forms only (deferred: leaves the fastest channel unserved)

The principles behind them

Models propose, code disposes

Anything that moves money, changes a balance or reaches a customer is decided and executed by tested code or a person.

Controls live in the platform

Gateway, scanning, governance and evaluation apply to every team by default.

Ground or decline

A clause or fact cited from a source, or an honest statement that none was found.

Measure before shipping

Accuracy, safety and cost are tested on every change, not argued about.

Build this for your business

This example is a receivables platform for a distributor, but the same pattern, deterministic financial rules, a governed gateway, runtime security, grounded evidence and measured quality, fits any back-office process that moves money. We can scope a pilot on your own systems.

Book a discovery call