How to Configure CrewAI ClickHouse Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up crewai clickhouse approval, add human checks in your agent tasks and restrict database roles. This step stops AI agents from running bad queries on live data. Many teams give agents one shared database user with broad rights. That setup makes setup fast for early tests. Yet broad rights let an agent read private tables or run heavy queries at any time. One bad prompt can expose emails or lock up cluster nodes. How crewai clickhouse approval works with native controls CrewAI coordina

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.

To set up crewai clickhouse approval, add human checks in your agent tasks and restrict database roles. This step stops AI agents from running bad queries on live data. Many teams give agents one shared database user with broad rights. That setup makes setup fast for early tests. Yet broad rights let an agent read private tables or run heavy queries at any time. One bad prompt can expose emails or lock up cluster nodes.

How crewai clickhouse approval works with native controls

CrewAI coordinates multiple AI agents to finish complex jobs. You define tasks and give agents tools to talk to external systems. When an agent needs data from ClickHouse, it builds a SQL query and runs it. You can pause the agent before it runs a tool by turning on human input in the task. The agent then prints its plan and waits for a person to say yes or no.

On the database side, ClickHouse manages users, roles, row policies, settings profiles, and quotas with SQL. To turn on SQL access control, you set a storage folder in the server settings. You also need at least one admin user with rights to manage access and named collections. A user can only grant the rights that they already hold themselves. Creating a new user takes the create user right on the server.

During user setup, you can set the login method, allowed host addresses, default roles, and user settings. You can also limit read rights down to single columns on a table. When you grant select rights on specific columns, the user can only query those named columns. If the agent tries to select all columns with a star, ClickHouse blocks the query. The database returns no data unless the table only holds the allowed columns. Since version 24.10, a trailing star lets admins grant rights by table name prefix.

What native setup solves and what it misses

ClickHouse roles and column grants do a good job of limiting what tables an agent can touch. Host limits and quotas also help keep basic usage in check. Human steps inside the agent code let a builder check a task during local testing.

Still, these native controls leave big gaps in live team workflows. ClickHouse checks who logs in, not the exact context of each query in flight. Once an agent logs in with a valid user, every allowed query runs right away. ClickHouse does not have a built-in pause button to hold a single query for team sign-off. Also, human prompts inside CrewAI run in the local console or app thread. They do not tie into central chat tools with clear audit logs for security teams.

Approval Chains & Escalation + ClickHouse Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Column grants are also all or nothing. If an agent needs a table with user emails or phone numbers, you face a hard choice. You must block the column or expose raw values to the model. Native grants cannot mask card numbers or national IDs on the fly while returning the rest of the row.

Why runtime query checks matter for AI agents

AI agents write SQL on the fly based on user prompts and table schemas. Even with a read-only role, an agent can write a bad join or scan billions of rows. Relying on agent code alone to ask for permission is risky. If a developer forgets a flag in code, the agent skips the check. Putting the approval step and data masking in front of the database keeps every query safe.

Check ClickHouse queries and result columns on the wire

ClickHouse users and row policies decide who connects. They do not check each statement on the wire or redact sensitive string columns in query results. With hoop.dev, you run an open-source proxy, a sidecar for your ClickHouse. It reads ClickHouse's native TCP protocol before queries run while ClickHouse stays in charge of login and grants.

Multi-statement queries and table mutations are split and checked by hoop.dev guardrails. Banned actions are refused with a native ClickHouse error. On returned rows, hoop.dev data masking rewrites String and FixedString columns that match your rules. The audit trail logs each query, table, and verdict. See the MIT-licensed source on GitHub.

Frequently asked questions

Can ClickHouse pause a single agent query for human sign-off?

No, ClickHouse evaluates grants when a query starts and either runs it or blocks it right away. To pause a query for team review, you need an external check before the query reaches the database.

What happens when a CrewAI agent runs SELECT * on a column-restricted table?

ClickHouse refuses the query and returns zero data unless the user has rights on every column in that table. You must instruct your agent to name only the allowed columns in its SQL statements.

How do you keep AI agents from sending raw PII to language models?

You can restrict sensitive columns with native SQL grants so the agent cannot query them at all. Or you can apply dynamic data masking that rewrites matched emails, phone numbers, and card numbers in query results.

The query runs. The emails stay hidden.