AI agent data access is one of the top concerns security leaders raise about agents — in a 2026 Okta survey, 83% of IT and security leaders cited data leakage as a top barrier to adoption. Agents need data to be useful, but they read it on behalf of users who may not be entitled to all of it, and they can pass it on through emails, tickets and tool calls. This guide covers practical patterns for limiting what agents can read and share.
How agents leak data
- Over-broad queries. The agent's credentials can read every customer, so a cleverly phrased request returns all of them.
- Wrong customer. The agent looks up a record that belongs to someone other than the user it's helping.
- Indirect exfiltration. Prompt injection instructs the agent to include data in an email, URL or tool call.
- Oversharing in outputs. The agent quotes more of a record than the user needs.
- Bulk export. A legitimate-looking request pulls thousands of rows.
Patterns for AI agent data access
Bind lookups to the conversation
Take the customer or user ID from the session, never from the model's arguments. The rule: an agent can only read the record of the person it's serving.
allow when customer_id == conversation.customer_id
deny when rows > 1 reason = "bulk export not allowed"
Read only what the task needs
Expose narrow tools — get_order_status rather than query_database. Return only the fields the task needs, and mask the rest. This is least privilege applied to data.
Treat sharing as an action
Sending data somewhere — an email, a ticket, an external API — is an action that deserves its own rules: approved destinations, no personal data to external domains, approval for attachments.
Cap volume
Set row limits per query and per day. Unusual volume is held for approval rather than silently allowed.
Record access decisions
Log which records each agent read, for whom, and which access attempts were denied. Denied attempts are often the first signal of misuse. See AI agent audit trail.
Data access and compliance
Data protection law generally expects purpose limitation and data minimisation, and these patterns support both. If an agent processes personal data in a sensitive context, involve your privacy team early — see AI agent compliance.
Where Gaten fits
Gaten checks data actions before they run: lookups bound to the right customer, bulk exports denied, sharing to external destinations held for approval — with every decision recorded. See how policies work.
Frequently asked questions
How do you control what data an AI agent can access?
Give it narrow tools, bind lookups to the user it's serving, return only needed fields, cap volume, and check sharing actions against policy.
Can AI agents leak personal data?
Yes — through over-broad queries, prompt injection or oversharing in responses. Scoped access and action-level rules reduce the risk significantly.
Should agents have direct database access?
Generally no. Expose purpose-built tools with fixed queries and field filtering instead of open query access.

