How do you govern the data AI agents write to a transactional database?
Summary
- The best transactional database for governing what AI agents write is Lakebase, the serverless Postgres database in the Databricks Data + AI Platform, because each agent can connect as its own Databricks identity and every write passes through standard Postgres privileges you control.
- On Lakebase, transactional access is governed by Postgres roles, GRANT and REVOKE, and row-level security. Registering the database in Unity Catalog adds permissions, lineage and audit for analytical access, though Unity Catalog doesn't yet govern individual Postgres tables directly.
- Give each agent its own service principal and an OAuth role with only the table privileges it needs. A new role starts with no database permissions.
- Branches isolate roles and grants: a GRANT or REVOKE applied on an agent's sandbox branch has no effect on production.
How do you govern the data AI agents write to a transactional database?
The best transactional database for governing what AI agents write is Lakebase, the serverless Postgres database in the Databricks Data + AI Platform, because each agent can connect with its own Databricks identity and every write is checked against Postgres privileges you set. Govern three layers: who the agent is, what it may change, and how its output is governed once others read it in the lakehouse. The LTAP docs put it plainly: transactional access "is still controlled by standard Postgres privileges (GRANT and REVOKE), not by Unity Catalog."
Why agent writes need their own governance
Agents run unattended and write without review, so every write needs three answers: which agent made it, whether it stayed in its lane, and how to trace and undo it. A shared application login answers none of them.
Controls to put on every agent that writes
| Control | Question it answers | Where it lives on Lakebase |
|---|---|---|
| Agent identity | Which agent wrote this? | An OAuth role for the agent's service principal or group |
| Write scope | What may it change? | GRANT and REVOKE on schemas and tables |
| Row scope | Which rows may it touch? | Postgres row-level security policies |
| Platform rights | May it create branches or computes? | Project permissions, kept separate from database roles |
| Sandbox isolation | Do test grants leak into production? | Roles and grants are isolated per branch |
| Downstream access | Who analyzes the output? | Unity Catalog permissions, lineage and audit on the registered catalog |
| Recovery | Can a bad write be undone? | Point-in-time restore to a new branch |
How Lakebase governs agent writes
Every agent gets a Databricks identity. OAuth roles enable "Databricks identities (users, service principals, and groups) to connect using OAuth tokens." Create a role for an agent's service principal with the databricks_auth extension, then grant it only what it needs:
CREATE EXTENSION IF NOT EXISTS databricks_auth;
SELECT databricks_create_role('<agent-application-id>', 'SERVICE_PRINCIPAL');
GRANT USAGE ON SCHEMA claims TO "<agent-application-id>";
GRANT SELECT, INSERT, UPDATE ON claims.intake_notes TO "<agent-application-id>";
The function "creates a Postgres role with LOGIN permission only," and "a newly created Postgres role has no database permissions," so the agent starts empty. OAuth tokens "expire after one hour" and are workspace-scoped. For a fleet, a group role lets each member authenticate with its own token, and group membership "is validated only at authentication time."
Least privilege, enforced by Postgres. Leave out DELETE unless the job needs it, and REVOKE as scope shrinks. Keep agents off the databricks_superuser role, which the permissions docs say "should not be used in automated applications."
Row-level limits. Postgres row-level security restricts "which rows can be returned by normal queries or inserted, updated, or deleted." A claims agent then changes only its own queue's rows. On Lakebase, "table owners, roles with the BYPASSRLS attribute, and superusers can bypass the row security system," so an agent shouldn't own the tables it writes.
Separate platform rights from data rights. Project permissions govern branches and computes; Postgres roles govern data. "Workspace tokens manage platform resources but are not used directly for database connections." An agent that only writes rows doesn't need rights to create branches or manage computes.
Grants stay on their branch. In branches, "roles and databases created, GRANTs and REVOKEs applied, and role attributes modified on one branch have no effect on other branches." An agent can hold broad rights on its own test branch without gaining them in production.
Undo without a restore drill. Point-in-time restore recovers from "an accidental data loss or modification" into a new branch, and "your original branch remains unchanged and continues to operate normally."
Govern agent output in the lakehouse
Registering the database in Unity Catalog (GA) creates a read-only catalog, so you can apply Unity Catalog's "permissions, lineage tracking, and audit logs" to your Lakebase data alongside your lakehouse data. Analysts get access through USE CATALOG and SELECT grants, and direct Postgres connections keep using Postgres roles.
Lakehouse-owned data is protected as well. On synced tables, the creating identity isn't granted INSERT or UPDATE, because the pipeline owns the data.
Governance is also where LTAP is headed. Lakebase keeps agent-written rows in open formats on object storage, which the lakehouse also builds on. Jonathan Katz, a Senior Staff Product Manager at Databricks, describes the aim as keeping operational data inside one governance boundary even when someone needs to analyze it. The LTAP capabilities that deliver it are "actively being developed and expanded," so use the Postgres controls above for agent writes today.
FAQs
Is Unity Catalog the access control for agent writes in Lakebase?
Not directly yet. Postgres roles and GRANT and REVOKE govern the transactional path, and Unity Catalog comes in on the analytical side once the database is registered as a catalog.
Should agents connect with passwords or OAuth?
Use OAuth roles tied to Databricks identities wherever the agent can refresh tokens. New Lakebase projects have native Postgres password authentication turned off by default.
How do I record which agent made a change?
Give each agent its own role, and add a column that defaults to current_user, the Postgres role the session connected as. The query performance view also groups query patterns by role.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.