Portaldocs

Modal

Connect a Modal workspace so Portal can run jobs in Modal sandboxes, with or without a GPU.

Warnings and limits

  • Modal can preempt GPU sandboxes, with about 5 s of notice. That is often too short to save a checkpoint, and a job whose checkpoint cannot finish in time can lose its work.
  • A sandbox runs at most 24 hours. Portal checkpoints and suspends a job 30 minutes before that.
  • A sandbox's memory is limited at 1.5 times what the job asks for (--mem): Modal lets a sandbox use more than its request, billed beyond Portal's estimate, and the limit keeps that to at most half the request again. A job that grows past the limit is checkpointed and suspended, not killed; raise --mem to avoid the pause. The plan, the quote and the job's first event say the limit.
  • Sandbox CPU and memory are priced at Modal's sandbox rate, 3 times its list price; GPUs at the list price. Pinning a region multiplies the price by 1.15 (us, eu or ap) or 1.75 (a narrower region).
  • The CLI as installed cannot run portal connect modal --from-cli: it lacks the Modal SDK. Connect from the console or a file.
  • A GPU sandbox is created only once Modal has capacity for it. A job pinned to one GPU type gives up after 5 minutes and ends no_capacity, with Modal's other GPU types to choose (the 3 cheapest, with prices); with other offers to try, Modal gets 3 minutes. Modal's L4 pool is scarce (direct creates took 4 to 17 minutes on launch day) while T4, A10 and A10G start at once as a rule. A GPU job's events say what it waits for every minute.
  • The job's environment is a Modal image, built on the first run of each set of requirements: 30 minutes at most for the requirements and 10 for Portal's own layer. A build that fails is built once more afresh; a second failure ends the job with uv's reason.
  • A sandbox holds at most 8 GPUs; a quote for more is refused. A sandbox holds its lease (1 hour ahead, 90 minutes at first) against your connection's cap, not its whole 24 hours.
  • Without a region, Modal places a sandbox anywhere (a T4 landed in ap-southeast between US jobs on 2026-10-31), so a move of a large state can pause longer. Pin region=us, eu or ap when that matters, at the 1.15 premium.

Connect

Create a token on modal.com, then add it on the console's Connect page: the token ID, the token secret, and optionally the Modal environment. Left empty, the connection uses Modal's default environment, main, and the saved connection says so; name another environment of the workspace to use that one instead.

From the CLI, put the token in a file only you can read:

MODAL_TOKEN_ID=ak-...
MODAL_TOKEN_SECRET=as-...
portal connect modal --file modal.env

The secret is sealed on Portal's side and never shown again.

What a job runs on

Each job gets a Modal sandbox sized to what it asked for: CPU in quarter cores, memory in GiB, and optionally a GPU. Its memory is a request with a limit of 1.5 times it, which Modal enforces; Portal stops the job's allocations just below the limit, so running out pauses the job for a checkpoint instead of Modal ending it.

GPUs
NVIDIA T4, L4, A10, L40S, A100 40 GB, A100 80 GB, H100, H200, B200

The sandbox's image holds your project's requirements on Python 3.12 (or the version your project asks for), with PyTorch's CUDA 12.6 build on GPU sandboxes.

Preemption and lifetime

Modal may preempt a GPU sandbox. It sends a signal first, and Portal's node takes it as a notice with 5 s to act. CPU sandboxes are not preempted.

Modal ends every sandbox at its timeout, at most 24 hours after it started. Portal's lifetime policy checkpoints and suspends the job 30 minutes before, so you can resume it in a new sandbox. See What Portal does on its own.

Your Modal plan

Your Modal plan (starter, team or enterprise) sets the data transfer allowance in Portal's cost estimates. An Owner sets it in the console's Settings (modal_plan, starter by default).

On this page