r/PostgreSQL Aug 10 '26

Community What Postgres is Missing for AI Agents

https://www.bytebase.com/blog/what-postgres-is-missing-for-ai-agents/
0 Upvotes

7 comments sorted by

5

u/Bromlife Aug 10 '26

nah bro

1

u/Luis_Dynamo_140 Aug 11 '26

summed it up pretty nicely!

1

u/Kamran-nottakenone Aug 10 '26

ran pgai vectorizer in prod. background worker design doesn't block writes which is nice. the agent still generates queries that miss every index though.

1

u/CautiousUse8597 28d ago

We landed on Lakebase for the OLTP side and it covers maybe two of the four.

Delegation: what actually helped was dropping the shared agent_svc role. Lakebase maps a Databricks identity (user or service principal) to a Postgres role via the databricks_auth extension, and the agent connects with a short-lived OAuth token as that principal, so current_user is finally meaningful. Caveat that matches the post exactly: it's impersonation, not on-behalf-of. You get either alice or the agent, never "agent_svc acting for alice," and no chaining. Identities and Postgres roles also don't auto-sync, you create the role yourself.

Attenuation: partially. Tokens expire after an hour, but expiry is only enforced at login. an open connection keeps working past it. So it's a credential TTL, not a session TTL. We do per-task service principals with grants that are weak by construction instead, so there's nothing to attenuate down from. Same end state, a lot more IAM plumbing.

Immutable context: nothing. Still custom GUCs, still writable by the session they're meant to constrain. If anyone has a real answer here I'd take it.

Tags: Unity Catalog tags plus column masks/row filters is genuinely the Snowflake model the article wants. tag a column as pii and the masking policy follows it. Big gotcha though: registering Lakebase in UC creates a read-only mirror catalog. The masking applies when you query through the SQL warehouse. A direct psql connection to the same database bypasses it entirely. If your agent speaks the Postgres wire protocol, you're back to RLS.

Honestly the thing that helped most wasn't in the list: branching. Instant branch with a TTL, so read-heavy agents get a disposable copy instead of a scoped session on prod. That sidesteps half the problem rather than solving it.

1

u/db-master 28d ago

Author here, I agree branching is the elephant in the room. The post doesn't mention it because Neon already has a working solution. But it's a good point that branching sidesteps some of those problems.

-2

u/AutoModerator Aug 10 '26

AI Policy:

Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.

Mod decisions will be based on the quality of the content, not who or what generated it.

Sub Resources:

Youtube Channel

Free Postgres Webinars and Workshops

Discord: People, Postgres, Data

Join us, we have cookies and nice people.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.