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

> OpenHands says to treat its agent as untrusted and run it in a container, sandbox or VM. Run its backend on a Sandscale workspace (a Firecracker microVM), connect Agent Canvas through port-forward, and, separately, give a local OpenHands a sandbox through MCP. What each setup isolates and what it does not.

OpenHands says to treat its agent as untrusted and run it in a container, sandbox or VM. Run its backend on a Sandscale workspace (a Firecracker microVM), connect Agent Canvas through port-forward, and, separately, give a local OpenHands a sandbox through MCP. What each setup isolates and what it does not.

November 29, 2026 · 7 min read · The Sandscale team

**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](https://sandscale.dev/sandboxes) 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](https://docs.openhands.dev/openhands/usage/agent-canvas/architecture), [install](https://docs.openhands.dev/openhands/usage/agent-canvas/setup), [remote backend](https://docs.openhands.dev/openhands/usage/agent-canvas/backend-setup/remote), [VM / self-hosted](https://docs.openhands.dev/openhands/usage/agent-canvas/backend-setup/vm) and [MCP settings](https://docs.openhands.dev/openhands/usage/settings/mcp-settings) pages; Sandscale’s [workspaces guide](https://sandscale.dev/docs/guides/workspaces), [CLI reference](https://sandscale.dev/docs/reference/cli) 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

```sh
sandscale login
sandscale workspace templates-list
sandscale workspace create --name openhands-box --template-id TEMPLATE_ID --yes
sandscale workspace ssh openhands-box
```

`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:

```sh
node --version
uv --version
agent-canvas --version
```

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`):

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

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):

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

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.

```sh
sandscale workspace port-forward openhands-box 8000:8000
```

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

```sh
agent-canvas --frontend-only
```

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

```sh
sandscale workspace stop --ws-id WORKSPACE_ID --yes
```

Stopping keeps the disk. Per the [pricing page](https://sandscale.dev/pricing), 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](https://sandscale.dev/sandboxes/mcp) 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](https://sandscale.dev/blog/remote-vs-local-sandscale-mcp-server) 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

- [Codex exec in a cloud workspace](https://sandscale.dev/blog/codex-exec-in-a-cloud-workspace)
- [Claude Code headless in a cloud workspace](https://sandscale.dev/blog/claude-code-headless-in-a-cloud-workspace)
- [Gemini CLI headless in a cloud workspace](https://sandscale.dev/blog/gemini-cli-headless-in-a-cloud-workspace)
- [Remote or local: choosing between Sandscale’s two MCP servers](https://sandscale.dev/blog/remote-vs-local-sandscale-mcp-server)

**On this page**

1. What runs where in OpenHands
2. Pattern 1: the backend on a workspace
3. Pattern 2: keep OpenHands local and add a sandbox as an MCP server
4. FAQ
5. Related

**Run your agents in a box of their own**

Each sandbox is a Firecracker microVM. Free includes 100 awake vCPU-hours a month.

[Start free](https://cloud.sandscale.dev/auth/signup)

## Keep reading

- [November 29, 2026 · **Browser-free test runs for coding agents: a fast tier to run on every edit, and a browser tier to leave for CI** · How to split a project's tests so a coding agent's loop never needs a real browser: node and DOM-emulated tests first, browser end-to-end tests last. Vitest projects, jsdom and happy-dom limits, pytest markers, Node's test runner, Playwright tags and go test -short, plus how to make a filtered run fail loudly instead of passing by running nothing.](https://sandscale.dev/blog/browser-free-test-runs-for-coding-agents)
- [November 29, 2026 · **Connecting Cline to a remote MCP sandbox: streamableHttp, OAuth sign-in and what autoApprove should list** · Add the remote Sandscale MCP server to Cline so its installs and test runs can go to a Firecracker microVM instead of your machine. The cline_mcp_settings.json entry, sign-in, which tools to auto-approve, a rule that points Cline at the sandbox, and what Cline's settings cannot enforce.](https://sandscale.dev/blog/cline-with-a-remote-mcp-sandbox)

---
Source: https://sandscale.dev/blog/openhands-with-a-hosted-microvm
