Opt-In Modal Development Tooling and Credential Provisioning in Sandboxes¶
Previously, sandboxes supported --python for runtime virtual environment isolation, while setup scripts and ADR-0005 intentionally prohibited decrypting Modal client credentials (~/.modal.toml) inside sandboxes to prevent container processes from accessing root Modal cloud account infrastructure. However, workflows developing Modal applications, sandboxes, or distributed functions from inside a cloud sandbox require both a Python environment and authenticated Modal CLI/SDK access. We decided to retire --python and replace it with --modal across both standard and VM sandboxes: passing --modal couples Python 3 virtual environment provisioning (with the modal package pre-installed) with SOPS decryption of secrets/modal.toml into ~/.modal.toml. When --modal is omitted, neither Python tooling nor Modal client credentials are provisioned inside the sandbox.
Considered Options¶
- Retain separate
--pythonand introduce independent--modal-creds: Keep--pythonstrictly for the virtual environment and add a second flag for credential decryption. Rejected because running Modal tooling inside the sandbox inherently requires Python, and splitting them introduces redundant flags and partial configuration states where credentials exist without the SDK or vice versa. - Maintain strict credential isolation and prohibit sandbox credentials: Continue refusing to decrypt
secrets/modal.tomlin sandboxes under all circumstances, forcing developers to run Modal commands exclusively from host workstations. Rejected because it blocks self-contained cloud development workflows, meta-sandboxing, and autonomous agent tasks that manage Modal resources. - Unified
--modalflag provisioning both Python environment and credentials: Replace--pythonwith--modalin bothstandard_sandbox/main.pyandvm_sandbox/main.py. When enabled, dynamically install Python 3 system dependencies, provision an isolated.venvwithmodalpre-installed, and decryptsecrets/modal.tomlto~/.modal.toml(mode 0600) viascripts/setup.sh --modal. When omitted, neither credentials nor Python tooling are injected. Accepted because it aligns sandbox capabilities with host workflows, preserves least privilege by default, and maintains flavor parity.
Consequences¶
--pythonis removed fromstandard_sandbox/main.py.--modalis supported in bothstandard_sandbox/main.pyandvm_sandbox/main.py.- In
startup.sh(both standard and VM sandboxes), SOPS bootstrapping triggers ifENABLE_ANTIGRAVITY=1orENABLE_MODAL=1, requiringAGE_PRIVATE_KEYand passing the active flags (--modal,--agy, or both) toscripts/setup.sh. - Sandboxes launched with
--modalhave$TARGET_DIR/.venvprovisioned with themodalPython SDK pre-installed and project dependencies installed fromrequirements.txt. - Sandboxes launched without
--modaldo not provision Python tooling,.venv, or~/.modal.toml. - Inspection utility
/usr/local/bin/check-modalverifies Python,.venv, and Modal authentication status, with/usr/local/bin/check-pythonmaintained as a symlink. - Documentation in
CONTEXT.md,readme.md,standard_sandbox/readme.md, andvm_sandbox/readme.mdis updated to reflect Modal Development Tooling.