Pause a sandbox and pick it up later, in another tab or another process.
A running sandbox can be suspended and reconstructed on demand. Nothing keeps
running in between, so there is no daemon and no background process to manage.Only the memory pages that changed since boot are written, which keeps a delta
at a couple of megabytes rather than the size of the snapshot.Anything the guest held carries across, including variables set with
env at creation. Pass env to Sandbox.resume
only when you want to add or change one on the way back up.
This is the one place the TypeScript SDK deliberately differs from the Python
one. A browser tab has nowhere to put a file, so suspend() hands you the state
and lets you decide where it goes. For a hosted app that is usually your own
backend.
const sandbox = await Sandbox.create();await sandbox.commands.run("uv pip install --system requests");const delta = await sandbox.suspend(); // Uint8Array, a couple of MiBawait sandbox.close();// Later, possibly in another tab or another process:const resumed = await Sandbox.resume({ id: "my-instance", snapshotId: sandbox.snapshotId, delta,});const result = await resumed.code.run("import requests; print(requests.__version__)");console.log(result.text);
Suspend into browser storage, returns an instance id
Sandbox.resume(idOrInstance, options?)
Resume from an id or from delta bytes
Sandbox.listInstances()
List instances held in browser storage
Sandbox.destroy(id)
Delete a stored instance
for (const instance of await Sandbox.listInstances()) { console.log(instance.id, instance.snapshotId, new Date(instance.savedAt));}
sandbox.close() shuts down a running sandbox and leaves suspended instances
alone. Use Sandbox.destroy(id) to remove one, or
snapshots.clear({ instances: true }) to drop them all.
A delta only resumes against the snapshot it was taken from. snapshotId is
recorded for exactly that reason, so keep it with the bytes if you store them
yourself.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"vpod","description":"Give your agent a disposable Linux machine.","colors":{"primary":"#121212","light":"#e5e5e5","dark":"#121212"},"logo":{"light":"https://mintcdn.com/vpod/jo2aS6onH5gW_EaY/logo/light.svg?fit=max\u0026auto=format\u0026n=jo2aS6onH5gW_EaY\u0026q=85\u0026s=61715fcc0499fd9cbb17e105ffa27900","dark":"https://mintcdn.com/vpod/jo2aS6onH5gW_EaY/logo/dark.svg?fit=max\u0026auto=format\u0026n=jo2aS6onH5gW_EaY\u0026q=85\u0026s=3a5de1c67ec11460ccbc895437b5e9ac"},"favicon":"https://mintcdn.com/vpod/jo2aS6onH5gW_EaY/favicon.svg?fit=max\u0026auto=format\u0026n=jo2aS6onH5gW_EaY\u0026q=85\u0026s=9834db74a0da2de2ce06ed19122c65b3","appearance":{"default":"dark"},"background":{"color":{"light":"#ffffff","dark":"#121212"}},"navbar":{},"footer":{"socials":{"github":"https://github.com/capsulerun/vpod","website":"https://vpod.sh"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"vpod","hasAudioNarration":false,"actualSubdomain":"vpod","customDomains":["docs.vpod.sh"],"gitSource":{"type":"github","owner":"capsulerun","repo":"vpod-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6ab01613295cfe37c7f7ebfb","clientVersion":"0.0.4117","searchFilterCounts":[{"language":"default","tag":"TypeScript SDK","count":7},{"language":"default","tag":"Python SDK","count":5},{"language":"default","tag":"Get Started","count":3},{"language":"default","tag":"Embedded preview (In Iframe)","count":2},{"language":"default","tag":"Browser","count":2},{"language":"default","tag":"CLI","count":1},{"language":"default","tag":"Resources","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"sdk/typescript/suspend-resume","slug":"/sdk/typescript/suspend-resume","pageMetadata":{"title":"Suspend \u0026 resume","description":"Pause a sandbox and pick it up later, in another tab or another process.","icon":"pause","href":"/sdk/typescript/suspend-resume"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Pause a sandbox and pick it up later, in another tab or another process.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`A running sandbox can be suspended and reconstructed on demand. Nothing keeps\nrunning in between, so there is no daemon and no background process to manage.`}),`\n`,_jsx(_components.p,{children:`Only the memory pages that changed since boot are written, which keeps a delta\nat a couple of megabytes rather than the size of the snapshot.`}),`\n`,_jsxs(_components.p,{children:[`Anything the guest held carries across, including variables set with\n`,_jsx(_components.a,{href:`/sdk/typescript/sandbox#env`,children:_jsx(_components.code,{children:`env`})}),` at creation. Pass `,_jsx(_components.code,{children:`env`}),` to `,_jsx(_components.code,{children:`Sandbox.resume`}),`\nonly when you want to add or change one on the way back up.`]}),`\n`,_jsx(Heading,{level:`2`,id:`the-delta-is-bytes-not-a-location`,children:`The delta is bytes, not a location`}),`\n`,_jsxs(_components.p,{children:[`This is the one place the TypeScript SDK deliberately differs from the Python\none. A browser tab has nowhere to put a file, so `,_jsx(_components.code,{children:`suspend()`}),` hands you the state\nand lets you decide where it goes. For a hosted app that is usually your own\nbackend.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` sandbox`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Sandbox`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`create`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` sandbox`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`commands`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`run`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"uv pip install --system requests\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` delta`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` sandbox`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`suspend`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Uint8Array, a couple of MiB`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` sandbox`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`close`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Later, possibly in another tab or another process:`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` resumed`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Sandbox`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`resume`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` id:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"my-instance\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` snapshotId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` sandbox`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`snapshotId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` delta`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` resumed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`code`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`run`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"import requests; print(requests.__version__)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`result`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`text`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`letting-the-browser-hold-it`,children:`Letting the browser hold it`}),`\n`,_jsx(_components.p,{children:`In a browser you can skip the round trip and keep the delta in origin-private\nstorage:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` instanceId`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` sandbox`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`suspendToOpfs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// After a page reload:`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` resumed`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Sandbox`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`resume`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`instanceId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`This is what makes an `,_jsx(_components.code,{children:`export MARKER=1`}),`, a refresh, and an `,_jsx(_components.code,{children:`echo $MARKER`}),` that\nstill answers work in a single tab.`]}),`\n`,_jsx(Heading,{level:`2`,id:`managing-instances`,children:`Managing instances`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{style:{textAlign:`left`},children:`Method`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`sandbox.suspend()`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Suspend and return the delta bytes`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`sandbox.suspendToOpfs()`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Suspend into browser storage, returns an instance id`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Sandbox.resume(idOrInstance, options?)`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Resume from an id or from delta bytes`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Sandbox.listInstances()`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`List instances held in browser storage`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Sandbox.destroy(id)`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`Delete a stored instance`})]})]})]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` instance`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Sandbox`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`listInstances`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`instance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`instance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`snapshotId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Date`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`instance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`savedAt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`sandbox.close()`}),` shuts down a running sandbox and leaves suspended instances\nalone. Use `,_jsx(_components.code,{children:`Sandbox.destroy(id)`}),` to remove one, or\n`,_jsx(_components.code,{children:`snapshots.clear({ instances: true })`}),` to drop them all.`]})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`A delta only resumes against the snapshot it was taken from. `,_jsx(_components.code,{children:`snapshotId`}),` is\nrecorded for exactly that reason, so keep it with the bytes if you store them\nyourself.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Suspend \u0026 resume","description":"Pause a sandbox and pick it up later, in another tab or another process.","icon":"pause","href":"/sdk/typescript/suspend-resume"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"The delta is bytes, not a location","slug":"the-delta-is-bytes-not-a-location","depth":2,"children":[]},{"title":"Letting the browser hold it","slug":"letting-the-browser-hold-it","depth":2,"children":[]},{"title":"Managing instances","slug":"managing-instances","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"vpod","siteName":"vpod","title":"Suspend \u0026 resume - vpod","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-19T18:08:01.785Z","originalFileLocation":"sdk/typescript/suspend-resume.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Pause a sandbox and pick it up later, in another tab or another process.\">\u003cmeta data-mint-head name=\"application-name\" content=\"vpod\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/vpod/Gs2hVi5r4RXyLioT/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/vpod/Gs2hVi5r4RXyLioT/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/vpod/Gs2hVi5r4RXyLioT/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/vpod/Gs2hVi5r4RXyLioT/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/vpod/Gs2hVi5r4RXyLioT/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/vpod/Gs2hVi5r4RXyLioT/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/vpod/Gs2hVi5r4RXyLioT/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/vpod/Gs2hVi5r4RXyLioT/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/vpod/Gs2hVi5r4RXyLioT/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Suspend \u0026amp; resume - vpod\">\u003cmeta data-mint-head property=\"og:description\" content=\"Pause a sandbox and pick it up later, in another tab or another process.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"vpod\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.vpod.sh/sdk/typescript/suspend-resume\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://vpod.mintlify.site/_mintlify/api/og/v2?division=TypeScript+SDK\u0026amp;title=Suspend+%26+resume\u0026amp;description=Pause+a+sandbox+and+pick+it+up+later%2C+in+another+tab+or+another+process.\u0026amp;theme=48dc19e4050caeb2026842a5\u0026amp;signature=ea898fd4fb9fc3683ba0920187f039708249de84ba18abe1de2b2880c936dda7\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Suspend \u0026amp; resume - vpod\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Pause a sandbox and pick it up later, in another tab or another process.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://vpod.mintlify.site/_mintlify/api/og/v2?division=TypeScript+SDK\u0026amp;title=Suspend+%26+resume\u0026amp;description=Pause+a+sandbox+and+pick+it+up+later%2C+in+another+tab+or+another+process.\u0026amp;theme=48dc19e4050caeb2026842a5\u0026amp;signature=ea898fd4fb9fc3683ba0920187f039708249de84ba18abe1de2b2880c936dda7\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/vpod/Gs2hVi5r4RXyLioT/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"vpod\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#121212\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.vpod.sh/sdk/typescript/suspend-resume\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdk/typescript/suspend-resume.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.vpod.sh/#organization\",\"name\":\"vpod\",\"url\":\"https://docs.vpod.sh\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/vpod/jo2aS6onH5gW_EaY/logo/light.svg?fit=max\u0026auto=format\u0026n=jo2aS6onH5gW_EaY\u0026q=85\u0026s=61715fcc0499fd9cbb17e105ffa27900\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.vpod.sh#website\",\"name\":\"vpod\",\"url\":\"https://docs.vpod.sh\",\"publisher\":{\"@id\":\"https://docs.vpod.sh/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.vpod.sh/sdk/typescript/suspend-resume#webpage\",\"url\":\"https://docs.vpod.sh/sdk/typescript/suspend-resume\",\"name\":\"Suspend \u0026 resume\",\"description\":\"Pause a sandbox and pick it up later, in another tab or another process.\",\"dateModified\":\"2026-09-19T18:08:01.785Z\",\"isPartOf\":{\"@id\":\"https://docs.vpod.sh#website\"},\"breadcrumb\":{\"@id\":\"https://docs.vpod.sh/sdk/typescript/suspend-resume#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.vpod.sh/sdk/typescript/suspend-resume#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"TypeScript SDK\",\"item\":\"https://docs.vpod.sh/sdk/typescript/sandbox\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Suspend \u0026 resume\",\"item\":\"https://docs.vpod.sh/sdk/typescript/suspend-resume\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.vpod.sh/sdk/typescript/suspend-resume#article\",\"headline\":\"Suspend \u0026 resume\",\"name\":\"Suspend \u0026 resume\",\"description\":\"Pause a sandbox and pick it up later, in another tab or another process.\",\"url\":\"https://docs.vpod.sh/sdk/typescript/suspend-resume\",\"mainEntityOfPage\":{\"@id\":\"https://docs.vpod.sh/sdk/typescript/suspend-resume#webpage\"},\"dateModified\":\"2026-09-19T18:08:01.785Z\",\"publisher\":{\"@id\":\"https://docs.vpod.sh/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.vpod.sh#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"vpod\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"vpod\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/sdk/typescript/suspend-resume.md","siteName":"vpod","nav":{"global":null,"groups":[{"group":"Get Started","pages":[{"title":"Introduction","icon":"terminal","href":"/index"},{"title":"Quickstart","icon":"rocket","href":"/quickstart"},{"title":"Private snapshots","icon":"key","href":"/private-snapshots"}]},{"group":"TypeScript SDK","pages":[{"title":"Sandbox","icon":"cube","href":"/sdk/typescript/sandbox"},{"title":"Process I/O","icon":"arrows-left-right","href":"/sdk/typescript/process-io"},{"title":"Tracing","icon":"footprints","href":"/sdk/typescript/tracing"},{"title":"Snapshots","description":"Available snapshots, the snapshot API, and managing the local cache.","icon":"camera","href":"/sdk/typescript/snapshots"},{"title":"Suspend \u0026 resume","icon":"pause","href":"/sdk/typescript/suspend-resume"},{"group":"Browser","pages":[{"title":"Running in a browser","description":"Serve the SDK from a page, and what the guest can reach once it boots.","icon":"globe","href":"/sdk/typescript/browser"},{"title":"Embedding","icon":"box","href":"/sdk/typescript/embedding"}]}]},{"group":"Python SDK","pages":[{"title":"Sandbox","icon":"cube","href":"/sdk/python/sandbox"},{"title":"Process I/O","icon":"arrows-left-right","href":"/sdk/python/process-io"},{"title":"Tracing","icon":"footprints","href":"/sdk/python/tracing"},{"title":"Snapshots","icon":"camera","href":"/sdk/python/snapshots"},{"title":"Suspend \u0026 resume","icon":"pause","href":"/sdk/python/suspend-resume"}]},{"group":"Embedded preview (In Iframe)","pages":[{"title":"Embed a preview","icon":"window-maximize","href":"/preview/embed"},{"title":"The iframe bridge","icon":"arrows-left-right","href":"/preview/bridge"}]},{"group":"CLI","pages":[{"title":"CLI reference","icon":"terminal","href":"/cli/reference"}]},{"group":"Resources","pages":[{"title":"Contributing","icon":"code-pull-request","href":"/contributing"}]}]},"basePath":"","title":"Suspend \u0026 resume - vpod","buildId":"dpl_41S5Z2jG9QnfDRwN1KZrLdBwj7DM","deploymentId":"dpl_41S5Z2jG9QnfDRwN1KZrLdBwj7DM","dynamics":[],"chunks":[]}