the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

Create Runloop blueprint lazily with defaults

Attempt devbox creation first; if it fails, log a warning and create
the blueprint with default launch parameters: 2 CPU cores, 4 GB RAM,
10 GB disk, and user "modal" with uid 4444

+27 -9
+27 -9
apps/modal-sandbox/src/providers/runloop/index.ts
··· 132 132 bearerToken: options.runloopApiKey, 133 133 }); 134 134 135 - await sdk.blueprint.create({ 136 - name: templateName, 137 - dockerfile: `FROM ${image}`, 138 - }); 139 - 140 - const sandbox = await sdk.devbox.create({ 141 - blueprint_name: templateName, 142 - }); 143 - return new RunloopSandbox(sandbox); 135 + try { 136 + const sandbox = await sdk.devbox.create({ 137 + blueprint_name: templateName, 138 + }); 139 + return new RunloopSandbox(sandbox); 140 + } catch (error) { 141 + consola.warn( 142 + `Runloop blueprint ${templateName} not found, creating a new one...`, 143 + ); 144 + await sdk.blueprint.create({ 145 + name: templateName, 146 + dockerfile: `FROM ${image}`, 147 + launch_parameters: { 148 + custom_cpu_cores: 2, 149 + custom_gb_memory: 4, 150 + custom_disk_size: 10, 151 + user_parameters: { 152 + username: "modal", 153 + uid: 4444, 154 + }, 155 + }, 156 + }); 157 + const sandbox = await sdk.devbox.create({ 158 + blueprint_name: templateName, 159 + }); 160 + return new RunloopSandbox(sandbox); 161 + } 144 162 } 145 163 146 164 async get(id: string, options?: SandboxOptions): Promise<BaseSandbox> {