Skip to content

Modal

The modal Provider connects offrig directly to Modal Sandboxes over gRPC (https://api.modal.com:443) and Modal’s per-task Task Command Router—zero user-deployed cloud services, zero SSH setup, and full 3-layer Snapshot support on both x86_64 and aarch64.

offrig resolves Modal credentials locally as a strict (token_id, token_secret) pair in three tiers:

  1. Explicit [rigs.<name>].token_id and [rigs.<name>].token_secret (env, file, or cmd SecretResolver sources)
  2. MODAL_TOKEN_ID and MODAL_TOKEN_SECRET environment variables
  3. Existing ~/.modal.toml profiles created by modal setup ($MODAL_CONFIG_PATH, [rigs.<name>].profile, MODAL_PROFILE, or the active profile)
Terminal window
# Uses existing ~/.modal.toml or MODAL_TOKEN_ID / MODAL_TOKEN_SECRET
offrig rig add modal --provider modal --default
# GPU Rig with ordered fallback (user-local only)
offrig rig add ml --provider modal \
--app offrig-ml \
--gpu H100 \
--gpu A100-80GB \
--idle-minutes 5
# KVM microVM Rig with Docker-in-Docker (`run.docker = "dind"`)
offrig rig add modal-dind --provider modal \
--runtime vm \
--idle-minutes 10
[rigs.modal]
provider = "modal"
app = "offrig" # <= 51 chars; catalog Volume is `offrig-state-<app>`
modal_environment = "main" # optional Modal workspace environment
# profile = "work" # optional ~/.modal.toml profile
runtime = "gvisor" # gvisor (default) | vm (enables dind; forbids gpu)
# gpu = ["H100", "A100-80GB"] # optional single string or ordered fallback list
# regions = ["us-east"] # optional Modal scheduler region hints
arch = "x86_64" # x86_64 | aarch64
# snapshot_ttl_days = 0 # 0 / omitted = no expiry
idle_minutes = 5 # default 5 min; max 1440 (24h); 0 disables idle stop
# Optional explicit credential pair (defaults to MODAL_TOKEN_* -> ~/.modal.toml)
# [rigs.modal.token_id]
# env = "MODAL_TOKEN_ID"
# [rigs.modal.token_secret]
# env = "MODAL_TOKEN_SECRET"
  • Elastic or pinned compute: Leaving [resources].cpu and [resources].memory_mib unset lets Modal burst elastically from its minimum floor. Setting explicit cpu (1..=64) or memory_mib (64..=344064) pins both reservation and ceiling (cpu maps 1:1 to nproc). Explicit disk_mib is rejected because Modal fixes Sandbox rootfs at 512 GiB.
  • Runtimes & nested Docker: runtime = "gvisor" (default) supports GPUs and sets supports_dind = false. runtime = "vm" boots a Modal KVM microVM supporting stock dockerd (run.docker = "dind") and forbids gpu. run.docker = "host" is unsupported.
  • Safe client-orchestrated idle stop: Defaults to idle_minutes = 5. While your laptop is awake, the Local daemon runs offrigd secret-scan, captures a Layer-2 filesystem snapshot, re-checks for concurrent activity, and terminates the Modal Sandbox to stop billing. On a secret leak during automated idle stop, the snapshot is skipped, a sticky dev.offrig.last_stop_warning is recorded, and the Sandbox is still terminated; explicit offrig sandbox stop and offrig sandbox resize abort fail-closed and leave the Sandbox running.
  • Cross-laptop inventory: Base, Deps, and Saved Snapshots (names 1..=51 chars) are published as Modal Named Images; persistent Sandbox state lives in an unmounted Modal Volume v2 (offrig-state-<app>, never mounted inside any Sandbox).
  • Custom images & Dockerfiles: Supports curated Ubuntu 24.04, [env].image, and self-contained or multi-stage [env].dockerfile (COPY --from=). Local build-context COPY/ADD is not yet supported on Modal.
Terminal window
offrig rig doctor modal