# Sandboxes

URL: /code/platform/sandboxes · Id: `capability: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](/business/nouns/action) with its logs and [Cost](/business/nouns/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](/business/nouns/setting). It holds only state it can rebuild and writes results through the API, so losing a machine loses nothing.
- Code reaches the [Startup](/business/nouns/startup) only through the typed `$`, under the caller's [Permissions](/business/nouns/permission) and [Limits](/business/nouns/limit).
- Every [Agent](/business/nouns/agent) acts from a sandbox: the MCP `do` tool runs its program in an isolate. Builds, tests and [Evaluators](/business/nouns/evaluator) run in machines.

## Verbs
None.

## Interfaces
- [API](/code/api/reference)
- [SDK](/code/sdk/reference)
- [CLI](/code/cli/reference)
- [MCP](/code/mcp/reference)

## Example
```ts
// 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 }
```