← Back to Blog
Header image for blog post: Best sandbox runners for AI agents and code execution in 2026
Deborah Emeni
Published 21st September 2026

Best sandbox runners for AI agents and code execution in 2026

TL;DR: Best sandbox runners in 2026

Sandbox runners provide isolated environments for AI agents, user-submitted code, and untrusted scripts. The best choice depends on startup speed, concurrent capacity, isolation, and what needs to persist between tasks.

  1. Northflank: Best for AI agent sandbox execution at high concurrency. A fit for teams that want fast, isolated sandboxes for AI-generated code, with thousands of concurrent sessions and custom environments for coding agents, APIs, scripts, and GPU tasks.
  2. E2B: Best for agent execution workflows with reusable state. A fit for teams that need SDK-based execution, pause and resume, and saved workspace state between tasks.
  3. Modal: Best for programmatic sandbox execution with GPUs. A fit for teams configuring custom environments for code execution and compute-intensive agent tasks.
  4. Fly.io Sprites: Best for persistent agent workspaces. A fit for teams that want installed tools and project files to survive inactivity, with filesystem checkpoints for rollback.
  5. Vercel Sandbox: Best for sandbox execution in Vercel applications. A fit for teams that want SDK-managed microVMs, configurable sessions, and snapshots within their existing Vercel workflow.
  6. Cloudflare Sandbox: Best for sandbox execution from Workers. A fit for teams building agents with Cloudflare Workers that need command execution, file operations, and application previews.
  7. CodeSandbox: Best for cloned environments and parallel agent tasks. A fit for teams that want reusable development environments with snapshots, cloning, and hibernation.

Follow the Northflank sandbox quickstart to run your first task, get started on Northflank, or talk to an engineer about your sandbox workload.

Sandbox runners cover a wider range of tools than most comparisons acknowledge, from browser-based execution environments to production-grade microVM platforms running at scale.

This article compares the best sandbox runners in 2026 across isolation model, persistence, bring your own cloud (BYOC) support, GPU access, startup speed, and concurrency, so you can match the right one to your use case.

What is a sandbox runner?

A sandbox runner is an isolated execution environment that limits what running code can access on your host system, in other tenants, or in production infrastructure. The isolation boundary determines the security model: standard Linux containers share the host kernel and rely on namespace separation, while microVMs and VM-based runtimes such as Firecracker and Kata Containers give each workload a dedicated kernel, and gVisor intercepts system calls in user space to reduce the kernel attack surface.

Sandbox runners are used for AI agent code execution, user-submitted scripts, code interpretation, and any workload where you cannot trust the code being run. See what is a sandbox environment? and what is an AI sandbox? for deeper breakdowns.

What should you look for in a sandbox runner?

The evaluation criteria depend on your workload, but these questions are worth working through before committing to a platform:

  • What isolation model does it use? Containers, gVisor, and microVMs offer meaningfully different security guarantees. For untrusted code at scale, microVM-level isolation provides a dedicated kernel per workload. See Kata Containers vs Firecracker vs gVisor for a technical breakdown.
  • Does it support both ephemeral and persistent environments? Ephemeral environments handle stateless, short-lived execution. Persistent environments let agents maintain state across sessions without rebuilding from scratch. Check whether persistence includes files, process memory, or both.
  • Can it deploy inside your own infrastructure? If workloads cannot leave your network for compliance or data residency reasons, check whether bring your own cloud (BYOC) is available self-serve or only on an enterprise plan requiring a sales process.
  • How quickly can it run your workload at scale? Check sandbox startup time, concurrency limits, and creation-rate limits. Confirm that custom environments can run your coding agents, scripts, generated APIs, and test suites.
  • Does it support GPU workloads? Not all sandbox runners include GPU access. Confirm this is available within the same platform if your workloads require it.
  • Does it meet your compliance requirements? Check SOC 2 reports, data handling, and any contractual requirements for regulated workloads.

What are the best sandbox runners in 2026?

Each platform below takes a different approach to sandbox execution. Here is what they provide and where they fit.

1. Northflank: Best for AI agent sandbox execution at high concurrency

Northflank provides isolated sandbox environments for AI agents and code execution, with fast startup and support for thousands of concurrent sessions. Run coding agents, scripts, generated APIs, repository builds, and GPU tasks in custom environments, with persistent files when work needs to continue across sessions.

