Sandboxes
Sandboxes run untrusted or generated code in isolated, leased machines, from millisecond scripts to full builds.
Sandboxes run untrusted or generated code in isolation: an isolate for a script in milliseconds, a leased machine for shells, files and builds. Every run is an Action with its logs and Cost.
Contract
- An isolate has no filesystem and no network. It reaches only the hosts its call allowlists.
- An isolate stops at its
timeout: 5 seconds by default, 60 at most. CPU time and outbound requests are capped per call. - Dependencies are pinned to exact versions.
- A machine is leased for a term set by a Setting. It holds only state it can rebuild and writes results through the API, so losing a machine loses nothing.
- Code reaches the Startup only through the typed
$, under the caller's Permissions and Limits. - Every Agent acts from a sandbox: the MCP
dotool runs its program in an isolate. Builds, tests and Evaluators run in machines.
Verbs
None.
Interfaces
Example
// tallyroom.app cleans uploaded spreadsheets. Each Customer writes its own row rule,
// and the rule runs in an isolate with no network.
import { $ } from 'startup-builder'
const rows = [{ name: 'Ana Costa', email: ' Ana@Example.com ' }]
const run = await $.sandbox.evaluate({
script: 'export default (row) => ({ ...row, email: row.email.trim().toLowerCase() })',
input: rows,
dependencies: { 'date-fns': '4.1.0' },
fetch: [],
timeout: 2000,
})
// { success: true, value: [...], logs: [], duration: 41 }