Modal Sandbox

erikmayEnvironments & CloudNot reviewed by BB
Get it for macOS

Run each bb thread in its own Modal cloud sandbox that snapshots and stops after 15 idle minutes, with or without a project.


Keep agents off your own computer: every thread gets a fresh cloud sandbox in your Modal account, with your project checked out or, for a thread without a project, a personal workspace. When a sandbox sits idle, the plugin saves its filesystem and stops it, and your next message starts it again from that snapshot.

What you get

  • Modal Sandbox in the new-thread environment picker, for a project or for "No project". From the CLI: bb thread spawn --environment-provider modal-sandbox, or modal-sandbox-workspace without a project.
  • A snapshot and stop after 15 idle minutes (configurable, or off). Archiving the last thread on a sandbox removes the sandbox and its snapshots.
  • Sandbox sizes and images in the plugin's settings: CPU and memory presets, the bundled Dockerfile (Node.js, Git, GitHub CLI, Python, pnpm, Claude Code, Codex and Pi), your own Dockerfiles, or existing Modal images. With more than one, the composer shows a picker.
  • bb modal to test the account, build the image, and try it in a 30-minute debug sandbox.

How it works

bb creates the sandbox, installs its daemon there, and connects it back to your bb server. A pause snapshots the filesystem and terminates the sandbox; a resume starts a new sandbox from that snapshot. Modal stops any sandbox after 24 hours, so pause long-running work before then.

If your bb server is reachable only on your tailnet, add a Tailscale OAuth client in the settings. Every sandbox then joins as an ephemeral, tagged node with its own single-use key and leaves the tailnet before it stops.

Requirements

  • A Modal account and API token. Image builds and running sandboxes are billed as Modal usage.
  • A route from the sandbox to your bb server: bb connect, a public server URL, or Tailscale (optional; needs a Tailscale account and an OAuth client).
  • Agent logins on the sandbox, for example bb's Account Pooler or CLAUDE_CODE_OAUTH_TOKEN in Settings → Environment variables.
  • bb 0.51 or later. Disable bb's bundled Modal Sandbox plugin first: both use the same provider ids and the bb modal command.
  • The plugin uses bb's experimental machine provider API, so a bb update can require a plugin update.

More from erikmay

More in Environments & Cloud 26

Create and manage where threads run, locally or in the cloud.

View all