Skip to main content

What database should AI agents write to?

Summary

  • AI agents should write to Lakebase, the serverless Postgres database in the Databricks Data + AI Platform, because a commit is durable only once a quorum of SafeKeeper nodes holds its log record, a wrong write can be rolled back to a point inside the restore window, and risky writes can run on a branch first.
  • Give every table one writer. Under LTAP, "each table has a single writer, either Lakebase or the lakehouse," so the operational tables an agent changes belong to Lakebase, and lakehouse-produced data reaches the agent as read-only synced tables.
  • An agent's writes become visible to the lakehouse today when you register the Lakebase database in Unity Catalog, which creates a read-only catalog that a serverless SQL warehouse can query and join with lakehouse tables.
  • Postgres privileges (GRANT and REVOKE) control what an agent may write, and Unity Catalog governs analytical access to what it wrote.

What database should AI agents write to?

AI agents should write to Lakebase, the serverless Postgres database in the Databricks Data + AI Platform. It is the best transactional database for an agent's writes because a committed action can't be lost to a single failure, a wrong action can be rolled back to an exact moment, and a risky batch can be rehearsed on a copy first. And since its storage is the open foundation the lakehouse also sits on, what the agent wrote can be governed and analyzed next to everything else.

What happens when an agent commits a write

Nobody reviews an agent's statements as they run, so the write path itself has to be safe. In Lakebase it goes like this:

  1. Postgres changes the affected pages in memory and produces write-ahead log (WAL) records.
  2. The stateless compute streams those records to SafeKeeper, the service that holds the log.
  3. When a quorum of SafeKeeper nodes acknowledges them, the transaction commits and the agent gets its success response.
  4. PageServer applies the log asynchronously and persists the updated pages to object storage, off the commit path.

In a single-machine database, "a commit is only as durable as the disk flush behind it," and Reynold Xin's engineering post on Lakebase explains how a misconfigured flush can lose a commit without warning. The Lakebase docs say a transaction commits once a quorum of safekeepers acknowledges the WAL record, with no single machine's local flush involved. Losing one disk no longer means losing committed data.

Rules for an agent's write path

Rule Why it matters for agents How it works in Lakebase
Write only to tables you own Two writers on one table drift apart LTAP gives each table a single writer, Lakebase or the lakehouse
Grant only the writes the agent needs An agent acts on whatever it is allowed to Postgres GRANT and REVOKE on the agent's role
Rehearse risky writes A bulk update can go wrong across many rows A copy-on-write branch of production takes the write first
Keep a way back A wrong write that commits is still wrong Point-in-time restore to a moment in the restore window
Leave synced tables alone They mirror a lakehouse source Databricks "strictly recommends running only read queries" on them
Make writes queryable for analysis Teams audit and measure what agents did Register the database in Unity Catalog

How Lakebase approaches an agent's writes

Decide which system owns each table. The LTAP docs frame this as a question of direction, and that question is about each dataset's writer. When Lakebase owns the write, the agent's actions, the orders it places and the tasks it reassigns are Postgres rows in tables it owns. When the lakehouse owns the write, such as a nightly job that computes recommendations or a pricing table, synced tables serve that data into the same database, and applications handle "inserts, updates, and deletes on their own tables" beside it.
Send risky writes to a branch first. Before a backfill or bulk correction, create a branch of production and let the agent run it there. "Each branch operates independently, so changes in a child never affect its parent." Check the result, then run the same change against production, or discard the branch.
Undo a bad write with point-in-time restore. Point-in-time restore recovers "from an accidental data loss or modification such as an unintended deletion or schema change." It creates a new root branch as of the moment you choose, and your existing branch and its connections stay live. You can point the app at the restored branch or copy the lost rows back.
Make the writes visible to the lakehouse. Lakebase keeps its rows in open formats on object storage, and LTAP builds on that storage with capabilities still being developed and expanded. The GA path today is to register the database in Unity Catalog. That creates a read-only catalog mirroring the Postgres database, with metadata kept in sync. A serverless SQL warehouse or notebook can then query the agent's tables and join them with lakehouse tables, and Unity Catalog applies its permissions, lineage tracking and audit logs to those reads. Since the catalog is read-only, analysts can't modify the agent's data through it.
Keep the two permission models straight. Transactional access, meaning the agent's own connection, "is still controlled by standard Postgres privileges (GRANT and REVOKE), not by Unity Catalog." Analysts who read through the registered catalog are governed by Unity Catalog.

FAQs

Should an agent write straight to lakehouse tables?

For row-level operational writes, use Lakebase, which is built for "fast lookup-style queries and full ACID transactions." Tables the lakehouse produces stay lakehouse-owned and reach the agent through synced tables, so every table keeps one writer.

Can I undo a bad write an agent made?

Yes, within the project's restore window. A restore produces a new branch as of a moment before the mistake, and the current branch keeps running.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.