Runs one accepted session from workspace startup through worker execution,
resumability, and cleanup.
string
required
Devin session ID supplied by the scheduler.
modal.App
required
Deployed Modal application.
modal.Image
required
Prepared workspace image for a new session.
Additional supported keywords follow
modal.Sandbox.create,
including resources and region. Positional commands and the managed timeout,
workdir, and readiness_probe options are rejected.The containing function must receive the configured Devin credential.
Finds queued sessions for the configured outpost and starts Modal invocations.
Pass the generated session function’s asynchronous spawn method:
worker.dispatch_pending_sessions(session.spawn)
The scheduler function must receive the configured Devin credential and retain the
generated single-container limit.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"modal-devin","description":"Run secure, resumable Devin Outposts workers on Modal.","colors":{"primary":"#09AF58","light":"#80EE64","dark":"#09AF58"},"logo":{"light":"https://mintcdn.com/modal-devin/yMnkiWeaEc6bEsMB/assets/modal-logo-light.svg?fit=max\u0026auto=format\u0026n=yMnkiWeaEc6bEsMB\u0026q=85\u0026s=5dd42ccb917a383d6e67c5458d2376ca","dark":"https://mintcdn.com/modal-devin/yMnkiWeaEc6bEsMB/assets/modal-logo-dark.svg?fit=max\u0026auto=format\u0026n=yMnkiWeaEc6bEsMB\u0026q=85\u0026s=7a257b5a6da19312fa02e9547ee844a0","href":"/"},"appearance":{"default":"dark","strict":true},"background":{"color":{"light":"#FFFFFF","dark":"#161616"}},"navbar":{"links":[{"href":"https://github.com/modal-labs/modal-devin","label":"GitHub"}],"primary":{"type":"github","href":"https://github.com/modal-labs/modal-devin"}},"footer":{"socials":{"github":"https://github.com/modal-labs/modal-devin"}},"styling":{"eyebrows":"breadcrumbs","latex":false},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"modal-devin","hasAudioNarration":false,"actualSubdomain":"modal-devin","customDomains":[],"gitSource":{"type":"github","owner":"modal-labs","repo":"modal-devin","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae95c4c37dad6e4be6ca033:success","clientVersion":"0.0.4344","searchFilterCounts":[{"language":"default","tag":"Reference","count":6},{"language":"default","tag":"Concepts","count":5},{"language":"default","tag":"How-to guides","count":5},{"language":"default","tag":"Tutorials","count":2}]},"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":"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":"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":"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":"turbopuffer-dual-write","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":"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}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"reference/worker","slug":"/reference/worker","pageMetadata":{"title":"Worker reference","description":"Configure one outpost, build its image, and run its Modal entrypoints.","icon":"gears","href":"/reference/worker"},"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: \"Configure one outpost, build its image, and run its Modal entrypoints.\"\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,ParamField,Table}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Worker`}),` is the supported runtime interface for one Devin Outposts outpost.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,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:`1`,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_devin `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Worker`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`constructor`,children:`Constructor`}),`\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:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Worker(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` name: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_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\":`#D4D4D4`},children:` *`}),_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:` outpost_id: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_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:` api_url: `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.beta.devinenterprise.com\"`}),_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:` settings: WorkerSettings `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`|`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` None`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--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`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsx(ParamField,{path:`name`,type:`string`,required:true,id:`param-name`,children:_jsx(_components.p,{children:`Durable name for this deployment. It must contain a non-whitespace character.`})}),`\n`,_jsx(ParamField,{path:`outpost_id`,type:`string`,required:true,id:`param-outpost-id`,children:_jsx(_components.p,{children:`Devin Outposts outpost ID.`})}),`\n`,_jsx(ParamField,{path:`api_url`,type:`string`,default:`https://api.beta.devinenterprise.com`,id:`param-api-url`,children:_jsx(_components.p,{children:`Devin API base URL. Credentials, query strings, and fragments are rejected.`})}),`\n`,_jsx(ParamField,{path:`settings`,type:`WorkerSettings | None`,default:`None`,id:`param-settings`,children:_jsxs(_components.p,{children:[`Validated runtime policy. Defaults to `,_jsx(_components.code,{children:`WorkerSettings()`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`worker-from_env`,children:_jsx(_components.code,{children:`Worker.from_env()`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,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:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Worker.from_env(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` name: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_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\":`#D4D4D4`},children:` *`}),_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:` outpost_id: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_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:` api_url: `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.beta.devinenterprise.com\"`}),_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:`) `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`->`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Worker`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Creates a worker whose runtime settings come from `,_jsx(_components.code,{children:`MODAL_DEVIN_*`}),` environment\nvariables.`]}),`\n`,_jsx(Heading,{level:`2`,id:`properties`,children:`Properties`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Property`}),_jsx(_components.th,{children:`Meaning`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`name`})}),_jsx(_components.td,{children:`Original deployment name`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`app_name`})}),_jsx(_components.td,{children:`Conventional generated Modal application name`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`settings`})}),_jsxs(_components.td,{children:[`Validated `,_jsx(_components.code,{children:`WorkerSettings`}),` value`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`session_function_timeout_seconds`})}),_jsx(_components.td,{children:`Minimum safe timeout for the session function`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`controller_image`,children:_jsx(_components.code,{children:`controller_image()`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,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:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`worker.controller_image(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, python_version: `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"3.12\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`->`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modal.Image`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Returns the image used by the generated scheduler. Most applications should leave it\nunchanged.`}),`\n`,_jsx(Heading,{level:`2`,id:`base_image`,children:_jsx(_components.code,{children:`base_image()`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,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:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`worker.base_image(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_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:` python_version: `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"3.12\"`}),_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:` install_ffmpeg: `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`bool`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` install_chrome: `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`bool`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`->`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modal.Image`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Returns the customizable image for new session workspaces. It includes the Devin CLI,\ncommon system tools, and `,_jsx(_components.code,{children:`/root/workspace`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`prepare_image`,children:_jsx(_components.code,{children:`prepare_image()`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,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:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`worker.prepare_image(image: modal.Image) `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`->`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modal.Image`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Finishes a customized workspace image. Call it once after every custom image\noperation, and keep the generated application wiring unchanged.`}),`\n`,_jsx(Heading,{level:`2`,id:`run_session`,children:_jsx(_components.code,{children:`run_session()`})}),`\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:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`worker.run_session(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` session_id: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_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\":`#D4D4D4`},children:` *`}),_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:` app: modal.App,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` image: modal.Image,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` **`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sandbox_options,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`->`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Runs one accepted session from workspace startup through worker execution,\nresumability, and cleanup.`}),`\n`,_jsx(ParamField,{path:`session_id`,type:`string`,required:true,id:`param-session-id`,children:_jsx(_components.p,{children:`Devin session ID supplied by the scheduler.`})}),`\n`,_jsx(ParamField,{path:`app`,type:`modal.App`,required:true,id:`param-app`,children:_jsx(_components.p,{children:`Deployed Modal application.`})}),`\n`,_jsx(ParamField,{path:`image`,type:`modal.Image`,required:true,id:`param-image`,children:_jsx(_components.p,{children:`Prepared workspace image for a new session.`})}),`\n`,_jsxs(_components.p,{children:[`Additional supported keywords follow\n`,_jsx(_components.a,{href:`https://modal.com/docs/sdk/py/latest/modal.Sandbox#create`,children:_jsx(_components.code,{children:`modal.Sandbox.create`})}),`,\nincluding resources and region. Positional commands and the managed `,_jsx(_components.code,{children:`timeout`}),`,\n`,_jsx(_components.code,{children:`workdir`}),`, and `,_jsx(_components.code,{children:`readiness_probe`}),` options are rejected.`]}),`\n`,_jsx(_components.p,{children:`The containing function must receive the configured Devin credential.`}),`\n`,_jsx(Heading,{level:`2`,id:`dispatch_pending_sessions`,children:_jsx(_components.code,{children:`dispatch_pending_sessions()`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,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:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`worker.dispatch_pending_sessions(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` spawn_session: Callable[[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`object`}),_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:`) `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`->`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Finds queued sessions for the configured outpost and starts Modal invocations.\nPass the generated session function’s asynchronous spawn method:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,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:`1`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`worker.dispatch_pending_sessions(session.spawn)`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The scheduler function must receive the configured Devin credential and retain the\ngenerated single-container limit.`})]})}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":"Worker reference","description":"Configure one outpost, build its image, and run its Modal entrypoints.","icon":"gears","href":"/reference/worker"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Constructor","slug":"constructor","depth":2,"children":[]},{"title":"Worker.from_env()","slug":"worker-from_env","depth":2,"children":[]},{"title":"Properties","slug":"properties","depth":2,"children":[]},{"title":"controller_image()","slug":"controller_image","depth":2,"children":[]},{"title":"base_image()","slug":"base_image","depth":2,"children":[]},{"title":"prepare_image()","slug":"prepare_image","depth":2,"children":[]},{"title":"run_session()","slug":"run_session","depth":2,"children":[]},{"title":"dispatch_pending_sessions()","slug":"dispatch_pending_sessions","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"modal-devin","siteName":"modal-devin","title":"Worker reference - modal-devin","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-07-17T17:52:57.458Z","originalFileLocation":"reference/worker.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"dark\";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=\"Configure one outpost, build its image, and run its Modal entrypoints.\">\u003cmeta data-mint-head name=\"application-name\" content=\"modal-devin\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/modal-devin/_generated/favicon/apple-touch-icon.png?v=3\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/modal-devin/_generated/favicon/favicon-32x32.png?v=3\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/modal-devin/_generated/favicon/favicon-16x16.png?v=3\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/modal-devin/_generated/favicon/favicon.ico?v=3\">\u003cmeta data-mint-head property=\"og:title\" content=\"Worker reference - modal-devin\">\u003cmeta data-mint-head property=\"og:description\" content=\"Configure one outpost, build its image, and run its Modal entrypoints.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"modal-devin\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://modal-devin.mintlify.app/reference/worker\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://modal-devin.mintlify.site/_mintlify/api/og/v2?division=Reference\u0026amp;title=Worker+reference\u0026amp;description=Configure+one+outpost%2C+build+its+image%2C+and+run+its+Modal+entrypoints.\u0026amp;theme=9778a4187333ca55e5cc3c5c\u0026amp;signature=4977704316c914d0f66983ec7ab4851f02a5e7d90dd62036b61b045cce767c14\">\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=\"Worker reference - modal-devin\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Configure one outpost, build its image, and run its Modal entrypoints.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://modal-devin.mintlify.site/_mintlify/api/og/v2?division=Reference\u0026amp;title=Worker+reference\u0026amp;description=Configure+one+outpost%2C+build+its+image%2C+and+run+its+Modal+entrypoints.\u0026amp;theme=9778a4187333ca55e5cc3c5c\u0026amp;signature=4977704316c914d0f66983ec7ab4851f02a5e7d90dd62036b61b045cce767c14\">\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=\"https://mintlify.s3.us-west-1.amazonaws.com/modal-devin/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"modal-devin\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#09AF58\">\u003clink data-mint-head rel=\"canonical\" href=\"https://modal-devin.mintlify.app/reference/worker\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/reference/worker.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://modal-devin.mintlify.app/#organization\",\"name\":\"modal-devin\",\"url\":\"https://modal-devin.mintlify.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/modal-devin/yMnkiWeaEc6bEsMB/assets/modal-logo-light.svg?fit=max\u0026auto=format\u0026n=yMnkiWeaEc6bEsMB\u0026q=85\u0026s=5dd42ccb917a383d6e67c5458d2376ca\"}},{\"@type\":\"WebSite\",\"@id\":\"https://modal-devin.mintlify.app#website\",\"name\":\"modal-devin\",\"url\":\"https://modal-devin.mintlify.app\",\"publisher\":{\"@id\":\"https://modal-devin.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://modal-devin.mintlify.app/reference/worker#webpage\",\"url\":\"https://modal-devin.mintlify.app/reference/worker\",\"name\":\"Worker reference\",\"description\":\"Configure one outpost, build its image, and run its Modal entrypoints.\",\"dateModified\":\"2026-07-17T17:52:57.458Z\",\"isPartOf\":{\"@id\":\"https://modal-devin.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://modal-devin.mintlify.app/reference/worker#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://modal-devin.mintlify.app/reference/worker#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Reference\",\"item\":\"https://modal-devin.mintlify.app/reference/cli\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Worker reference\",\"item\":\"https://modal-devin.mintlify.app/reference/worker\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://modal-devin.mintlify.app/reference/worker#article\",\"headline\":\"Worker reference\",\"name\":\"Worker reference\",\"description\":\"Configure one outpost, build its image, and run its Modal entrypoints.\",\"url\":\"https://modal-devin.mintlify.app/reference/worker\",\"mainEntityOfPage\":{\"@id\":\"https://modal-devin.mintlify.app/reference/worker#webpage\"},\"dateModified\":\"2026-07-17T17:52:57.458Z\",\"publisher\":{\"@id\":\"https://modal-devin.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://modal-devin.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"modal-devin\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"modal-devin\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/reference/worker.md","siteName":"modal-devin","nav":{"global":null,"groups":[{"group":"Tutorials","icon":"graduation-cap","pages":[{"title":"Create an outpost","icon":"wand-magic-sparkles","href":"/tutorials/create-an-outpost"},{"title":"Customize an outpost","icon":"paintbrush","href":"/tutorials/custom-workspace"}]},{"group":"How-to guides","icon":"screwdriver-wrench","pages":[{"title":"Configure resources and regions","icon":"microchip","href":"/guides/resources-and-regions"},{"title":"Configure runtime behavior","icon":"sliders","href":"/guides/runtime-configuration"},{"title":"Deploy multiple outposts","icon":"boxes-stacked","href":"/guides/multiple-outposts"},{"title":"Operate a deployed worker","icon":"gauge-high","href":"/guides/operate-a-worker"},{"title":"Troubleshoot a deployment","icon":"stethoscope","href":"/guides/troubleshooting"}]},{"group":"Concepts","icon":"lightbulb","pages":[{"title":"How modal-devin works","icon":"diagram-project","href":"/explanation/architecture"},{"title":"Resumability","icon":"clock-rotate-left","href":"/explanation/resumability"},{"title":"Security model","icon":"shield-halved","href":"/explanation/security"},{"title":"Session lifecycle","icon":"route","href":"/explanation/session-lifecycle"},{"title":"Timeouts","icon":"stopwatch","href":"/explanation/timeouts"}]},{"group":"Reference","icon":"book-open","pages":[{"title":"Command-line reference","description":"Complete reference for modal-devin init, deploy, destroy, doctor, and global options.","icon":"terminal","href":"/reference/cli"},{"title":"Worker reference","icon":"gears","href":"/reference/worker"},{"title":"WorkerSettings reference","description":"Runtime policy, environment variables, defaults, and validation.","icon":"sliders","href":"/reference/settings"},{"title":"Image helpers reference","icon":"compact-disc","href":"/reference/images"},{"title":"Exception reference","icon":"triangle-exclamation","href":"/reference/exceptions"},{"title":"Generated application reference","icon":"file-code","href":"/reference/generated-application"}]}]},"basePath":"","title":"Worker reference - modal-devin","deploymentId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","buildId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","dynamics":[],"chunks":[]}