How to Configure OpenHands Bigquery Connect

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up openhands bigquery connect, you give the coding agent a cloud service account. The agent uses those cloud credentials to run queries against your warehouse datasets. Most engineering teams start by placing a static key file inside the agent runtime container. That quick setup works for testing, but broad cloud roles create big risks in production. An autonomous agent with wide warehouse permissions can read sensitive tables or run expensive scans. How openhands bigquery connect works

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 openhands bigquery connect, you give the coding agent a cloud service account. The agent uses those cloud credentials to run queries against your warehouse datasets. Most engineering teams start by placing a static key file inside the agent runtime container. That quick setup works for testing, but broad cloud roles create big risks in production. An autonomous agent with wide warehouse permissions can read sensitive tables or run expensive scans.

How openhands bigquery connect works in practice

OpenHands runs as an autonomous software agent inside an isolated sandbox container. When you ask the agent to analyze data, it writes scripts or runs command tools. Those tools need a valid identity to talk to Google Cloud APIs. Teams usually create a dedicated cloud service account or attach a workload identity to the sandbox. Next, an admin grants that identity specific warehouse roles for job execution and data reading.

Once the credentials are in place, the agent can list tables and inspect schemas. It writes analytical queries based on the task prompt and sends them to the warehouse. The cloud platform checks the service account role and runs the query job. Results return straight into the agent workspace so the model can read the output. The agent then uses those rows to write code, build charts, or fix bugs.

Why static cloud roles leave a security gap

Native cloud roles do a good job of controlling which datasets an identity can touch. You can lock a service account down to a single project or dataset with ease. Still, cloud roles only check who logs in and which table they target. They do not inspect what individual statements or commands do in flight.

Once a table is readable, the agent can pull every column and row inside it. If a table holds customer emails, phone numbers, or card numbers, the model receives them. Those raw values enter the agent context window and get sent to external model providers. A confused agent might also run an unindexed full table scan that spikes your cloud bill. Even worse, if the role allows writes, one bad script can drop or alter tables.

BigQuery IAM + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What to check before giving agents warehouse access

Start by separating agent identities from human engineer accounts and production app roles. Never reuse an existing backend service account for an autonomous coding sandbox. Grant read-only roles on specific datasets rather than project-wide viewer or editor permissions. Set strict byte billing limits on the cloud project to stop runaway query costs.

You should also review how query results flow back into the agent runtime. If a dataset contains national IDs or card numbers, static roles will not hide them. Teams need a way to rewrite matched fields in results before the agent reads them. You also want statement-level approval rules for any query that changes schemas or deletes rows. Having a clear audit log link between the user prompt and the warehouse job helps reviews.

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

Can OpenHands query BigQuery without storing a JSON key file?

Yes, you can run the agent on cloud compute that supports workload identity federation. This lets the sandbox container request short-lived tokens from the cloud metadata server at runtime. Removing static key files from disk stops the agent from leaking secrets in code commits.

How do we stop an agent from running expensive warehouse scans?

You can set maximum bytes billed limits at the project or user level in your cloud console. If the agent writes a query that exceeds your cap, the warehouse fails the job right away. Pairing cost caps with read-only roles keeps both your budget and your data safe.

How do we protect sensitive columns when agents read production tables?

Native warehouse roles apply to whole tables or views unless you manage complex column tags. A simpler path is using dynamic data masking that rewrites matched fields in results in flight. This replaces emails, phone numbers, or card numbers with masked strings before the agent sees the output.

The query runs. The emails stay hidden.