AI & Agents

From Lakehouse to AI Agents: The Serving and Governance Layer

An AI agent on a lakehouse is a new kind of user: one that reads data, calls tools and acts at machine speed. Most agent pilots give it a service account and hope. This is the serving and governance layer our Databricks POD builds instead — so an agent can only see what it should, do what it is allowed to, and leave a record of everything it changed.

TL;DR

Agents fail in production for the same reason dashboards used to: they read data nobody governed. The fix is a serving and governance layer between the lakehouse and the agent. Agents read gold through governed views and act through Unity Catalog functions, never through raw SQL on tables. Retrieval runs on vector indexes built from governed gold tables. Models sit behind Model Serving with a gateway for rate limits, guardrails and payload logging. Each agent has its own identity, or acts on behalf of the user, so catalog permissions apply. And an audit layer records not only the trace, but the business change and who approved it. Below is the architecture, the trust boundaries, and the control checklist we use before an agent touches production.

An agent is a new kind of user

For twenty years the lakehouse, and the warehouse before it, served two kinds of consumer: people looking at dashboards, and pipelines feeding other systems. AI agents are a third. They read data like an analyst, call systems like a pipeline, and act at a speed and volume neither ever did. And they make decisions about what to read and what to do next at run time, from instructions written in natural language.

That combination breaks a quiet assumption most data platforms rely on: that whoever queries a table already knows what they are allowed to do with it. An agent knows only what its tools and permissions allow. If the only thing between an agent and your claims data is a service account with SELECT on everything, the agent has exactly that access — for every user who talks to it.

The good news: if you built the lakehouse properly — Unity Catalog, gold tables with contracts, masks and row filters in the catalog — most of the controls an agent needs already exist. This post is about wiring the agent into them instead of around them. If you have not, start with our reference architecture.

The architecture

The serving and governance layer sits between the lakehouse and the agent. It has five parts: governed data for agents to read, tools that are themselves governed objects, a serving tier with a gateway, an identity model, and an audit layer that captures evidence from every hop.

The serving and governance layer between the lakehouse and the agent
User or systemapp · Slack · workflow AI gateway → agent on Model Serving rate limits · guardrails · payload logging · usage tracking agent code + prompts versioned in MLflow · evaluated before release Foundation modelhosted or externalvia the same gateway Read toolsUC functions overgoverned views Retrievalvector search ongold documents Action toolsbusiness APIs withauthority limits Human approvalabove the limit,raised by the system Unity Catalog grants · row filters & column masks · tags · lineage · audit Goldconformed facts & entities Servingfeatures · low-latency tables bronze and silver are never exposed to agents Audit layer traces gateway logs tool calls approvals business changes cost per outcome InsightLense Release gate evaluation set judges + human review regression vs last version solid arrows: requests and data · dashed: evidence flowing to the audit layer
The agent never touches a table directly. It reaches data through tools that are themselves governed objects, and every hop leaves evidence.

Data for agents: gold, served three ways

Agents should read the same trusted data your dashboards do, which means gold and serving tables, never bronze or silver. What changes is how that data is shaped for them:

ShapeOn DatabricksUsed for
Governed viewsViews on gold with row filters and masks inherited from the base tablesStructured questions: balances, claims, orders, KPIs
Vector indexesMosaic AI Vector Search, delta-sync indexes built from a gold documents tableRetrieval over policies, contracts, tickets, runbooks
Low-latency featuresFeature tables served online for millisecond lookupsContext for real-time decisions inside a conversation

Two details matter more than they look. First, the vector index is built from a governed table, with the access-control attributes carried as metadata so retrieval can be filtered by who is asking. An index built from a folder of exported PDFs has no governance at all. Second, table and column comments are now part of the interface. Agents, like Genie, choose tools and columns from descriptions. A gold table without good comments is a gold table an agent will misuse.

Tools, not tables

The single most important design decision is that agents do not write SQL against tables. They call tools, and every tool is a governed object with an owner, a description, a signature and its own grants. On Databricks the natural form for read tools is a Unity Catalog function:

-- A read tool: narrow, typed, documented, governed like any other object
CREATE OR REPLACE FUNCTION claims_prod.agent_tools.open_claims_for_policy(
    policy_id STRING COMMENT 'Policy number, e.g. PA-2041-118'
)
RETURNS TABLE (claim_id STRING, loss_date DATE, status STRING, reserve DECIMAL(18,2))
COMMENT 'Open claims on one policy. Use when a user asks about the status of their claims.'
RETURN SELECT claim_id, loss_date, status, reserve
       FROM   claims_prod.gold.v_claim_current
       WHERE  policy_number = policy_id AND status <> 'CLOSED';

GRANT EXECUTE ON FUNCTION claims_prod.agent_tools.open_claims_for_policy
      TO `agent-claims-assistant`;

A narrow tool limits what the agent can ask for, makes its behavior testable, and gives you one place to change logic without retraining or re-prompting anything. It also composes with the catalog: the function reads a view whose row filters and masks still apply.

