Skip to content
docs
type to search↑↓ move↵ openesc close
v0.3.2github

Connect a TypeScript backend

2 min readv0.3.2this page as markdown
let your agent do it
Connect my Node or Bun backend to Hermitbox.
Paste it into your agent. It follows this page as Markdown: typescript.md

Give your Node or Bun backend sandboxes: create one, run a command in it and delete it with the TypeScript SDK.

Install the SDK from npm:

shell
npm install hermitbox

Quickstart

typescript
import { Hermitbox } from 'hermitbox'

const hb = new Hermitbox()
const box = await hb.sandbox()
console.log((await box.run('echo hello')).stdout.trim())
await box.delete()

On the machine where you installed Hermitbox, new Hermitbox() connects automatically. From another machine, set HERMITBOX_API_URL and HERMITBOX_API_KEY in the backend’s private environment.

Snapshot and fork

Try a risky change without touching the original. Save a sandbox at a clean checkpoint, fork an independent copy, change the fork and throw it away:

typescript
import { Hermitbox } from 'hermitbox'

const hb = new Hermitbox()
const box = await hb.sandbox()

try {
  await box.write('config.json', '{"mode":"safe"}')
  const snapshot = await box.snapshot()
  const fork = await snapshot.fork()

  try {
    await fork.write('config.json', '{"mode":"experimental"}')
    console.log('original:', await box.read('config.json'))
    console.log('fork:', await fork.read('config.json'))
  } finally {
    await fork.delete()
  }
} finally {
  await box.delete()
}

Output:

text
original: {"mode":"safe"}
fork: {"mode":"experimental"}

Keep this code on the server. A browser bundle must never contain a project key. On serverless platforms, await work inside the request lifetime or use a supported background worker: the platform can stop an unawaited promise when the request ends.

Long streams need a runtime that permits their duration. The host tier still controls capabilities and isolation. SDK reference.

run it yourself
$curl -fsSL https://hbx.sh | sh
or ask your agent
Install Hermitbox and set it up for me
Linux (x86_64 or aarch64), no root, no Docker. Agents can read every page: llms.txt · llms-full.txt
the floor · nothing below this line