

Sarthak Varshney is a Docker Captain, 5x C# Corner MVP, and 2x Alibaba Cloud MVP, with over six years of hands-on experience in the IT industry, specializing in cloud computing, DevOps, and modern application infrastructure. He is an Author and Associate Consultant, known for working extensively with cloud platforms and container-based technologies in real-world environments.
OpenHands is an open-source AI agent that can:
Docker Sandbox provides a secure, containerized environment to run OpenHands with automatic API key injection and network isolation.
Before you begin, ensure you have:
Docker Sandbox CLI (sbx) installed on your machine
An API key for your preferred LLM provider:
Node.js knowledge (basic) - The kit uses Node.js v22 internally
The Docker Sandbox securely stores your API key in the host's secret store—it never enters the sandbox directly.
sbx secret set-custom -g \
--host api.anthropic.com \
--env ANTHROPIC_API_KEY \
--placeholder "sk-ant-{rand}" \
--value "YOUR_ANTHROPIC_API_KEY_HERE"
sbx secret set-custom -g \
--host api.openai.com \
--env OPENAI_API_KEY \
--placeholder "sk-{rand}" \
--value "YOUR_OPENAI_API_KEY_HERE"
sbx secret set-custom -g \
--host generativelanguage.googleapis.com \
--env GOOGLE_API_KEY \
--placeholder "AIza{rand}" \
--value "YOUR_GOOGLE_API_KEY_HERE"
Verify your secrets were registered:
sbx secret list -g
There are two ways to run the OpenHands kit:
sbx run --kit "git+https://github.com/sarthakvarshney8081/sbx-kits-contrib.git#dir=openhands" openhands
First, clone the repository:
git clone https://github.com/sarthakvarshney8081/sbx-kits-contrib.git
cd sbx-kits-contrib
Then launch the kit:
sbx run --kit ./openhands openhands
The sandbox will now:
uv package managerThis typically takes 2–5 minutes on first run.
Once the sandbox is running and Agent Canvas is listening on port 8000, you need to expose that port to your host machine:
sbx ports openhands-sbx-kits-contrib --publish 8000:8000
Then open your browser and navigate to:
http://localhost:8000
You should see the OpenHands Agent Canvas UI. The sandbox proxy automatically injects your API credentials into outbound requests, so no further authentication is needed.
Inside the Agent Canvas, you can:
Example tasks:
If port 8000 is occupied on your host, map it to a different port:
sbx ports openhands-sbx-kits-contrib --publish 8080:8000
Then access the UI at:
http://localhost:8080
Verify your secrets are correctly registered:
sbx secret list -g
If needed, update a secret:
sbx secret set-custom -g \
--host api.anthropic.com \
--env ANTHROPIC_API_KEY \
--value "YOUR_NEW_KEY_HERE"
Check the sandbox logs:
sbx logs openhands-sbx-kits-contrib
Common issues:
npm install -g @openhands/agent-canvasThe kit automatically clears proxy environment variables to prevent Python httpx from crashing. If you still encounter proxy errors:
sbx exec openhands-sbx-kits-contrib \
printf 'HTTP_PROXY=\nHTTPS_PROXY=\nALL_PROXY=\n' >> /etc/environment
Then restart the sandbox.
The Docker Sandbox kit uses a proxy-based injection model for security:
Register secrets once with sbx secret set-custom
Network isolation — The sandbox declares which hosts it needs:
api.anthropic.com (Anthropic API)api.openai.com (OpenAI API)generativelanguage.googleapis.com (Google Gemini)Automatic injection — When OpenHands makes a request:
x-api-key: <your-key>Authorization: Bearer <your-key>Your API key never enters the sandbox directly — it's only injected into outgoing HTTP requests by the proxy.
sbx stop openhands-sbx-kits-contrib
sbx rm openhands-sbx-kits-contrib
If you want to remove your stored API keys:
sbx secret rm -g --host api.anthropic.com
sbx secret rm -g --host api.openai.com
sbx secret rm -g --host generativelanguage.googleapis.com
When the sandbox first starts, the kit automatically installs:
| Component | Version | Purpose |
|---|---|---|
| uv | Latest | Fast Python package manager |
| Node.js | v22 | Runtime for Agent Canvas |
| npm | Latest (with Node.js) | JavaScript package manager |
| @openhands/agent-canvas | Latest | The OpenHands web UI and agent |
All installations happen inside the sandbox and don't affect your host system.
The kit pre-configures several environment variables inside the sandbox:
WORKSPACE_DIR: /workspace # Working directory for agent tasks
PORT: 8000 # Web UI port
HTTP_PROXY: "" # Cleared to prevent httpx crashes
HTTPS_PROXY: ""
ALL_PROXY: ""
You can override these when launching the sandbox:
sbx run --kit ./openhands \
--env WORKSPACE_DIR=/custom-workspace \
--env PORT=9000 \
openhands
Questions or issues? Open an issue on the sbx-kits-contrib repository.