How to Configure Semantic Kernel ClickHouse Sandbox
You set up a semantic kernel clickhouse sandbox by creating a limited database user for your AI agent. You then assign read-only roles, column grants, and resource quotas to that account. Many teams start by giving their agent a broad admin key during early tests. That wide permission lets a bad prompt read private data or run heavy queries. How a semantic kernel clickhouse sandbox works Semantic Kernel uses plugins to let language models run tasks and fetch outside data. When the model needs
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 a semantic kernel clickhouse sandbox by creating a limited database user for your AI agent. You then assign read-only roles, column grants, and resource quotas to that account. Many teams start by giving their agent a broad admin key during early tests. That wide permission lets a bad prompt read private data or run heavy queries.
How a semantic kernel clickhouse sandbox works
Semantic Kernel uses plugins to let language models run tasks and fetch outside data. When the model needs facts, the plugin sends a SQL query to your database. The database checks the user account tied to that plugin session before running anything.
ClickHouse manages users, roles, row policies, settings profiles, and quotas as access items through SQL. To turn on SQL access control, you set a storage directory on the server. You also need at least one admin user with access management rights turned on. That admin can then create a dedicated user account just for your AI plugin. A user can only grant the privileges that they hold themselves.
When you create the sandbox user, you set its login method and allowed hosts. You also attach default roles and user settings to lock down the account. For a safe sandbox, you grant read rights only on specific tables and columns. When you grant select rights on just two columns, the agent can read only those. If the agent tries to select all columns with a star, the query fails. It returns no data at all unless the table holds only those granted columns. You can also grant select rights across tables that share a name prefix.
What native database roles solve and what they miss
Native ClickHouse access controls do a great job of limiting who can log in. They also limit which tables and columns a specific user account can read. Quotas and settings profiles help stop a single user from taking all server memory. Row policies filter out rows that a specific role should not read at all.
Still, static database roles leave an operational gap when AI agents run live queries. Once the plugin logs in, the database trusts every valid query from that user. A granted column might still hold emails, phone numbers, card numbers, or national IDs. If the agent queries that column, the database sends all those raw values back. Static grants cannot rewrite matched fields in results on the fly during a query. They also cannot pause a risky query to ask a human for quick approval. Finally, database logs show the shared plugin user instead of the end user's identity.
ClickHouse Access Management + AI Sandbox Environments: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Steps to harden your agent query workflow
Start by creating a dedicated role for your Semantic Kernel plugin in your database. Grant select rights only on the exact columns the agent needs for its task. Avoid granting select rights on full tables when a few columns will do. Next, restrict the hosts that the agent user account can log in from. Attach a quota and a settings profile so bad queries cannot slow the server.
Test your agent with prompts that try to read blocked columns or run star queries. Confirm that the database refuses those queries and returns no data to the plugin. Review your query logs often to see what SQL the language model writes. When columns hold sensitive strings like emails or card numbers, add runtime data masking.
Check ClickHouse queries and results before execution
Access control in ClickHouse is essential setup. Setup alone does not check single queries for risk or rewrite sensitive strings in returned rows. By design, hoop.dev sits beside the server as a sidecar for your ClickHouse and parses every statement before execution.
First, hoop.dev guardrails block disallowed deletes, drops, and alter mutations. Then hoop.dev data masking rewrites sensitive string columns in responses and logs each decision per resource. Read the docs and source on GitHub.
Frequently asked questions
Why do star queries fail in a column-limited ClickHouse sandbox?
When you grant select rights on specific columns, ClickHouse blocks queries on other columns. A select-star query fails unless the table contains only the columns you granted.
How do you turn on SQL-driven access control in ClickHouse?
You configure the access control storage directory on the server first. Then you enable access management and named collection control for at least one user.
Can a ClickHouse sandbox user grant its own permissions to another agent?
No, a user can only grant privileges that they already hold themselves. Creating new users also requires the dedicated create user privilege on that account.
Related guides
In this post