How to Configure OpenHands Redis Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an openhands redis sandbox by running an isolated container with scoped roles. You then pass those role credentials into your agent workspace settings. Teams often start by giving the agent a default admin user for speed. That broad role lets the agent flush keys or read private cache data. How the openhands redis sandbox architecture works OpenHands runs tasks inside a dedicated container to keep host machines safe. When the agent needs to test cache logic, it needs a data store.

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 redis sandbox by running an isolated container with scoped roles. You then pass those role credentials into your agent workspace settings. Teams often start by giving the agent a default admin user for speed. That broad role lets the agent flush keys or read private cache data.

How the openhands redis sandbox architecture works

OpenHands runs tasks inside a dedicated container to keep host machines safe. When the agent needs to test cache logic, it needs a data store. You can run a separate Redis instance inside that same isolated network. The agent reads and writes keys during its coding session.

To keep this setup safe, admins define strict permission rules inside Redis. You create a dedicated user role just for the coding agent. That role restricts which command groups and key prefixes the agent can use. You disable dangerous server management commands so the agent cannot wipe the store.

Next, you place the user credentials into the workspace secret store. The agent container reads these secrets as local variables when it boots up. The agent then uses those credentials to log in its session and run tests. Each task gets a clean state without touching shared staging systems.

Network isolation for agent containers

Good role permissions must pair with strict network rules on the host. The agent container should only talk to its assigned Redis instance. You can place both containers on a private virtual network bridge. This stops the agent from reaching other internal databases on your network.

Teams also set hard memory limits on the Redis container itself. An AI agent might write a bad loop that floods the cache. A memory cap stops one runaway task from crashing the whole host machine. You can also set an eviction rule to drop old test keys.

When the coding session ends, the platform should destroy both containers right away. Tearing down the instance wipes all temporary test data and session state. The next agent run starts with a fresh container and empty cache. This stops state leaks between different tasks and keeps test runs clean.

Redis Access Control Lists + AI Sandbox Environments: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native sandbox setups solve and what they leave open

Native roles and private networks solve the basic isolation problem well. They ensure that an agent only logs in with an approved user role. They also stop a test loop from taking down shared company systems. For simple local code tests, this native setup works fine.

Still, static roles leave a big operational gap during live debugging sessions. Native rules only decide who can log in and which command categories work. They do not inspect what individual commands or payloads do in flight. Also, storing plain credentials inside container variables exposes those secrets to the agent.

If a prompt goes wrong, the agent can print its own secret variables. Also, teams often clone staging data into the sandbox to debug real bugs. That cloned cache might hold emails, phone numbers, card numbers, or national IDs. Native Redis rules do not rewrite matched fields in results before the agent reads them.

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

How do I stop the agent from running flush commands?

You can edit the Redis user rule to block the dangerous command group. Remove flush and server admin commands from the role before the session starts.

Where should I store the sandbox credentials for OpenHands?

Store the user name and password inside the workspace secret manager. Do not hardcode credentials inside your code repo or agent prompt instructions.

What happens if the sandbox cache has real user data?

Standard Redis roles return the full value of any allowed key. To protect emails or card numbers, you must mask matched fields in results.

The query runs. The emails stay hidden.