How to Configure OpenHands Bigquery Sandbox
To set up an openhands bigquery sandbox, link an isolated agent container to a test cloud project. You assign a service account role so the agent can run test queries. Many engineering teams start by mounting local cloud keys into the agent runtime. They often reuse a broad developer role to get the agent working fast. When permissions are too wide, the AI agent can drop tables or read sensitive rows. One bad prompt can wipe out test datasets or expose private customer records. How the native
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.
To set up an openhands bigquery sandbox, link an isolated agent container to a test cloud project. You assign a service account role so the agent can run test queries. Many engineering teams start by mounting local cloud keys into the agent runtime. They often reuse a broad developer role to get the agent working fast. When permissions are too wide, the AI agent can drop tables or read sensitive rows. One bad prompt can wipe out test datasets or expose private customer records.
How the native openhands bigquery sandbox works
OpenHands runs AI coding agents inside local containers or isolated cloud runtime pods. The agent writes scripts, runs shell commands, and calls external APIs to finish tasks. Google Cloud offers a BigQuery sandbox and dedicated test projects for safe query testing. These cloud spaces let teams test SQL logic without touching production data tables.
To link the two systems, an engineer creates a cloud service account first. Next, the engineer grants that account permissions to run jobs and read datasets. The team then passes those account credentials into the OpenHands container runtime. Inside the container, the agent uses standard cloud client libraries to send SQL queries. The cloud platform checks the service account role when the agent logs in. Once the check passes, the agent can query any table allowed by that role.
What native roles solve and what they miss
Native cloud roles do a good job of controlling initial project sign-in. They stop the AI agent from touching projects outside its assigned test space. You can also restrict the account to read-only permissions at the dataset level. This setup keeps production warehouses safe from accidental writes during basic code tests.
Still, static cloud roles only check who logs in at the start. They do not inspect what individual SQL statements or commands do in flight. If the agent needs write roles to build test tables, it can also delete tables. Static keys sitting inside the agent container are also easy for prompts to leak. The agent can read the key file and print it into task logs. Native roles also cannot mask sensitive fields like emails or phone numbers in query results. If test tables hold real customer card numbers, the agent pulls them into context. Those raw values then get sent out to external model providers during the task.
BigQuery IAM + AI Sandbox Environments: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Best practices for safer agent query testing
Teams should never give an AI agent a human engineer's personal cloud credentials. Always create a dedicated service account just for the agent test runtime. Scope that role down to a single test dataset rather than the whole project. Remove all table drop permissions unless the current task requires schema destruction.
You should also scrub sensitive customer data before loading it into test tables. Replace real emails, phone numbers, and national IDs with fake test strings first. If you must query real data, use dynamic masking to rewrite matched fields in results. Finally, rotate or revoke the agent credentials as soon as the coding task ends. This step stops old keys from lingering on developer laptops or build servers.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
How do I let OpenHands run BigQuery queries without sharing my personal login?
Create a dedicated cloud service account with permissions limited to your test dataset. Pass only that specific account role to the agent runtime instead of user credentials.
Can an AI agent accidentally delete data inside a BigQuery test project?
Yes, if the assigned cloud role includes data editor or admin permissions. The agent can run drop table statements unless you block destructive commands in flight.
How do I keep private data out of AI model prompts during query tests?
Use synthetic data in your sandbox tables whenever you test new agent workflows. You can also apply data masking rules that rewrite emails and card numbers in results.
Related guides
In this post