Infrastructure
AI agents that write and execute code autonomously need infrastructure that can handle untrusted code safely and scale on demand. With the April 2026 launch of native sandbox support in the OpenAI Agents SDK, developers can now choose from seven officially integrated hosted sandbox providers to run agent-generated code in isolated environments. Selecting the right secure sandbox platform determines whether your agents can execute code safely, scale without manual intervention, and access GPU acceleration when workloads require it.

AI agents that write and execute code autonomously need infrastructure that can handle untrusted code safely and scale on demand. With the April 2026 launch of native sandbox support in the OpenAI Agents SDK, developers can now choose from seven officially integrated hosted sandbox providers (Blaxel, Cloudflare, Daytona, E2B, Modal, Runloop, and Vercel) to run agent-generated code in isolated environments, alongside built-in SDK sandbox clients such as Docker and Unix-local environments. Selecting the right secure sandbox platform determines whether your agents can execute code safely, scale without manual intervention, and access GPU acceleration when workloads require it. This guide examines the seven hosted sandbox provider integrations announced for the OpenAI Agents SDK, starting with Modal, a serverless compute platform built for secure code execution at massive scale with on-demand GPU support.
Modal delivers serverless compute purpose-built for AI workloads, offering secure sandboxes that can scale to massive concurrency with on-demand GPU access layered on top. The platform takes your code, containerizes it, and executes it in the cloud with automatic scaling, all defined through a code-defined SDK supporting Python, TypeScript, and Go.
Sandbox.create, and Images are defined through Modal's image APIsModal maintains SOC 2 Type II certification and supports HIPAA-compliant workloads on Enterprise plans via a BAA. The platform uses gVisor-based sandboxing for compute isolation, TLS 1.3 for public APIs, and encryption for data in transit and at rest.
Modal's OpenAI Agents SDK integration uses Modal Sandboxes through the SDK's sandbox tooling. Modal's official guide, Building with Modal and the OpenAI Agents SDK, covers setup, GPU-enabled agent execution, and parallel subagents, referencing SandboxAgent, ShellTool, ModalSandboxSession, and ModalSandboxClientOptions. The platform supports Sandbox state persistence through filesystem snapshots, directory snapshots, memory snapshots, and persistent storage options such as Volumes or CloudBucketMounts.
Best For: Teams building AI agents that need secure code execution at scale, with on-demand GPU access when workloads call for ML inference, model fine-tuning, or compute-intensive analysis.
E2B specializes in cloud development environments for AI agents, focusing on ephemeral code execution with Firecracker microVM isolation. The platform provides an open-source option for teams with specific data sovereignty requirements.
E2B provides the E2BSandboxClient class with four complete code examples in the official documentation, including a fullstack code review example with parallel sandbox workers. The template marketplace offers pre-configured environments for Node.js, Python data science, and other common use cases.
Best For: Teams building coding agents that need MCP integration for external tool connectivity and prefer longer timeouts for complex multi-step workflows.
Cloudflare Sandbox runs on Cloudflare's global edge network, offering low-latency code execution with seamless integration into the Workers ecosystem. The platform provides an official 20-minute tutorial with a deploy button for setup.
Cloudflare provides a streamlined setup flow, including an official 20-minute tutorial with a deploy button. The sandbox bridge Worker architecture enables HTTP access and R2/S3 bucket mounts for persistent data.
Best For: Teams already using Cloudflare services who need global edge distribution for their coding agents.
Daytona provides full-featured cloud development environments with a detailed seven-section integration guide covering basic to advanced patterns.
Daytona's OpenAI Agents guide demonstrates memory consolidation as a background task with phase-1 and phase-2 processing, allowing agents to extract durable facts and preferences into structured files that persist across sessions.
Best For: Teams building agents that require persistent development environments with memory continuity and prefer workspace state that survives interruptions.
Vercel Sandbox provides Firecracker microVM isolation, the same VM technology used by AWS Lambda, for maximum security when running untrusted agent-generated code.
Vercel Sandbox excels for agents building or testing web applications, particularly Next.js projects. The automatic preview URL generation enables human operators to review agent-generated applications before deployment.
Best For: Teams building agents that generate web applications, particularly those working in the Next.js ecosystem who prioritize strong security isolation.
Blaxel offers a sandbox platform built specifically for AI agents, with a focus on persistent "agent computers" that stay on standby and resume quickly when needed.
Blaxel provides three progressive examples, simple agent, data analysis, and coding agent, with clear guidance on file transfer patterns and preview URL handling.
Best For: Teams building coding agents that generate web applications and need preview URL support with diverse template options.
Runloop provides a devbox-based architecture with tunnel networking support, backed by isolated VM-style development environments.
RunloopSandboxClient class provided in the OpenAI Agents SDKRunloop is included in the official SDK providers table and was mentioned in the April 2026 announcement. The platform offers dedicated documentation for devbox management and tunnel configuration.
Best For: Teams with specific networking requirements who prefer a devbox-oriented architecture for sandbox execution.
Modal's architecture is specifically engineered for agentic and machine learning workloads. The platform's custom container runtime, scheduler, and file system are optimized for the unique demands of secure code execution, GPU-accelerated computation, and dynamic scaling that AI agents require.
Modal is the only official OpenAI Agents SDK sandbox provider offering GPU acceleration. While other providers focus exclusively on CPU-based code execution, Modal enables agents to access GPUs on-demand when workloads require ML inference, model fine-tuning, or compute-intensive analysis, a significant differentiator for AI-native applications.
Modal's sandbox infrastructure supports 50,000+ concurrent sessions. Engineered for fast cold starts and faster feedback loops, Modal uses memory snapshotting and an optimized filesystem that helps containers come online quickly without letting large images slow startup down. This combination of scale and startup speed is essential for coding agents handling dynamic workloads where rapid container spin-up directly impacts user experience and agent responsiveness.
With SOC 2 Type II certification, HIPAA-compliant workload support via BAA, and comprehensive security practices including gVisor sandboxing and TLS 1.3, Modal meets the compliance requirements that enterprise AI agent deployments demand.
Modal's code-defined SDK supports Python, TypeScript, and Go, eliminating infrastructure configuration overhead. Functions and classes use decorators, while Sandboxes are created programmatically with Sandbox.create and Images are defined through Modal's image APIs, all without YAML. This approach enables rapid iteration and deployment velocity that configuration-heavy platforms struggle to match.
For teams building AI agents that require secure code execution, production-grade reliability, and on-demand GPU access, Modal's combination of AI-native infrastructure, sandboxed execution at scale, and proven enterprise compliance makes it the clear choice for OpenAI Agents SDK integration.
Explore the Modal documentation to get started.
Explore the Modal documentation to get started building with the OpenAI Agents SDK.
View Modal DocsA code execution sandbox is an isolated environment where AI-generated code runs without access to host systems, other workloads, or sensitive data. For OpenAI Agents that generate and execute code autonomously, sandboxing is critical, it prevents malicious or buggy generated code from causing damage. The OpenAI Agents SDK now provides native sandbox execution in the Python SDK, with TypeScript support planned, giving developers an execution layer without forcing them to piece it together themselves.
Sandbox providers use different isolation technologies to protect data. Modal uses gVisor-based sandboxing where compute jobs are containerized and virtualized, while Vercel and E2B employ Firecracker microVMs for hardware-level isolation. Sandboxing isolates code from host resources and other workloads; however, network access and egress controls vary by provider and should be configured according to your threat model.
For enterprise deployments, look for SOC 2 Type II certification, which validates security controls over time. Modal maintains SOC 2 Type II compliance and supports HIPAA-compliant workloads on Enterprise plans via a BAA. Additional security features to evaluate include encryption in transit and at rest, TLS 1.3 for APIs, and documented vulnerability remediation timeframes by severity. Modal documents Critical at 24 hours, High at 1 week, Medium at 1 month, Low at 3 months, and Informational at 3 months or longer.
Among the seven hosted sandbox provider integrations announced for the OpenAI Agents SDK, Modal is the only one offering GPU support for ML workloads. This enables agents to run inference models, perform fine-tuning, or execute compute-intensive analysis alongside standard code execution, a significant advantage for AI-native applications that need both secure sandboxing and GPU acceleration.
Modal's OpenAI Agents SDK integration uses Modal Sandboxes through the SDK's sandbox tooling, with SandboxAgent, ShellTool, ModalSandboxSession, and ModalSandboxClientOptions, and delivers fast cold starts with support for 50,000+ concurrent sessions. The platform's gVisor isolation secures untrusted code execution, while on-demand GPU access enables agents to run ML workloads. Sandbox state persistence through filesystem snapshots, directory snapshots, memory snapshots, and storage options such as Volumes allows agents to maintain state across sessions, and the code-defined SDK supporting Python, TypeScript, and Go enables rapid development without configuration overhead.
Ephemeral sandboxes spin up for a task and tear down afterward, ideal for stateless code execution. Persistent sandboxes maintain state across sessions. Daytona's OpenAI Agents guide demonstrates a memory capability where durable facts and preferences are persisted in structured files across sessions, while Modal supports Sandbox state persistence through filesystem snapshots, directory snapshots, memory snapshots, and persistent storage options such as Volumes or CloudBucketMounts. The right choice depends on whether your agent needs clean-room execution each time or continuity across workflows.