detach() closes the daemon connection and releases the local Modal handle. It does not terminate the attached Sandbox.
Call terminate() on an attached desktop only when your process has authority to stop its owner’s Sandbox.
Acquire a named desktop
Use attach_or_create() when a name is your allocation key:
from modal_computer_use import ComputerConfig, ComputerSandboxwith ComputerSandbox.attach_or_create( name="support-desktop", config=ComputerConfig(),) as computer: print(computer.status().ready)
The SDK attaches to a compatible live Sandbox with that app-scoped name. It creates one if none exists. The context terminates only a Sandbox that this call created.An existing named Sandbox must match the expected configuration tags. Use attach(name=...) when you intentionally connect to a legacy target.
Use native async lifecycle methods
The async lifecycle methods are async context managers:
import asynciofrom modal_computer_use import AsyncComputerSandboxasync def main() -> None: async with AsyncComputerSandbox.create() as computer: screenshot = await computer.screenshots.full() print(screenshot.width, screenshot.height)asyncio.run(main())
Do not await AsyncComputerSandbox.create() directly. Enter the returned context manager with async with.
Lifecycle summary
Construction path
Context exit
create()
Terminates and detaches the created Sandbox
attach()
Detaches and keeps the existing Sandbox running
Existing branch of attach_or_create()
Detaches and keeps the existing Sandbox running
Created branch of attach_or_create()
Terminates and detaches the created Sandbox
local() or direct base_url
Closes the daemon connection only
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Modal Computer Use","description":"Deploy and control a Linux desktop in a Modal Sandbox.","colors":{"primary":"#248713","light":"#7FEE63","dark":"#248713"},"logo":{"light":"https://mintcdn.com/modal-computer-use/U3YncLggMA24W1qr/logo/modal-computer-use-wordmark-light.png?fit=max\u0026auto=format\u0026n=U3YncLggMA24W1qr\u0026q=85\u0026s=943b5af5a43d50b39138b4e5edf2d97c","dark":"https://mintcdn.com/modal-computer-use/U3YncLggMA24W1qr/logo/modal-computer-use-wordmark-dark.png?fit=max\u0026auto=format\u0026n=U3YncLggMA24W1qr\u0026q=85\u0026s=bb97fc01370de2e9fec2d07ec9abfe10"},"favicon":"https://mintcdn.com/modal-computer-use/3wQYz05ZptY4tQnA/favicon.png?fit=max\u0026auto=format\u0026n=3wQYz05ZptY4tQnA\u0026q=85\u0026s=f1678b886ff6b5dd229b7c6eb8962495","background":{"color":{"dark":"#141614"}},"navbar":{"primary":{"type":"github","href":"https://github.com/ashtonchew/modal-computer-use"}},"footer":{"socials":{"github":"https://github.com/ashtonchew/modal-computer-use","x":"https://x.com/ashtonchew"},"links":[{"header":"Project","items":[{"label":"GitHub","href":"https://github.com/ashtonchew/modal-computer-use"},{"label":"PyPI","href":"https://pypi.org/project/modal-computer-use"},{"label":"Releases","href":"https://github.com/ashtonchew/modal-computer-use/releases"}]},{"header":"Support","items":[{"label":"Issues","href":"https://github.com/ashtonchew/modal-computer-use/issues"},{"label":"Security","href":"https://github.com/ashtonchew/modal-computer-use/security/policy"}]}]},"fonts":{"family":"Geist"},"icons":{"library":"tabler"},"styling":{"eyebrows":"breadcrumbs","codeblocks":"system","latex":false},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"modal-computer-use","hasAudioNarration":false,"actualSubdomain":"modal-computer-use","customDomains":[],"gitSource":{"type":"github","owner":"ashtonchew","repo":"modal-computer-use-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6a9c759a10ab928b389deeb0","clientVersion":"0.0.4286","searchFilterCounts":[{"language":"default","tag":"Documentation","count":37},{"language":"default","tag":"Desktop workflows","count":13},{"language":"default","tag":"Benchmarks","count":12},{"language":"default","tag":"Deployment and operations","count":12},{"language":"default","tag":"API Reference","count":12},{"language":"default","tag":"Python SDK","count":10},{"language":"default","tag":"Results and evidence","count":8},{"language":"default","tag":"Getting started","count":8},{"language":"default","tag":"Run and reproduce","count":4},{"language":"default","tag":"Model integrations","count":4}]},"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":"site-roles","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":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":"#pagination{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr));gap:1rem}#pagination a{box-sizing:border-box;width:100%;min-height:4.5rem;margin-left:0;padding:0.75rem 1rem;border:1px solid rgb(var(--gray-200) / 0.7);border-radius:0.75rem;background:transparent;transition:border-color 150ms ease-out}#pagination a:hover{border-color:rgb(var(--gray-300))}#pagination a[rel=\"next\"]{justify-content:flex-end;text-align:right}#pagination a[rel=\"next\"]{grid-column:2}.dark #pagination a{border-color:rgb(var(--gray-800) / 0.7)}.dark #pagination a:hover{border-color:rgb(var(--gray-700))}@media (max-width: 63.999rem){#pagination{grid-template-columns:minmax(0, 1fr)}#pagination a[rel=\"next\"]{grid-column:1}}.action-frame-results th,.action-frame-results td{min-width:0!important}"}]}
{"page":{"pagePath":"v1/build/create-and-attach","slug":"/v1/build/create-and-attach","pageMetadata":{"title":"Create and attach to desktops","sidebarTitle":"Create and attach","description":"Choose a Modal Sandbox lifecycle and keep ownership explicit.","href":"/v1/build/create-and-attach"},"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: \"Choose a Modal Sandbox lifecycle and keep ownership explicit.\"\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={code:`code`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`create()`}),` when your process owns a new desktop. Use `,_jsx(_components.code,{children:`attach()`}),` when another process owns an existing desktop.`]}),`\n`,_jsx(Heading,{level:`2`,id:`create-an-owned-desktop`,children:`Create an owned desktop`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`python`,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:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modal_computer_use `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ComputerSandbox`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`with`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ComputerSandbox.create() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` computer:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` status `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` computer.status()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(status.ready)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The context waits for daemon readiness. It terminates the created Sandbox on exit.`}),`\n`,_jsxs(_components.p,{children:[`Set `,_jsx(_components.code,{children:`wait=False`}),` when you need to do other work before readiness:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`python`,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:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`computer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ComputerSandbox.create(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`wait`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`False`}),_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:`try`}),_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\":`#D4D4D4`},children:` computer.wait_until_ready(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`timeout`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`120.0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(computer.status().ready)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`finally`}),_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\":`#D4D4D4`},children:` computer.terminate(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`wait`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_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:` computer.detach()`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`attach-without-taking-ownership`,children:`Attach without taking ownership`}),`\n`,_jsxs(_components.p,{children:[`Pass exactly one selector. You can use `,_jsx(_components.code,{children:`sandbox_id`}),`, `,_jsx(_components.code,{children:`name`}),`, or `,_jsx(_components.code,{children:`run_id`}),` for a Modal-backed attachment.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`python`,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:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modal_computer_use `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ComputerSandbox`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`computer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ComputerSandbox.attach(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` sandbox_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sb-REPLACE_ME\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` wait`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` readiness_timeout`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`120.0`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(computer.status().ready)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`finally`}),_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:` computer.detach()`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`detach()`}),` closes the daemon connection and releases the local Modal handle. It does not terminate the attached Sandbox.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Call `,_jsx(_components.code,{children:`terminate()`}),` on an attached desktop only when your process has authority to stop its owner’s Sandbox.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`acquire-a-named-desktop`,children:`Acquire a named desktop`}),`\n`,_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`attach_or_create()`}),` when a name is your allocation key:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`python`,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:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modal_computer_use `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ComputerConfig, ComputerSandbox`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`with`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ComputerSandbox.attach_or_create(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"support-desktop\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ComputerConfig(),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` computer:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(computer.status().ready)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The SDK attaches to a compatible live Sandbox with that app-scoped name. It creates one if none exists. The context terminates only a Sandbox that this call created.`}),`\n`,_jsxs(_components.p,{children:[`An existing named Sandbox must match the expected configuration tags. Use `,_jsx(_components.code,{children:`attach(name=...)`}),` when you intentionally connect to a legacy target.`]}),`\n`,_jsx(Heading,{level:`2`,id:`use-native-async-lifecycle-methods`,children:`Use native async lifecycle methods`}),`\n`,_jsx(_components.p,{children:`The async lifecycle methods are async context managers:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`python`,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:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` asyncio`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modal_computer_use `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AsyncComputerSandbox`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` main`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`None`}),_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:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` with`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AsyncComputerSandbox.create() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` computer:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` screenshot `}),_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\":`#D4D4D4`},children:` computer.screenshots.full()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(screenshot.width, screenshot.height)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`asyncio.run(main())`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Do not await `,_jsx(_components.code,{children:`AsyncComputerSandbox.create()`}),` directly. Enter the returned context manager with `,_jsx(_components.code,{children:`async with`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`lifecycle-summary`,children:`Lifecycle summary`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Construction path`}),_jsx(_components.th,{children:`Context exit`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`create()`})}),_jsx(_components.td,{children:`Terminates and detaches the created Sandbox`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`attach()`})}),_jsx(_components.td,{children:`Detaches and keeps the existing Sandbox running`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`Existing branch of `,_jsx(_components.code,{children:`attach_or_create()`})]}),_jsx(_components.td,{children:`Detaches and keeps the existing Sandbox running`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`Created branch of `,_jsx(_components.code,{children:`attach_or_create()`})]}),_jsx(_components.td,{children:`Terminates and detaches the created Sandbox`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`local()`}),` or direct `,_jsx(_components.code,{children:`base_url`})]}),_jsx(_components.td,{children:`Closes the daemon connection only`})]})]})]})]})}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":{"codeStyling":"system","config":{},"pageMetadata":{"title":"Create and attach to desktops","sidebarTitle":"Create and attach","description":"Choose a Modal Sandbox lifecycle and keep ownership explicit.","href":"/v1/build/create-and-attach"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Create an owned desktop","slug":"create-an-owned-desktop","depth":2,"children":[]},{"title":"Attach without taking ownership","slug":"attach-without-taking-ownership","depth":2,"children":[]},{"title":"Acquire a named desktop","slug":"acquire-a-named-desktop","depth":2,"children":[]},{"title":"Use native async lifecycle methods","slug":"use-native-async-lifecycle-methods","depth":2,"children":[]},{"title":"Lifecycle summary","slug":"lifecycle-summary","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/modal-computer-use/afedbf24fbf1ce4f/table-keyboard-scroll.js"],"subdomain":"modal-computer-use","siteName":"Modal Computer Use","title":"Create and attach to desktops - Modal Computer Use","navMaps":{"firstHrefInVersion":{"2.x":{"href":"/build/create-and-attach","matchLevel":1},"1.x":{"href":"/v1/build/create-and-attach","matchLevel":0}},"firstHrefInLanguage":{}},"lastModified":"2026-08-11T01:51:58.760Z","originalFileLocation":"v1/build/create-and-attach.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=\"system\"}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=\"Choose a Modal Sandbox lifecycle and keep ownership explicit.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Modal Computer Use\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/modal-computer-use/QIAzi0owsS6Rkve0/_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/modal-computer-use/QIAzi0owsS6Rkve0/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/modal-computer-use/QIAzi0owsS6Rkve0/_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/modal-computer-use/QIAzi0owsS6Rkve0/_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/modal-computer-use/QIAzi0owsS6Rkve0/_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/modal-computer-use/QIAzi0owsS6Rkve0/_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/modal-computer-use/QIAzi0owsS6Rkve0/_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/modal-computer-use/QIAzi0owsS6Rkve0/_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/modal-computer-use/QIAzi0owsS6Rkve0/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Create and attach to desktops - Modal Computer Use\">\u003cmeta data-mint-head property=\"og:description\" content=\"Choose a Modal Sandbox lifecycle and keep ownership explicit.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Modal Computer Use\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://modal-computer-use.mintlify.app/v1/build/create-and-attach\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://modal-computer-use.mintlify.site/_mintlify/api/og/v2?division=Desktop+workflows\u0026amp;title=Create+and+attach+to+desktops\u0026amp;description=Choose+a+Modal+Sandbox+lifecycle+and+keep+ownership+explicit.\u0026amp;theme=b7d7aff4163f59c6d290186a\u0026amp;signature=fdbc00c0b3929bf632843550b35dcdf22ed30c22d580f733461e26dfd7fcae78\">\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=\"Create and attach to desktops - Modal Computer Use\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Choose a Modal Sandbox lifecycle and keep ownership explicit.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://modal-computer-use.mintlify.site/_mintlify/api/og/v2?division=Desktop+workflows\u0026amp;title=Create+and+attach+to+desktops\u0026amp;description=Choose+a+Modal+Sandbox+lifecycle+and+keep+ownership+explicit.\u0026amp;theme=b7d7aff4163f59c6d290186a\u0026amp;signature=fdbc00c0b3929bf632843550b35dcdf22ed30c22d580f733461e26dfd7fcae78\">\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/modal-computer-use/QIAzi0owsS6Rkve0/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Modal Computer Use\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#248713\">\u003clink data-mint-head rel=\"canonical\" href=\"https://modal-computer-use.mintlify.app/v1/build/create-and-attach\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/v1/build/create-and-attach.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://modal-computer-use.mintlify.app/#organization\",\"name\":\"Modal Computer Use\",\"url\":\"https://modal-computer-use.mintlify.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/modal-computer-use/U3YncLggMA24W1qr/logo/modal-computer-use-wordmark-light.png?fit=max\u0026auto=format\u0026n=U3YncLggMA24W1qr\u0026q=85\u0026s=943b5af5a43d50b39138b4e5edf2d97c\"}},{\"@type\":\"WebSite\",\"@id\":\"https://modal-computer-use.mintlify.app#website\",\"name\":\"Modal Computer Use\",\"url\":\"https://modal-computer-use.mintlify.app\",\"publisher\":{\"@id\":\"https://modal-computer-use.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://modal-computer-use.mintlify.app/v1/build/create-and-attach#webpage\",\"url\":\"https://modal-computer-use.mintlify.app/v1/build/create-and-attach\",\"name\":\"Create and attach to desktops\",\"description\":\"Choose a Modal Sandbox lifecycle and keep ownership explicit.\",\"dateModified\":\"2026-08-11T01:51:58.760Z\",\"isPartOf\":{\"@id\":\"https://modal-computer-use.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://modal-computer-use.mintlify.app/v1/build/create-and-attach#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://modal-computer-use.mintlify.app/v1/build/create-and-attach#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Modal Computer Use\",\"item\":\"https://modal-computer-use.mintlify.app\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create and attach to desktops\",\"item\":\"https://modal-computer-use.mintlify.app/v1/build/create-and-attach\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://modal-computer-use.mintlify.app/v1/build/create-and-attach#article\",\"headline\":\"Create and attach to desktops\",\"name\":\"Create and attach to desktops\",\"description\":\"Choose a Modal Sandbox lifecycle and keep ownership explicit.\",\"url\":\"https://modal-computer-use.mintlify.app/v1/build/create-and-attach\",\"mainEntityOfPage\":{\"@id\":\"https://modal-computer-use.mintlify.app/v1/build/create-and-attach#webpage\"},\"dateModified\":\"2026-08-11T01:51:58.760Z\",\"publisher\":{\"@id\":\"https://modal-computer-use.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://modal-computer-use.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Modal Computer Use\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Modal Computer Use\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/v1/build/create-and-attach.md","siteName":"Modal Computer Use","nav":{"global":null,"versions":[{"version":"2.x","default":true,"tag":"Latest","pages":[{"title":"2.x","href":"/build/create-and-attach"}]},{"version":"1.x","tag":"Previous","tabs":[{"tab":"Documentation","icon":"book","groups":[{"group":"Getting started","pages":[{"title":"Control a Linux desktop on Modal","sidebarTitle":"Home","href":"/v1"},{"title":"Install Modal Computer Use","sidebarTitle":"Installation","href":"/v1/start/installation"},{"title":"Create your first desktop","sidebarTitle":"Quickstart","href":"/v1/start/quickstart"},{"title":"Choose an example","sidebarTitle":"Examples","description":"Choose a maintained Modal Computer Use example for your lifecycle, provider, or storage use case.","href":"/v1/start/examples"}]},{"group":"Desktop workflows","pages":[{"title":"Create and attach to desktops","sidebarTitle":"Create and attach","href":"/v1/build/create-and-attach"},{"title":"Automate a browser","sidebarTitle":"Browser automation","description":"Configure Chromium or Firefox in a Modal desktop and open a page.","href":"/v1/build/browser-automation"},{"title":"Run action batches","sidebarTitle":"Action batches","href":"/v1/build/action-batches"},{"title":"Capture screenshots and recordings","sidebarTitle":"Screenshots and recordings","href":"/v1/build/screenshots-recordings"},{"title":"Store and persist artifacts","sidebarTitle":"Artifacts and storage","href":"/v1/build/artifacts-storage"},{"title":"Hand a desktop to a Modal Function","sidebarTitle":"Session handoff","href":"/v1/build/session-handoff"}]},{"group":"Model integrations","pages":[{"title":"Run an OpenAI computer loop","sidebarTitle":"OpenAI","href":"/v1/integrate/openai"},{"title":"Run an Anthropic computer loop","sidebarTitle":"Anthropic","href":"/v1/integrate/anthropic"}]},{"group":"Deployment and operations","pages":[{"title":"Deploy a Modal desktop","sidebarTitle":"Deploy","href":"/v1/operate/deploy"},{"title":"Configure a desktop","sidebarTitle":"Configure","href":"/v1/operate/configure"},{"title":"Keep warm desktop capacity","sidebarTitle":"Warm capacity","href":"/v1/operate/warm-capacity"},{"title":"Reduce desktop loop latency","sidebarTitle":"Performance","href":"/v1/operate/performance"},{"title":"Secure a desktop deployment","sidebarTitle":"Security","href":"/v1/operate/security"},{"title":"Troubleshoot a desktop","sidebarTitle":"Troubleshooting","href":"/v1/operate/troubleshooting"}]}]},{"tab":"Benchmarks","icon":"stopwatch","pages":[{"title":"Benchmarks","href":"/v1/benchmarks/overview"}]},{"tab":"API Reference","icon":"code","pages":[{"title":"API Reference","href":"/v1/reference/overview"}]}]}]},"basePath":"","title":"Create and attach to desktops - Modal Computer Use","deploymentId":"dpl_G6E2ur2Zjq51xGTVZPSFXsWoTxCu","buildId":"dpl_G6E2ur2Zjq51xGTVZPSFXsWoTxCu","dynamics":[],"chunks":[]}