What is a sandbox router?

ComputeSDK team · Published

A sandbox router is a service that sends each request to create a code sandbox to one of several sandbox providers, in an order you choose, such as cheapest first. If a provider fails to create the sandbox, the router tries the next one. Your code calls one API, and the router picks the provider.

AI agents, coding assistants and evaluation pipelines use sandboxes to run code they've generated, isolated from your own infrastructure. A router lets them use many sandbox providers without integrating each one, and keeps new sandboxes starting when one provider is down or out of capacity.

26 providers available today

  • Agent37
  • Archil
  • Beam
  • Blaxel
  • Buddy
  • Cloudflare
  • Daytona
  • E2B
  • Freestyle
  • Isorun
  • Luxor
  • Microsandbox
  • Miosa
  • Modal
  • Mosaic
  • Namespace
  • Novita
  • Railway
  • Sail
  • Sandbox0
  • sfcompute
  • Sprites
  • Superserve
  • Tensorlake
  • Upstash
  • Vercel
See all providers

Not the Kubernetes Sandbox Router

The name is also used for a different component. The Kubernetes SIGs Agent Sandbox project (also used by Agent Sandbox on GKE) includes a "Sandbox Router": a reverse proxy inside one Kubernetes cluster that forwards each request to the right sandbox pod, using a sandbox ID in a request header.

Sandbox router (this page)Kubernetes Sandbox Router
Chooses betweenSandbox providers (E2B, Modal, Daytona, …)Sandbox pods in one cluster
Decides byYour rules: provider order and allowed providersThe sandbox ID on the request
Handles provider failureYes: tries the next providerNo: one cluster, one provider
Where it runsA hosted API in front of the providersInside your Kubernetes cluster

The two can work together: a self-hosted Kubernetes sandbox cluster could be one of the providers a sandbox router chooses between.

How a sandbox router works

  1. You send one request, for example "create a sandbox, size medium". You use one API key and one SDK, CLI or REST call, whichever provider ends up running it.
  2. The router builds an ordered list of providers for that request from your rules: which providers are allowed or excluded, and which sizes are allowed.
  3. It tries the first provider on the list. If the create succeeds, you get the sandbox back, with its ID and the provider that runs it.
  4. If the create fails, it tries the next provider, and so on down the list. If every provider fails, you get one error listing each attempt and why it failed.
  5. You run commands and destroy the sandbox through the same API. The router keeps track of which provider holds each sandbox. A running sandbox stays on that provider; failover only happens when a sandbox is created.
Create requestProvider A: failsProvider B: createsYour sandbox

How the order is chosen

You can narrow the list for a single request: keep only certain providers, or ignore some.

Your own provider keys (optional)

You can also add your own provider API keys. They're tried either first (the default) or as a fallback after ComputeSDK's accounts, and sandboxes on your keys are billed by the provider.

Why use a sandbox router

When you don't need one

Sandbox router vs. the alternatives

ApproachMultiple providersAutomatic failoverOne billYou maintain
Call each provider's SDK directlyOnly by writing each integrationOnly if you build itNoEvery integration
An open-source multi-provider SDKYesOnly if you build itNoKeys, retries, accounting
Kubernetes Sandbox RouterNo (one cluster)Non/aThe cluster
Hosted sandbox routerYesYes, at createYesYour rules

An LLM router (OpenRouter, AI gateways) is the same idea applied to model APIs: one API, many providers, routing and fallback. A sandbox router applies it to the compute that runs agent code.

FAQ

ComputeSDK bills for sandboxes it runs on these providers through the router, and scores every provider with the same public benchmarks. More: Sandboxes docs · provider ratings · how it works