DeepInfra raises $107M Series B to scale the inference cloud — read the announcement

DeepInfra · Sandboxes

A safe place
for agents
to run code.

A sandbox is an isolated Linux microVM: a small virtual machine with its own kernel. Start one with a single API call, on our image or any public container image. Run bash or Python in it, and move files in and out. From $0.054 per hour, billed by the second.

The nano plan · 1 vCPU · 1 GB RAM

$0.054/ hour

Billed by the second, no minimum

$0while a sandbox is stopped
7 plansup to 8 vCPU and 32 GB RAM
50active sandboxes per account
7 daysto restart a stopped sandbox

The whole lifecycle in a few lines

Create a sandbox, run code, move files, then stop or delete it. No Dockerfile, no orchestrator, no fleet to look after.

  1. 01

    Create

    Sandbox.create() returns once the microVM is running. Pick a plan, an idle timeout and, if you need one, your own image.

  2. 02

    Run

    exec() runs any command and run_python() runs Python. Each result has stdout, stderr and a return code.

  3. 03

    Move files

    fs.write() and fs.read() move files in and out of /workspace, up to 100 MiB per call.

  4. 04

    Stop or terminate

    stop() frees the compute and keeps /workspace. terminate() deletes the sandbox.

Python · pip install deepinfra

from deepinfra import Sandbox

sb = Sandbox.create(plan="small", timeout="10m")  # blocks until running

r = sb.exec("bash", "-c", "pip install pandas")
print(r.stdout, r.stderr, r.returncode)

out = sb.run_python("print(21 * 2)").check()  # raises on a non-zero exit
print(out.stdout)  # "42"

sb.fs.write("/workspace/in.csv", b"a,b\n1,2\n")
data = sb.fs.read("/workspace/in.csv")

sb.stop()       # frees compute, keeps /workspace
sb.start()      # /workspace is back, the rest is reset
sb.terminate()  # deletes the sandbox and /workspace

Built for code you did not write

For coding agents, code interpreters, data pipelines and eval harnesses that run untrusted code.

Its own kernel, not a shared container

Every sandbox boots as its own microVM on Kata Containers and QEMU/KVM, with its own kernel and a virtualized hardware boundary. It is not a slice of a host shared with other tenants.

Our image or yours

The default image is Ubuntu with Python, Node.js, git and build tools, and it starts from a warm pool in about a second. Pass image to run any public container image instead, from Docker Hub, GHCR, Quay and the other supported registries.

A scriptable API

Run bash or Python, read and write files, and get typed errors to branch on. Use the Python or TypeScript SDK, or call the HTTP API directly, with the same API key you use for inference.

Stop now, resume later

stop() frees the compute and keeps /workspace. start() brings it back within 7 days. A stopped sandbox costs nothing.

Many at once

Every network method has an async twin, such as acreate and aexec, so running dozens of sandboxes is a plain asyncio program. Up to 50 can be active per account.

A locked-down network

A sandbox can reach the public internet, so pip install works. It accepts no inbound connections and cannot reach other sandboxes.

Plans and pricing

Billed by the second with no minimum. A stopped sandbox costs nothing.

Sandbox plans and hourly prices
PlanvCPURAMDiskPer hour
nano11 GB5 GB$0.054
small22 GB10 GB$0.107
medium24 GB20 GB$0.134
large48 GB40 GB$0.268
xlarge416 GB40 GB$0.375
2xlarge816 GB40 GB$0.536
4xlarge832 GB40 GB$0.750

Disk is the size of /workspace. The rest of the filesystem has 20 GB of its own on every plan. A sandbox gets the small plan when you name none. The same catalog is in the dashboard and at GET /v1/sandboxes/catalog.

Images, isolation, lifetime and limits

The numbers to plan around. The docs cover each one in detail.

Images

Default image

Ubuntu with Python, Node.js, git and build tools

Custom image

Any public linux/amd64 image with /bin/sh

Image size

Up to 4 GiB compressed · 20 GB unpacked

Start

About a second on the default image

Isolation

Runtime

Kata Containers on QEMU/KVM

Kernel

One per sandbox

Inbound connections

None

Internet access

1 Gbit/s down · 200 Mbit/s up

Lifetime

Idle timeout

1 hour by default · set per sandbox

Longest continuous run

24 hours, then it stops

Stopped sandbox kept for

7 days

Command timeout

60 s by default · up to 30 min

Limits

Active sandboxes

50 per account

File transfer

100 MiB per call

/workspace disk

5 to 40 GB, by plan

Rest of the filesystem

20 GB on every plan

Common questions

What to know before you run code in a sandbox.

What is a sandbox?

An isolated Linux microVM that you create with one API call. You run commands and Python in it, move files in and out, and stop or delete it when you are done. It is built for agents and pipelines that run untrusted code.

How is a sandbox billed?

By the second with no minimum, at the hourly rate of its plan, from $0.054 per hour for nano. Billing runs while a sandbox is creating, starting, running or stopping. A stopped sandbox costs nothing.

Can I use my own image?

Yes. Pass image when you create the sandbox, with any public linux/amd64 container image that contains /bin/sh, up to 4 GiB compressed. Docker Hub, ghcr.io, quay.io, gcr.io, public.ecr.aws, mcr.microsoft.com and nvcr.io are supported. The tag is pinned to its digest at create, so a later start runs the same image. Common images start in 6 to 20 seconds. Private images are not supported.

How much disk does a sandbox have?

Two disks. /workspace is 5 to 40 GB, by plan, and it is the only part that survives a stop. Everything outside /workspace shares 20 GB on every plan, so apt and pip can install anywhere. Filling that disk makes writes fail, and the sandbox keeps running.

What happens to my data when I stop a sandbox?

Everything under /workspace is kept and comes back when you start the sandbox again. The rest is reset, because start() boots a fresh container from the sandbox's image: installed packages, environment changes, /tmp and /root are gone.

How long does a sandbox live?

Three clocks apply. It stops after its idle timeout, 1 hour by default, and a running command counts as activity. It stops after 24 hours of continuous running. Once stopped, it is deleted after 7 days unless you start it again.

Which API key works with sandboxes?

A key that has the compute:sandbox scope, or an unrestricted key. A scoped key without that scope cannot create or use sandboxes. You set a key's scopes under API keys in the dashboard.

What happens if a sandbox crashes?

It moves to the failed state and is deleted within about 5 minutes, and /workspace is not kept. Only a clean stop() guarantees that your data survives, so write anything you want to keep to external storage.

Run your first sandbox

Install the SDK, set DEEPINFRA_API_KEY to the key you use for inference, and create a sandbox. It runs code a few lines later.

Need an agent that stays on? See hosted agents.