northflank-sandbox-page.png

Key capabilities:

  • Fast startup and high concurrency: Sub-second sandbox boot times on Northflank Cloud, with support for thousands of concurrent sessions.
  • Workload isolation: Managed CPU sandboxes use microVMs, while GPU sandboxes use gVisor. On your own infrastructure, supported runtime options include Kata Containers, Firecracker, and gVisor, depending on the deployment.
  • Ephemeral and persistent environments: Run short-lived tasks or retain files on attached volumes, with no fixed session time limit.
  • Custom environments: Use container images with the languages, dependencies, and tools your agent needs to execute code, test an API, or run a build.
  • Deployment options: Use Northflank's managed cloud or self-serve bring your own cloud (BYOC). Northflank acts as the control plane to run coding agents and their sandboxes in your virtual private cloud (VPC), with a supported isolation runtime configured in your cluster.
  • GPU execution: Run GPU tasks in sandboxes with on-demand NVIDIA H100, A100, L4, and other GPU options.
  • Programmatic control: Create sandboxes, execute commands, manage files, and clean up environments through APIs and SDKs.
  • Multi-tenancy: Create separate execution environments for users, agents, or jobs.
  • Security: Northflank is SOC 2 Type II and HIPAA compliant, with Business Associate Agreements (BAAs) supported under Enterprise contracts.

Pricing: $0.01667/vCPU-hour, $0.00833/GB-hour, with H100 GPU plans at $2.74/hour all-inclusive (CPU and RAM included). The free developer Sandbox tier includes always-on compute with no sleeping, two free services, one database, and two cron jobs for development and testing. Pay-as-you-go offers self-service CPU and GPU workloads, per-second billing, no seat-based fees, and autoscaling. Enterprise plans offer custom pricing, volume discounts, 24/7 support, service-level agreements (SLAs), single sign-on (SSO), and audit logs. See the full pricing details for additional GPU options and compute plans.

Northflank is a strong fit when you need fast sandbox execution, thousands of concurrent agent sessions, custom environments, and persistent files for long-running work.

Next steps:

2. E2B

E2B supports AI-generated code execution through Python and JavaScript SDKs, with pause and resume for reusable agent workspaces.

Key capabilities:

  • Isolation: Isolated Linux VMs created on demand via API
  • Pause and resume: Normal pause preserves filesystem and memory; filesystem-only pause keeps files but reboots on resume
  • Retention: Paused sandboxes retained indefinitely with no automatic deletion
  • Session limits: 24 hours on Pro and 1 hour on Hobby, with longer Enterprise options
  • Automatic resume: AutoResume for automatically resuming paused sandboxes when configured
  • Snapshots: Snapshots for saving and restoring sandbox state
  • Execution access: Command execution, interactive terminals, and access to services running inside the sandbox
  • Integrations: Git integration and cloud storage bucket connectivity
  • Deployment: Bring your own cloud (BYOC) available on Enterprise for AWS, GCP, and Azure (requires contacting sales)

3. Modal

Modal is a serverless compute platform with a sandbox interface for executing untrusted or dynamically defined code.

Key capabilities:

  • Isolation: gVisor-based sandbox isolation, with CPU-only VM Sandboxes also available in beta
  • Custom environments: Sandbox environments defined and spawned at runtime with custom container images
  • Session limits: Sandbox timeouts configurable up to 24 hours, with Filesystem Snapshots for longer workflows
  • GPU execution: GPU access configurable per sandbox
  • Networking: Tunnels for direct external connections and granular egress network policies
  • Persistence: Filesystem snapshots for state preservation and restoration
  • SDKs: Python SDK (primary), JavaScript and Go SDKs
  • Deployment: No bring your own cloud (BYOC) deployment option

4. Fly.io Sprites

Sprites are persistent, hardware-isolated Linux environments built on Fly.io's infrastructure.

Key capabilities:

  • Isolation: Firecracker microVM isolation per Sprite
  • Persistent storage: Persistent 100 GB filesystem with a local cache backed by durable object storage
  • Idle billing: Automatic idle behaviour: compute charges stop when idle, filesystem is preserved
  • Idle states: Warm and cold idle states preserve files; running processes and memory are not preserved
  • Checkpoints: Copy-on-write filesystem checkpoints for restoring disk state without capturing process memory
  • Application access: Unique HTTPS URL per Sprite for exposing services or APIs
  • SDKs: CLI plus JavaScript, Go, and Python SDKs
  • Deployment: No bring your own cloud (BYOC)

