Use cases
What Lifo is for
A tiny Linux-like VM in pure TypeScript unlocks a few things that are painful with containers or WASM. Here are the ones people reach for most — each with a hands-on guide.
Run untrusted code
Execute agent- or user-generated code in a disposable box with no container. No host filesystem, no native binaries, no cloud — client-side or server-side, the same way.
- ✓Bound every run with a timeout and an AbortSignal
- ✓A fresh box per task — they share no state
- ✓Nothing touches the host unless you explicitly allow it
const box = await Sandbox.create();
await box.fs.writeFile("/tmp/run.js", untrustedCode);
const { stdout, exitCode } = await box.commands.run(
"node /tmp/run.js",
{ timeout: 5_000 },
);Full-stack dev environment
Run real web and mobile dev servers — Vite, Expo — entirely in a browser tab, with a terminal and a live preview. HMR works. No cloud dev box, no container.
- ✓npm and npx are real inside the box
- ✓Live preview of any in-VM port over a service worker
- ✓Vite, Expo (SDK 54 & 57), and Supabase run unmodified
const sandbox = await Sandbox.create({ terminal });
const bridge = new ServiceWorkerBridge(sandbox.kernel.portRegistry);
await bridge.connect("/sw.js", "/");
sandbox.commands.run("npm install && npm run dev");
new PreviewBrowser(preview, { bridge, port: 5173 });A box for your agents
Give an AI agent a real computer — filesystem, shell, Node, npm — that boots instantly and is safe to hand generated commands to. A full edit-run-observe loop.
- ✓Expose run-command and read/write-file tools
- ✓Headless in Node, or client-side in the browser
- ✓Snapshot & resume an agent's workspace between turns
const box = await Sandbox.create({ cwd: "/workspace" });
await box.fs.writeFile("/workspace/main.js", generated);
const { stdout, exitCode } = await box.commands.run("node main.js", {
timeout: 30_000,
});
// feed the result back to the modelEdge-first bash
A POSIX shell and 60+ coreutils anywhere JavaScript runs — Cloudflare Workers, Vercel Edge, Deno, the browser. Pure JS, in-memory filesystem, sub-millisecond boot.
- ✓grep / sed / awk / sort pipelines, no binary needed
- ✓Pipe data straight through with stdin — no disk required
- ✓No cold start, no native deps, volatile by default
const box = await Sandbox.create();
const { stdout } = await box.commands.run(
"grep ERROR log.txt | sort | uniq -c | sort -rn",
{ stdin: logText },
);Something else in mind?
The same box runs in a browser tab, in Node, and on the edge. If your case fits that shape, it probably fits Lifo.