AI agents and your data

Straight answers before you let AI agents near your data.

AI agents are most useful on real company data, and that is exactly where a mistake is expensive. These answers cover what security and data teams ask first: how agents should connect, what can leak, what can be injected, and how to prove what an agent saw. Each one starts with a short answer and separates general advice from what DBShifts does.

Getting started

What it means to give AI agents access to company data, and the shape of a safe setup.

What is an AI agent gateway?

An AI agent gateway is a control point between AI agents and the systems they read from. Instead of database credentials, each agent gets a scoped token. The gateway checks every request against your policy — which tables and columns, PII masking, volume limits — records it, and only then returns data.

Read the answer →

How do I give AI agents access to my database safely?

Don't give the agent a connection string. Put a governed layer in between: a scoped, revocable token per agent, only the tables and columns it needs, PII masked on the server, limits on how much it can read, returned data scanned for prompt injection, and every request logged so you can see exactly what it accessed.

Read the answer →

What is AI data governance?

AI data governance means controlling and proving what data AI systems can reach and what they did with it: which tables and columns, with sensitive values masked, within usage limits, with every access logged in a record auditors can trust. It applies the discipline of human data access to agents, assistants and AI features.

Read the answer →

Should AI agents use RAG or query the database directly?

Use retrieval-augmented generation (RAG) for unstructured documents, and governed queries for live structured data. Embedding database rows into a vector store goes stale as rows change, cannot answer totals or joins reliably, and copies regulated data into a second system. Querying the source keeps answers current and data under existing controls.

Read the answer →

Security

Where AI access to databases goes wrong: MCP tools, generated SQL, injected instructions, broad permissions.

Is it safe to connect an MCP server to a production database?

It depends on what the MCP server exposes. A server that offers a 'run SQL' tool backed by full credentials is only as safe as the model's choices. A safe setup uses a read-only user, structured tools instead of raw SQL, a token per client, server-side PII masking, volume limits and a log of every tool call.

Read the answer →

Is text-to-SQL safe to run against a production database?

Not on its own. When a model writes raw SQL, the query can join anything, scan everything, bypass masking with SQL functions, or change data if the user allows it. Safer designs give the model structured tools — filter, aggregate, follow a real foreign key — and enforce allowlists, masking and limits on the server.

Read the answer →

Can data in my database prompt-inject an AI agent?

Yes. It's called indirect prompt injection: text stored in a row — a support ticket, a review, a form field — that addresses the model, such as 'ignore previous instructions'. When an agent reads that row into its context, the model may obey it. Access controls decide which data an agent gets; they don't inspect what the data says.

Read the answer →

What permissions should an AI agent have on a database?

Only what the task needs: read-only access, specific tables and columns with everything else denied, sensitive columns masked, rows scoped to the user or tenant it serves, capped volume per request and per day, a token that expires, and changes only through named actions a person approves.

Read the answer →

Privacy and oversight

Keeping personal data away from models, proving what agents saw, and stopping one fast.

People, databases and networks

Each person's own permissions, one agent across several databases, and databases that stay inside your network.

Agents working together

When agents call each other and their tools: what may cross, which tools they may use, and stopping a runaway chain.

Asking your data

Plain-English questions answered from real rows, without giving a model the keys.

Put a governed gateway between your agents and your data

Scoped tokens instead of credentials, PII masked on the server, every request audited.