BlogsModalSandboxed Code Execution

Sandboxed Code Execution

Sandboxed Code Execution

25
posts
2024–2026

Modal's platform now supports scaling to millions of concurrent sandboxes, with tens of thousands of sandboxes created per second. This is achieved by rebuilding the core sandbox platform from the ground up, removing central bottlenecks from the control plane, and optimizing container scheduling and startup. The new system utilizes a fleet of horizontally scaled scheduling servers that directly contact workers via RPC, bypassing central datastores in the critical path for sandbox creation. Recent updates include enhanced networking capabilities for sandboxes, allowing secure HTTP and WebSocket connections via Sandbox Connect Tokens, and the integration of Modal Sandboxes into various AI agent and coding platform demos, demonstrating their ability to securely run code at scale and connect to UIs through Modal Tunnels.

2026

Devin Outposts on Modal | Modal Blog

7/21/2026

Introduced `modal-devin`, an open-source integration enabling Devin AI agents to run within Modal Sandboxes as 'Outposts'. This allows Devin to leverage Modal's features like fast cold-starts, custom images, snapshotting, cost-efficient bursting, and large-scale sandbox deployment. The integration provides a `scheduler` and `session` function for managing agent execution, allowing agents to use custom toolchains, persist their state via workspace snapshots, and access specific hardware like GPUs on demand.

Scaling to 1 million concurrent sandboxes in seconds | Modal Blog

7/16/2026

Rebuilt the core sandbox platform to support millions of concurrent sandboxes and tens of thousands of sandbox creations per second. Eliminated central bottlenecks and global coordination from the critical path by implementing a horizontally scalable fleet of scheduling servers that directly communicate with workers via RPC. Workers publish state to Redis streams asynchronously, removing datastores from the critical path of sandbox creation. Optimized container scheduling and startup by simplifying the path to a layer of load balancers that create containers directly on the worker fleet. Addressed issues with the `rtnl` lock in the Linux kernel during high-volume container startup.

Unpacking sandbox startup latency: why started ≠ ready | Modal Blog

6/22/2026

Introduced Readiness Probes as a first-class feature for sandboxes, allowing users to define custom checks (shell commands or TCP ports) to determine when a sandbox is fully initialized and ready for use. This feature is integrated with `sandbox.wait_until_ready()` and provides a new 'ready' event in the dashboard timeline for enhanced observability of the sandbox startup lifecycle. The post also discusses the optimization of perceived latency through warm pools and the use of Directory Snapshots, highlighting how Readiness Probes simplify the management of these warm pools by providing a reliable signal for when a sandbox is truly ready to be handed out.

Product updates: VM Sandboxes, Lower latency routing, RBAC, and more | Modal Blog

6/15/2026

Introduced VM Sandboxes as a new runtime for Sandboxes, offering a full Linux kernel for advanced workloads like eBPF and systemd. Added domain allowlisting for Sandboxes to restrict outbound network connections. Introduced Named Images as the recommended way to handle Image builds in Sandboxes, decoupling image builds from app deployment. Sandbox readiness probes are now generally available. Sandbox Filesystem and Directory Snapshots now support configurable TTLs and timeouts.

Introducing Claude Managed Agents with Modal Sandboxes | Modal Blog

5/19/2026

This post details the integration of Modal Sandboxes with Anthropic's Claude Managed Agents. It highlights how Modal Sandboxes provide a secure and isolated environment for running tool calls within agentic workflows. The post emphasizes Modal's capabilities such as fast startup with custom images (demonstrated with an example of installing ffmpeg, imagemagick, and mediainfo), persistence options (Volumes and various snapshot types), cost-efficient burst pricing, network security (connect tokens), and scalable compute resources (CPU, memory, GPU). It also includes testimonials from Mason AI, DoorDash, and Blend, showcasing the benefits of this integration for enterprise AI agent development.

Building with Modal and the OpenAI Agents SDK | Modal Blog

4/15/2026

This post details the integration of the OpenAI Agents SDK with Modal Sandboxes to build custom agent harnesses. It introduces concepts like `SandboxAgent`, `WorkspaceShellCapability`, `ModalSandboxClientOptions` for GPU attachment, and `SQLiteSession` for stateful interactions. The post also describes advanced patterns like using subagents for higher-order planning and parallelization via a `SubAgentPool` with `asyncio.Future` for non-blocking execution.

