An open-source, faster Devin alternative
TypeScript
docs(microvm): add a parallel MicroVM docs tab so customers can prepare to migrate — 21 pages covering lifecycle, the 8-hour ceiling and endAt, filesystem-only checkpoints, sizes, the in-guest secrets tradeoff and the supported/unsupported split, with the existing Sandboxes docs left untouched and still first
Brian Reardon01169fcc6ccc
diff --git a/docs/docs.json b/docs/docs.jsonindex 740bbb43..d73290d4 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -65,7 +65,10 @@},{"group": "Test and operate",- "pages": ["agents/playground", "agents/logs"]+ "pages": [+ "agents/playground",+ "agents/logs"+ ]},{"group": "Examples",@@ -84,7 +87,11 @@"groups": [{"group": "Getting Started",- "pages": ["introduction", "quickstart", "how-it-works"]+ "pages": [+ "introduction",+ "quickstart",+ "how-it-works"+ ]},{"group": "Sandboxes",@@ -108,14 +115,18 @@"group": "Usage","tag": "Preview","expanded": true,- "pages": ["sandboxes/usage"]+ "pages": [+ "sandboxes/usage"+ ]}]},{"group": "Browser Sessions","tag": "Preview",- "pages": ["browser-sessions/overview"]+ "pages": [+ "browser-sessions/overview"+ ]},{"group": "Reserved Capacity",@@ -159,7 +170,9 @@"group": "Usage & Tags","tag": "Preview","expanded": true,- "pages": ["reference/typescript-sdk/usage"]+ "pages": [+ "reference/typescript-sdk/usage"+ ]},"reference/typescript-sdk/exec","reference/typescript-sdk/filesystem",@@ -331,11 +344,72 @@},{"group": "Resources",- "pages": ["troubleshooting"]+ "pages": [+ "troubleshooting"+ ]},{"group": "Self-hosting",- "pages": ["self-hosting/overview", "self-hosting/gcp-development"]+ "pages": [+ "self-hosting/overview",+ "self-hosting/gcp-development"+ ]+ }+ ]+ },+ {+ "tab": "Sandboxes · MicroVM",+ "groups": [+ {+ "group": "Start here",+ "pages": [+ "microvm/overview",+ "microvm/whats-different",+ "microvm/quickstart",+ "microvm/migrate"+ ]+ },+ {+ "group": "Lifecycle",+ "pages": [+ "microvm/lifecycle",+ "microvm/lifetime",+ "microvm/idle-timeout",+ "microvm/hibernate"+ ]+ },+ {+ "group": "Working in a sandbox",+ "pages": [+ "microvm/exec",+ "microvm/files",+ "microvm/terminals",+ "microvm/preview-urls"+ ]+ },+ {+ "group": "State",+ "pages": [+ "microvm/checkpoints",+ "microvm/templates",+ "microvm/secrets"+ ]+ },+ {+ "group": "Limits",+ "pages": [+ "microvm/not-supported",+ "microvm/sizes",+ "microvm/security-model"+ ]+ },+ {+ "group": "Reference",+ "pages": [+ "microvm/sdk-differences",+ "microvm/errors",+ "microvm/faq"+ ]}]}diff --git a/docs/microvm/checkpoints.mdx b/docs/microvm/checkpoints.mdxnew file mode 100644index 00000000..1888e6c9--- /dev/null+++ b/docs/microvm/checkpoints.mdx@@ -0,0 +1,66 @@+---+title: "Checkpoints"+description: "Filesystem snapshots — what they capture, and what they do not"+---++A checkpoint captures the sandbox's **filesystem**. Restoring puts those files back.++```typescript+const cp = await sandbox.createCheckpoint("after-install");+// wait for status "ready"++await sandbox.restoreCheckpoint(cp.checkpointId);+```++<Warning>+Checkpoints on this runtime **do not capture live memory**. Restoring gives you your files back+on a freshly booted sandbox — not a process tree resumed mid-execution.+</Warning>++## Why++The current runtime can snapshot a running VM's memory because we operate the hypervisor. The+MicroVM platform exposes no snapshot or memory-export operation at all, so a filesystem archive+is the only checkpoint that can exist here. This is an API ceiling, not a missing feature.++## What this changes for you++**If you checkpoint an installed environment** — dependencies, a built toolchain, a seeded+database directory — nothing changes. That is a filesystem, and it restores exactly.++**If you checkpoint a warmed process** — a loaded model, an open connection pool, a debugger+paused at a breakpoint — that state is gone on restore. Your process starts again from scratch,+with its files in place.++The practical test: if you would be happy with the result of `reboot` plus your files, a+checkpoint gives you that.++## The `kind` argument++The current runtime accepts `kind: "full"` for a memory-inclusive checkpoint. Here:++- omitting `kind`, or asking for `disk_only`, works and produces a filesystem checkpoint+- explicitly asking for `full` is **refused**, rather than quietly giving you a disk-only+ checkpoint under a name that promises more++```typescript+await sandbox.createCheckpoint("env"); // fine+await sandbox.createCheckpoint("env", { kind: "disk_only" }); // fine+await sandbox.createCheckpoint("env", { kind: "full" }); // refused+```++## Restore is in-place++`restoreCheckpoint` rolls the current sandbox's filesystem back to the checkpoint. It does not+create a new sandbox.++<Note>+**Forking a new sandbox from a checkpoint is not available yet.** `createFromCheckpoint` fails+on this runtime. It is being worked on. Until then, restore into an existing sandbox.+</Note>++## Checkpoints outlive their sandbox++A checkpoint is stored durably and is not bound to the sandbox that produced it. That makes it+the tool for surviving the [8-hour ceiling](/microvm/lifetime): checkpoint before the deadline,+then restore onto a sandbox you create later.diff --git a/docs/microvm/errors.mdx b/docs/microvm/errors.mdxnew file mode 100644index 00000000..46eb38e0--- /dev/null+++ b/docs/microvm/errors.mdx@@ -0,0 +1,42 @@+---+title: "Errors"+description: "What the distinct failures mean and whether retrying helps"+---++The runtime tries to make "retry" versus "change your request" obvious from the status code.++## Creates++| Status | Meaning | Retry? |+|---|---|---|+| `400` requested size not available | The size has no published image here. The message lists the sizes that do exist. | No — pick a listed size. |+| `503` out of capacity | A genuine shortage. | Yes, once something frees up. No `Retry-After`, because hammering a full region only adds rate limiting. |+| `503` rate limited | Creates are arriving faster than the provider accepts. | Yes — a `Retry-After: 1` header is set. |+| `429` concurrent sandbox limit | Your org is at its concurrency cap. | Yes, after ending a sandbox. |++The distinction between the first two matters: an unavailable size is permanent for that+request, and reporting it as capacity would send you to support about a shortage that does not+exist.++## Operations on a sandbox++| Status | Meaning |+|---|---|+| `501` not supported for this sandbox | The operation does not exist on this runtime — `scale`, a `full` checkpoint, mounts. See [What's not supported](/microvm/not-supported). |+| `404` | The sandbox is gone. If it was hibernated, it may have reached its lifetime ceiling — check `endAt`. |+| `502` could not attach | The connection to the sandbox failed. Usually transient; retry once. |++<Note>+A `501` is a statement about the runtime, not about your sandbox. Retrying will not change it,+and neither will recreating the sandbox.+</Note>++## Things that used to be silent++Several failures that previously looked like success now report honestly. If you have code that+assumed a `200` meant the operation happened, these are worth knowing about:++- Asking for an idle timeout longer than the lifetime ceiling returns `applied: false` rather+ than accepting a value that could never fire.+- A `full` checkpoint is refused rather than quietly producing a disk-only one.+- An unavailable size is refused rather than silently serving a different size.diff --git a/docs/microvm/exec.mdx b/docs/microvm/exec.mdxnew file mode 100644index 00000000..a83a86ab--- /dev/null+++ b/docs/microvm/exec.mdx@@ -0,0 +1,72 @@+---+title: "Running commands"+description: "One-shot commands and streaming sessions"+---++Command execution is unchanged from the current runtime. The same calls, the same semantics.++## One-shot++```typescript+const r = await sandbox.exec.run("ls -la /home/sandbox");+r.stdout; // captured+r.stderr; // captured separately+r.exitCode; // the real exit code, not thrown+```++A non-zero exit is a value, not an exception — `exit 42` gives you `exitCode: 42`.++Options work as you would expect:++```typescript+await sandbox.exec.run("pwd && echo $TOKEN", {+ cwd: "/tmp",+ env: { TOKEN: "abc" },+ timeout: 120,+});+```++## Streaming++For long-running commands, or when you want output as it happens:++```typescript+const session = await sandbox.exec.start("npm", {+ args: ["run", "build"],+ onStdout: (chunk) => process.stdout.write(new TextDecoder().decode(chunk)),+ onStderr: (chunk) => process.stderr.write(new TextDecoder().decode(chunk)),+ onExit: (code) => console.log("exited", code),+});++const exitCode = await session.done;+```++Stdout and stderr stay distinguishable, which matters if you redirect one and not the other.++## Background work++A session can outlive the call that started it:++```typescript+const session = await sandbox.exec.background("python", { args: ["worker.py"] });++const sessions = await sandbox.exec.list();+await sandbox.exec.kill(session.sessionId);+```++<Note>+The handle returned by `start`/`background` exposes `sessionId`, while entries from+`exec.list()` use `sessionID`. Both are typed correctly, but the casing differs — worth knowing+before you write a `.find()` against it.+</Note>++## Reattaching++```typescript+const session = await sandbox.exec.attach(sessionId, {+ onStdout: (chunk) => { /* ... */ },+});+```++Attaching replays recent scrollback and then streams live output, so a client that reconnects+sees what it missed.diff --git a/docs/microvm/faq.mdx b/docs/microvm/faq.mdxnew file mode 100644index 00000000..5aa920ac--- /dev/null+++ b/docs/microvm/faq.mdx@@ -0,0 +1,56 @@+---+title: "FAQ"+description: "Questions worth answering before you migrate"+---++<AccordionGroup>+ <Accordion title="Does anything change for me right now?">+ No. Your sandboxes keep running on the current runtime until your org is moved, and the+ existing [Sandboxes](/introduction) docs stay accurate for as long as that is true.+ </Accordion>++ <Accordion title="Can the 8-hour limit be raised for my account?">+ No. It is enforced by the platform underneath, not by a quota on our side, and it counts+ hibernated time as well as running time. If you have work that needs a longer-lived+ sandbox, it needs restructuring — see [Sandbox lifetime](/microvm/lifetime).+ </Accordion>++ <Accordion title="Will my existing checkpoints still work?">+ Filesystem checkpoints restore normally. Checkpoints that captured live memory restore+ their filesystem only — the memory image is ignored, and you get a fresh boot with your+ files.+ </Accordion>++ <Accordion title="Do I need to change my code?">+ For most workloads, no. Check for `scale`, `setAutoscale`, mounts, image builds and+ `createFromCheckpoint`, and review anywhere you assume a sandbox lives indefinitely. The+ checklist is on [Prepare to migrate](/microvm/migrate).+ </Accordion>++ <Accordion title="Is it faster?">+ Creates are, because sandboxes come from a warm pool rather than being scheduled onto a+ host. Command execution and file operations are comparable.+ </Accordion>++ <Accordion title="Why can't I mount anything?">+ The guest runs without `CAP_SYS_ADMIN`, and it is absent from the capability bounding set,+ so `mount` cannot be performed even by root. The same restriction removes a large class of+ escape techniques. Copy data in, or read it over the network instead.+ </Accordion>++ <Accordion title="What happens to my sandboxes if my org is halted?">+ Each one is archived to durable storage and its host released, so charges stop. When the+ org resumes they are restored onto new hosts with their files intact. Running processes are+ not preserved.+ </Accordion>++ <Accordion title="Can I run on both runtimes at once?">+ Not within a single org — an org is on one runtime at a time. Testing against a separate+ non-production org is the usual approach, and the same code runs against both.+ </Accordion>++ <Accordion title="Something I depend on is in the 'not available yet' list.">+ Tell us. That list is prioritised work, not a fixed decision, and knowing what is blocking+ a real migration is what changes the order.+ </Accordion>+</AccordionGroup>diff --git a/docs/microvm/files.mdx b/docs/microvm/files.mdxnew file mode 100644index 00000000..5a33ec96--- /dev/null+++ b/docs/microvm/files.mdx@@ -0,0 +1,57 @@+---+title: "Files"+description: "Reading and writing the sandbox filesystem"+---++Filesystem access is unchanged from the current runtime.++```typescript+await sandbox.files.write("/home/sandbox/notes.txt", "hello");+const text = await sandbox.files.read("/home/sandbox/notes.txt");++await sandbox.files.makeDir("/home/sandbox/work");+const entries = await sandbox.files.list("/home/sandbox");++await sandbox.files.exists("/home/sandbox/notes.txt"); // true+await sandbox.files.remove("/home/sandbox/notes.txt");+```++## Binary and large files++```typescript+await sandbox.files.write("/home/sandbox/blob.bin", new Uint8Array([0, 1, 2, 255]));+const bytes = await sandbox.files.readBytes("/home/sandbox/blob.bin");+```++Large writes stream rather than buffering, so multi-megabyte files are fine over the same call.++## Signed URLs++For uploads and downloads that should not go through your process, mint a URL and hand it out:++```typescript+const download = await sandbox.downloadUrl("/home/sandbox/report.pdf");+const upload = await sandbox.uploadUrl("/home/sandbox/incoming.zip");++await fetch(upload, { method: "PUT", body: fileContents });+```++Both work the same as on the current runtime.++## What does not exist here++<Warning>+**Mounts are not available.** FUSE, NFS, overlay and 9p all require a capability the guest does+not have, so there is no way to attach external storage as a filesystem inside a MicroVM+sandbox. This is a platform limitation, not a feature gap we are working through.+</Warning>++If you use mounts to bring a dataset into the sandbox, the alternatives are to copy it in with+`files.write` or a signed upload URL, or to have your code read it directly from object storage+over the network.++## Files and the lifetime ceiling++The sandbox filesystem does not outlive the sandbox, and sandboxes end after at most 8 hours.+Anything you need to keep should be checkpointed or written somewhere durable before then —+see [Sandbox lifetime](/microvm/lifetime).diff --git a/docs/microvm/hibernate.mdx b/docs/microvm/hibernate.mdxnew file mode 100644index 00000000..383d4327--- /dev/null+++ b/docs/microvm/hibernate.mdx@@ -0,0 +1,49 @@+---+title: "Hibernate and wake"+description: "Suspending a sandbox in place, and what that does not do"+---++```typescript+await sandbox.hibernate();+// ... later+await sandbox.wake();+```++Hibernating suspends the host. The filesystem, the process tree and anything in memory are all+exactly as you left them when you wake it.++## What is different here++On the current runtime, hibernation writes a checkpoint to storage and releases the host, so a+sandbox can stay hibernated indefinitely and wake anywhere.++Here it is a suspend in place, which has two consequences:++<Warning>+**Hibernated time counts against the 8-hour ceiling.** A sandbox hibernated overnight reaches+its deadline while asleep and is destroyed. It does not wake up the next morning.+</Warning>++**The sandbox stays on its host.** It does not move, which is why waking is fast — but it also+means hibernation is not a way to park something long-term.++## When to use it++Hibernation is for gaps measured in minutes to a few hours: an agent waiting on a human, a+session between turns, a build waiting for input. Combined with an+[idle timeout](/microvm/idle-timeout) it is a cost control.++It is not a way to preserve a sandbox across days. For that, checkpoint the filesystem and+create a fresh sandbox later — see [Checkpoints](/microvm/checkpoints).++## Waking a sandbox that has ended++If a hibernated sandbox reached its ceiling, it is gone. Waking it fails, and the sandbox+reports as stopped. Check `endAt` before relying on a wake:++```typescript+const info = await getSandbox(sandboxId);+if (Date.parse(info.endAt) < Date.now()) {+ // the sandbox is past its deadline — restore from a checkpoint instead+}+```diff --git a/docs/microvm/idle-timeout.mdx b/docs/microvm/idle-timeout.mdxnew file mode 100644index 00000000..14e2a5aa--- /dev/null+++ b/docs/microvm/idle-timeout.mdx@@ -0,0 +1,42 @@+---+title: "Idle timeout"+description: "Auto-hibernate an idle sandbox, within the lifetime ceiling"+---++A sandbox can hibernate itself after a period with no activity, so you are not paying for a box+nobody is using.++```typescript+await sandbox.setTimeout(3600); // hibernate after an hour idle+```++Activity means your requests — commands, file operations, terminal input. Internal health+checks do not count as activity, so a sandbox nobody is using really does go idle.++## The response tells you what was applied++An idle timeout cannot outlive the sandbox. Because the lifetime ceiling is 8 hours, a longer+timeout could never fire, so the API reports what it actually did rather than accepting a value+it cannot honour:++```json+// POST /api/sandboxes/{id}/timeout {"timeout": 3600}+{ "applied": true, "requested": 3600, "timeout": 3600 }++// POST /api/sandboxes/{id}/timeout {"timeout": 86400}+{ "applied": false, "requested": 86400, "timeout": 0 }+```++<Note>+Check `applied`. A request above the ceiling is refused rather than silently clamped, so you+find out at the call site instead of discovering later that your sandbox never slept.+</Note>++## What waking costs++Waking is a resume of the suspended host, so it is fast and your filesystem and processes are+exactly where you left them.++The catch is that the time spent hibernated still counted against the 8-hour ceiling. An idle+timeout saves you money; it does not extend the sandbox's life. See+[Sandbox lifetime](/microvm/lifetime).diff --git a/docs/microvm/lifecycle.mdx b/docs/microvm/lifecycle.mdxnew file mode 100644index 00000000..5c6a129e--- /dev/null+++ b/docs/microvm/lifecycle.mdx@@ -0,0 +1,62 @@+---+title: "Lifecycle"+description: "The states a MicroVM sandbox moves through"+---++## States++| Status | Meaning |+|---|---|+| `running` | Alive and serving requests. |+| `hibernated` | Suspended in place, or archived by an org halt. Wake to use it again. |+| `stopped` | Ended — by you, by its idle timeout, or by reaching its lifetime ceiling. |+| `error` | Failed to start, or failed in a way it could not recover from. |++## Creating++Creates are served from a warm pool, so a sandbox is usually ready in well under a second.++```typescript+const sandbox = await Sandbox.create({ apiKey });+console.log(sandbox.sandboxId);+```++The response carries `endAt` — the deadline the platform will enforce. See+[Sandbox lifetime](/microvm/lifetime).++## Ending++```typescript+await sandbox.kill();+```++A sandbox also ends on its own when its idle timeout expires, or when it reaches its 8-hour+ceiling. All three land in `stopped`.++## Restarting without losing the disk++`reboot` restarts the guest. Processes are cleared; the filesystem is kept.++```typescript+await sandbox.files.write("/home/sandbox/keep.txt", "still here");+await sandbox.reboot();+await sandbox.files.read("/home/sandbox/keep.txt"); // "still here"+```++This is the tool for recovering a wedged process without losing your work. It does not reset+the lifetime ceiling — the host underneath is the same host.++## Org-level halts++If an org is halted for non-payment, its sandboxes are **archived and their hosts released**:+the filesystem is written to durable storage, then the host is given back so charges stop.++When the org resumes, each sandbox is restored onto a new host with its files intact. Running+processes are not preserved — it comes back as a fresh boot holding your data, the same as any+checkpoint restore on this runtime.++<Note>+This differs from the current runtime, which parks halted sandboxes in place. It has to: a+suspended sandbox would still hit the 8-hour ceiling and be destroyed, and a credit halt often+lasts longer than that.+</Note>diff --git a/docs/microvm/lifetime.mdx b/docs/microvm/lifetime.mdxnew file mode 100644index 00000000..c0fe00d2--- /dev/null+++ b/docs/microvm/lifetime.mdx@@ -0,0 +1,86 @@+---+title: "Sandbox lifetime"+description: "The 8-hour ceiling, endAt, and how to design around them"+---++Every MicroVM sandbox has a hard end time. When it arrives, the provider destroys the host and+the sandbox's disk goes with it.++<Warning>+The ceiling is **8 hours**, and it counts **running and hibernated time together**. It cannot be+extended, and hibernating does not pause it.+</Warning>++This is the single largest behavioural difference from the current runtime, where a sandbox+lives until something ends it.++## Reading the deadline++Every sandbox reports when it will end:++```typescript+const info = await fetch(`${apiUrl}/api/sandboxes/${sandboxId}`, {+ headers: { "X-API-Key": apiKey },+}).then((r) => r.json());++console.log(info.status); // "running"+console.log(info.endAt); // "2026-09-02T04:30:26Z"+```++`endAt` means *when this sandbox ends*: the scheduled deadline while it is alive, and the actual+end time once it has stopped.++<Note>+**Do not compute the deadline yourself.** Sandboxes are served from a warm pool, so the host+often started before your create did. A sandbox may report seven and a half hours remaining+rather than eight. `endAt` is the truth; `createdAt + 8h` is not.+</Note>++## Designing around it++The ceiling is only a problem for work that assumes a sandbox is where state lives. Two shapes+work:++### Checkpoint and recreate++Before the deadline, checkpoint the filesystem, create a fresh sandbox and restore onto it.++```typescript+const remainingMs = Date.parse(info.endAt) - Date.now();++if (remainingMs < 30 * 60 * 1000) { // half an hour left+ const cp = await sandbox.createCheckpoint(`rollover-${Date.now()}`);+ // wait for the checkpoint to report ready, then create a new sandbox+ // and restore onto it before this one ends+}+```++You pay a restart, and anything that was only in memory is gone. Files survive.++### Externalise the state++The alternative is to stop caring: keep durable state in object storage or a database, and+treat every sandbox as disposable. Work that already looks like this needs no changes at all —+the ceiling stops being visible.++## What happens at the deadline++The host is destroyed. The sandbox's API row moves to a terminal state and `endAt` becomes the+time it actually ended. Requests to it after that point fail like any other stopped sandbox.++There is no grace period and no warning event. If you need to act before the deadline, poll+`endAt` and act on the margin yourself.++## Hibernation does not buy time++On the current runtime, hibernating a sandbox parks it indefinitely. Here it suspends the host+in place — and suspended time counts against the same 8 hours.++A sandbox hibernated overnight will not be there in the morning. See+[Hibernate and wake](/microvm/hibernate).++## Idle timeouts are clamped to the ceiling++You can ask for an idle timeout, but not one that outlives the sandbox. A request above the+ceiling is reported back as not applied rather than silently accepted — see+[Idle timeout](/microvm/idle-timeout).diff --git a/docs/microvm/migrate.mdx b/docs/microvm/migrate.mdxnew file mode 100644index 00000000..15768b79--- /dev/null+++ b/docs/microvm/migrate.mdx@@ -0,0 +1,83 @@+---+title: "Prepare to migrate"+description: "How to find out whether your workload is affected, before anything moves"+---++Nothing about your sandboxes changes until your org is moved. This page is here so you can find+out ahead of time whether that move is a non-event or something you need to plan.++## Step 1 — answer four questions++Most workloads are unaffected. These four are what separate the two cases:++<Steps>+ <Step title="Does any sandbox need to live longer than 8 hours?">+ Include hibernated time — it counts. If yes, that work needs restructuring before you move.+ See [Sandbox lifetime](/microvm/lifetime).+ </Step>+ <Step title="Do you restore checkpoints expecting a running process?">+ If your checkpoints capture a warmed process — a loaded model, an open connection pool —+ restore will not bring it back. If they capture an installed environment, you are fine.+ See [Checkpoints](/microvm/checkpoints).+ </Step>+ <Step title="Do you call scale, autoscale, or mount anything?">+ None of these exist on the new runtime. See [What's not supported](/microvm/not-supported).+ </Step>+ <Step title="Do you build images or fork from checkpoints?">+ Both are unavailable today. Fork is being worked on; image builds are not scheduled.+ </Step>+</Steps>++If all four are "no", your migration is a configuration change and you can stop reading here.++## Step 2 — find the calls in your code++Search for the surfaces that behave differently:++```bash+# Hard failures on the new runtime+rg -n "\.scale\(|setAutoscale|\.mounts\b|createFromCheckpoint|buildImage|image:"++# Worth reviewing, since the semantics change+rg -n "createCheckpoint|restoreCheckpoint|\.hibernate\(|setTimeout"+```++## Step 3 — handle the lifetime ceiling++If you found long-lived sandboxes, the shape that works is to stop treating the sandbox as the+place your state lives:++<CardGroup cols={2}>+ <Card title="Checkpoint and recreate" icon="camera">+ Checkpoint before the deadline, create a fresh sandbox, restore. Costs a restart; keeps+ your files.+ </Card>+ <Card title="Externalise the state" icon="database">+ Keep durable state outside the sandbox, so any sandbox is disposable and the ceiling stops+ mattering.+ </Card>+</CardGroup>++Read `endAt` and act on it rather than assuming a wall-clock 8 hours from your create — a+pooled sandbox starts with less than the full budget.++## Step 4 — re-read the security model if you use secrets++Secrets still reach your sandbox as sealed placeholders and are still substituted only for the+hosts they are scoped to. What changed is where the real value is held: on the new runtime it+lives in a root-owned process **inside** your sandbox rather than on a separate machine.++Unprivileged code in the sandbox cannot read it, but a privilege escalation inside the sandbox+reaches secrets that it would not have reached before. If you model that risk, read+[Security model](/microvm/security-model).++## Step 5 — test against it++Ask us to move a non-production org first. The same SDK and the same code run against both+runtimes, so your existing test suite is the test.++<Note>+If something in your workload does not fit what is described here, tell us before you are+scheduled to move rather than after. The constraints on this page are real, but which of them+we prioritise is not fixed.+</Note>diff --git a/docs/microvm/not-supported.mdx b/docs/microvm/not-supported.mdxnew file mode 100644index 00000000..c6030b98--- /dev/null+++ b/docs/microvm/not-supported.mdx@@ -0,0 +1,48 @@+---+title: "What's not supported"+description: "Permanent limits and in-progress gaps, kept separate on purpose"+---++Two lists, because the difference matters when you are planning. The first will not change.+The second is work.++## Permanent limits++These come from the platform underneath. We are not going to ship them.++| | Why |+|---|---|+| **Sandboxes living past 8 hours** | The provider destroys the host at its lifetime ceiling, counting running and hibernated time together. |+| **Live-memory checkpoints** | The platform exposes no snapshot or memory-export operation. A filesystem archive is the only checkpoint that can exist. |+| **Mounts (FUSE, NFS, overlay, 9p)** | The guest does not have `CAP_SYS_ADMIN`, and it is absent from the bounding set, so `mount` cannot be performed at all. |+| **Resizing a running sandbox** | Memory is a property of the image a sandbox launched from. It cannot be changed after launch. |+| **Live migration** | There are no hosts of ours to migrate between. |++Calls into these surfaces are **refused**, not silently ignored. `scale()` returns a clear+"not supported for this sandbox" rather than reporting success and doing nothing.++## Not available yet++These are gaps in our implementation, not the platform's.++| | Status |+|---|---|+| **Fork from a checkpoint** | `createFromCheckpoint` fails. Restore into an existing sandbox instead. In progress. |+| **Image builds** | Declarative `image:` manifests and the build pipeline are unavailable. Use [templates](/microvm/templates) or checkpoints. |+| **Checkpoint patches** | The patch API is not wired to this runtime. |+| **Promoting a checkpoint to full** | Depends on memory capture, so it is blocked behind a permanent limit. |++## Behaves differently rather than missing++| | |+|---|---|+| **Hibernate** | Suspends in place; hibernated time counts against the lifetime ceiling. |+| **Org halt** | Archives the filesystem and releases the host, rather than parking the sandbox. |+| **Idle timeout** | Clamped to the lifetime ceiling; the response tells you whether it was applied. |+| **Sizes** | Only published size tiers can be served. An unavailable size is refused with the list of sizes that exist. |++## If something here blocks you++The permanent list is genuinely fixed, but the priority order of the second list is not. If one+of those gaps is what stands between you and migrating, say so — that is useful information and+it changes what we work on next.diff --git a/docs/microvm/overview.mdx b/docs/microvm/overview.mdxnew file mode 100644index 00000000..6258b973--- /dev/null+++ b/docs/microvm/overview.mdx@@ -0,0 +1,69 @@+---+title: "MicroVM sandboxes"+description: "The runtime we are moving sandboxes onto, and what it means for your code"+---++MicroVM is the runtime OpenComputer sandboxes are moving to. It runs each sandbox as an+isolated microVM on managed infrastructure instead of on VM hosts we operate ourselves.++These docs describe that runtime specifically. The [Sandboxes](/introduction) docs continue to+describe the current runtime and stay accurate for as long as your org is on it — nothing you+are running today changes because this page exists.++## Why it exists++Operating the VM fleet ourselves put a layer between your sandbox and us that had to be kept+healthy: host capacity, kernel versions, live migration, per-box tunnels. Most incidents came+from that layer rather than from sandboxes. Moving to managed microVMs removes it.++What you get for that:++<CardGroup cols={2}>+ <Card title="Faster starts" icon="bolt">+ Sandboxes are served from a warm pool. A create is typically well under a second, and+ there is no host to schedule onto first.+ </Card>+ <Card title="Fewer moving parts" icon="wrench">+ No worker fleet, no per-box tunnel, no live migration. Less to go wrong between your code+ and the sandbox.+ </Card>+</CardGroup>++## What it costs you++This is the part worth reading before you plan a migration. The new runtime is not a superset+of the old one — it is a different set of tradeoffs, and two of them are hard limits rather+than things we intend to fix:++<Warning>+**Sandboxes cannot live longer than 8 hours.** The provider destroys the host at that point,+counting running and hibernated time together. There is no extension, and the disk goes with+it. See [Sandbox lifetime](/microvm/lifetime).+</Warning>++<Warning>+**Checkpoints capture the filesystem, not live memory.** Restoring gives you a fresh boot with+your files in place, not a running process tree frozen mid-execution. See+[Checkpoints](/microvm/checkpoints).+</Warning>++The full list, including what is temporarily missing versus permanently impossible, is on+[What's not supported](/microvm/not-supported).++## What stays the same++Most of the API does. Creating sandboxes, running commands, streaming output, reading and+writing files, terminals, preview URLs, signed URLs, webhooks and secrets all work through the+same SDK calls, and the same code runs on both runtimes.++That is deliberate: the runtime is meant to be something you notice in your bill and your+latency graphs, not in your code.++<CardGroup cols={2}>+ <Card title="What's different" icon="list" href="/microvm/whats-different">+ A side-by-side of the two runtimes.+ </Card>+ <Card title="Prepare to migrate" icon="clipboard-check" href="/microvm/migrate">+ A checklist for finding out whether your workload is affected.+ </Card>+</CardGroup>diff --git a/docs/microvm/preview-urls.mdx b/docs/microvm/preview-urls.mdxnew file mode 100644index 00000000..d0526d3e--- /dev/null+++ b/docs/microvm/preview-urls.mdx@@ -0,0 +1,34 @@+---+title: "Preview URLs"+description: "Exposing a port from inside the sandbox"+---++Preview URLs are unchanged from the current runtime.++```typescript+const preview = await sandbox.createPreviewURL({ port: 3000 });+console.log(preview.hostname); // sb-<id>-p3000.<your-domain>++const all = await sandbox.listPreviewURLs();+await sandbox.deletePreviewURL(3000);+```++Anything listening on that port inside the sandbox is reachable at the returned hostname.++## Auth++```typescript+const preview = await sandbox.createPreviewURL({+ port: 3000,+ authConfig: { /* ... */ },+});+```++A preview URL can require a bearer token, and the token can be rotated with+`rotatePreviewAuthToken()`. Without auth configured, the URL is open to anyone who has it.++## Lifetime++A preview URL lives as long as its sandbox — which on this runtime is at most 8 hours. Links+you hand to someone else will stop working when the sandbox ends, so treat them as short-lived+rather than as stable addresses.diff --git a/docs/microvm/quickstart.mdx b/docs/microvm/quickstart.mdxnew file mode 100644index 00000000..48ebf11f--- /dev/null+++ b/docs/microvm/quickstart.mdx@@ -0,0 +1,92 @@+---+title: "Quickstart"+description: "Create a MicroVM sandbox and run something in it"+---++If you have used OpenComputer sandboxes before, this will look familiar — that is the point.++## Create and run++<CodeGroup>+```typescript TypeScript+import { Sandbox } from "@opencomputer/sdk";++const sandbox = await Sandbox.create({ apiKey: process.env.OPENCOMPUTER_API_KEY });++const result = await sandbox.exec.run("echo hello from a microVM");+console.log(result.stdout); // hello from a microVM+console.log(result.exitCode); // 0++await sandbox.kill();+```++```python Python+from opencomputer import Sandbox++sandbox = await Sandbox.create()++result = await sandbox.exec.run("echo hello from a microVM")+print(result.stdout) # hello from a microVM+print(result.exit_code) # 0++await sandbox.kill()+```+</CodeGroup>++## Files++```typescript+await sandbox.files.write("/home/sandbox/hello.txt", "written from the SDK");+const text = await sandbox.files.read("/home/sandbox/hello.txt");++const entries = await sandbox.files.list("/home/sandbox");+```++Binary content round-trips through `readBytes`, and large files stream rather than buffering.++## Stream a long-running command++`exec.run` waits for the command to finish. When you want output as it happens, or the command+outlives the request, start a session instead:++```typescript+const session = await sandbox.exec.start("sh", {+ args: ["-c", "for i in 1 2 3; do echo line $i; sleep 1; done"],+ onStdout: (chunk) => process.stdout.write(new TextDecoder().decode(chunk)),+ onStderr: (chunk) => process.stderr.write(new TextDecoder().decode(chunk)),+});++const exitCode = await session.done;+```++Stdout and stderr stay separate, and the exit code is delivered when the process ends.++## Know when your sandbox ends++This is the one habit worth building that the current runtime never required. Every sandbox has+a hard end time:++```typescript+const info = await fetch(`${apiUrl}/api/sandboxes/${sandbox.sandboxId}`, {+ headers: { "X-API-Key": apiKey },+}).then((r) => r.json());++console.log(info.endAt); // e.g. 2026-09-02T04:30:26Z+```++<Note>+`endAt` is measured from when the underlying host started, not from your create. A sandbox+served out of the warm pool may report slightly less than the full 8 hours — that is honest,+not a bug. See [Sandbox lifetime](/microvm/lifetime).+</Note>++## Next++<CardGroup cols={2}>+ <Card title="Sandbox lifetime" icon="clock" href="/microvm/lifetime">+ The 8-hour ceiling and how to design around it.+ </Card>+ <Card title="Prepare to migrate" icon="clipboard-check" href="/microvm/migrate">+ Find out whether your workload is affected.+ </Card>+</CardGroup>diff --git a/docs/microvm/sdk-differences.mdx b/docs/microvm/sdk-differences.mdxnew file mode 100644index 00000000..17839629--- /dev/null+++ b/docs/microvm/sdk-differences.mdx@@ -0,0 +1,59 @@+---+title: "SDK differences"+description: "What changes in your code, and the minimum SDK version"+---++The same SDK talks to both runtimes. Most code needs no changes at all.++## Minimum version++<Note>+Use TypeScript SDK **v0.15.8 or later** if you use terminals or streaming exec sessions.+Earlier versions could not open WebSockets against any runtime — the SDK's own HTTP/2+connection pool captured the upgrade, and WebSockets cannot be negotiated over HTTP/2.+</Note>++## Calls that fail on this runtime++| Call | Behaviour |+|---|---|+| `sandbox.scale({ memoryMB })` | `501` — memory is fixed at launch. |+| `sandbox.setAutoscale(...)` | `501` — same reason. |+| `sandbox.mounts.*` | Not available. |+| `Sandbox.createFromCheckpoint(id)` | Fails today; fork is in progress. |+| `createCheckpoint(name, { kind: "full" })` | Refused. Omit `kind` for a filesystem checkpoint. |+| `Sandbox.create({ image: ... })` | Image builds are unavailable. |++## Calls whose meaning changes++| Call | On this runtime |+|---|---|+| `sandbox.hibernate()` | Suspends in place. The time still counts against the 8-hour ceiling. |+| `sandbox.restoreCheckpoint(id)` | Restores files onto a fresh boot — no live process state. |+| `sandbox.setTimeout(seconds)` | Clamped to the lifetime ceiling; check `applied` in the response. |+| `Sandbox.create({ memoryMB })` | Only published size tiers; anything else is refused with the list. |++## Unchanged++`exec.run`, `exec.start`, `exec.background`, `exec.attach`, `exec.list`, `exec.kill`,+`files.*`, `pty.create`, `createPreviewURL`, `downloadUrl`, `uploadUrl`, `reboot`, `kill`,+`isRunning`, webhooks and secret stores all behave identically.++## Worth adding to your code++Read `endAt` and act on it. It is the one genuinely new thing this runtime asks of you:++```typescript+const info = await getSandbox(sandbox.sandboxId);+const msLeft = Date.parse(info.endAt) - Date.now();++if (msLeft < 30 * 60 * 1000) {+ // checkpoint and roll over to a fresh sandbox+}+```++## A naming papercut++`exec.start()` and `exec.background()` return a handle with `sessionId`, while `exec.list()`+returns entries with `sessionID`. Both are typed correctly and both runtimes behave the same+way, but the casing differs — matching them up needs care.diff --git a/docs/microvm/secrets.mdx b/docs/microvm/secrets.mdxnew file mode 100644index 00000000..61fd28db--- /dev/null+++ b/docs/microvm/secrets.mdx@@ -0,0 +1,59 @@+---+title: "Secrets"+description: "Sealed tokens, host scoping, and where the real value lives"+---++Secrets behave the same way from your code's point of view, and the protection model is the+same: your sandbox never holds the real value.++## How it works++Put secrets in a store, then name the store when you create a sandbox:++```typescript+// the sandbox is created with the store attached+const sandbox = await Sandbox.create({ secretStore: "prod-keys" });++const out = await sandbox.exec.run('echo "$MY_TOKEN"');+console.log(out.stdout); // osb_sealed_3cda2f3ca0a0e0509a338cab83298f43+```++The environment variable holds a **sealed placeholder**, not your secret. When the sandbox+makes a request to a host that secret is scoped to, a proxy substitutes the real value into the+outbound request. Requests anywhere else carry the placeholder, which is worthless.++That means bypassing the proxy fails closed — code that dials an upstream directly sends a+useless string rather than leaking your key.++## Host scoping++A secret is only substituted for the hosts it is allowed to reach:++```typescript+// MY_TOKEN scoped to api.github.com+// a request to api.github.com -> the real value is substituted+// a request to anywhere else -> osb_sealed_... is sent instead+```++## Rotation++Updating a secret's value takes effect on running sandboxes without a restart. The sealed+placeholder does not change — only what it resolves to — so nothing inside the sandbox needs to+know a rotation happened.++## The one real difference++<Warning>+On this runtime the substituting proxy runs **inside your sandbox**, as root, rather than on a+separate machine.+</Warning>++Your code runs as the unprivileged `sandbox` user and cannot read root's memory, so the+day-to-day protection is unchanged. What changes is the blast radius of a privilege escalation+*inside* the sandbox: on the current runtime that would not reach your secrets, and here it+would.++We made this choice deliberately over a shared regional proxy, which would have been a single+service holding every customer's secrets and a single point of failure on everyone's egress.+The reasoning, and what it means if you model this risk, is on+[Security model](/microvm/security-model).diff --git a/docs/microvm/security-model.mdx b/docs/microvm/security-model.mdxnew file mode 100644index 00000000..d8eaafff--- /dev/null+++ b/docs/microvm/security-model.mdx@@ -0,0 +1,65 @@+---+title: "Security model"+description: "Isolation, egress, and the one place this runtime is weaker"+---++## Isolation++Each sandbox is its own microVM with its own kernel, on managed infrastructure. Your code runs+as the unprivileged `sandbox` user inside it. Sandboxes do not share a kernel with each other.++The guest deliberately runs without `CAP_SYS_ADMIN`, which is why+[mounts are impossible](/microvm/files) — the same restriction that removes a large class of+container-escape techniques also removes `mount`.++## Egress and secrets++Outbound HTTPS can be restricted to an allowlist, and secrets are substituted only for the+hosts each secret is scoped to. Because the sandbox holds sealed placeholders rather than real+values, ignoring the proxy and dialing an upstream directly leaks nothing — the request carries+a worthless string.++The sandbox also cannot use the proxy to reach cloud instance metadata; that is blocked+explicitly.++## Where this runtime is weaker++<Warning>+The process holding your real secret values runs **inside your sandbox** as root, rather than+on a separate machine outside it.+</Warning>++On the current runtime, the substituting proxy runs on the VM host. A privilege escalation+inside a sandbox would not reach it, because it was on the other side of the VM boundary.++Here there is no host of ours to put it on, so it runs as a root-owned process in the guest.+Customer code runs unprivileged and cannot read root's memory — but if code in your sandbox+escalates to root, it can reach the secrets scoped to that sandbox.++### Why we chose this++The alternative was a shared regional proxy service. That would have been a single service+holding every customer's secrets and a single point of failure on every customer's egress path —+bought precisely because we removed the host that made it unnecessary. Concentrating every+tenant's secrets in one place to protect against escalation within a single tenant is a worse+trade.++### What to do about it++For most workloads this is not a meaningful change: if untrusted code can escalate to root in+your sandbox, the secrets that sandbox is allowed to use are usually not the most interesting+thing it can reach.++If you do model this risk:++- Scope each secret to the narrowest set of hosts that works, so a compromised sandbox reaches+ only what it needed.+- Give sandboxes running untrusted code their own store, rather than sharing one with trusted+ workloads.+- Prefer short-lived credentials, which the 8-hour lifetime ceiling makes natural.++## Data lifetime++A sandbox's disk is destroyed with it, and every sandbox ends within 8 hours. Anything that+should persist has to be checkpointed or written somewhere durable — see+[Sandbox lifetime](/microvm/lifetime).diff --git a/docs/microvm/sizes.mdx b/docs/microvm/sizes.mdxnew file mode 100644index 00000000..6b4ec35a--- /dev/null+++ b/docs/microvm/sizes.mdx@@ -0,0 +1,50 @@+---+title: "Sandbox sizes"+description: "Choosing memory, and what happens when a size is unavailable"+---++On this runtime, a sandbox's memory is a property of the image it launches from. Each size we+offer in a region is a separately published image.++```typescript+const sandbox = await Sandbox.create({ memoryMB: 4096 });+```++Omitting `memoryMB` gives you the region's default size, which is the one kept in the warm pool+and therefore the fastest to start.++## Unavailable sizes are refused++If you ask for a size that has no published image in that region, the create is refused — with+the sizes that *are* available:++```json+{+ "error": "requested sandbox size is not available in this region: 16384MB was requested; this region offers 4096 MB",+ "hint": "request one of the listed sizes, or contact support to have another published"+}+```++<Note>+This is a `400`, not a `503`. The request names something that does not exist, so retrying will+never help — as opposed to a genuine capacity shortage, which is reported separately and is+worth retrying.+</Note>++The important property is that you are never *silently* given a different size than you asked+for. Memory cannot be adjusted after launch, so a quiet downgrade would bill you for one size+and hand you another with no later point at which the mistake could be corrected.++## Non-default sizes start colder++Only the default size is kept warm. Another size has to cold-launch from its own image, which+takes noticeably longer than a pooled create. If start latency matters, prefer the default.++## Resizing is not possible++<Warning>+`scale()` and autoscaling are not supported. Memory is fixed at launch by the image, so a+running sandbox cannot be resized.+</Warning>++If you size sandboxes dynamically today, decide the size at create time instead.diff --git a/docs/microvm/templates.mdx b/docs/microvm/templates.mdxnew file mode 100644index 00000000..5bc62aff--- /dev/null+++ b/docs/microvm/templates.mdx@@ -0,0 +1,39 @@+---+title: "Templates"+description: "Starting from a prepared environment"+---++Named templates work on this runtime.++```typescript+const sandbox = await Sandbox.create({ templateID: "my-template" });+```++A template create claims a standard pooled sandbox and unpacks the template's workspace onto+it. That means a template costs an archive rather than a separately published machine image,+and new templates are available immediately rather than after an image build.++## What a template carries++The workspace — your files, installed dependencies, anything on disk. It does not carry a+memory image, for the same reason [checkpoints](/microvm/checkpoints) do not.++## Image builds are not available yet++<Warning>+Declarative image manifests (`image:` on create) and the image build pipeline are **not+supported** on this runtime. They depend on a build fleet that this runtime does not have.+</Warning>++If you build images today, that workflow needs an alternative before you migrate. The two that+work now:++<CardGroup cols={2}>+ <Card title="Templates" icon="layer-group">+ Prepare a workspace once and start sandboxes from it.+ </Card>+ <Card title="Checkpoints" icon="camera">+ Install into a sandbox, checkpoint it, and restore that checkpoint when you need the+ environment again.+ </Card>+</CardGroup>diff --git a/docs/microvm/terminals.mdx b/docs/microvm/terminals.mdxnew file mode 100644index 00000000..7d8db824--- /dev/null+++ b/docs/microvm/terminals.mdx@@ -0,0 +1,38 @@+---+title: "Interactive terminals"+description: "PTY sessions over WebSocket"+---++Terminals work the same as on the current runtime.++```typescript+const pty = await sandbox.pty.create({+ onOutput: (data) => process.stdout.write(new TextDecoder().decode(data)),+});++pty.send("whoami\n");+// ... later+pty.close();+```++`pty.create()` resolves once the connection is open, so it is safe to `send` immediately after+awaiting it.++## Requirements++Terminals and streaming exec sessions use WebSockets.++<Note>+Use SDK **v0.15.8 or later**. Earlier versions configured an HTTP/2 connection pool that also+captured WebSocket upgrades, which cannot be negotiated over HTTP/2 — terminals would fail to+connect. Newer versions give WebSockets their own HTTP/1.1 connection.+</Note>++If you are driving the socket yourself rather than through the SDK, connect over HTTP/1.1.++## What travels over the socket++Raw terminal bytes in both directions. Resize is a separate call rather than an inline control+message, which keeps the stream a plain byte pipe.++The wire format is identical on both runtimes — the same client code works against either.diff --git a/docs/microvm/whats-different.mdx b/docs/microvm/whats-different.mdxnew file mode 100644index 00000000..7385f940--- /dev/null+++ b/docs/microvm/whats-different.mdx@@ -0,0 +1,49 @@+---+title: "What's different"+description: "A side-by-side of the current runtime and MicroVM"+---++Everything not listed here behaves identically, and the same SDK code runs on both.++## At a glance++| | Current runtime | MicroVM |+|---|---|---|+| Maximum lifetime | unbounded | **8 hours**, running + hibernated |+| Checkpoints | filesystem **and** live memory | filesystem only |+| Restore from checkpoint | resumes a running process tree | fresh boot with your files |+| Hibernate | checkpoint to storage, wake anywhere | suspend in place |+| Hibernated time | does not count against a lifetime | **counts against the 8 hours** |+| Resize a running sandbox | supported | not supported |+| Sizes | requested at create | fixed per published size tier |+| Mounts (FUSE/NFS/overlay) | supported | not possible |+| Image builds | supported | not yet |+| Fork from a checkpoint | supported | not yet |+| Checkpoint patches | supported | not yet |+| Secret storage | on a host outside your sandbox | inside your sandbox, as root |+| Live migration | supported | not applicable |+| Exec, files, PTY, preview URLs, webhooks, signed URLs | — | identical |++## The two that will bite++**The 8-hour ceiling** is the one to plan around. It is a property of the platform underneath,+not a quota we can raise, and it counts hibernated time. A sandbox you hibernate for the night+does not come back in the morning. If you have work that assumes a long-lived box, read+[Sandbox lifetime](/microvm/lifetime) before anything else.++**Checkpoints don't capture memory.** If you use checkpoints to freeze a warmed-up process —+a loaded model, an open connection pool, a debugger mid-session — restoring will not give that+back. You get the filesystem, and your process starts again. If you use checkpoints to capture+an installed environment, nothing changes for you.++## What gets better++- Creates come from a warm pool, so start latency is lower and more consistent.+- There is no worker fleet to drain, so deploys stop disturbing running sandboxes.+- An unavailable sandbox size is now refused with the sizes that *are* available, instead of+ being reported as a capacity problem.+- A sandbox row can no longer outlive its host, so "running" in the API means running.++<Card title="What's not supported" icon="ban" href="/microvm/not-supported">+ The full list, split into permanent limits and things still in progress.+</Card>