How to Configure Codex Neon Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a codex neon sandbox by giving the AI agent a scoped database role. Then you point the agent to an isolated database branch for testing. Teams often start by handing the agent a standard admin key to move fast. When permissions are too broad, a bad prompt or coding mistake can wipe out test data. It can also expose customer records stored inside that database branch. How a codex neon sandbox works in practice An AI coding agent writes SQL queries and runs migration scripts to test

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 codex neon sandbox by giving the AI agent a scoped database role. Then you point the agent to an isolated database branch for testing. Teams often start by handing the agent a standard admin key to move fast. When permissions are too broad, a bad prompt or coding mistake can wipe out test data. It can also expose customer records stored inside that database branch.

How a codex neon sandbox works in practice

An AI coding agent writes SQL queries and runs migration scripts to test new features. A serverless Postgres branch acts as a disposable copy of your main database schema. To link them, engineers create a database role with restricted read or write permissions. They store the database login string in the local workspace where the agent runs. When the agent needs to check a schema, it reads that login string. It opens a standard Postgres session and sends SQL commands to the branch. The database checks the role permissions when the session starts. If the role allows table reads, the database returns the matching rows to the agent. If the role allows schema changes, the agent can create or drop tables in that branch. Once the task finishes, the team can reset or delete the branch.

What native database roles solve and what they miss

Native database roles and isolated branches solve the first layer of risk. A branch keeps schema tests away from your main production database tables. A read-only or table-scoped role stops the agent from changing tables outside its scope. This setup decides which user account can log in to the database. It also controls which tables that user account can read or change. Still, native roles do not inspect individual SQL statements while they run in flight. Many teams copy real data into test branches to debug hard app bugs. If a table holds customer emails, phone numbers, or card numbers, a read role returns them. The agent receives those raw values in its context window and sends them to the model. Also, a shared database role does not show which developer ran the agent. Database logs only show the shared role name, not the human behind the session.

Why branch data still needs statement-level checks

Even in a test branch, an AI agent can run slow or dangerous queries. A broad select query can pull thousands of rows containing national IDs or card numbers. If the agent has write rights in the branch, one bad command can drop needed test tables. Then other developers sharing that test branch lose their work right away. Teams need a way to check every single command before the database runs it. They also need data masking that rewrites matched fields like emails in query results. Tying each agent query to an individual user identity fixes the audit log gap. This gives engineering teams clear records of every SQL query the coding agent runs.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Check every Postgres query on the wire

Database roles and network rules decide who can open a session. They do not read what each SQL statement does after login. With hoop.dev, you run an open-source proxy, a sidecar for your Postgres, inline in the Postgres wire protocol. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review. Your apps and agents keep their login details and change only the host and port in the connection string their tool uses.

Before a query runs, hoop.dev guardrails refuse bad deletes or drops with a real Postgres error, or hold risky queries for approval. On the way back, hoop.dev data masking rewrites sensitive values in returned rows in memory, and every verdict goes to the audit trail. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for HIPAA, GDPR, and PCI DSS. See the code on GitHub.

Frequently asked questions

Why should an AI agent use a separate database role in a sandbox?

A separate role limits which tables and schemas the coding agent can read or change. This stops the agent from altering system settings or reading restricted tables during a test.

What happens if a test branch contains real customer data?

A standard database role returns all rows and columns that the user account can read by default. Without field masking, queries will return raw emails, phone numbers, and card numbers to the agent.

Can native database roles pause a single risky SQL command for human approval?

No, native database roles only grant or deny table permissions when the query runs. They cannot pause a specific drop or delete statement to ask a human for approval first.

The query runs. The emails stay hidden.