Product Updates: Directory Snapshots, GLM-5, billing updates and more | Modal Blog

3/4/2026

Introduced Directory Snapshots for Modal Sandboxes, enabling granular snapshotting and mounting of specific directories. Added a `.detach()` method to `modal.Sandbox` for explicit resource cleanup. The post also highlights the growing use of Sandboxes for coding agents and references a webinar on scaling and productionizing them.

Directory Snapshots: Resumable project state for Sandboxes | Modal Blog

2/24/2026

Introduced Directory Snapshots for Sandboxes, allowing specific directories to be snapshotted and mounted into other Sandboxes. This enables independent lifecycle management of system and application state, facilitates pre-warming Sandboxes with project-specific code, and optimizes file loading by prioritizing snapshot contents.

How Ramp built a full context background coding agent on Modal | Modal Blog

2/19/2026

This post details how Ramp leveraged Modal Sandboxes to build a full-context background coding agent. It highlights the use of filesystem snapshots for near-instant sandbox startup times (under 30 minutes from the last snapshot), the integration of multiple services (Postgres, Redis, Temporal, RabbitMQ, VS Code server, VNC stack with Chromium) within a single sandbox to replicate local development environments, and the use of Modal's distributed primitives (Functions for cron jobs, Dicts for coordination, Queues for routing) to manage hundreds of concurrent sessions. The agent's ability to integrate with Ramp's observability stack (Sentry, Datadog) and CI/CD tools (GitHub, Buildkite) for end-to-end verification is also emphasized.

Product Updates: Modal in AWS & GCP marketplaces, Sandbox improvements, and more | Modal Blog

1/28/2026

Introduced UI updates to improve Sandbox observability, including clearer resource and region details, and a new execution timeline showing each Sandbox's full lifecycle from creation to termination.

2025

Product updates: Updates to Volumes, JS and Go SDKs, and more

10/31/2025

Introduced Sandbox Connect Tokens for secure HTTP and WebSocket connections to Sandboxes using authenticated requests. Highlighted the use of Modal Sandboxes in the 'Modal Vibe' demo for building a scalable AI coding platform, enabling users to prompt an LLM to generate sandboxed web apps that connect to a React UI through Modal Tunnels. Also showcased Meta FAIR's use of Sandboxes for reinforcement learning in their Code World Model, Cognition's Fast Context subagent playground, and Restate's guide on building a durable, serverless coding agent using Sandboxes for execution.

Build an AI coding platform that scales to millions of monthly sessions

9/22/2025

This post demonstrates the scalability of Modal Sandboxes by building and analyzing 'Modal Vibe,' a demo AI coding platform capable of supporting millions of monthly sessions. It details the architecture of a scalable vibe coding platform, highlighting the challenges of managing a large fleet of sandboxes and how Modal addresses these through its fast boot times, high sandbox production rates, and ability to run tens of thousands of sandboxes in parallel. Performance metrics are provided, showing increasing throughput as the number of sandboxes scales from 1 to 1000, with the AI API becoming the bottleneck. The post also references other use cases like Poe and Zencastr to further illustrate the platform's capabilities at scale.

Inside Modal Notebooks: How we built a cloud GPU notebook that boots in seconds

9/16/2025

