---
title: "Discussion on \"Why we stopped letting AI agents connect directly to the database\" | Hashnode"
description: "Discussion on \"Why we stopped letting AI agents connect directly to the database\". A read-only replica inside your network, contract-based queries and an outbound-only connection: how an AI agent uses ERP data without database credentials."
url: "https://hashnode.com/posts/why-we-stopped-letting-ai-agents-connect-directly-to-the-database/6aed07a2ff2dd3fb23aa5b7d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why we stopped letting AI agents connect directly to the database](https://zihinai.hashnode.dev/why-we-stopped-letting-ai-agents-connect-directly-to-the-database?utm_source=hashnode&utm_medium=feed)

A read-only replica inside your network, contract-based queries and an outbound-only connection: how an AI agent uses ERP data without database credentials.

Nov 5 · 6 min read · zihinai.hashnode.dev  
Read the article

-   [#artificial-intelligence](https://hashnode.com/tag/artificial-intelligence)
-   [#mcp](https://hashnode.com/tag/mcp)
-   [#security](https://hashnode.com/tag/security)
-   [#software-architecture](https://hashnode.com/tag/software-architecture)

## Written by

[Ronan Oliveira](https://hashnode.com/@oliveiraronan)

@oliveiraronan

  
[View profile](https://hashnode.com/@oliveiraronan)

## Responses 2

Markdown supported · ⌘↵ to post

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Nov 9](https://hashnode.com/posts/why-we-stopped-letting-ai-agents-connect-directly-to-the-database/6aed07a2ff2dd3fb23aa5b7d/comment/6af15786bf36fdf837b4885b)

Replay also needs a consistency boundary across the agreed tables. An open-orders contract and a stock-balance contract can each return valid read-only results while observing different points in a replicated transaction, producing an inconsistent combined answer.

I would expose the replica snapshot or replication watermark used for the response, and test an order update whose related inventory change arrives separately. That would establish whether the Bridge sees a coherent business state or merely individually valid rows. Separating the operational database from agent load is useful, but the replica's transaction visibility becomes part of the tool contract too.

[Cai](https://hashnode.com/@cailab)

[Nov 6](https://hashnode.com/posts/why-we-stopped-letting-ai-agents-connect-directly-to-the-database/6aed07a2ff2dd3fb23aa5b7d/comment/6aed8a2e48c123999d1b9052)

This mirrors what we found building agent-to-agent payment flows. Direct DB access for agents creates an unbounded trust surface every connection becomes a potential vector. The right pattern is a narrow intermediary layer that exposes only the operations agents actually need, with capability scoping and rate limiting built in. Agent wallets do this for payments by issuing session keys scoped to specific operations and budgets, so the agent never touches the backing infrastructure.
