Sandboxes
Trusted infrastructure for untrusted agents
Designed to give agents the computers they need at the scale, speed, and reliability they demand.
Computers for agents.
Reinforcement learning rollouts
import modalapp = modal.App("code-rl-reward")@app.function()def compute_reward(completion: str, testcase: list[str]) -> int: code = get_generated_code_and_test_cases(completion, testcase) # Each rollout gets its own isolated, disposable sandbox sb = modal.Sandbox.create(app=app) score = 0 try: p = sb.exec("python", "-c", code, timeout=30) p.wait() score = 1 if p.returncode == 0 else 0 # reward = did the code run? finally: sb.terminate() return score SANDBOXES
1M+ in parallel
Rollouts that scale fast without slowing down your workflow.
Get started1M+ sandboxes in under a minute
Keep your GPUs saturated and rollouts moving with startup that stays fast at scale.
On-demand access to GPUs
Full support for GPU Sandboxes, including RDMA-enabled GPUs, with a few lines of code.
One provider, Sandboxes and training
Built-in training solutions to support the full RL process beyond Sandboxes.
Coding Agents
import modalapp = modal.App.lookup("coding-agent", create_if_missing=True)sandbox = modal.Sandbox.create(app=app)try: code = agent.generate_code("Calculate the first 20 Fibonacci numbers") result = sandbox.exec("python", "-c", code, timeout=30) agent.process_result(result)finally: sandbox.terminate() SANDBOX
Started
Environment
agent.py - tools.py
Image
Resources
Volumes
Task
Executing untrusted code
python / workspace / agent.py
The fast, reliable computer your coding agent needs to do its best work.
Get startedFast startup on any image
Snapshot full or partial filesystems to start large, custom images in under a second.
Secure networking
Lock down domain egress while still giving agents access to the Secrets, data, and tools they need.
Integrated inference platform
Power agents with open-weight models from Modal's shared, dedicated, or custom endpoints.
import modalapp = modal.App("code-rl-reward")@app.function()def compute_reward(completion: str, testcase: list[str]) -> int: code = get_generated_code_and_test_cases(completion, testcase) # Each rollout gets its own isolated, disposable sandbox sb = modal.Sandbox.create(app=app) score = 0 try: p = sb.exec("python", "-c", code, timeout=30) p.wait() score = 1 if p.returncode == 0 else 0 # reward = did the code run? finally: sb.terminate() return score SANDBOXES
1M+ in parallel
Rollouts that scale fast without slowing down your workflow.
Get started1M+ sandboxes in under a minute
Keep your GPUs saturated and rollouts moving with startup that stays fast at scale.
On-demand access to GPUs
Full support for GPU Sandboxes, including RDMA-enabled GPUs, with a few lines of code.
One provider, Sandboxes and training
Built-in training solutions to support the full RL process beyond Sandboxes.
Engineered for the scale, flexibility, and speed agents require
Scale to a million in under a minute
Modal's infrastructure scales to the concurrency that production agent systems demand with no performance degradation under load.
Elastic CPU and memory resourcing
Automatically “burst” CPU or memory, increasing resource efficiency, saving money, and reducing the risk of out-of-memory errors.
Sub-second starts on custom images
Bring your dependencies, your base image, your setup scripts. Sub-second cold-starts even on custom and large images.
Active-resource Sandbox pricing
Reserve for your baseline, burst up to your peak. Modal charges the max of what you reserve and what you use, so you can avoid over-provisioning CPU and memory.
Compute costs
CPU
Physical core (2 vCPU equivalent)
$0.1419 / core / h
*minimum of 0.125 cores per container
Memory
$0.0240 / GiB / h
“Modal powers both our reinforcement learning infrastructure and production inference. Millions of sandboxes on one end, real-time serving on the other.”
“We use Sandboxes to power Coding Sessions, which allows users to delegate and iterate on issues with their coding agent by tagging @Linear.”
“It would have been really hard to build Inspect without Modal. A lot of the complexity is hidden behind just being able to spin up sandboxes very quickly with a lot of services and data, and effectively have infinite of them at any given time.”
Latest updates

Sandbox resourcing: burst, don't reserve
Why you're paying for capacity you aren't using, and how to pay only for what you use.

Modal becomes a gVisor maintainer
Modal runs upwards of 40 million gVisor containers every day. Here's why we bet on it, what we've built into it, and where we want to take it next.

How Snorkel runs realistic agent simulations with Modal
Modal powers inference for the open-weight models that Snorkel is evaluating as well as GPU and CPU sandboxes for millions of simulations per month.
Frequently asked questions
-
Concurrency is determined by pricing tier. Starter comes with 100 concurrent containers, Team with 5,000, and Enterprise with custom limits. Modal's scheduling infrastructure is tested with over one million concurrent Sandboxes.
-
Modal Sandboxes start in under one second. They've also been designed to stay fast in production environments and under load. Modal Sandboxes are fast on large, custom images. They can also sustain fast creation rates of over 10,000 a second with no degradation.
-
Modal Sandboxes have flexible CPU and memory resourcing. If a Sandbox requires more resources than originally provisioned, it can “burst” to use more resources. Users are charged the max of their resource request and their actual resource usage, per second.
Bursting is automatic and enables you to request fewer resources and increase your Sandbox's resource efficiency.
-
Because Modal Sandboxes can use additional memory and CPU resources as needed, you are able to request fewer resources than you would with most other providers. We recommend using the default resource request if you are getting started.
-
Sandboxes bill max(request, actual) by the second. Modal Sandboxes are billed the way they are because of bursting, where an individual Sandbox can use additional CPU and memory resources as needed.
Modal Sandboxes are priced at the same rate as non-preemptible Functions (3x the Function list price).
-
While most competitors bill based on a user's resource request, Modal bills based on the max of the user's request and their actual usage. In practice, this Active-resource billing model means that users can provision less memory and CPU and increase their resource efficiency.
Modal customers have saved over 20% because they are able to unlock cost-efficiency through usage-based pricing.
-
Because Modal Sandboxes are billed based on active resources, you should estimate total cost differently than you would with other Sandbox providers who charge based on fixed reservations. For CPU, you can estimate by calculating: Sandbox duration × rate × average CPU cores used. For memory, you can estimate by calculating: Sandbox duration × rate × average GiB used.
It's important to use the average resource consumption instead of the peak because Modal Sandboxes are charged based on the max(request, usage). For most Modal Sandboxes, the guidance is to not request any resources, defaulting to a small reservation of 0.125 cores and 128 MiB of memory. Modal Sandboxes are designed to burst above their reservation as needed. Since Sandboxes typically have bursty resource consumption, the difference between peak usage and average usage can be significant. Calculating the price of Modal Sandboxes by using peak resource consumption will usually significantly overestimate the total cost.
