What Databricks does here
Databricks is the data and AI platform for the receivables platform. It keeps operational copies and decisions in governed tables, builds the clause index from contracts, serves models where useful and provides tracing and evaluation. The orchestrator itself runs in the application tier and calls the AI gateway for models.
Governance in Unity Catalog
One catalog per environment, with schemas by purpose. Access is granted to groups, never to individuals, and sensitive data is protected in the table, so every notebook, dashboard and evaluation job inherits the control.
| Schema | Contents | Who can read |
|---|---|---|
| bronze | Raw bank lines, remittance pointers, invoice and payment extracts as received | Data engineers |
| silver | Cleaned invoices, payments, applications, disputes and decisions, with bank tokens and payer names as sensitive columns | AR (Accounts Receivable) engineers and analysts, with masks |
| gold | Evaluation sets, KPIs (Key Performance Indicators), feedback, aging and unapplied-cash views | Finance, evaluation and support teams |
| knowledge | Clause index and its source table | The agent service principal |
| security | Scan results and security events from the gateway | Security operations |
Protecting sensitive data in the table
Row filters and column masks make the rule part of the table. Analysts see a masked bank token; an AR lead sees it for a case they own.
-- Tokenised bank accounts and payer names are masked except for approved roles
CREATE FUNCTION ar_prod.silver.mask_sensitive(value STRING)
RETURN CASE WHEN is_account_group_member('ar_leads') THEN value ELSE '***' END;
ALTER TABLE ar_prod.silver.payments
ALTER COLUMN bank_account_tok SET MASK ar_prod.silver.mask_sensitive;
ALTER TABLE ar_prod.silver.payments
ALTER COLUMN payer_name SET MASK ar_prod.silver.mask_sensitive;
-- Regional teams see only their customers
CREATE FUNCTION ar_prod.silver.region_filter(region STRING)
RETURN is_account_group_member('ar_global') OR is_account_group_member(CONCAT('ar_', region));
ALTER TABLE ar_prod.silver.invoices
SET ROW FILTER ar_prod.silver.region_filter ON (region);The clause index
Contract clauses are chunked by clause, tagged with customer, contract, effective dates and a version, and stored in a gold table. A Vector Search index (the product is now branded Databricks AI Search) syncs from that table, so a change to a contract updates the index without a rebuild. The agent filters by customer and effective date at query time, so it cannot cite another customer's terms or an expired clause.
from databricks.vector_search.client import VectorSearchClient
index = VectorSearchClient().get_index(
endpoint_name="ar-knowledge",
index_name="ar_prod.knowledge.contract_clauses_index",
)
def search_clauses(question: str, customer_id: str, on_date: str) -> list[dict]:
hits = index.similarity_search(
query_text=question,
columns=["clause_id", "contract_id", "title", "text", "source_url"],
filters={"customer_id": customer_id, "effective_from <=": on_date, "effective_to >=": on_date},
num_results=5,
)
return hits["result"]["data_array"]No rebuild is needed. Effective dates make sure a clause applies only when it should.
Serving, the gateway and tracing
Model Serving
Hosts any fine-tuned or small task model, such as the match scorer or the late-payment model, behind an endpoint with scaling and versioning.
AI Gateway on endpoints
Rate limits, usage tracking, guardrails, fallbacks and inference tables for served endpoints, to complement the enterprise gateway.
MLflow tracing
Spans for each retrieval, model call and tool call, logged with the case and trace identifier from the gateway.
Agent evaluation
Runs the evaluation set with built-in and custom judges, and stores results in a gold table for comparison across releases.
Jobs that keep it current
| Job | Schedule | What it does |
|---|---|---|
| Ingest bank and ERP (Enterprise Resource Planning) extracts | Every 15 minutes | Lands extracts in bronze and upserts silver |
| Refresh clause index | On contract change, daily check | Re-chunks changed contracts, writes the source table and syncs the index |
| Mask and curate traces | Hourly | Redacts traces from the gateway into silver, with sensitive fields masked |
| Score late-payment risk | Nightly | Writes risk scores with reasons to a gold table |
| Nightly evaluation | Nightly and on every release | Runs the evaluation set, writes scores and alerts on regressions |
| Feedback to test cases | Weekly | Turns reviewed exceptions and corrections into new evaluation cases |
What the data answers
- Share of payment value applied without a person, by customer segment and bank.
- Unapplied cash by age and owner, and how long it takes to resolve.
- Dispute reasons ranked, and cost of disputes by cause.
- Days sales outstanding by customer, region and collector.
- Cost per invoice, per payment and per dispute, from gateway metadata.
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