How to Configure Goose CockroachDB Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a goose cockroachdb sandbox by linking the AI agent to an isolated test database. You give the agent a restricted database user role and a dedicated schema for testing. Many engineering teams start by handing the agent a default root user key to move fast. Broad database roles let an autonomous agent drop tables or read sensitive test data by mistake. How a goose cockroachdb sandbox works in practice Goose acts as a local AI developer agent that runs shell tools and database querie

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 a goose cockroachdb sandbox by linking the AI agent to an isolated test database. You give the agent a restricted database user role and a dedicated schema for testing. Many engineering teams start by handing the agent a default root user key to move fast. Broad database roles let an autonomous agent drop tables or read sensitive test data by mistake.

How a goose cockroachdb sandbox works in practice

Goose acts as a local AI developer agent that runs shell tools and database queries. CockroachDB provides distributed SQL storage that mimics production rules inside a safe test cluster. To link them, an engineer creates a dedicated SQL user inside the test cluster. The engineer then assigns table read and write rights to that specific database user.

Next, the engineer stores the database login string inside the local workspace of the agent. When you ask the agent to build a feature, it reads the schema first. The agent then writes SQL statements and runs them against the test cluster to check results. If a query fails, the agent reads the error log and tries a new query.

This loop repeats until the agent finishes the task or hits a permission wall. The database cluster checks the assigned role at the start of each session. If the role allows schema changes, the agent can create or alter tables on its own.

What native roles solve and where gaps remain

Native database roles do a good job of separating test schemas from live production tables. You can block the agent from touching other databases on the same test cluster. You can also limit the user role to read-only queries when the agent only needs data.

Still, static database roles only check who logs in at the start of a session. They do not inspect what individual SQL statements do while the agent runs its loop. Once a role grants write rights, the agent can delete every row in that table by default. Static roles also cannot tell if a test table holds real emails or card numbers.

AI Sandbox Environments + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Teams often copy production data into a test cluster to debug hard bugs. When the agent queries those tables, raw emails and phone numbers enter the model context. Data masking that rewrites matched fields in results helps prevent raw data exposure during testing. Also, local agent credentials sit on developer laptops where scripts or prompts might read them.

Why query-level controls matter for AI agents

Human developers usually write one query at a time and check the output before continuing. An AI agent can fire dozens of SQL statements in a few seconds without pausing. If the agent misreads a schema, it might run a destructive update across thousands of rows.

Relying only on wide database grants leaves the test cluster open to sudden breakage. When a shared test database breaks, every developer on the team loses time fixing the state. Teams need a way to pause risky commands and require a human check before execution. Checking every command in flight keeps the test cluster stable while the agent works.

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 I give my AI agent admin rights in a test database?

No, admin rights let the agent drop schemas or change cluster settings by mistake. Always create a narrow database user role that only touches the tables needed for the task.

How do I handle realistic test data when an AI agent queries the sandbox?

Avoid putting raw user records into a shared test cluster whenever possible. If realistic data is present, use field masking that rewrites emails, phone numbers, and card numbers in query results.

Why do static database passwords cause issues for local AI agents?

Local agents read workspace files and run shell tools on the developer machine. A static password stored in plain text can leak into agent logs or model prompts during debugging.

The query runs. The emails stay hidden.