Action tools — anything that changes the business, such as settling a claim, issuing a refund or closing an incident — are different. They should call the system of record through its own API, and the authority limits must live in that system, not in the agent’s prompt. When we built Vsure, our carrier run by AI agents, the claims system refused any settlement above the adjuster agent’s limit and raised an approval to a supervisor. The agent could not talk its way past it, because the limit was never the agent’s to enforce.

Serving and the gateway

Agents and the models they call run behind Mosaic AI Model Serving, with the AI gateway in front. The gateway is where the platform-wide controls live, so individual teams do not each reimplement them:

  • Rate limits and usage tracking per endpoint, per user and per agent, so one runaway loop cannot consume the month’s budget.
  • Guardrails on inputs and outputs: PII detection, unsafe content filters and topic restrictions, applied before anything reaches the model or the user.
  • Payload logging to inference tables in Unity Catalog, so every request and response is queryable and governed like any other data.
  • One front door for every model, hosted or external, so switching providers is a configuration change and not a security review.

Agent code, prompts and tool definitions are versioned together in MLflow, traced with MLflow Tracing, and released only after they pass an evaluation set — automated judges plus human review on a sample — with no regression against the previous version.

Whose identity does the agent use?

This is the question most pilots skip, and the one security teams ask first. There are two valid answers and one invalid one:

ModelWhen to use itWhat the catalog sees
On behalf of the userAssistants answering a person’s questions about data they can already seeThe user — row filters and masks apply exactly as in a dashboard
Agent’s own service principalAutonomous agents doing a defined job, such as triage or reconciliationA dedicated principal with the minimum grants that job needs
Shared service accountNeverOne identity for every agent and every user, with the union of all their access

The on-behalf-of model is the safest default for assistants because it makes the agent unable to show a user anything the user could not already query. The service-principal model is right for autonomous work, provided each agent has its own principal — so its access can be reviewed, its activity audited and its credentials revoked without affecting anything else.

Three trust boundaries

It helps to name where risk actually crosses. There are three boundaries, and each needs a different kind of control:

Three trust boundaries, three different controls
1 · Model boundary what crosses: prompts, retrieved context, outputs control: gateway, guardrails, PII filters, payload logs 2 · Data boundary what crosses: rows and documents the agent reads control: UC grants, row filters, masks, per-agent identity 3 · Action boundary what crosses: changes to the business control: authority limits in the system of record, human approval, idempotent APIs limits live in the product
Most agent pilots only control the outer boundary. The inner two are where real losses happen, and neither can be enforced by a prompt.

The failure we see most: teams put strong guardrails on the model boundary — content filters, prompt-injection detection — and nothing on the action boundary. The agent is polite, safe and on-topic, and it can still refund the wrong customer, because nothing in the refund API checks who is asking or how much.

Audit and assurance: evidence of what changed

Tracing tells you what an agent did: prompts, tool calls, tokens, latency. That is necessary and not sufficient. When an agent is allowed to change something that costs money, you also need to know what changed in the business, under whose authority, at what cost — and you need to be told when a control quietly stops firing.

This is the gap our InsightLense product is built for. It organizes agent evidence into five layers:

LayerQuestion it answersEvidence
TraceabilityWhat did the agent do?Traces, tool calls, retrieved context
ControlWhat was it not allowed to do?Refused actions, limit breaches, escalations
AuditWhat changed in the business, and who approved it?Change records joined to approvals
EconomicsWhat did each outcome cost?Cost per resolved case or per decision, not per million tokens
AssuranceAre the controls still working?Alerts when an expected refusal or escalation stops occurring

Because traces, inference tables and audit logs all land in Unity Catalog, this evidence can be joined to the business data itself. That is what turns a log into an answer an auditor accepts.

The control checklist before an agent touches production

ControlDone when
Data sourceThe agent reads gold and serving only, through views or functions
MetadataEvery table, column and tool the agent uses has a useful description
RetrievalVector indexes are built from governed tables and filtered by the caller’s access
IdentityOn behalf of the user, or a dedicated service principal per agent
ToolsNarrow, typed and granted individually; no general-purpose SQL tool in production
ActionsAuthority limits are enforced in the system of record, with human approval above them
GatewayRate limits, guardrails and payload logging are on for every endpoint
EvaluationThe release passes an evaluation set with no regression against the last version
AuditBusiness changes are linked to traces and approvals, and queryable
AssuranceSomeone is alerted when a control stops firing, not just when an error occurs
Kill switchThe agent can be disabled in minutes without a deployment

The bottom line

Agents do not need a new data platform. They need the lakehouse you should already have — governed gold data, permissions in the catalog, good metadata — plus a thin serving and governance layer that makes the agent a well-behaved citizen of it: tools instead of tables, its own identity or the user’s, a gateway in front, limits in the systems it acts on, and evidence from every step.

Build that layer once and every new agent inherits it. Skip it and every agent becomes its own security review, which is why so many pilots never reach production.

Putting agents on your lakehouse?

Our Databricks POD starts with a two-to-three week assessment — data readiness, identity, tool design and controls — and a findings report that tells you which agent use case is safe to ship first.

Databricks POD
Back to blog