Sandboxes
Trusted infrastructure for untrusted agents
High performance sandboxes designed to give agents the computers they need at a scale 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 fast with massively parallel sandboxes that spin up fast.
Any dependency, any image
Programmatically define your exact rollout environment and dependencies.
Egress controls to prevent cheating
Lock each rollout's egress, keeping rollout environments reproducible and contained.
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 save state and resume instantly later.
Secure networking
Lock down domain egress while still giving agents access to the Secrets, data, and tools they need.
Build robust environments
Start from any image, install what you need at runtime, and keep state across a long agent session.
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 fast with massively parallel sandboxes that spin up fast.
Any dependency, any image
Programmatically define your exact rollout environment and dependencies.
Egress controls to prevent cheating
Lock each rollout's egress, keeping rollout environments reproducible and contained.
Engineered for the speed and scale agents require
Scale to a million in under a minute
Modal's infrastructure scales to the parallelism that production agent systems and RL training actually demand.
Fast on any image
Bring your dependencies, your base image, your setup scripts. Sub-second scheduling and strong cold-start performance on custom images
Adaptive provisioning of resources
Elastically scale both CPU and Memory as needed so you never have to worry about under provisioning or over paying.
Modal Sandbox Pricing
Only pay for what you use. Burst up to what you need without over-allocating CPU or memory in advance.
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

Modal Clusters are generally available
Multi-node GPU clusters with RDMA, gang scheduled from Modal's shared capacity pool and billed by the second, behind a single decorator.

VM Sandboxes: Full computers for agents
VM Sandboxes are built for those who need to give their agents the power of a full computer.

Runtime Roundup: VM Sandboxes, Multi-node clusters, and more
Everything announced live at Modal's inaugural conference, Runtime.

