How to Configure OpenHands Bigquery Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up openhands bigquery approval, combine cloud IAM roles with agent action confirmation prompts. This setup stops the AI coding agent from running risky queries without a human check. Many teams start by giving the agent a broad service account key for data work. Broad permissions let an automated tool drop tables or scan massive datasets by mistake. A clear review step keeps your data warehouse safe and keeps cloud bills low. How openhands bigquery approval works in practice OpenHands

Approval Chains & Escalation + BigQuery IAM: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

To set up openhands bigquery approval, combine cloud IAM roles with agent action confirmation prompts. This setup stops the AI coding agent from running risky queries without a human check. Many teams start by giving the agent a broad service account key for data work. Broad permissions let an automated tool drop tables or scan massive datasets by mistake. A clear review step keeps your data warehouse safe and keeps cloud bills low.

How openhands bigquery approval works in practice

OpenHands runs as an autonomous agent that writes code and executes shell commands in containers. When the agent needs warehouse data, it uses standard client libraries or command line tools. You start by creating a dedicated cloud service account with narrow read or write roles. Next, you turn on confirmation mode inside the agent runtime settings for your workspace. In this mode, the agent pauses before it executes any shell action or script.

A human operator reads the proposed command and approves or rejects the action in chat. You can also use cloud policy tags to restrict which columns the service account reads. If the agent needs temporary access to restricted datasets, admins grant roles through cloud ticketing. This workflow links local agent confirmation steps with cloud role checks for every task.

Where native agent and cloud permissions fall short

Cloud IAM roles decide which service account logs in and which datasets it can touch. Those roles do not check the content of each SQL query while it runs. Once a service account has query rights, it can run expensive full table scans. Local agent confirmation prompts also have real limits for busy engineering teams. An agent often wraps SQL queries inside Python scripts or background shell tasks.

The human reviewer sees a script run command instead of the exact SQL statement. Reviewers get tired when they must check dozens of routine terminal steps every hour. Also, storing cloud keys inside agent containers creates a leak risk if a prompt fails. Teams need a way to inspect individual queries and mask sensitive fields like emails or phone numbers.

Approval Chains & Escalation + BigQuery IAM: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing query risk for automated coding agents

Safe agent data access requires separating identity management from individual query execution checks. Start by removing static service account keys from the agent workspace and container files. Give the agent read access only to small staging datasets during normal development tasks. When a task touches production tables, route the query through a review queue first.

Reviewers should see the exact SQL text and the target project before any execution. Data masking rules should also rewrite card numbers and national IDs in query results. This approach keeps sensitive values out of agent logs and model context windows. Clear audit logs then tie every query back to both the agent and reviewer.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Can OpenHands run BigQuery queries without human review?

Yes, if you give the agent valid credentials and turn off confirmation mode. Most teams keep human review on for production data to prevent costly query mistakes.

How do you limit BigQuery costs when an AI agent writes SQL?

You can set project byte limits and custom cost quotas in your cloud console. You should also review large scan queries before the agent runs them against production.

What is the safest way to handle sensitive columns during agent queries?

Use column level security rules and dynamic data masking for fields like emails and phone numbers. Masking rewrites matched fields in results so raw values do not enter model prompts.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.