How to Configure OpenHands Snowflake Sandbox
You set up an openhands snowflake sandbox by running the agent in an isolated container. Then you give that container a scoped database role with narrow permissions. Engineering teams often start by handing the agent a broad developer role to move fast. When permissions are too wide, an automated coding agent can drop tables or read private customer records. How the native openhands snowflake sandbox workflow operates OpenHands runs tasks inside a local or cloud container to keep code executi
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 openhands snowflake sandbox by running the agent in an isolated container. Then you give that container a scoped database role with narrow permissions. Engineering teams often start by handing the agent a broad developer role to move fast. When permissions are too wide, an automated coding agent can drop tables or read private customer records.
How the native openhands snowflake sandbox workflow operates
OpenHands runs tasks inside a local or cloud container to keep code execution isolated. When the agent needs warehouse data, it reads credentials stored inside that container space. You set up a dedicated user and role inside your Snowflake account for the agent. That role holds specific permissions on a test database, a test schema, and a small warehouse.
The agent writes scripts or queries based on the prompt from the user. It then authenticates to the Snowflake session using a password or a key pair. The cloud warehouse checks the role permissions before it runs any query from the agent. If the role allows table reads, the warehouse runs the query and returns the rows.
Teams also set resource limits on the warehouse used by the sandbox role. This step stops a bad loop in the agent from burning through compute credits. You can clone production tables into the sandbox schema so the agent tests against real structures. Still, cloning real rows brings sensitive data straight into the agent container.
What native role permissions solve and what they leave open
Native warehouse roles do a good job of blocking whole schemas and databases. They decide which user can log in and which tables that role can touch. Warehouse resource monitors also cap how much compute time a specific role can spend.
Still, a static role cannot check what an individual SQL statement does in flight. Once the agent authenticates to the Snowflake session, it can run any query the role allows. If the sandbox role has write permissions, the agent might delete test rows by mistake. A shared sandbox breaks down fast when an agent drops a table other developers need.
Snowflake Access Control + AI Sandbox Environments: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Static permissions also struggle with sensitive columns inside shared test tables. If a table holds emails, phone numbers, or card numbers, a basic role returns them all. You have to build and maintain masking rules inside the warehouse for every sensitive column. Without dynamic masking that rewrites matched fields in results, raw data enters the agent prompt history.
Best practices for safer agent database sessions
Start by giving the agent a read-only role on a separate sandbox schema. Never pass admin credentials or broad developer keys into the container runtime. Keep the container secrets out of the files that the agent can read directly.
Next, strip or mask emails, phone numbers, and national IDs before loading sandbox tables. Make sure every query from the agent ties back to the human who started the task. Clear logs help your team see which prompt caused a slow or broken query. Finally, review the queries the agent runs before you let it touch staging schemas.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
How should an OpenHands agent authenticate to a Snowflake session?
Create a dedicated service user with a scoped role for the agent container. Use key pair login instead of a static password, and limit the role to sandbox schemas.
Can an OpenHands agent view sensitive data in a sandbox?
Yes, if the sandbox tables hold real data, the agent reads whatever the role permits. Use data masking to rewrite emails, phone numbers, and card numbers in query results.
How do we stop an agent from running destructive SQL queries?
Grant read-only permissions on the sandbox schema whenever the task only needs data checks. If the agent must write data, require human approval before running drop or delete statements.
Related guides
In this post