DEV Community

Sandscale
Sandscale

Posted on Originally published at sandscale.dev

Running OpenHands' agent server on a hosted microVM and reaching it with sandscale workspace port-forward

Short answer: OpenHands' own install page warns that its agents can run shell commands and read or write files with your account's permissions, and that Agent Canvas, the client, does not isolate them. Its VM guide covers running the backend on another machine. A Sandscale workspace is a persistent Firecracker microVM with its own kernel and disk, so it fits that role: start the backend there, forward its port to your laptop with sandscale workspace port-forward, and add it in Canvas as a remote backend. There is a second, smaller pattern at the end for when you want OpenHands to stay on your machine and send only commands to a sandbox.

Sources, read in November 2026: OpenHands' Agent Canvas architecture, install, remote backend, VM / self-hosted and MCP settings pages; Sandscale's workspaces guide, CLI reference and the --help text of CLI 1.3.0.

What runs where in OpenHands

Per OpenHands' architecture page, Agent Canvas is a browser client and control center. It is not an agent runtime or a sandbox. Agent Server runs the conversations and tools, and the workspace it runs in defines which files, processes, credentials and networks the agent can reach.

The same page says what the boundary is for each setup. For a host process, Agent Server and its tools run directly on the backend host without container isolation, and if the backend is remote, that host is the execution boundary, not the browser's machine. With Docker or Kubernetes, the container or pod is. A remote backend uses the same Agent Server API as a local one.

Two consequences for this post. The backend can live somewhere other than your laptop, and where you put it decides what a bad agent run can reach. If it runs on a Sandscale workspace, that is the workspace's disk and the workspace's network access, not your home directory.

Pattern 1: the backend on a workspace

Create the workspace

sandscale login
sandscale workspace templates-list
sandscale workspace create --name openhands-box --template-id TEMPLATE_ID --yes
sandscale workspace ssh openhands-box
Enter fullscreen mode Exit fullscreen mode

TEMPLATE_ID comes from templates-list (these commands match the help text of CLI 1.3.0). Plan limits decide whether you can create a workspace; the workspaces guide has the details.

Install the backend

OpenHands' VM guide lists what Agent Canvas needs: Node.js 24 or later with npm, uv, git and curl. It suggests Ubuntu with 2 vCPU and 4 GB of RAM as enough for a single user. We have not checked what each Sandscale template ships with, so install whatever is missing from OpenHands' own instructions and confirm:

node --version
uv --version
agent-canvas --version
Enter fullscreen mode Exit fullscreen mode

The install step in that guide is npm install -g @openhands/agent-canvas. The workspace also needs outbound network access to install these and to reach your model provider; that follows your plan and your organization's policy.

Set the key and start it

OpenHands requires LOCAL_BACKEND_API_KEY in public mode, and its VM guide says remote and shared deployments should always run in public mode. Create the key file without printing the key (any other source of a high-entropy secret works as well as openssl):

printf 'export LOCAL_BACKEND_API_KEY="%s"\n' "$(openssl rand -hex 32)" > ~/.agent-canvas.env
chmod 600 ~/.agent-canvas.env
Enter fullscreen mode Exit fullscreen mode

Then start the backend only, in tmux as the guide does, so it outlives your SSH session (install tmux first if the template does not have it):

tmux new-session -d -s canvas
tmux send-keys -t canvas 'source ~/.agent-canvas.env && agent-canvas --backend-only --public' Enter
Enter fullscreen mode Exit fullscreen mode

The default port is 8000. Detach with Ctrl-b, then d, and reattach with tmux attach-session -t canvas.

One caveat from Sandscale's side: the workspaces docs say a workspace sleeps when nobody is using it, with an idle timeout. They do not say whether a background process or an open port-forward counts as use, so do not leave a long conversation running unattended without checking how your workspace behaves.

Reach it from your laptop

OpenHands' guide uses an SSH tunnel to 127.0.0.1:8000 as its personal-access option. sandscale workspace port-forward is the same idea through Sandscale: it listens on 127.0.0.1 on your computer and reaches the port on the workspace until you press Ctrl+C.

sandscale workspace port-forward openhands-box 8000:8000
Enter fullscreen mode Exit fullscreen mode

