Skip to content
Agents tracked: 504 Releases (7d): 602 Agent status: no reported issuesSince last limit reset: Claude 13d · Codex 11d For AI agents: Markdown Updated Nov 24, 2026

Modal Sandboxes

by Modal Labs

Safe cloud boxes to run untrusted code.

Code sandboxes

WebsitePricingGitHub

1. Price

Free tier: Starter: $30/month of free compute, no monthly fee. As reported on the official pricing page, checked Nov 1, 2026.

modal.com/pricing

Checked against the maker's official pages, pricing on Nov 1, 2026. Tap a verdict to see its source.How we checkedReport an error

What Modal Sandboxes does

Modal Sandboxes are short-lived, locked-down computers in the cloud where your app runs code it does not trust, such as code written by an AI assistant or uploaded by users. If that code breaks something, only the sandbox is affected. You pay per second for the processor and memory it actually uses.

  • Modal Sandboxes is one of 12 APIs in the Code sandboxes category on AgentGid.
  • Its cheapest paid plan ($250 a month) is the 7th cheapest of the 9 here with a monthly plan.
  • It is one of 11 that can be started for free.
  • 4 of them ship an official MCP server; Modal Sandboxes does not.
  • Its official SDK is the 1st most downloaded in the category (12.7M a week).

What people build with it

Run code your AI assistant wrote

Let a chatbot or coding agent run the Python it just wrote and read the result, without risking your own server.

Run code your users submit

Run homework, coding-challenge answers or user plugins in a box with no internet and a time limit, so a bad script cannot leak data or run forever.

Hand files in and out

Upload a spreadsheet or a project into the sandbox, let the code work on it, and read the results back.

Live preview of an app an agent built

Start a small web server inside the sandbox and open it through a private link, so you can try what the agent made.

Save a ready setup and reuse it

Install the tools once, save the sandbox's state, and start every new session from that saved copy so it begins faster.

Grade many AI attempts at once Idea

Run hundreds of copies of the same task side by side to test or score an AI model's answers, each in its own clean box.

Modal Sandboxes popularity

12M
SDK downloads a week
+8.1% on the 4-week average
24
public agent repos use its SDK
539
GitHub stars, modal-labs/modal-client
SDK downloads per weeknpm modal, pypi modal 12,000,739

SDK downloads from npm and PyPI, weekly. Numbers as of Nov 17, 2026.

Pricing

Free tier

Starter: $30/month of free compute, no monthly fee

Cheapest plan

$250 a month

Usage price

Sandbox CPU $0.00003942 per physical core (2 vCPU) per second; memory $0.00000667 per GiB per second

Plans

Minimum 0.125 cores per container. Team plan $250/month + compute includes $100/month credits. Since 2026-09-01, Shared Endpoint tokens are billed from the first request even on Starter. No vendor MCP server found; third-party ones exist.

What one action costs

ActionPrice
1 physical CPU core (2 vCPU) for 1 second in a sandbox$0.00003942
1 GiB of memory for 1 second in a sandbox$0.00000667
Team plan for a month (plus compute; includes $100 of credits)$250
Price history
  • A year of the pricing page in the Internet Archive (14 months): the lowest monthly figure went from $30 (2025-10) to $30 (2026-11).

As reported on the official pricing page, checked Nov 1, 2026. Prices change: confirm before you buy. modal.com/pricing

Limits

All plans

A sandbox lives 5 minutes by default and at most 24 hours

Starter

100 containers and 10 GPUs at the same time, 3 seats

Team

5,000 containers and 50 GPUs at the same time

All plans

At least 0.125 CPU cores and 128 MiB of memory are billed per sandbox

Starter / Team

Logs are kept 1 day on Starter and 30 days on Team

From the official docs. modal.com/docs/guide/sandboxes.md

Key and access

How it signs in

A Modal API token pair (token ID and token secret), created with modal setup in a browser or in the workspace settings.

Environment variable
MODAL_TOKEN_ID and MODAL_TOKEN_SECRET (or ~/.modal.toml written by modal token set)
Safe in browser code
No, keep it on your server
Card at sign-up

Not stated on the pages we read

Steps only a person can do

  • Sign up for Modal and connect the machine with modal setup (opens a browser), or create a token in the workspace settings. Put MODAL_TOKEN_ID and MODAL_TOKEN_SECRET in the server environment (kept out of git) for the modal package to read.
  • Set a workspace budget so runaway sandboxes cannot run up a large bill. No code change; also set timeout and resource limits on every Sandbox.create.
  • Decide whether to install Modal's agent skill or the standalone command-line tool from its install script. If yes, the person runs it; the agent uses pip install modal at a pinned version inside the project's virtual environment.

Commercial use and your data

Modal is a paid online service with free monthly credits; its client libraries are open source under Apache-2.0. You may run your users' code through your product, but not resell or give others direct access to Modal.

In a paid app
With conditions

You may run your users' or agents' code through your own product, but not rent, resell or give third parties direct access to Modal, and not process prohibited content.

“rent, resell or otherwise allow any third party direct access to or use of the Service” source

inside-app-bundle
Yes

The modal client packages (Python and JavaScript) are Apache-2.0; keep the license notice when you ship them.

“"license":"Apache-2.0"” source

Trains on what you send

Not stated as allowed; the terms give Modal a license to customer data only as needed to provide the service.

Keeps your data

Sandbox logs are kept 1 day on Starter and 30 days on Team; sandbox memory snapshots 7 days; filesystem snapshots 30 days by default.

