# Modal Sandboxes — card for AI agents

Serverless isolated containers for coding agents and untrusted code, with GPUs available.

Maker: Modal Labs · category: Code sandboxes

## Price (official page)
- Free tier: Starter: $30/month of free compute, no monthly fee
- Free tier terms: free allowance · monthly (read from the wording above and the pricing page; empty = not stated)
- Paid from $250/month
- Usage price: Sandbox CPU $0.00003942 per physical core (2 vCPU) per second; memory $0.00000667 per GiB per second
- Pricing page: https://modal.com/pricing (checked 2026-10-09)
- Note: 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.

## Connect
- npm: `npm install modal`
- PyPI: `pip install modal`
- Repository: https://github.com/modal-labs/modal-client

## For AI agents on Modal Labs's own site (AgentGid check 2026-11-13: 4 of 6)
- llms.txt: https://modal.com/llms.txt (full text: https://modal.com/llms-full.txt)
- Docs pages as Markdown: 99% of the pages llms.txt lists
- OpenAPI description: none found at the usual places
- Official MCP server: no · official SDK: yes · status page: yes
- robots.txt lets AI assistants (ChatGPT-User, Claude-User) read the site: yes

## A year of price history (Internet Archive copies of the pricing page, read by rules)
- Months read: 14 (2025-10 to 2026-11) of https://modal.com/pricing
- Lowest $/month figure on the page: $30 in 2025-10, $30 in 2026-11
- A figure is any "$X/month" on the page (plans, seats and add-ons alike); open the archived copy to see which plan it is.

## Price history in AgentGid's catalog (since 2026-10-09)
- Changes recorded: 0 (a vendor price change or an editor's correction; the evidence archive keeps the pricing page of each date)

## Other APIs in this category
- Vercel Sandbox: https://agentgid.com/apis/vercel-sandbox/agent.md
- E2B: https://agentgid.com/apis/e2b/agent.md
- Daytona: https://agentgid.com/apis/daytona/agent.md
- CodeSandbox SDK: https://agentgid.com/apis/codesandbox-sdk/agent.md
- Riza: https://agentgid.com/apis/riza/agent.md

## Links
- AgentGid page: https://agentgid.com/apis/modal-sandboxes/


## Modal Sandboxes: safe cloud boxes to run untrusted code

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.

### Where to use 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: 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. (idea, not from the official pages)

### How to start
- Create a Modal account (an account is required), then install the Python package.

```
pip install modal
```

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

```
modal setup
```

- 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())
```


### License
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.

### Good to know
- You need a Modal account and a token. The free Starter plan includes $30 of compute each month.
- Sandboxes cost about three times the normal processor and memory price, because they are never interrupted.
- By default code in a sandbox can reach any site on the internet; block it or allow only the sites it needs.
- A sandbox stops after 5 minutes unless you give it a longer limit, at most 24 hours.
- Modal's hosted AI models are billed from the first use, even inside the free credits; only compute is covered.

Checked 2026-11-10 against: https://modal.com, https://modal.com/pricing, https://modal.com/llms.txt, https://modal.com/docs/guide/intro.md, https://modal.com/docs/guide/getting-started.md, https://modal.com/docs/guide/sandboxes, https://modal.com/docs/guide/sandboxes.md, https://modal.com/docs/guide/sandbox-resources.md, https://modal.com/docs/guide/sandbox-networking.md, https://modal.com/docs/guide/sandbox-files.md, https://modal.com/docs/guide/sandbox-snapshots.md, https://modal.com/docs/guide/sandbox-spawn, https://modal.com/docs/guide/tunnels.md, https://modal.com/docs/guide/security.md, https://modal.com/docs/guide/region-selection.md, https://modal.com/docs/guide/data-residency.md, https://modal.com/docs/guide/billing.md, https://modal.com/docs/sdk/py/latest/exception.md, https://modal.com/docs/sdk/py/latest/config.md, https://modal.com/docs/sdk/js/latest.md, https://modal.com/docs/sdk/js/latest/Errors.md, https://modal.com/legal/terms, https://modal.com/legal/privacy-policy, https://pypi.org/pypi/modal/1.6.3/json, https://registry.npmjs.org/modal/0.11.1

### Mistakes to avoid
- Don't: Leaving the default network open for code written by an AI or a user. → Do: 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.)
- Don't: Passing your API keys or Modal secrets into the sandbox that runs untrusted code. → Do: 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.)
- Don't: Setting large cpu and memory requests "to be safe". → Do: 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.)
- Don't: Expecting a sandbox to keep running for a long agent session without a timeout. → Do: Pass timeout= (up to 24 hours) and an idle_timeout, and snapshot state you want to keep. (The default lifetime is 5 minutes.)
- Don't: Catching the built-in TimeoutError around a readiness probe. → Do: 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.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
