I recommend transitioning from Inspect Modal Sandbox to Inspect Sandboxes or that new projects use Inspect Sandboxes instead.
Existing Inspect Modal Sandbox users can continue using it but should be aware of this transition.
This plugin for Inspect allows you to use containers as sandboxes, running within Modal.
Add this using Poetry
poetry add git+ssh://git@github.com/anthonyduong9/inspect_modal_sandbox.git
or in uv,
uv add git+ssh://git@github.com/anthonyduong9/inspect_modal_sandbox.git
This plugin requires a Modal account. Sign up at modal.com.
Authenticate the Modal CLI:
pip install modal
python3 -m modal setupYou can configure the eval using either a Docker Compose file, or by specifying a Dockerfile path.
By default, the provider uses Modal's default Debian-based image with Python 3.11.
The services key is required. All other options are optional.
services:
default:
image: python:3.12
build:
context: .
dockerfile: Dockerfile
working_dir: /app
environment:
MY_VAR: "value"
mem_limit: 1g
cpus: 2.0
x-inspect_modal_sandbox:
timeout: 3600
idle_timeout: 300
block_network: false
cidr_allowlist:
- "0.0.0.0/0"
cloud: aws
region: us-east-1As an alternative to Docker Compose you can specify a Dockerfile path directly, e.g.
sandbox=("modal", "path/to/Dockerfile")- User switching: The
userparameter inexec()is ignored. Commands run as the container's default user (root). - Root execution: Modal containers run as root by default.
See CONTRIBUTING.md