Where data is stored

Requests are routed through us-east (Virginia) by default; choosing a container region costs 1.15 to 1.75 times the base price.

Errors to handle

modal.exception.AuthError

The token is missing or invalid.

Set MODAL_TOKEN_ID and MODAL_TOKEN_SECRET (or run modal token info to check the saved token).

modal.exception.SandboxTimeoutError

The sandbox ran past its timeout (5 minutes unless you set one).

Pass a longer timeout to Sandbox.create (up to 24 hours) or split the work.

modal.exception.ExecTimeoutError

One command run with exec took longer than its own timeout.

Raise the timeout on sb.exec, or stop the command and report it to the user.

modal.exception.ResourceExhaustedError

A quota or rate limit was hit, for example too many containers at once for your plan.

Retry later with backoff, run fewer sandboxes at once, or move to a plan with higher limits.

exit code 137

The sandbox or process was killed (terminated, or out of memory).

Check sb.returncode and the dashboard's exit reason; raise the memory request if it ran out of memory.

Use it from an agent

Our agent check

4 of 6: llms.txt yes, OpenAPI no, SDK yes, MCP no, status page yes, AI assistants allowed yes

Checked Nov 13, 2026.

MCP server

Community servers only

npm
npm install modal
PyPI
pip install modal

Instructions in its docs to check first

The docs say

“Read https://modal.com/docs/guide/getting-started.md and walk me through Modal setup.”

A ready prompt for coding agents; the setup needs a Modal account and a browser sign-in, which only the person can do.

The docs say

“modal skills install # [--claude] [--global]”

Ask the person first; with --global it installs an agent skill for every project on the machine.

The docs say

“curl -LsSf uvx.sh/modal/install.sh | sh”

Ask the person first; it runs a downloaded install script. Prefer pip install modal at a pinned version in the project's virtual environment.

Alternatives

Modal Sandboxes This page

from $0.00000667 per GiB perFree tier

E2B

Pick E2B for sandboxes built only for AI agents, on small virtual machines that start in under a second.

Free (open source)Free tierOfficial MCP

Vercel Sandbox

Pick Vercel Sandbox when your app already runs on Vercel and you want short-lived Linux machines next to it.

from $0.0212 per GB-hourFree tierOfficial MCP

Daytona

Pick Daytona when you need fast-starting sandboxes with Windows or GPU options, billed per second.

from $0.000108 per GiB-hour afterFree tierOfficial MCP

All code sandboxes APIs

Get started

Tell your AI assistant

“Run AI-generated code in a Modal Sandbox with modal 1.6.3: read MODAL_TOKEN_ID and MODAL_TOKEN_SECRET from the server environment, create the sandbox with block_network=True, a timeout and a memory limit, and never pass my secrets into it.”

  1. Create a Modal account (an account is required), then install the Python package.

    pip install modal

    From modal.com/docs/guide/getting-started.md

  2. Connect your computer to your account; this opens a browser to sign in and saves a token.

    modal setup

    From modal.com/docs/guide/getting-started.md

  3. Create a sandbox, run a command in it and read the output.

    sb_app = modal.App.lookup("my-app", create_if_missing=True)
    sb = modal.Sandbox.create(app=sb_app)
    
    p = sb.exec("python", "-c", "print('hello')", timeout=3)
    print(p.stdout.read())
    

    From modal.com/docs/guide/sandboxes.md

First request

sb_app comes from modal.App.lookup("my-app", create_if_missing=True), as in the first example of the guide.

sb = modal.Sandbox.create(app=sb_app)

# Read returncode of individual process
p = sb.exec("sh", "-c", "exit 42")
p.wait()
print(p.returncode) # 42

# Read returncode of finished sandbox
# Terminate sends a SIGKILL, code 137
sb.terminate(wait=True)
print(sb.returncode) # 137

Mistakes to avoid

Leaving the default network open for code written by an AI or a user.
Create the sandbox with block_network=True, or allow only the needed sites with outbound_domain_allowlist.

By default sandboxes can reach any public address, so bad code could send data out.

Passing your API keys or Modal secrets into the sandbox that runs untrusted code.
Keep secrets on your server and give the sandbox only the files it needs.

Modal's shared responsibility model puts keeping credentials out of untrusted workloads on you.

Setting large cpu and memory requests "to be safe".
Leave them unset (bursting covers most loads) and set limits to cap runaway code.

Requested resources are billed for the sandbox's whole life, even when idle.

Expecting a sandbox to keep running for a long agent session without a timeout.
Pass timeout= (up to 24 hours) and an idle_timeout, and snapshot state you want to keep.

The default lifetime is 5 minutes.

Catching the built-in TimeoutError around a readiness probe.
Catch modal.exception.TimeoutError.

Modal raises its own error class, which a bare except TimeoutError does not catch.

Questions

Is there a free plan?

Yes, the Starter plan has no monthly fee and includes $30 of compute a month; you pay only above that.

Can code in the sandbox reach my other Modal resources or the internet?

It cannot reach your Modal resources or accept incoming connections by default, but it can reach the internet unless you block or limit it.

Can I use it from JavaScript?

Yes, the modal package on npm runs sandboxes from server-side Node.js 22+, Deno or Bun.

How do I keep costs down?

Do not set a resource request unless you need guaranteed capacity; you then pay only for what the sandbox uses, and you can set a workspace budget.

Do sandboxes get GPUs?

Yes, with the gVisor runtime; GPU sandboxes can be interrupted, unlike CPU ones.