How to Configure OpenHands Redshift Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up an openhands redshift sandbox, pair an isolated agent container with a scoped database role. Give the agent read-only schema grants and strict query timeouts before it runs any task. Many teams start by giving the coding agent a shared admin login to speed up testing. That broad login lets the agent drop tables, lock production rows, or read sensitive customer data. A safe setup separates the container workspace from the data warehouse and limits every database role. How an openhands

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 redshift sandbox, pair an isolated agent container with a scoped database role. Give the agent read-only schema grants and strict query timeouts before it runs any task. Many teams start by giving the coding agent a shared admin login to speed up testing. That broad login lets the agent drop tables, lock production rows, or read sensitive customer data. A safe setup separates the container workspace from the data warehouse and limits every database role.

How an openhands redshift sandbox works

OpenHands runs tasks inside an isolated container where the AI agent writes code and runs commands. When the agent needs data, it opens a network session to your Amazon Redshift cluster. You set up a dedicated sandbox schema or a separate test cluster for the agent. Then you create a specific database user and role just for those automated tasks. This role gets permission to read sample tables and write only to a scratch schema.

Next, you pass the host details and login keys into the agent runtime workspace. The agent uses standard database drivers inside its container to send SQL queries to the cluster. Redshift checks the user role upon login and enforces table and schema grants. You also set workload rules on the cluster to stop long queries from draining compute resources. This basic architecture keeps agent experiments away from your core business tables.

Why native database roles fall short for AI agents

Native cluster roles and container limits solve the basic problem of who can log in. They stop an agent from touching schemas outside its assigned sandbox group. They also cap how much memory or CPU a single query can burn on the cluster. For static scripts with predictable queries, these native database controls work well enough.

Still, AI coding agents write new SQL statements on the fly during each task. Once logged in, the role cannot inspect what individual statements do in flight. An agent with scratch write permissions can still run a bad join or pull huge tables. If the sandbox holds real customer rows, query results can expose emails, phone numbers, or card numbers. Also, cluster logs only show the shared agent user, not the prompt or user behind the task.

Redshift Security + AI Sandbox Environments: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Scoping data and queries in the sandbox

To make the sandbox safe, teams must control both the data and the query flow. Start by loading synthetic data or scrubbed rows into the test tables whenever possible. When agents need realistic schemas, strip out national IDs and payment details before loading the sandbox. If sensitive columns must stay in the table, masking rules should rewrite matched fields in results.

You also need a way to check every SQL command before the database runs it. Blocking destructive commands at the statement level stops accidental table drops inside the shared scratch space. Tying each query back to the specific engineer who started the agent fixes the audit trail. This gives security teams clear logs without forcing engineers to build new database roles every day.

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

Should the AI agent use a separate Redshift cluster or a schema?

A separate test cluster gives the strongest isolation for compute and storage. If cost is a concern, a dedicated scratch schema with strict workload limits also works well.

How do we stop an OpenHands agent from running runaway queries?

Set query timeout rules and row limits on the database workload queue assigned to the agent. This forces the cluster to cancel any query that runs too long or scans too much data.

What happens if the sandbox contains real customer data?

The agent will pull those raw values into its container workspace and model context window. Use dynamic data masking to rewrite emails, phone numbers, and card numbers in query results before they return.

The query runs. The emails stay hidden.