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
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 between | Sandbox providers (E2B, Modal, Daytona, …) | Sandbox pods in one cluster |
| Decides by | Your rules: provider order and allowed providers | The sandbox ID on the request |
| Handles provider failure | Yes: tries the next provider | No: one cluster, one provider |
| Where it runs | A hosted API in front of the providers | Inside 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
- 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.
- 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.
- 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.
- 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.
- 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.
How the order is chosen
- Recommended: ComputeSDK's recommended order, ranked by ComputeSDK's benchmark results and price (the default).
- Cheapest: providers ranked by hourly price for the size you asked for, worked out per request.
- Custom: your own order.
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
- Fewer failed creates. When a provider has an incident or runs out of capacity, new sandboxes are created on the next provider instead of failing. Provider uptime, measured every few minutes.
- One integration instead of many. Each provider has its own SDK, auth, sizes and lifecycle; the router puts them behind one API.
- Price control. Cheapest-first ordering puts the lowest hourly price for your size first, across providers that bill differently.
- No lock-in. Switching or adding a provider is a settings change, not a migration.
When you don't need one
- You depend on one provider's distinctive features, such as a specific GPU, a persistent workspace model or a custom image format. Call that provider directly.
- You run one sandbox now and then. Failover and price ordering matter at volume.
- You already run your own sandbox cluster and never need another provider.
Sandbox router vs. the alternatives
| Approach | Multiple providers | Automatic failover | One bill | You maintain |
|---|---|---|---|---|
| Call each provider's SDK directly | Only by writing each integration | Only if you build it | No | Every integration |
| An open-source multi-provider SDK | Yes | Only if you build it | No | Keys, retries, accounting |
| Kubernetes Sandbox Router | No (one cluster) | No | n/a | The cluster |
| Hosted sandbox router | Yes | Yes, at create | Yes | Your 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