Connect a TypeScript backend
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
Create a sandbox, run a command, and delete it from a Node or Bun backend with the TypeScript SDK.
- Install
hermitboxin your Node backend with its package manager. - Set
HERMITBOX_API_URLandHERMITBOX_API_KEYin the backend’s private environment. - Run this module with your application’s normal TypeScript runner or build.
import { Hermitbox } from 'hermitbox'
// Connect with HERMITBOX_API_URL and HERMITBOX_API_KEY from the environment.
const hb = new Hermitbox()
// Use the install's default tier. A container also needs an image.
const { defaults } = await hb.project()
if (!defaults) throw new Error('The install did not report its default tier')
const { isolation } = defaults
const box = await hb.sandbox(
isolation === 'container' ? { isolation, image: 'alpine:3.22' } : { isolation },
)
try {
// Run a command and stop if it failed.
const result = await box.run('echo hello')
if (result.code !== 0) throw new Error(result.stderr)
console.log(result.stdout) // hello
} finally {
// Delete the sandbox, even when something failed.
await box.delete()
}Keep this on the server: browser bundles 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 | shor ask your agent
Install Hermitbox and set it up for me
or add to your agent
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