LGPD and AI agents on your database: what changes and how to control it

6 min read · Updated November 14, 2026

AI agents did not get an exception under Brazil's data protection law (LGPD). When Cursor or Claude queries a customer table, that is processing of personal data, and the company remains responsible for it.

The principles that matter most

Law 13,709/2018 lists principles in article 6. For AI agents on the database, four stand out:

  • Necessity: process only the minimum needed for the purpose. An agent with access to every table goes against this by default.
  • Security: technical and administrative measures to protect data from unauthorized access and loss (art. 46).
  • Prevention: take measures to avoid harm before it happens.
  • Accountability: be able to show the measures exist and work.

The law also requires controllers and processors to keep a record of processing operations (art. 37).

Where agents create risk

  • Broad credentials: the intern's agent sees the same payroll as the CFO's.
  • Data going to the model: query results are sent to the AI model provider. Review contracts and where that data is processed.
  • Uncontrolled deletion: deleting data by mistake is also a security incident.
  • No record: without knowing who asked for what, you cannot answer a data subject or the regulator.

Controls that produce evidence

  • Access per person, not a shared password: every query tied to someone.
  • Data profiles: sensitive tables separated by profile, granted in PostgreSQL itself.
  • A recorded access request when someone needs data outside their profile, with justification and approval.
  • Approval for deletion and structural changes.
  • Masked literals in the records, so the audit does not become another copy of personal data.
  • A defined retention period for the audit trail.

How GatekeeperID Agents helps

Each person uses the agent with their own token and data profile. What the profile cannot read becomes an access request that another person grants or refuses. Deletions wait for approval. The audit records who asked, what ran, and who approved, with values masked, for 90 days. The database password and the full SQL stay on the company network.

This guide is not legal advice. Take these controls to your data protection officer to assess your case.

Control and evidence for AI on your data

We show data profiles, access requests, and the audit in a 20-minute demo.

Book a 20-minute demo

Questions about this guide

Does using AI on the database break the LGPD?

Not by itself. What matters is a legal basis, purpose, minimum access, security, and records. The risk is giving the agent a broad credential with no control and no trail.

Does data queried by the agent go to the model provider?

The query result is sent to the model Cursor or Claude uses. That is why it pays to limit what each profile can read and to check the provider contract.

Does GatekeeperID store the personal data that was queried?

No. The Cloud receives masked SQL and decisions. Queried rows and the database password stay on your network.

More guides