Run untrusted TypeScript.

Execute agent-generated code in a hardened sandbox.

pnpm add run

Give code only what it needs.

Guest code accesses only the host functions you provide.

Learn how the sandbox works
TypeScript
run.ts
import { run } from 'run';

const result = await run({
  source: `
    const doubled = await tools.double(21);
    return { message: 'Hello from the sandbox!', doubled };
  `,
  hostFunctions: {
    tools: {
      double: (value: number) => value * 2,
    },
  },
});

if (result.status === 'completed') {
  console.log(result.value);
}

Hardened by default

Every invocation runs in a fresh QuickJS context without ambient access to Node.js, files, environment variables, modules, or the network.

Explicit capabilities

Expose only the host functions your guest code needs. Inputs and outputs cross a serialized boundary you control.

Built for long-running work

Interrupt execution for approval or authentication, then resume from a signed continuation without repeating completed work.

Learn more about run

Explore the documentation