Databricks Agent Bricks and Genie Ontology for Governed Cross-Border Liquidity
Purpose
This guide builds a synthetic cross-border liquidity research and governance prototype for fragmented Asia-Pacific financial jurisdictions. It uses Databricks Free Edition as a perpetual, no-cost, serverless-only cloud environment.
The implementation combines narrowly scoped agents, Genie Agents, Genie Ontology, Unity Catalog, Lakebase branches, governed evidence, human approval, schema controls, idempotency tests, and dual-run simulation.
The objective is not to create an autonomous system that moves cash, executes foreign-exchange trades, or settles assets. The objective is to produce a governed recommendation containing the proposed corridor, market assumptions, evidence, legal-entity scope, cost attribution, settlement risk, and required human approvals.
Important product and control boundaries
Agent Bricks is a platform for developing and operating governed agents. A current implementation should use Genie Agents for low-code natural-language analytics or the Agent Bricks CLI for coded multi-agent coordination. The legacy Supervisor Agent is not recommended for new systems, and the legacy Supervisor API reached end of life on September 30, 2026.
Genie Ontology is a governed business-context layer. It combines modeled Unity Catalog semantics with inferred snippets from approved assets such as metric views, dashboards, SQL queries, and Genie Agents. It is not automatically a complete enterprise knowledge graph, and it does not replace Unity Catalog permissions.
Only context from assets that the current user is permitted to access can be used by Genie Ontology. This prevents ontology context from becoming a bypass around data authorization.
Unity Catalog automatically captures lineage for supported Databricks SQL and Spark DataFrame workloads, including table-level and column-level lineage. It helps trace data and transformations, but it does not automatically capture every internal reasoning token or prove the correctness of an agent conclusion. Persist the agent plan, tool calls, query identifiers, rule versions, evidence references, and human decision in governed audit tables.
Do not describe a proposed route as a way to evade foreign-exchange controls or conversion obligations. The system may compare lawful routes and costs, but every route must satisfy legal-entity permissions, local-market access, currency controls, sanctions, AML, tax, reporting, settlement, and internal risk requirements.
Do not describe dual-run output as perfectly identical or guaranteed at microsecond precision. Compare outputs using explicit event identifiers, source watermarks, tolerance windows, deterministic and non-deterministic field classifications, and measured latency distributions.
Step 1: Create the Databricks Free Edition workspace
Create a Databricks Free Edition workspace named:
apac_cross_border_liquidity_agents_free_nonprod
Create these workspace folders:
00_environment01_reference_data02_ltap_streams03_liquidity_metrics04_genie_ontology05_genie_agents06_agent_bricks07_evidence_and_approval08_change_management09_dual_run10_audit
Create a notebook named 00_environment_check and run:
SELECT current_user() AS current_user, current_catalog() AS current_catalog, current_schema() AS current_schema, current_timestamp() AS checked_at; Record these Free Edition constraints:
- Serverless-only compute.
- Fair-use quotas.
- No production SLA.
- Feature and preview availability varies by cloud and region.
- No live cash movement, order routing, settlement, or external payment instructions.
- Synthetic or properly licensed delayed data only.
- All consequential results require human approval outside the prototype.
Step 2: Define the cross-border liquidity domains
Create narrowly scoped domains instead of one agent with unrestricted regional access.
Use these synthetic domains:
SGD_USD_CORRIDORUSD_HKD_CORRIDORUSD_KRW_CORRIDORUSD_IDR_CORRIDORUSD_MYR_CORRIDORUSD_PHP_CORRIDORUSD_THB_CORRIDORUSD_VND_CORRIDORCLEARING_DELAY_MONITORINGLEGAL_ENTITY_POSITION_COMPLIANCEGROUP_LIQUIDITY_RESEARCH
For every domain, define:
- Legal entities.
- Jurisdictions.
- Permitted currencies.
- Permitted instruments.
- Approved data sources.
- Market hours and calendars.
- Settlement methods.
- Maximum data age.
- Permitted actions.
- Prohibited actions.
- Required human approver.
- Escalation owner.
The prototype should recommend RESEARCH, ESCALATE, REJECT, or REQUEST_HUMAN_REVIEW. It must not return EXECUTE.
Step 3: Create the Unity Catalog namespace
Create the catalog and schemas:
CREATE CATALOG IF NOT EXISTS apac_liquidity_lab; CREATE SCHEMA IF NOT EXISTS apac_liquidity_lab.raw; CREATE SCHEMA IF NOT EXISTS apac_liquidity_lab.silver; CREATE SCHEMA IF NOT EXISTS apac_liquidity_lab.gold; CREATE SCHEMA IF NOT EXISTS apac_liquidity_lab.reference; CREATE SCHEMA IF NOT EXISTS apac_liquidity_lab.governance; CREATE SCHEMA IF NOT EXISTS apac_liquidity_lab.agent_audit; CREATE SCHEMA IF NOT EXISTS apac_liquidity_lab.evaluation; If catalog creation is unavailable, create the schemas in the default catalog.
Create separate production catalogs for different legal entities when the data-residency or administrative boundary requires stronger isolation. A shared training catalog is acceptable only because all data in this guide is synthetic.
Step 4: Create the jurisdiction-rule model
Create a governed rule table:
CREATE TABLE IF NOT EXISTS apac_liquidity_lab.reference.jurisdiction_rules ( rule_id STRING, jurisdiction_code STRING, legal_entity_id STRING, currency STRING, instrument_type STRING, rule_type STRING, rule_text STRING, machine_condition STRING, permitted_status STRING, required_approval STRING, effective_from TIMESTAMP, effective_to TIMESTAMP, source_uri STRING, source_authority STRING, approved BOOLEAN, reviewed_at TIMESTAMP, is_synthetic BOOLEAN ) USING DELTA; Use controlled rule types:
DATA_RESIDENCYFX_CONTROLSETTLEMENT_CUTOFFLOCAL_MARKET_ACCESSREPORTINGSANCTIONSAMLTAXPOSITION_LIMITCOUNTERPARTY_LIMITHUMAN_APPROVAL
Do not allow a language model to convert legal text directly into an enforceable machine condition without legal, compliance, and engineering review.
Step 5: Create legal-entity and corridor reference data
Create legal entities:
CREATE TABLE IF NOT EXISTS apac_liquidity_lab.reference.legal_entities ( legal_entity_id STRING, legal_name STRING, jurisdiction_code STRING, data_residency_region STRING, base_currency STRING, permitted BOOLEAN, effective_from TIMESTAMP, effective_to TIMESTAMP, is_synthetic BOOLEAN ) USING DELTA; Create corridors:
CREATE TABLE IF NOT EXISTS apac_liquidity_lab.reference.corridors ( corridor_id STRING, source_entity_id STRING, destination_entity_id STRING, source_currency STRING, destination_currency STRING, settlement_method STRING, source_cutoff_local STRING, destination_cutoff_local STRING, minimum_settlement_minutes INT, maximum_settlement_minutes INT, manual_review_required BOOLEAN, permitted_for_research BOOLEAN, is_synthetic BOOLEAN ) USING DELTA; Keep onshore and offshore markets separate. For example, do not combine CNY and CNH into one generic RMB market.
Step 6: Create the LTAP event model
Create a synthetic event table:
CREATE TABLE IF NOT EXISTS apac_liquidity_lab.raw.liquidity_events ( event_id STRING, event_time TIMESTAMP, received_time TIMESTAMP, legal_entity_id STRING, jurisdiction_code STRING, corridor_id STRING, currency STRING, event_type STRING, bid DECIMAL(24,10), ask DECIMAL(24,10), available_notional DECIMAL(24,2), settlement_delay_minutes INT, funding_cost_bps DECIMAL(14,4), source_system STRING, source_sequence BIGINT, schema_version STRING, idempotency_key STRING, payload VARIANT, is_synthetic BOOLEAN, ingested_at TIMESTAMP ) USING DELTA; Use these event types:
FX_QUOTEFUNDING_RATEPOSITION_UPDATESETTLEMENT_STATUSCLEARING_DELAYLIMIT_UPDATEMARKET_HALTDATA_QUALITY_ALERT
LTAP describes the integration of transactional and analytical workloads. It does not imply that every operational event appears in an analytical table at zero latency. Record source commit, ingestion, transformation, and query timestamps.
Step 7: Create quality and idempotency controls
Create a quarantine table:
CREATE TABLE IF NOT EXISTS apac_liquidity_lab.governance.quarantined_events ( quarantine_id STRING, event_id STRING, detected_at TIMESTAMP, failure_type STRING, failure_detail STRING, source_record STRING, resolution_status STRING, is_synthetic BOOLEAN ) USING DELTA; Validate:
- Event ID is present.
- Idempotency key is present.
- Schema version is supported.
- Event and received timestamps are valid.
- Legal entity exists.
- Corridor exists.
- Currency belongs to the corridor.
- Bid and ask are positive where required.
- Ask is not below bid unless explicitly classified.
- Available notional is non-negative.
- Source sequence is explainable.
Detect duplicates:
SELECT idempotency_key, COUNT(*) AS duplicate_count FROM apac_liquidity_lab.raw.liquidity_events GROUP BY idempotency_key HAVING COUNT(*) > 1; Never let a replayed event create a second payment, position adjustment, case, approval, or fee. In the prototype, all events are read-only research inputs.
Step 8: Create normalized liquidity metrics
Create a validated view:
CREATE OR REPLACE VIEW apac_liquidity_lab.silver.liquidity_events_valid AS SELECT *, (bid + ask) / 2 AS midpoint, (ask - bid) / NULLIF((bid + ask) / 2, 0) * 10000 AS spread_bps, timestampdiff(MILLISECOND, event_time, received_time) AS source_latency_ms, timestampdiff(SECOND, event_time, current_timestamp()) AS age_seconds FROM apac_liquidity_lab.raw.liquidity_events WHERE event_id IS NOT NULL AND idempotency_key IS NOT NULL AND available_notional >= 0 AND ( event_type <> 'FX_QUOTE' OR (bid > 0 AND ask > 0 AND ask >= bid) ); Create corridor state:
CREATE OR REPLACE VIEW apac_liquidity_lab.gold.corridor_liquidity_state AS WITH ranked AS ( SELECT *, ROW_NUMBER() OVER ( PARTITION BY corridor_id, legal_entity_id, currency, event_type ORDER BY event_time DESC, source_sequence DESC ) AS row_number FROM apac_liquidity_lab.silver.liquidity_events_valid ) SELECT * EXCEPT (row_number) FROM ranked WHERE row_number = 1; Step 9: Calculate the cross-market basis
Create a basis view:
CREATE OR REPLACE VIEW apac_liquidity_lab.gold.cross_market_basis AS SELECT source.corridor_id, source.legal_entity_id AS source_entity_id, destination.legal_entity_id AS destination_entity_id, source.currency, source.ask AS source_executable_ask, destination.bid AS destination_executable_bid, ((destination.bid / NULLIF(source.ask, 0)) - 1) * 10000 AS gross_basis_bps, source.funding_cost_bps + destination.funding_cost_bps AS funding_cost_bps, GREATEST(source.settlement_delay_minutes, destination.settlement_delay_minutes) AS maximum_settlement_delay_minutes, LEAST(source.available_notional, destination.available_notional) AS indicated_capacity, GREATEST(source.age_seconds, destination.age_seconds) AS maximum_age_seconds, source.event_time AS source_event_time, destination.event_time AS destination_event_time FROM apac_liquidity_lab.gold.corridor_liquidity_state source JOIN apac_liquidity_lab.gold.corridor_liquidity_state destination ON source.corridor_id = destination.corridor_id AND source.currency = destination.currency AND source.legal_entity_id <> destination.legal_entity_id WHERE source.event_type = 'FX_QUOTE' AND destination.event_type = 'FX_QUOTE'; Gross basis is not a risk-free profit. Subtract funding, hedging, fees, slippage, market impact, capital lock, tax, reporting, and compliance buffers before producing a research result.
Step 10: Define the Genie Ontology
Create curated business definitions:
-
Cross-Border Liquiditymeans immediately usable funding or settlement capacity after legal-entity, currency, market-access, and operational constraints. -
Gross Basismeans the observable executable-price difference before costs. -
Net Basismeans gross basis after all approved cost and risk components. -
Available Notionalmeans the minimum of venue depth, entity position limit, counterparty capacity, settlement capacity, and corridor limit. -
Settlement Delaymeans the expected time to final settlement under the selected route, not only the message-processing time. -
Permitted Routemeans a route that passed machine-readable controls and still requires any specified human approval. -
Research Candidateis not a trade, payment, funding instruction, or settlement authorization.
Attach authority to certified metric views and approved policy pages. Assign lower authority to ad hoc notebooks and unreviewed analyst comments.
Create separate ontology context for each legal entity and a group aggregate scope. Do not let an entity agent use snippets extracted from unauthorized sources.
Step 11: Configure Genie Agents
Create these Genie Agents:
Genie SGD USD Corridor ResearchGenie USD KRW Corridor ResearchGenie APAC Settlement DelayGenie Legal Entity Position ComplianceGenie Group Liquidity Aggregate
A Genie Agent requires Unity Catalog data and a pro or serverless SQL warehouse. It can use up to 50 tables, views, or metric views. Start with fewer than ten certified assets per agent.
Configure each agent with:
- Narrow approved views.
- Example questions.
- Verified SQL.
- Business instructions.
- Prohibited conclusions.
- Required evidence fields.
Data access is evaluated using the end user's Unity Catalog permissions. Test interactive user access separately from background service-principal access.
Step 12: Create narrow Agent Bricks
Implement specialized agents rather than one broad autonomous agent.
Create these logical agents:
corridor_basis_agentsettlement_delay_agentlegal_entity_compliance_agentcost_attribution_agentevidence_compilation_agentchange_validation_agent
Each agent receives only the tools and data needed for its role.
The basis agent cannot approve compliance.
The compliance agent cannot calculate or execute a trade.
The evidence agent cannot alter source data.
The change-validation agent can read production and shadow results but cannot deploy code.
For new coded multi-agent systems, use the Agent Bricks CLI or a directly managed agent loop. Do not build new dependencies on the retired Supervisor API.
Step 13: Implement agentic governance
The governance workflow begins when a monitored condition exceeds a threshold.
Example triggers:
- Gross basis widens by more than 40 basis points.
- Indicated capacity drops by more than 50 percent.
- Settlement delay exceeds 120 minutes.
- Source data becomes older than 60 seconds.
- A corridor's rule version changes.
- A legal-entity limit is missing.
- Two authoritative sources conflict.
The agent workflow should:
- Read the certified corridor state.
- Resolve the ontology definitions.
- Retrieve approved jurisdiction rules.
- Calculate gross and net basis.
- Evaluate legal-entity and settlement constraints.
- Identify data-quality failures.
- Compile sources and lineage references.
- Produce a recommendation for human review.
The workflow must stop when a required value is missing. Do not substitute a missing cost or rule with zero.
Step 14: Prevent autonomous settlement
Create an explicit prohibited-tool policy.
Agents must not have direct access to:
- Payment initiation.
- Treasury transfer.
- Order entry.
- Trade amendment.
- Wallet signing.
- Private keys.
- Settlement release.
- Limit override.
- Sanctions override.
- Customer communication send.
An agent may create a governed proposal record:
CREATE TABLE IF NOT EXISTS apac_liquidity_lab.governance.route_proposals ( proposal_id STRING, created_at TIMESTAMP, created_by_agent STRING, source_entity_id STRING, destination_entity_id STRING, corridor_id STRING, proposed_notional DECIMAL(24,2), gross_basis_bps DECIMAL(14,4), net_basis_bps DECIMAL(14,4), settlement_delay_minutes INT, compliance_status STRING, evidence_bundle_id STRING, recommendation STRING, human_decision STRING, decided_by STRING, decided_at TIMESTAMP, is_synthetic BOOLEAN ) USING DELTA; The permitted recommendation values are RESEARCH, ESCALATE, REJECT, and REQUEST_HUMAN_REVIEW.
Step 15: Build the evidence bundle
Create an evidence table:
CREATE TABLE IF NOT EXISTS apac_liquidity_lab.agent_audit.evidence_bundle ( evidence_bundle_id STRING, created_at TIMESTAMP, agent_run_id STRING, proposal_id STRING, data_object STRING, query_id STRING, source_watermark TIMESTAMP, rule_id STRING, rule_version STRING, ontology_snippet_id STRING, model_endpoint STRING, prompt_template_version STRING, tool_name STRING, result_hash STRING, evidence_uri STRING, is_synthetic BOOLEAN ) USING DELTA; Store enough information to reproduce the result without storing unrestricted sensitive prompts.
Hash or redact customer and counterparty identifiers in the evidence view where full identity is unnecessary.
A complete evidence bundle should identify:
- Data sources.
- Timestamps and watermarks.
- Cost components.
- Jurisdiction rules.
- Ontology definitions.
- SQL query IDs.
- Model and prompt versions.
- Missing or conflicting evidence.
- Human decision.
Step 16: Use Unity Catalog lineage
Open Catalog Explorer and inspect the lineage for:
- Raw liquidity events.
- Validated events.
- Corridor state.
- Cross-market basis.
- Route proposal.
- Evidence bundle.
- Dashboard or app.
Unity Catalog can capture table and column lineage for Databricks SQL and supported DataFrame workloads.
Use lineage for impact analysis before changing a field such as currency, legal_entity_id, settlement_delay_minutes, or funding_cost_bps.
Do not claim that Unity Catalog records an agent's entire reasoning chain automatically. Persist the agent's explicit plan and evidence references in audit tables.
Step 17: Build the human evidence panel
Create a Databricks App or AI/BI dashboard that shows:
- Proposal ID.
- Legal entities.
- Corridor.
- Currency pair.
- Proposed research notional.
- Gross basis.
- Every cost component.
- Net basis.
- Market-data age.
- Settlement delay.
- Available capacity.
- Applied rules.
- Conflicting evidence.
- Lineage references.
- Agent confidence and limitations.
- Required human approvals.
Provide decision choices:
APPROVE_FURTHER_RESEARCHREQUEST_MORE_EVIDENCEREJECTESCALATE_LEGALESCALATE_COMPLIANCEESCALATE_RISK
Do not include an EXECUTE button.
Step 18: Create the type audit
Create an expected schema registry:
CREATE TABLE IF NOT EXISTS apac_liquidity_lab.governance.schema_registry ( data_object STRING, schema_version STRING, column_name STRING, data_type STRING, nullable BOOLEAN, semantic_type STRING, approved_by STRING, effective_from TIMESTAMP, is_synthetic BOOLEAN ) USING DELTA; Compare the deployed schema with the registry.
Block changes that:
- Convert decimal money to floating-point without approval.
- Reduce decimal precision.
- Change UTC timestamp semantics.
- Rename a legal-entity field without updating policies.
- Make an idempotency key nullable.
- Remove a source sequence.
- Change currency from ISO code to free text.
- Remove the synthetic-data marker.
Use explicit versioning for payload changes.
Step 19: Create the idempotency audit
Replay the same input event at least three times into the shadow pipeline.
Expected behavior:
- One logical event.
- One proposal trigger at most.
- No duplicate evidence bundle.
- No duplicate human-review case.
- No second cost, fee, transfer, or position update.
Create an idempotency result table:
CREATE TABLE IF NOT EXISTS apac_liquidity_lab.evaluation.idempotency_results ( test_run_id STRING, idempotency_key STRING, replay_count INT, logical_output_count INT, duplicate_output_count INT, result_status STRING, tested_at TIMESTAMP, is_synthetic BOOLEAN ) USING DELTA; A passing test has one logical output and zero unauthorized duplicate effects.
Step 20: Create a Lakebase shadow branch
Where Lakebase is available, create a child branch named:
liquidity-agent-shadow-v2
Lakebase branches are isolated copy-on-write environments. Child changes do not affect the parent. Branch creation time does not depend on copying the complete database.
Use the shadow branch for:
- Schema changes.
- Agent audit-state changes.
- Rule-engine changes.
- Idempotency tests.
- Historical incident replay.
Set branch expiration for temporary CI or simulation branches.
Do not write shadow results back into the production branch.
Step 21: Build dual-run simulation
Duplicate a bounded, read-only input stream into two consumers:
- Current production logic.
- Shadow candidate logic.
Use the same source event ID, source sequence, event time, legal-entity context, and rule snapshot.
Do not duplicate a live payment or trade instruction into two executable systems. Use a sanitized read-only mirror or replay log.
Write both outputs to separate tables:
evaluation.production_outputsevaluation.shadow_outputs
Include:
- Event ID.
- Input hash.
- Rule version.
- Schema version.
- Output status.
- Net basis.
- Proposed capacity.
- Compliance result.
- Processing start and end times.
- Error category.
- Output hash.
Step 22: Compare production and shadow results
Join by event ID and rule snapshot.
Use exact comparison for deterministic fields:
- Legal entity.
- Corridor.
- Currency.
- Compliance status.
- Rule IDs.
- Recommendation category.
Use controlled tolerance for numerical fields:
- Net basis difference no more than 0.01 basis point for deterministic decimal logic.
- Capacity difference no more than the formally approved rounding unit.
- Settlement delay difference no more than one minute where source granularity is one minute.
Use semantic evaluation for generated explanations. Do not require identical language-model text.
Calculate latency differences:
- Median.
- p95.
- p99.
- Maximum.
Do not promise microsecond comparison in Free Edition. Serverless scheduling, SQL execution, model inference, and network paths are not a deterministic microsecond trading-control environment.
Step 23: Inject liquidity stress
Create synthetic stress cases:
- Available notional falls by 80 percent.
- Bid-ask spread widens five times.
- Funding cost rises 100 basis points.
- Settlement delay rises from 15 to 240...