5. Vercel Sandbox

Vercel Sandbox provides on-demand, isolated microVM environments for running untrusted code, tightly integrated with Vercel's deployment infrastructure.

Key capabilities:

  • Isolation: Firecracker microVM isolation
  • Custom environments: Managed Linux images and custom container images for your runtime and dependencies
  • Session limits: 5 minutes default, up to 45 minutes on Hobby, up to 24 hours on Pro and Enterprise
  • Persistence: Filesystem snapshots and persistent drives for retaining data between sessions
  • Resources: Up to 8 vCPUs and 16GB RAM on Pro, up to 32 vCPUs and 64GB RAM on Enterprise (2GB RAM per vCPU)
  • Billing: Active CPU billing, with provisioned memory, storage, and other usage metered separately
  • SDKs: TypeScript and Python SDKs, CLI
  • Deployment: Runs on Vercel's infrastructure only, no bring your own cloud (BYOC)

6. Cloudflare Sandbox

Cloudflare Sandbox provides isolated Linux container environments for running untrusted code, built on Cloudflare Containers and Durable Objects. It is available on the Workers Paid plan, with a Sandbox SDK 1.0 preview alongside the stable SDK.

Key capabilities:

  • Isolation: Isolated Linux containers, with each sandbox running in its own VM
  • Lifecycle: State is maintained while the container is active; state resets after inactivity (10 minutes by default, configurable)
  • Code interpreter: Python and Node.js code interpreter with persistent execution contexts while active
  • Nested containers: Docker-in-Docker support
  • Application previews: Preview URLs via automatic subdomain routing
  • Streaming: WebSocket support for real-time streaming
  • Terminal access: Browser terminal access
  • Persistence: S3-compatible object storage mounting (R2, S3, GCS) for persistence across sessions
  • SDK: TypeScript SDK
  • Integrations: Integrates with Cloudflare Workers, R2, KV, and Workers AI
  • Deployment: No bring your own cloud (BYOC)

7. CodeSandbox

CodeSandbox, now part of Together AI, provides microVM-based sandbox environments for AI agents, code interpretation, and developer workflows.

Key capabilities:

  • Isolation: MicroVM infrastructure with snapshot and restore
  • Reusable environments: VM snapshots and cloning for reusable environments
  • Persistence: Sandbox state persistence across sessions via snapshots
  • Hibernation: Customisable hibernation periods
  • SDK: CodeSandbox SDK for programmatic sandbox management
  • Workloads: Supports AI agents, development environments, code interpretation, and CI/CD
  • Deployment: No bring your own cloud (BYOC)

Which sandbox runner fits your use case?

The right platform depends on your primary requirement. Use the table below to narrow down your options.

If you need...Consider...
VM-isolated sandboxes for AI agents with self-serve bring your own cloud (BYOC)Northflank
Ephemeral and persistent AI agent sandboxes with no fixed session time limitNorthflank
Fast sandbox execution for AI-generated code and agent workloads at high concurrencyNorthflank
On-demand GPU execution in sandboxes for AI workloadsNorthflank, Modal
AI sandbox execution on a SOC 2 Type II compliant platform with self-serve bring your own cloud (BYOC)Northflank
API-driven sandbox execution with pause, resume, and AutoResumeE2B
gVisor-based isolation with runtime-defined environments and GPU accessModal
Persistent Linux environments with automatic idle behaviour and checkpointingFly.io Sprites
Firecracker microVM execution within the Vercel ecosystemVercel Sandbox
VM-isolated containers integrated with Cloudflare WorkersCloudflare Sandbox
MicroVM sandboxes with snapshot and restore for AI agents and code playgroundsCodeSandbox

How do sandbox runners compare on pricing?

Pricing checked in September 2026. Hourly equivalents are rounded where needed; Vercel rates shown are for its default region. Billing models differ across platforms (some bill based on active CPU usage only, others bill for the entire duration the sandbox is running). Verify current rates on each platform's pricing page before making cost decisions.

