Connect a TypeScript backend
- 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 the URL and key from the environment.const hb = new Hermitbox({ url: process.env.HERMITBOX_API_URL!, key: process.env.HERMITBOX_API_KEY!,})
// 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 } = defaultsconst 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; an unawaited promise may be terminated. 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
agents can read every page: llms.txt · llms-full.txt