How to get your Postgres data ready for agentic AI
Replicate Postgres with CDC or xmin using Airbyte so AI agents query a governed copy, not production. Learn when Postgres also works as a destination.

Airbyte replicates Postgres tables with CDC or xmin into a warehouse so agents never touch production, and the Postgres destination can serve as a small, typed landing zone for agent apps.
Postgres often holds the most important data a company has: users, accounts, orders, subscriptions, and the state of the product itself. It is also the database you least want an AI agent to experiment on. An agent writing exploratory SQL against production can lock rows, scan large tables at the wrong moment, or read data it was never meant to see.
The common answer is replication. Keep production where it is, copy the tables agents need into a separate, governed store, and point agents there. This guide covers how Airbyte replicates Postgres for that purpose, and when Postgres itself makes sense as the destination.
Why Postgres data matters for agentic AI
Application databases carry ground truth that SaaS tools only approximate:
- Product state. Plans, feature flags, usage counters, and account status are usually authoritative in Postgres.
- Transactions. Orders, invoices, and payments recorded by your own application.
- Relationships. Foreign keys encode how users, accounts, and objects relate, which helps an agent join data correctly.
- History, when you keep it. With CDC, inserts, updates, and deletes become a stream of changes that a warehouse can preserve.
An agent that can join this data with CRM, billing, and support data answers questions no single tool can.
What agents can do with Postgres data
- Answer product and usage questions. Count active accounts, find customers using a feature, or list accounts approaching a plan limit, from a replica instead of production.
- Explain account changes. With CDC history in the warehouse, show when an account's plan or status changed.
- Join product data with go-to-market data. Match application accounts to CRM records to surface expansion or churn risk.
- Support operations. Look up an order or user record for a support workflow without production credentials.
How Airbyte gets Postgres data ready
The Postgres source
What it replicates. Tables, views, and materialized views. Indexes and permissions are not replicated.
Access. Airbyte recommends a dedicated read-only Postgres user. On Airbyte Cloud, connections must be encrypted with TLS or go through an SSH tunnel, and you allowlist Airbyte's IP addresses. Microsoft Entra ID authentication is also supported for Azure databases.
Replication methods.
- Standard (xmin). Uses the
xminsystem column to detect changed rows. It is the method Airbyte's quick start uses. - Standard with a user-defined cursor. Uses a column such as
updated_at. - CDC (logical replication). Reads the write-ahead log through the
pgoutputplugin, a dedicated replication slot, and a publication. CDC captures deletes along with inserts and updates.
Airbyte recommends CDC when you need deletes, when the database is 500 GB or larger, or when tables have a primary key but no reliable cursor. CDC requires PostgreSQL 14 or later. You can run CDC against a replica if it runs PostgreSQL 16.1 or later with connector version 3.6.21 or later. For AWS Aurora, set rds.logical_wal_cache to 0 to disable Aurora's CDC caching layer, which is incompatible with Airbyte's implementation.
Scale. The connector checkpoints and chunks reads, so large initial syncs can resume instead of restarting.
Types. JSON and JSONB columns arrive as strings, and arrays arrive as arrays.
Deletes in the destination
With CDC, deleted rows are signaled to the destination. Destinations such as BigQuery and Snowflake expose a CDC deletion mode so you can choose between removing the row or keeping it marked as deleted. For agents asking about churn or cancellations, keeping deleted rows is often more useful.
The Postgres destination
Airbyte can also write to Postgres. Since version 3.0.0 it uses Direct Load: data goes straight into typed final tables, with no intermediate raw tables.
- Supports all five sync modes.
- Adds
_airbyte_raw_id,_airbyte_extracted_at,_airbyte_generation_id, and_airbyte_meta(JSONB) to each table. - Maps objects and arrays to JSONB.
- Each namespace maps to a schema, and identifiers are limited to 63 bytes.
- TLS is required on Airbyte Cloud, and SSH tunneling is available.
- Offers a CDC deletion mode and an option to drop tables with
CASCADE.
Airbyte's documentation is direct about scope: Postgres is not a data warehouse, and the destination is best for small data volumes (for example under about 10 GB) or testing. A Postgres destination works well as a compact store for an agent application's own data. For broad analytics across many sources, choose a warehouse.
How agents reach Postgres data
Postgres is not listed as an agent connector, so the context layer does not offer direct reads against a Postgres source or destination today. There are two practical paths:
- Sync to BigQuery or Snowflake. In Airbyte Cloud, the context layer can give agents read-only SQL access to those destinations, limited to
SELECTandSHOW TABLES. - Use the Airbyte MCP for pipeline work. At
https://mcp.airbyte.com/mcp, agents can create a Postgres connection, run a sync, discover the source catalog, and read job logs. Add?read-only=trueto limit an agent to read-only tools.
What this unlocks
- Agents that work with application data without production access.
- Deletes and updates preserved through CDC.
- Large initial syncs that resume from checkpoints.
- A typed Postgres landing zone for small agent apps.
- Pipeline management through the same MCP connection.
Getting started
- Create a read-only Postgres user and pick xmin or CDC.
- For CDC, set
wal_leveltological, create a replication slot withpgoutput, and add a publication. - Sync to BigQuery or Snowflake with Incremental Append + Deduped.
- Connect your agent to the Airbyte MCP and turn on agent access for the destination.
Try Airbyte free or talk to sales about database replication for agents.
Frequently asked questions
Should I let an AI agent query my production Postgres database?
It is safer to give agents a replicated copy. Airbyte reads from Postgres with a dedicated read-only user and writes to a warehouse or separate database, so agent queries do not compete with application traffic or touch production data.
Which Postgres replication method should I choose?
Airbyte's quick start uses Standard replication with the xmin system column. Use CDC when you need deletes captured, when the database is 500 GB or larger, or when tables lack a reliable cursor column. CDC requires PostgreSQL 14 or later.
Can I use a Postgres read replica as a CDC source?
Yes, if the replica runs PostgreSQL 16.1 or later and the connector is version 3.6.21 or later, with the additional replica configuration the docs describe.
Is Postgres a good destination for agent data?
For small volumes. Airbyte's docs note that Postgres is not a data warehouse and recommend it as a destination for small datasets, for example under about 10 GB, or for testing. Use a warehouse for larger agent workloads.
Can agents read Postgres directly through the Airbyte context layer?
Postgres is not documented as an agent connector at the time of writing. Agents can still work with Postgres data by syncing it to BigQuery or Snowflake, where the context layer supports read-only SQL.
Integrate with 700+ apps using Airbyte
Move data from 700+ sources into warehouses, lakes, and beyond. Set up pipelines in minutes with pre-built connectors and the Connector Builder.