In another terminal on your laptop, start the client only:

agent-canvas --frontend-only
Enter fullscreen mode Exit fullscreen mode

In Canvas, open the backend switcher, choose Manage Backends and Add Backend, enter a name, http://localhost:8000 as the Host / Base URL, and the key from ~/.agent-canvas.env on the workspace. Save and select it. Per the remote-backend page, the selected backend becomes the execution environment for new conversations, and its workspace, settings, secrets, MCP servers and automation state stay separate from your other backends.

What this setup does and does not do

It moves execution, working copies, conversation history and secrets from your laptop to the workspace. OpenHands' VM guide says to protect the filesystem of that machine because it stores settings, secrets, conversations and working copies, and it applies to this one too. The model key you enter in Canvas is stored by the backend, so it lives on the workspace's disk.

It does not make the agent's work trustworthy, and it does not isolate one OpenHands conversation from another on the same backend. If different projects need different boundaries, OpenHands' local backend page shows running several backends on different ports, and you can give each its own workspace.

We also do not claim anything about how port 8000 on the workspace is reachable by anything other than port-forward. Keep --public and the key, as the guide says, whatever your network settings are.

Stop it when you are finished

sandscale workspace stop --ws-id WORKSPACE_ID --yes
Enter fullscreen mode Exit fullscreen mode

Stopping keeps the disk. Per the pricing page, a box counts toward your awake vCPU-hours for the whole time it runs, busy or idle, so stop it when no one is using the backend. Start it again with sandscale workspace start --ws-id WORKSPACE_ID --yes. We have not checked whether processes survive a stop or a sleep, so assume they do not and start the backend again in tmux afterwards.

Pattern 2: keep OpenHands local and add a sandbox as an MCP server

If OpenHands runs on your machine, you can instead give it a place to run commands through MCP. OpenHands' MCP settings page lists the transports it supports (SSE, Streamable HTTP and stdio) and says to add a server from Customize, then MCP Servers, then Add custom server, press Test connection, and save. New servers apply to new conversations, not to ones already running.

Two ways to reach Sandscale from there:

  • Remote server. Server type SHTTP, URL https://mcp.sandscale.dev/mcp, authentication OAuth. The docs say OAuth in OpenHands opens a browser window on the first connection and stores tokens locally. Sandscale's remote server signs in with OAuth and each call runs as you. We have not tested OpenHands completing that sign-in, so use Test connection to find out.
  • Local server. Server type STDIO, command sandscale, argument mcp. This is the CLI's own server, which uses the sign-in from sandscale login on that machine. The remote-versus-local post compares the two tool lists.

Neither is a good fit for Pattern 1. OpenHands' docs describe the OAuth flow as opening a browser window and storing tokens locally, and a backend on a headless workspace has no browser to open, so we would not expect the sign-in to complete there (we have not tried it). The local stdio server needs a CLI sign-in on that machine, which has the same browser step. If you want a sandbox as an MCP server there, use Pattern 1 for the backend and treat MCP as a separate question.

To tell the agent when to use the sandbox, OpenHands' MCP page says standing instructions go in the repository's AGENTS.md, which OpenHands loads into the agent's context. As with any prompt-level rule, it is an instruction and not an enforcement.

FAQ

Does OpenHands isolate the agent by default?

Not by default. Its install page says agents run shell commands and read or write files with your account's permissions, that Agent Canvas does not isolate them, and that you should use a container, sandbox or VM for a tighter boundary.

Can Agent Canvas connect to a backend on another machine?

Yes. A remote backend is an Agent Server URL, an API key and a workspace where it can run tools. Add it under Manage Backends.

How do I reach the backend without exposing it to the internet?

OpenHands' VM guide describes an SSH tunnel to 127.0.0.1:8000. With a Sandscale workspace, sandscale workspace port-forward NAME 8000:8000 does that through Sandscale's own sign-in and a short-lived certificate.

Does a stopped workspace keep my OpenHands setup?

Stopping keeps the disk, so the installed backend and its stored data remain. Restart the backend after you start the workspace, since we have not verified that processes survive a stop.

Related

Runnable examples: sandscale/agent-quickstart.

Originally published on the Sandscale blog.

Top comments (0)