How to Configure OpenHands Oracle Sandbox
You set up an openhands oracle sandbox by pairing an isolated agent container with a restricted Oracle database role. This setup lets AI coding agents test schema changes without touching your live data. Many teams start by giving the agent a broad admin role to save time. That choice puts test data at risk when an agent runs a bad query. A safe setup needs strict role limits and clear network rules from day one. How the openhands oracle sandbox architecture works OpenHands runs AI agents ins
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 an openhands oracle sandbox by pairing an isolated agent container with a restricted Oracle database role. This setup lets AI coding agents test schema changes without touching your live data. Many teams start by giving the agent a broad admin role to save time. That choice puts test data at risk when an agent runs a bad query. A safe setup needs strict role limits and clear network rules from day one.
How the openhands oracle sandbox architecture works
OpenHands runs AI agents inside local or cloud containers to write code and run commands. When the agent needs to test database logic, it starts a session with an Oracle sandbox instance. You build this workflow by installing the Oracle client libraries inside the agent container image. Next, you create a dedicated Oracle user role with narrow permissions for the agent.
This database role should only read and write inside one test schema. You then pass the database host address and login details into the container workspace. The agent reads these values to log in its session and run SQL scripts. During a task, the agent writes app code, executes queries, and checks the output. If a query fails, the agent reads the error message and fixes its own SQL script.
What native database roles solve and what they miss
Native Oracle roles and container limits solve the basic problem of who can log in. They stop the agent from dropping system tables or reading schemas owned by other teams. Network rules also keep the container from talking to live production hosts. These controls form a strong first boundary for any automated coding tool.
Still, static database roles only check permissions when the session starts or targets an object. They do not inspect what individual SQL statements or shell commands do in flight. An agent with write permissions in a test schema can still wipe all test rows by mistake. Also, test databases often hold copies of real customer emails, phone numbers, or card numbers. Native roles return those raw fields to the agent session, which then sends them to external language models.
AI Sandbox Environments + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Best practices for safe agent database testing
Start by stripping all admin rights from the Oracle role used by the agent. Grant only select, insert, and update permissions on the specific tables needed for the task. Never allow the agent role to alter user permissions or read system views. Reset the test schema before each run so old agent tests do not break new ones.
You also need a way to watch commands and mask sensitive fields in flight. Data masking rewrites matched fields like emails and card numbers in query results. This step keeps sensitive values out of agent logs and model prompts. Pairing strict Oracle roles with runtime command checks gives your team a safe test loop.
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
Why does an AI coding agent need a dedicated database sandbox?
AI agents learn by running code, checking errors, and trying new commands on their own. A dedicated sandbox lets the agent run tests without breaking shared staging or live databases.
What Oracle permissions should we grant to the OpenHands agent?
Create a custom Oracle role that only allows basic read and write actions on one test schema. Do not grant table drop rights, user admin roles, or system view permissions.
How do we keep sensitive test data out of agent prompts?
Use synthetic test rows whenever possible so real user data stays out of the sandbox. When testing requires real shapes, use dynamic data masking to rewrite phone numbers and emails in results.
Related guides
In this post