Freestyle VMs provide maximum control and power for AI agents.
VMs provision in under 600ms from API request to ready machine.
Clone a running VM without pausing it — get full copies in milliseconds.
Hibernate VMs and resume exactly where you left off — pay nothing while paused.
First class TypeScript SDK
Create a VM with Bun
Install npm packages
Run code inside the VM and get back structured results
1import { freestyle, VmSpec } from "freestyle";
2import { VmBun } from "@freestyle-sh/with-bun";
3
4const { vm } = await freestyle.vms.create({
5 spec: new VmSpec({
6 with: { bun: new VmBun() },
7 }),
8});
9
10await vm.bun.install({ deps: ["zod"], global: true });
11
12
13const { result, stdout, stderr } = await vm.bun.runCode(`
14 import { z } from "zod";
15 const User = z.object({ name: z.string(), age: z.number() });
16 const user = User.parse({ name: "Alice", age: 30 });
17 console.log(JSON.stringify(user));
18`);
19
20console.log(result); // { name: "Alice", age: 30 }Spin up a VM with Bun
Scaffold and start a Next.js app
Fork into 3 identical copies
Every fork is completely independent
1import { freestyle, VmSpec } from "freestyle";
2import { VmBun } from "@freestyle-sh/with-bun";
3
4const { vm } = await freestyle.vms.create({
5 spec: new VmSpec({
6 with: { bun: new VmBun() },
7 }),
8});
9
10
11await vm.exec("bunx create-next-app@latest my-app -y");
12await vm.exec("cd my-app && bun run dev &");
13
14const { forks } = await vm.fork({ count: 3 });
15
16await Promise.all([
17 forks[0].exec("cd my-app && bun add shadcn && bunx shadcn init -y"),
18 forks[1].exec("cd my-app && bun add drizzle-orm && bunx drizzle-kit generate"),
19 forks[2].exec("cd my-app && bun add next-auth && bunx next-auth init"),
20]);Create a persistent VM
Start Redis, write to memory
Suspend — everything frozen, billing stopped
Exec wakes it — process still running
1import { freestyle, VmSpec } from "freestyle";
2import { VmBun } from "@freestyle-sh/with-bun";
3
4const { vm, vmId } = await freestyle.vms.create({
5 spec: new VmSpec({
6 with: { bun: new VmBun() },
7 }),
8 persistence: { type: "persistent" },
9});
10
11await vm.exec("redis-server --daemonize yes");
12await vm.exec("redis-cli SET counter 42");
13
14await vm.suspend();
15
16
17await sleep(30 * 24 * 60 * 60 * 1000); // 30 days later...
18
19const { stdout } = await vm.exec("redis-cli GET counter");
20console.log(stdout); // "42" — Redis was never restartedDefine terminal sessions
Interactive shell + read-only server log
Route each terminal to a public URL
Drop into any frontend with an iframe
1import { freestyle, VmSpec } from "freestyle";
2import { VmWebTerminal } from "@freestyle-sh/with-web-terminal";
3
4const { vm } = await freestyle.vms.create({
5 spec: new VmSpec({
6 with: {
7 terminal: new VmWebTerminal([
8 { id: "shell" },
9 { id: "server", command: "npm run dev", readOnly: true },
10 ] as const),
11 },
12 }),
13});
14
15await vm.terminal.shell.route({ domain: `shell-${projectId}.yourdomain.dev` });
16await vm.terminal.server.route({ domain: `logs-${projectId}.yourdomain.dev` });
17
18
19// Embed in your app with an iframe
20// <iframe src={`https://shell-${projectId}.yourdomain.dev`} />Create a VM and set up your environment
Install dependencies, scaffold apps
Snapshot the entire machine state
Spin up 10 clones instantly from the snapshot
1import { freestyle, VmSpec } from "freestyle";
2import { VmBun } from "@freestyle-sh/with-bun";
3
4const { vm } = await freestyle.vms.create({
5 spec: new VmSpec({
6 with: { bun: new VmBun() },
7 }),
8});
9
10await vm.exec("bunx create-next-app@latest my-app -y");
11await vm.bun.install({ deps: ["drizzle-orm", "shadcn"], cwd: "/root/my-app" });
12
13const { snapshotId } = await vm.snapshot();
14
15
16const vms = await Promise.all(
17 Array.from({ length: 10 }, () =>
18 freestyle.vms.create({ snapshotId })
19 )
20);Create a persistent VM
Create a scoped identity
Grant access to a specific user
Connect with SSH
1import { freestyle, VmSpec } from "freestyle";
2import { VmBun } from "@freestyle-sh/with-bun";
3
4const { vm, vmId } = await freestyle.vms.create({
5 spec: new VmSpec({
6 with: { bun: new VmBun() },
7 }),
8 persistence: { type: "persistent" },
9});
10
11const { identity } = await freestyle.identities.create();
12
13await identity.permissions.vms.create({
14 vmId,
15 allowedUsers: ["developer"],
16});
17
18const { token } = await identity.createToken();
19
20console.log(`ssh ${vmId}+developer:${token}@vm-ssh.freestyle.sh`);Beyond a Sandbox
Run VMs inside VMs, Docker, or any virtualization stack your agents need. Full KVM support.
Sealed Linux users, systemd services and groups; multi-user isolation inside every VM.
The full Linux networking stack with real root access.
First-class integrations for the tools and languages you want to use
Create your first VM in minutes. No credit card required.
Give each agent its own isolated environment with forking to explore multiple solutions.
Each user gets their own dev environment. Hibernate overnight, resume instantly.
Run headless browsers for testing, scraping, or AI-driven web tasks.

