How to Configure OpenHands ClickHouse Approval
You set up openhands clickhouse approval by pairing strict database roles with human review. This setup stops AI coding agents from running bad queries on live data. Teams often give an AI agent a broad database user to speed up work. That choice creates big risks when an agent writes a bad query or drops tables. A safe setup pairs tight database rules with a clear review step for risky actions. How openhands clickhouse approval works with database roles First, you need to lock down what the
Approval Chains & Escalation + ClickHouse Access Management: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up openhands clickhouse approval by pairing strict database roles with human review. This setup stops AI coding agents from running bad queries on live data. Teams often give an AI agent a broad database user to speed up work. That choice creates big risks when an agent writes a bad query or drops tables. A safe setup pairs tight database rules with a clear review step for risky actions.
How openhands clickhouse approval works with database roles
First, you need to lock down what the database user can do on its own. ClickHouse manages users, roles, row rules, settings profiles, and quotas through SQL. To turn this on, an admin sets a storage path on the server. At least one admin user needs access management rights turned on to start. Remember that a database user can only grant rights that they already hold.
Creating a new user for the agent requires the create user right. During this step, you set how the user logs in and which hosts can connect. You also assign default roles and specific user settings for the agent session. For read tasks, you can grant read rights on specific columns in a table. The agent can then query those allowed columns, while other columns stay off limits.
A full table read fails unless the user has rights to every single column. Starting in version 24.10, you can also grant rights across tables that share a name prefix. On the agent side, OpenHands runs tasks in a workspace and proposes actions. You can set the agent to pause before it runs shell commands or database scripts. A human reviewer then checks the planned step and approves or denies it.
What native roles solve and what gaps remain
Native database roles and column grants do a great job of limiting static reach. They make sure the agent account only touches the tables and columns you pick. Quotas and settings profiles also help keep resource use in check during long runs. Local agent prompts give a developer a chance to look at a command first.
Still, static database roles only decide who logs in and which objects they can touch. They cannot pause a single risky query in flight for a team lead to review. Once a role has write rights, every write query runs right away without a check. Also, local agent prompts only live inside the single developer session.
Approval Chains & Escalation + ClickHouse Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
They do not give security teams a central log of who approved a database change. Static grants also return raw values from any column the user is allowed to read. If an allowed column holds emails, phone numbers, card numbers, or national IDs, raw data comes back. Data masking is needed to rewrite matched fields in results before they reach the agent.
Why query-level review matters for autonomous agents
AI coding agents work fast and can chain many database calls together in seconds. When an agent hits an error, it often tries new queries to fix the problem. Without a review step on the query itself, a retry loop can alter live rows. Teams need a way to allow safe reads while holding writes for human sign-off.
Splitting read actions from write actions keeps the agent useful without risking production tables. The agent can inspect schemas and read safe columns to write good code. When the agent needs to alter a table or delete rows, the request waits. A reviewer checks the exact SQL statement and approves it from their chat app.
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 I restrict an OpenHands agent to specific ClickHouse columns?
Yes, ClickHouse lets you grant read rights on specific columns in a table. If the agent tries to query other columns or run a full wildcard read, the query fails.
Why are static ClickHouse roles not enough for AI agents?
Static roles grant standing rights for the whole session and cannot pause single queries. If an agent has write rights, it can run destructive updates without waiting for human sign-off.
How does data masking help when an agent queries ClickHouse?
Column grants are all-or-nothing, so allowed columns return raw text by default. Data masking rewrites matched fields like emails or card numbers in results while keeping queries working.
Related guides
In this post