How to Configure AutoGen ClickHouse Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an autogen clickhouse approval workflow by pairing restricted database roles with human review. An agent drafts a query, and a reviewer checks it before the database runs it. Teams often start by giving an AI agent a broad database login to test ideas fast. This habit creates big risks when an agent runs a bad query or reads private data. How native autogen clickhouse approval works Setting up safe database access for multi-agent apps starts inside the database itself. ClickHouse m

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 an autogen clickhouse approval workflow by pairing restricted database roles with human review. An agent drafts a query, and a reviewer checks it before the database runs it. Teams often start by giving an AI agent a broad database login to test ideas fast. This habit creates big risks when an agent runs a bad query or reads private data.

How native autogen clickhouse approval works

Setting up safe database access for multi-agent apps starts inside the database itself. ClickHouse manages users, roles, row policies, settings profiles, and quotas as access items. Admins create and update these items using SQL statements. To turn on SQL access control, the server needs a storage directory path set up. It also needs at least one user account with access management turned on. Once active, an admin can create a dedicated user account just for the agent.

A user account can only grant permissions that it already holds itself. Adding a new user requires the create user privilege on the server. During this step, you can define how the agent logs in. You can also limit which hosts the agent can connect from. You can assign default roles and set specific limits for that user account.

Next, you restrict what data the agent can read. You can grant read rights on specific columns instead of whole tables. If an agent only gets rights to two columns, it can only query those two. If the agent tries to read a third column, the database blocks the query. A wildcard query that asks for all columns will also fail and return nothing. It only works if the table holds just the allowed columns. Since version 24.10, you can also grant read rights across tables using a name prefix.

How agent review loops handle query checks

Database roles set the outer walls, while the agent framework handles the review prompts. In a multi-agent setup, one agent writes the query based on a user prompt. A second agent or a human user acts as the reviewer in the loop. The system pauses before it sends the SQL text to the database server.

When the agent wants to run a query, it prints the text for the reviewer. A human operator reads the statement and checks the tables and filters. If the query looks safe, the human types a reply to approve the step. If the query looks wrong, the human rejects it and asks for a fix. The agent then writes a new query and asks for approval again.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native setup solves and what it leaves open

Combining database grants with agent prompts solves the problem of wide-open access. Column grants stop the agent from reading restricted columns on the server. Host limits keep outside machines from using the agent login. Prompt checks give a human a chance to spot bad logic before a query runs.

Still, this basic setup leaves an operational gap during live execution. Database roles decide who logs in, not what each individual statement does in flight. Once a column is granted, the database sends back every row that matches a query. If an allowed column holds emails, phone numbers, or card numbers, the agent gets them. Native grants do not rewrite matched fields in results to hide national IDs.

Prompt checks inside the agent app also rely on the app code staying unchanged. If a developer changes the agent setting to skip human input, the check disappears. The database itself does not know if a human approved a specific statement. Teams also lack a single audit log that links the chat prompt to the SQL result.

Add runtime guardrails and masking beside ClickHouse

Database grants and network rules control who can reach ClickHouse. Even so, an allowed client or agent can send an alter mutation that deletes rows or read raw personal data. In practice, hoop.dev runs beside the server as a sidecar for your ClickHouse and checks native TCP queries with no change to your drivers.

With hoop.dev ClickHouse support, guardrails refuse banned queries before they run, and data masking rewrites matched string columns in results. The audit trail logs which entity types were masked and how many without storing raw values. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Can ClickHouse block an AutoGen agent from running wildcard queries?

Yes, you can grant read access to specific columns only. When you do this, the database refuses wildcard queries unless all table columns are allowed.

How do you limit where an AutoGen agent connects from?

When you create the database user, you can define allowed hosts in the SQL statement. The server will reject any login attempt from a machine outside that host list.

Why is agent-level approval not enough on its own?

Agent approval lives in app code, which a user or script can turn off. Enforcing rules outside the agent code keeps checks active for every single query.

The query runs. The emails stay hidden.