How to Configure AutoGen ClickHouse Audit Log
You set up an autogen clickhouse audit log by giving agents dedicated database users. You then track their queries through internal system tables and role rules. Many teams start by sharing one broad admin key across all agents. This shortcut makes it impossible to see which agent ran a bad query. Overly broad roles also let autonomous agents read private columns or drop tables. How to set up an autogen clickhouse audit log ClickHouse manages users, roles, row policies, settings profiles, and
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 audit log by giving agents dedicated database users. You then track their queries through internal system tables and role rules. Many teams start by sharing one broad admin key across all agents. This shortcut makes it impossible to see which agent ran a bad query. Overly broad roles also let autonomous agents read private columns or drop tables.
How to set up an autogen clickhouse audit log
ClickHouse manages users, roles, row policies, settings profiles, and quotas as access items. You can create and manage all of these items with SQL statements. Turning on SQL-driven access control requires a set storage folder on the server. It also needs at least one user with access management turned on. That user also needs named collection control set to one.
With this setup active, an admin can create a unique user for each agent. Creating a user requires the create user privilege on the database server. A user can only grant the privileges that they hold themselves. When you create the agent user, you set its login method and allowed hosts. You can also assign default roles and specific settings for that single user.
Next, you restrict what each AutoGen agent can read during a task. You can grant select rights on specific columns in a table. The agent can then run queries that use only those allowed columns. If the agent queries an unapproved column, the database blocks the query. A wildcard select query is also refused and returns no data at all. It only works if the table holds just the granted columns. You can also use a trailing asterisk to grant rights by table name prefix.
What native database roles solve and what they miss
Native SQL access rules do a great job of locking down static tables. When each AutoGen worker has its own user, the system log shows its name. You can check the database logs later to see which user ran a query. Quotas and settings profiles also stop an agent from using too much memory.
Still, native database setup only decides who can log in to the server. It does not inspect what individual statements do while they run in flight. If an agent has select rights on a column with emails, it reads them. Those raw emails, phone numbers, or card numbers then flow into the agent prompt. They also end up in external model provider logs.
Audit Log Integrity + 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 for the agent user. If an AutoGen agent runs a wildcard query for schema discovery, the query fails. Teams often grant full table rights just to stop these agent crashes. Once you grant full table rights, sensitive national IDs sit open to every prompt. Native logs only record the damage after the query finishes.
Why agent workflows need statement-level controls
Multi-agent frameworks generate SQL dynamically based on user chat input. Because prompts change every run, you cannot predict every query in advance. Static roles cannot tell a safe lookup from a broad data dump. You also cannot require a human to approve a risky query inside the database.
Teams need a way to link the human user to the agent database query. They also need data masking that rewrites matched fields in results before prompts read them. This keeps phone numbers and card numbers out of model memory while queries still work.
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
Why do wildcard queries fail for restricted AutoGen agents?
When you grant select on specific columns, ClickHouse blocks wildcard select queries by default. The query returns no data unless the table contains only the granted columns.
How do you turn on SQL-driven access rules in ClickHouse?
You must set a storage directory path on the server for access items. You also need at least one user with access management and named collection control enabled.
Can an AutoGen admin agent grant permissions to other agents?
An agent can only grant privileges if it holds the create user privilege. Even then, a user can only grant the exact privileges that they hold themselves.
Related guides
In this post