This post details the engineering behind Modal Notebooks, focusing on the integration of Modal Sandboxes with the Jupyter kernel protocol. Key contributions include the `modal-kernelshim` daemon for translating kernel messages to HTTP, a lazy-loading container filesystem for rapid image startup, and the use of VolumeFS for global, mutable storage. It also describes the implementation of real-time collaboration using Rushlight and Redis Streams, and the integration of LSP (Pyright) and AI completion (Claude 4, Zed's Zeta model) into the editor.

Introducing Notebooks – launch ML experiments with zero cold boots

9/9/2025

Introduces Modal Notebooks, a collaborative environment for high-performance interactive computing powered by GPU-enabled Python kernels that launch in seconds. Key features include <5-second cold-start times on arbitrary container images and hardware up to 256 vCPUs and 8 H100/B200 GPUs, auto-idling and resuming kernels to optimize costs, unified access to Modal Volumes, Secrets, and deployed Functions, and true real-time collaborative editing. The system leverages Modal's content-addressed FUSE filesystem for fast image loading and integrates with language server protocol (LSP) for enhanced developer experience.

Product updates: GPU memory snapshots, notebooks, service tokens, and more

8/11/2025

Introduced named Sandboxes for improved resource management and added .name property and .info() method to modal.Dict, modal.Queue, modal.Volume, and modal.Secret objects.

What is an AI code sandbox?

7/24/2025

This post introduces the concept of AI code sandboxes and details their importance in the context of LLM-generated code. It explains the underlying technologies like gVisor for isolation, and discusses key features such as fast cold starts, strong isolation, elastic scaling, and dynamic runtime environments. It also outlines various use cases including background coding agents, code reviews, LLM code interpreters, reinforcement learning, and AI-generated apps. While it mentions Modal as a vendor, the primary focus is on the concept and implementation of AI code sandboxes.

How Modal powered 250,000 Lovable app creations in a weekend

7/7/2025

This post details how Lovable utilized Modal Sandboxes to scale their application generation service, handling over 1 million sandboxes and up to 20,000 concurrent sandboxes during a promotional weekend. It highlights the reliability and scalability of Modal Sandboxes, contrasting it with Lovable's previous provider and their own build-vs-buy considerations. The post also mentions the use of Modal's Tunnels for secure communication within sandboxes and hints at future use of sandbox snapshotting for performance gains.

How Quora uses Modal to run thousands of Python sandboxes simultaneously

6/30/2025

This post details how Quora integrated Modal Sandboxes into their Poe AI chatbot platform to securely execute LLM-generated code. It highlights Quora's requirements for security, low latency, and reliability, and explains how Modal's existing Sandbox product met these needs without extensive in-house development. The post emphasizes the benefits of Modal's custom container stack (built on gVisor), fast scalability (tested up to 1000 Sandboxes/sec), and networking primitives (Tunnels, IP allowlisting) as key enablers for Quora's use case.

Modal Sandboxes are generally available

1/21/2025

This post announces the general availability of Modal Sandboxes, a feature for safely running untrusted code. It details the motivation behind building Sandboxes (agentic systems, user-provided code), provides code examples for basic execution, dynamic dependency installation, and filesystem snapshots. It also highlights customer use cases and performance metrics like 1000 Sandboxes per second throughput.

Product updates: L40Ss, proxy auth tokens, and sandbox disk snapshotting

1/21/2025

Introduced a Filesystem API for Sandboxes to seamlessly read and write files, and added disk snapshotting capabilities to create, branch, and restore Sandbox states, eliminating cold-start times. Sandboxes also now support `fsnotify-like` file watching and accept larger write payloads up to 1 GiB.

2024

Beat GPT-4o at Python by searching with 100 dumb LLaMAs

8/5/2024

This post details the use of Modal Sandboxes to evaluate LLM-generated Python code against the HumanEval dataset. It highlights how Sandboxes provide the necessary secure isolation for executing arbitrary code and running tests, enabling the assessment of LLM performance in code generation tasks. The experiment demonstrates scaling evaluation to thousands of tests in parallel, showcasing the robustness of the Sandboxed Code Execution feature for complex benchmarking scenarios.

Competitive prompt engineering

7/3/2024

This post details the use of Modal Sandboxes to securely execute untrusted LLM-generated code in the context of a competitive programming event (Prompt Olympics). It highlights the security benefits of sandboxes for handling potentially malicious code, such as `sudo rm -rf /` or zip bombs, and demonstrates their application in a coding challenge where participants used LLMs to write code that needed to be executed and tested in a safe environment.

Run GPU jobs from Airflow with Modal

6/20/2024

Introduces a custom Airflow ModalOperator that leverages Modal Sandboxes to execute Python functions within Airflow DAGs. This operator allows for dynamic configuration of compute resources, including GPUs, and provides a mechanism to pass Python functions as strings for execution. It also demonstrates passing data between Airflow tasks and Modal Sandboxes using Modal Dicts or file mounts.

How Hunch supercharged AI workflows with Modal Sandboxes

5/23/2024

This post introduces and details Modal Sandboxes, a new feature for secure and scalable code execution. It explains the challenges of running untrusted code, highlights the benefits of Sandboxes (security, performance, scalability, simplicity, flexibility), and provides a Python code example demonstrating how to spawn a Sandbox, install dependencies, execute code, and manage output and generated files. The post also showcases user examples of how Hunch leverages Sandboxes for AI workflows.

Product updates: Cloud buckets, Okta SSO & more

5/7/2024

Sandboxes now support writing to stdin, allowing for interactive input into sandboxed environments.