All posts

LGPD for CrewAI

A newly offboarded contractor still has a service account that CrewAI uses to pull customer records for a nightly report. The account can query any table, export raw rows, and write results to a shared bucket. When the contractor leaves, the token remains active for weeks, and no one knows which queries were run or what personal data left the environment. Under Brazil’s General Data Protection Law (lgpd), organizations must demonstrate accountability for every access to personal data, keep tamp

Free White Paper

LGPD (Brazil): The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

A newly offboarded contractor still has a service account that CrewAI uses to pull customer records for a nightly report. The account can query any table, export raw rows, and write results to a shared bucket. When the contractor leaves, the token remains active for weeks, and no one knows which queries were run or what personal data left the environment.

Under Brazil’s General Data Protection Law (lgpd), organizations must demonstrate accountability for every access to personal data, keep tamper‑evident logs, and ensure that only the minimum necessary information is exposed. Auditors look for concrete evidence: who accessed what, when, and whether the data was masked or approved before leaving the system.

For AI‑driven platforms like CrewAI, the challenge is twofold. First, the model often runs as an automated job that authenticates with a static credential. Second, the job can issue ad‑hoc queries that bypass human review, making it hard to prove compliance after the fact.

What lgpd expects from AI‑driven data pipelines

lgpd requires that personal data processing be transparent, auditable, and limited to the purpose originally disclosed. Key evidence points include:

  • Identity of the entity (human or service account) that initiated a request.
  • Exact query or command executed against the data store.
  • Timestamp and duration of the session.
  • Any transformation or masking applied to protected fields.
  • Approval records for operations that exceed a predefined risk threshold.

Without these artifacts, regulators consider the organization non‑compliant, and penalties can be severe.

Where the gap appears in typical CrewAI deployments

Most teams give CrewAI a long‑lived database credential and let the model connect directly to PostgreSQL, MySQL, or another datastore. The credential is stored in a CI secret manager, but the connection bypasses any gateway that could inspect the traffic. As a result:

  • There is no per‑query audit log; only the database’s generic connection logs exist.
  • Sensitive columns such as CPF, email, or address are returned in clear text.
  • High‑risk queries (e.g., full table scans or export commands) execute without any human sign‑off.
  • Session replay is impossible because the database does not retain the command stream.

These gaps mean that even if the organization implements strong identity‑provider policies, the enforcement outcomes required by lgpd never materialize.

How hoop.dev provides the missing controls

hoop.dev is a layer‑7 gateway that sits between CrewAI and the target infrastructure. By proxying every connection, hoop.dev becomes the only place where enforcement can happen.

Continue reading? Get the full guide.

LGPD (Brazil): Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Session recording for replay

hoop.dev records each command issued by CrewAI and streams the response back to the model. The recorded session can be replayed by auditors to verify exactly what data was accessed.

Inline data masking

When a query returns personal identifiers, hoop.dev masks those fields in real time. The model receives only the masked view, satisfying the data‑minimization principle of lgpd.

Just‑in‑time approval workflow

For queries that match a high‑risk pattern, such as exporting more than a thousand rows, hoop.dev pauses the request and routes it to a designated approver. Only after explicit approval does the gateway forward the command to the database.

Comprehensive audit trail

hoop.dev logs the identity of the service account, the full query text, the masking actions applied, and the approval decision. These logs can be exported to a SIEM for long‑term retention, giving the evidence lgpd auditors demand.

Because hoop.dev sits in the data path, none of these controls can be bypassed by reconfiguring the CrewAI job. The setup phase, defining OIDC identities, provisioning the service account, and configuring the gateway, decides who may start a session, but the enforcement outcomes only exist because hoop.dev is the gateway.

Getting started

To add lgpd‑ready protection to CrewAI, follow the getting started guide. The guide walks you through deploying the gateway, registering your database connection, and enabling masking and approval policies. For deeper details on policy configuration, see the learn section of the documentation.

FAQ

Does hoop.dev replace the database’s own audit logs?

No. hoop.dev augments existing logs with per‑command details, masking actions, and approval records that the database alone does not capture.

Can I use hoop.dev with other AI platforms besides CrewAI?

Yes. The gateway works with any client that speaks the supported wire protocols, including generic SQL clients, SSH, and HTTP APIs.

Is the audit data stored securely?

hoop.dev writes logs to a storage backend of your choice, and you control the encryption and retention policies. The platform itself does not claim any certification; it simply generates the evidence needed for lgpd compliance.

View the open‑source repository on GitHub for implementation details and contribution guidelines.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts