How to Configure CrewAI CockroachDB Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up crewai cockroachdb approval by pausing agent tasks for human review before running queries. You also restrict the database role so the agent only touches allowed tables. Most teams start by giving an agent a direct database login string. When that role has broad permissions, one bad prompt can delete or leak production rows. How crewai cockroachdb approval works in practice CrewAI lets you build teams of agents that use custom tools to reach outside systems. When an agent needs dat

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up crewai cockroachdb approval by pausing agent tasks for human review before running queries. You also restrict the database role so the agent only touches allowed tables. Most teams start by giving an agent a direct database login string. When that role has broad permissions, one bad prompt can delete or leak production rows.

How crewai cockroachdb approval works in practice

CrewAI lets you build teams of agents that use custom tools to reach outside systems. When an agent needs data from CockroachDB, it calls a database tool with a query. By default, the agent runs that tool right away without waiting for a person. To add a check, engineers enable human input on the task inside the agent workflow. This setting tells the agent to show its planned action and wait for a person.

On the database side, CockroachDB manages access through roles, grants, and network rules. You create a role for the agent and grant it read or write permissions. The agent tool loads a login key or password from the local host environment. Once the agent logs in, CockroachDB checks table grants for every query the agent sends.

Good agent design pairs task pauses with strict database grants. You might give one agent a read role and another agent a write role. Still, both parts rely on developers writing safe tool logic inside the app code. If a developer skips the human check on one task, the agent runs SQL alone.

What native setup solves and what it leaves open

Native roles in CockroachDB decide which user or agent can log into the cluster. Table grants stop an agent from reading or changing tables outside its assigned scope. Human checks in CrewAI help a person spot a bad plan during a test run. Together, these controls reduce the chance of an agent dropping a whole schema by mistake.

Still, a database login only checks who connects at the start of a session. Once the session is open, the database trusts every valid query from that role. If an agent has update rights on a table, it can change one row or all rows. CockroachDB grants cannot pause a single risky delete query to ask a human on Slack. They also cannot tell if a query came from a safe task or a broken prompt.

Approval Chains & Escalation + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

App level checks in CrewAI also have limits when teams scale up. The human check happens inside the Python process, not at the database boundary. Anyone who copies the database password from the app host can bypass the agent check. Also, native roles do not rewrite sensitive fields in query results. If a table holds emails, phone numbers, card numbers, or national IDs, the agent reads raw values. Data masking that rewrites matched fields in results must happen in flight before data returns.

Why query level checks matter for AI agents

Agents write SQL on the fly based on user prompts and table schemas. Even a read query can pull too many rows or expose private customer details. Teams need a way to inspect each SQL statement right before it reaches CockroachDB. When a query tries to change data, a reviewer should approve that exact statement first.

Moving approval outside the agent code keeps rules consistent across every script and team. Developers no longer need to build custom pause logic into every single CrewAI tool. Security teams also get a clear log of which person approved each query and when.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Can CockroachDB pause a single query from CrewAI for human review?

No, CockroachDB grants either allow or deny a query right away based on role permissions. You need an external approval workflow or task pause to hold a query for human sign-off.

Should a CrewAI agent share a database role with backend services?

No, you should always create a separate role with minimal table grants for the agent. Sharing roles makes it hard to audit agent queries or limit what the model can change.

How do you protect sensitive columns when CrewAI queries CockroachDB?

You can restrict column grants in the database or use dynamic data masking in flight. Masking rewrites matched fields like emails, phone numbers, and card numbers in query results by default.

The query runs. The emails stay hidden.