---
title: Interactive browser terminals in Sandboxes
description: The Sandbox SDK now supports proxying WebSocket connections to container PTY sessions, enabling browser-based terminal UIs with output buffering, reconnection, and multiple isolated terminals per sandbox.
image: https://edgetunnel-b2h.pages.dev/changelog-preview.png
---

> Documentation Index  
> Fetch the complete documentation index at: https://edgetunnel-b2h.pages.dev/changelog/llms.txt  
> Use this file to discover all available pages before exploring further. 

[Skip to content](#%5Ftop) 

# Changelog

New updates and improvements at Cloudflare.

[ Subscribe to RSS ](https://edgetunnel-b2h.pages.dev/changelog/rss/index.xml) [ View RSS feeds ](https://edgetunnel-b2h.pages.dev/fundamentals/new-features/available-rss-feeds/) 

![hero image](https://edgetunnel-b2h.pages.dev/_astro/hero.CVYJHPAd_26AMqX.svg) 

[ ← Back to all posts ](https://edgetunnel-b2h.pages.dev/changelog/) 

## Interactive browser terminals in Sandboxes

Feb 09, 2026 

[ Agents ](https://edgetunnel-b2h.pages.dev/agents/) 

The [Sandbox SDK ↗](https://github.com/cloudflare/sandbox-sdk) now supports PTY (pseudo-terminal) passthrough, enabling browser-based terminal UIs to connect to sandbox shells via WebSocket.

#### `sandbox.terminal(request)`

The new `terminal()` method proxies a WebSocket upgrade to the container's PTY endpoint, with output buffering for replay on reconnect.

* [  JavaScript ](#tab-panel-2859)
* [  TypeScript ](#tab-panel-2860)

**JavaScript**

```js
// Worker: proxy WebSocket to container terminal
return sandbox.terminal(request, { cols: 80, rows: 24 });
```

**TypeScript**

```ts
// Worker: proxy WebSocket to container terminal
return sandbox.terminal(request, { cols: 80, rows: 24 });
```

#### Multiple terminals per sandbox

Each session can have its own terminal with an isolated working directory and environment, so users can run separate shells side-by-side in the same container.

* [  JavaScript ](#tab-panel-2861)
* [  TypeScript ](#tab-panel-2862)

**JavaScript**

```js
// Multiple isolated terminals in the same sandbox
const dev = await sandbox.getSession("dev");
return dev.terminal(request);
```

**TypeScript**

```ts
// Multiple isolated terminals in the same sandbox
const dev = await sandbox.getSession("dev");
return dev.terminal(request);
```

#### xterm.js addon

The new `@cloudflare/sandbox/xterm` export provides a `SandboxAddon` for [xterm.js ↗](https://xtermjs.org/) with automatic reconnection (exponential backoff + jitter), buffered output replay, and resize forwarding.

* [  JavaScript ](#tab-panel-2863)
* [  TypeScript ](#tab-panel-2864)

**JavaScript**

```js
import { SandboxAddon } from "@cloudflare/sandbox/xterm";


const addon = new SandboxAddon({
  getWebSocketUrl: ({ sandboxId, origin }) =>
    `${origin}/ws/terminal?id=${sandboxId}`,
  onStateChange: (state, error) => updateUI(state),
});
terminal.loadAddon(addon);
addon.connect({ sandboxId: "my-sandbox" });
```

**TypeScript**

```ts
import { SandboxAddon } from "@cloudflare/sandbox/xterm";


const addon = new SandboxAddon({
  getWebSocketUrl: ({ sandboxId, origin }) =>
    `${origin}/ws/terminal?id=${sandboxId}`,
  onStateChange: (state, error) => updateUI(state),
});
terminal.loadAddon(addon);
addon.connect({ sandboxId: "my-sandbox" });
```

#### Upgrade

To update to the latest version:

```sh
npm i @cloudflare/sandbox@latest
```

```json
{"@context":"https://schema.org","@type":"BlogPosting","@id":"https://edgetunnel-b2h.pages.dev/changelog/post/2026-02-09-pty-terminal-support/#page","headline":"Interactive browser terminals in Sandboxes · Changelog","description":"The Sandbox SDK now supports proxying WebSocket connections to container PTY sessions, enabling browser-based terminal UIs with output buffering, reconnection, and multiple isolated terminals per sandbox.","url":"https://edgetunnel-b2h.pages.dev/changelog/post/2026-02-09-pty-terminal-support/","inLanguage":"en","image":"https://edgetunnel-b2h.pages.dev/changelog-preview.png","dateModified":"2026-02-09","datePublished":"2026-02-09","publisher":{"@type":"Organization","name":"Cloudflare","url":"https://www.cloudflare.com/"},"isPartOf":{"@type":"WebSite","@id":"https://edgetunnel-b2h.pages.dev/#website","name":"Cloudflare Docs","url":"https://edgetunnel-b2h.pages.dev/"}}
```
