Skip to main content
sandbox-router is an open-source Python library from Bespoke Labs that gives you one API to run code, shell commands, file transfers and coding agents across sandbox providers. Novita Sandbox is now a supported backend. Switch providers by changing one string — your rollout and evaluation code stays the same.

Install

Hello, sandbox

Sandbox Router terminal output showing Python returning 42, a successful shell command, and a binary file round-trip

Configuration

What you can do

Expose a service

Bind your service to 0.0.0.0 inside the sandbox, then expose the port. Protected services require the Sandbox-Traffic-Access-Token header, which the router returns for you.
Treat the header as a secret. It lives in memory only and is never serialized or logged; requests without it get HTTP 403. Sandbox Router expose_port output showing a service URL, the access header name without its token value, and an HTTP 200 response with Hello from Novita Sandbox

Reconnecting from another process

resume calls the SDK’s connect(sandbox_id). Connecting may extend a running sandbox’s expiry and may wake a paused sandbox. Recovery of paused, deleted or expired sandboxes is not guaranteed.

RL rollouts at scale

The pattern that works: one sandbox per rollout, destroyed when done, with timeout_secs set to your task budget.
  • Pre-bake dependencies into a custom template (with the Code Interpreter runtime) and pass it via template= instead of installing on every rollout.
  • Concurrency is bounded by your account quota.

Current limits

Not supported in this backend today: snapshots, jobs, listing sandboxes, a separate pause/resume API, runtime network policy changes, and generic CPU / RAM / disk / GPU / image mappings. Dockerfiles and restrictive network policies are rejected. allow_internet=False is not mapped to any isolation — do not rely on it to cut network access.
Last modified on November 16, 2026