How to Configure OpenHands DynamoDB Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up an openhands dynamodb sandbox, run the agent inside an isolated container. Then attach a narrow cloud role that points only to test tables. Engineering teams often start by giving the coding agent a broad developer key. That shortcut makes early testing fast for the team. Still, a wide role lets an automated agent alter or delete wrong tables. Scoping the agent role and isolating the database prevents bad commands from breaking shared systems. How the native openhands dynamodb sandbo

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 dynamodb sandbox, run the agent inside an isolated container. Then attach a narrow cloud role that points only to test tables. Engineering teams often start by giving the coding agent a broad developer key. That shortcut makes early testing fast for the team. Still, a wide role lets an automated agent alter or delete wrong tables. Scoping the agent role and isolating the database prevents bad commands from breaking shared systems.

How the native openhands dynamodb sandbox setup works

OpenHands runs tasks inside a local container workspace to keep host files safe. When the agent writes or tests database code, it needs a place to run requests. Teams usually pick one of two paths for a DynamoDB sandbox. The first path runs a local database emulator inside a companion container. Both containers share a private virtual network on the host machine. The agent sends table requests to the local emulator endpoint using dummy keys. No traffic leaves the machine, and cloud bills stay at zero.

The second path uses an isolated cloud account or a set of test tables. In this model, engineers create a dedicated cloud role just for the agent. The policy on that role grants read and write permissions only to specific table names. Teams then pass temporary session credentials into the agent workspace at startup. The cloud provider checks the role permissions on every table call. If the agent tries to touch a production table, the cloud API blocks the call.

Where native permissions fall short during agent runs

Native cloud roles and local containers solve the basic network isolation problem. They decide which service identity can log in and which table resources it can reach. That boundary is a strong first step for any team running autonomous coding tools. Yet native roles only check permissions at the resource and action level. Once a role grants read or write permissions on a table, every matching command goes through.

This gap matters when a sandbox holds realistic test data or shared staging records. A broad read permission lets the agent scan whole tables during a debugging loop. If those records contain real emails, phone numbers, or card numbers, that data enters the prompt context. Likewise, a table write role allows bulk deletes or schema edits inside the staging space. Native setup logs also scatter across container output and cloud audit trails. Teams cannot easily pause a single risky delete call for human review before it runs.

DynamoDB Fine-Grained Access + AI Sandbox Environments: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Best practices for safer agent database testing

Start by separating local logic tests from shared staging tests. Use a local DynamoDB container whenever the agent only needs to verify code syntax. Seed that local instance with fake records so no real user data is present. Keep the container network closed to outside traffic during the run.

When the agent must use a cloud sandbox, keep permissions tight. Limit the cloud role to item-level actions rather than table deletion or billing actions. Set short lifetimes on all session tokens passed into the agent container. Rotate test data often and scrub sensitive fields like national IDs before loading staging tables. Finally, monitor every command the agent sends so you can spot bad loops early.

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 use a local emulator or a cloud table for an OpenHands sandbox?

Use a local emulator for fast unit tests and basic code checks. Use a separate cloud account when testing cloud roles or multi-service workflows.

How do I stop the agent from deleting shared sandbox tables?

Remove table deletion actions from the cloud role attached to the agent workspace. Grant permissions only for item reads and writes on specific test tables.

What is the safest way to pass cloud keys to the agent container?

Never bake static long-lived keys into container images or code files. Pass short-lived session tokens at runtime and expire them right after the task ends.

The query runs. The emails stay hidden.