PlatformCPUMemoryStorageGPUBilling model
Northflank$0.01667/vCPU-hr$0.00833/GB-hr$0.15/GB-monthL4: $0.80/hr, A100 40GB: $1.42/hr, A100 80GB: $1.76/hr, H100: $2.74/hrPer second
Fly.io Sprites$0.07/CPU-hr$0.04375/GB-hr$0.000683/GB-hr hot; $0.000027/GB-hr coldDo not provide GPU computeActual usage, metered hourly; idle compute is free, retained storage is billed
Cloudflare Sandbox$0.072/vCPU-hr$0.009/GiB-hr$0.000252/GB-hrDo not provide GPU computeActive CPU; memory and disk provisioned. Requires $5/month Workers Paid plan; Workers and Durable Objects usage also billed
CodeSandboxPico VM: $0.075/hour (1 core)2 GB included in starting VM tier20 GB per VM on standard plansDo not provide GPU computeVM credits; prices before subscription savings
E2B$0.0504/vCPU-hr$0.0162/GiB-hr10–20GB included freeDo not provide GPU computePer second
Modal Sandboxes$0.1419/physical core-hr (2 vCPU)$0.0240/GiB-hr—L4: $0.80/hr, A100 40GB: $2.10/hr, A100 80GB: $2.50/hr, H100: $3.95/hr, H200: $4.54/hrPer second
Vercel Sandbox$0.128/vCPU-hr$0.0212/GB-hr$0.08/GB-month (snapshots)Do not provide GPU computeActive CPU; provisioned memory and other usage metered separately

Billing units differ: CodeSandbox includes CPU and RAM in its VM price, while Modal charges per physical core (two vCPUs).

Fly.io Sprites pricing update: From October 1, 2026, CPU costs $0.03825/CPU-hour and memory costs $0.021875/GB-hour. Storage rates remain unchanged.

Bring your own cloud (BYOC) support across sandbox runners

The table below shows how each platform handles bring your own cloud (BYOC) deployment, which clouds are supported, and whether it requires a sales process.

PlatformBring your own cloud (BYOC) availableClouds supportedAccess modelPricing model
NorthflankYes, fully self-serveAWS, GCP, Azure, and supported Kubernetes infrastructure, including on-premises and bare-metalSelf-serve, enterprise contracts available for larger commits (with bulk discounts)Cloud infrastructure costs plus Northflank management charges
E2BYes, limited and not self-serveAWS, GCP, and AzureNot publicly disclosed, need to contact salesCustom Enterprise pricing plus cloud infrastructure costs
ModalNoManaged only——
Fly.io SpritesNoManaged only——
Vercel SandboxNoManaged only, multiple regions——
Cloudflare SandboxNoManaged only——
CodeSandboxNoManaged only——

FAQ: Common questions about sandbox runners

The questions below cover what engineering teams most commonly ask when evaluating sandbox runners.

What is the difference between a sandbox runner and a development environment?

A sandbox runner is designed to execute arbitrary or untrusted code safely, typically for AI agents, user-submitted scripts, or code interpretation. A development environment is designed for developers to write, run, and iterate on code they own. Some platforms serve both purposes, but the security requirements and isolation models differ significantly between the two use cases.

Which sandbox runners support self-serve bring your own cloud (BYOC)?

Northflank offers self-serve bring your own cloud (BYOC) on supported cloud and Kubernetes infrastructure. It acts as the control plane to run coding agents and their sandboxes in your virtual private cloud (VPC). E2B bring your own cloud (BYOC) is available on Enterprise for AWS, GCP, and Azure and requires contacting their team. Modal, Vercel Sandbox, Cloudflare Sandbox, and Fly.io Sprites run on the vendor's infrastructure only.

Which sandbox runners support persistent environments?

Northflank supports both ephemeral and persistent environments with no forced time limits. Fly.io Sprites maintain a persistent filesystem across sessions with automatic idle behaviour. E2B supports persistent state via pause and resume, with session limits that depend on the plan. CodeSandbox supports persistence through snapshots and hibernation. Modal supports snapshot-based state preservation. Cloudflare Sandbox local state resets when its container stops; mounted object storage or backups can preserve files. Vercel Sandbox sessions run up to 24 hours on Pro and Enterprise with snapshotting available.

Which sandbox runners support GPU workloads?

Northflank supports sandboxed GPU workloads with NVIDIA H100, A100, L4, and other GPU options. Modal also provides GPU access configurable per sandbox.

The articles below go deeper on isolation technologies, deployment models, and sandbox infrastructure covered in this guide.

Share this article with your network
X