> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fibre.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Sizes and what is installed

> The four sandbox sizes with their CPU, memory, disk and price; what Fibre's default image has installed; how to install more, and how to bring your own image.

Before you run your first real workload, two questions come up: **how big should the sandbox be, and what is
already installed in it?** This page answers both, and shows how to add anything that is missing.

## Sizes

A sandbox's size decides how much CPU, memory and disk it gets. Bigger sizes do heavy work faster, and cost more
per hour while they are awake:

| Size | vCPU | Memory | Disk | Per awake hour | Good for |
| - | - | - | - | - | - |
| `xsmall` | 1 | 2 GB | 10 GB | \$0.0075 | An agent framework's tool calls, bots and webhooks, a small code interpreter |
| `small` (the default) | 2 | 4 GB | 10 GB | \$0.015 | Scripts, a code interpreter, most single agents |
| `medium` | 4 | 8 GB | 20 GB | \$0.030 | A coding agent on a real repo, a dev server, a browser |
| `large` | 8 | 16 GB | 40 GB | \$0.060 | Builds, test suites, Docker Compose stacks |
| `xlarge` | 16 | 32 GB | 80 GB | \$0.165 | Heavy compiles, data work, many containers |

You are billed per second while the sandbox is awake, and nothing for compute while it sleeps. Both runtimes cost
the same. To choose a size, pass it when you create the sandbox, then check what you got:

```bash title="CLI" run theme={null}
SBX=$(fibre create --size medium --lifetime 10m --label docs=sizes --json | jq -r .id)
fibre exec "$SBX" -- 'nproc && free -g && df -h /'   # 4 cores, 8 GB of memory, a 20 GB disk
```

```typescript title="TypeScript" run theme={null}
import { Sandbox } from "@fibre-dev/sdk";

const sbx = await Sandbox.create({ size: "medium", lifetime: 600, labels: { docs: "sizes" } });
const cpu = await sbx.run("nproc && free -g | awk '/Mem:/ {print $2 \" GB\"}' && df -h / | awk 'NR==2 {print $2}'");
console.log(cpu.stdout); // 4 · 8 GB · 20G
```

```python title="Python" run theme={null}
from fibre import Sandbox

sbx = Sandbox.create(size="medium", lifetime=600, labels={"docs": "sizes"})
cpu = sbx.run("nproc && free -g | awk '/Mem:/ {print $2 \" GB\"}' && df -h / | awk 'NR==2 {print $2}'")
print(cpu.stdout)  # 4 · 8 GB · 20G
```

```bash title="curl" run capture=SBX=.id theme={null}
curl -sS -X POST "$FIBRE_API_URL/v1/sandboxes" \
  -H "Authorization: Bearer $FIBRE_API_KEY" -H "Content-Type: application/json" \
  -d '{"size": "medium", "lifetime_sec": 600, "labels": {"docs": "sizes"}}'
```

> [accordion] Response
>
> ```json title="response" expected theme={null}
> {
>   "id": "…",
>   "status": "running",
>   "cpu_cores": 4,
>   "memory_mb": 8192,
>   "disk_gb": 20
> }
> ```

> [!TIP]
>
> **Start small and grow if you need to.** Since a sleeping sandbox costs nothing for compute, the size only matters for the
> work it does while awake. If you notice an agent's builds running out of memory, create its next sandbox one size
> up.

### An exact amount

If none of the sizes fits, you can ask for an exact amount instead: `cpu_cores` (from 0.25 to 16) and `memory_mb`
(from 256 to 32768). The sandbox is then billed as the smallest size that covers both. For example, 3 cores and
6 GB is billed as `medium`.

## What the default image has

If you do not choose an image, the sandbox starts from Fibre's default image. It is Debian Linux, with the tools an
agent usually reaches for first already installed:

| | |
| - | - |
| **Languages** | Python 3.11 (`python3`, `python`, `pip`, `venv`), Node.js 22 (`node`, `npm`, `npx`) |
| **Tools** | `git`, `curl`, `bash`, and the usual Linux commands |
| **Browser** | Chromium, with Playwright and ChromeDriver, ready for [browser automation](https://docs.fibre.dev/connect/browser.md) |
| **User** | `root`, in `/root`: install anything |
| **Network** | Open to the internet unless you [restrict it](https://docs.fibre.dev/sandboxes/overview.md#every-option) |

You can check the versions yourself with a single command:

```bash title="CLI" run theme={null}
fibre exec "$SBX" -- 'python3 --version && node --version && git --version && whoami'
```

```typescript title="TypeScript" run theme={null}
const versions = await sbx.run("python3 --version && node --version && git --version && whoami");
console.log(versions.stdout); // Python 3.11.2 · v22.… · git version 2.… · root
```

```python title="Python" run theme={null}
versions = sbx.run("python3 --version && node --version && git --version && whoami")
print(versions.stdout)  # Python 3.11.2 · v22.… · git version 2.… · root
```

```bash title="curl" run theme={null}
curl -sS -X POST "$FIBRE_API_URL/v1/sandboxes/$SBX/exec" \
  -H "Authorization: Bearer $FIBRE_API_KEY" -H "Content-Type: application/json" \
  -d '{"command": ["sh", "-c", "python3 --version && node --version && git --version && whoami"]}'
```

> [accordion] Response
>
> ```json title="response" expected theme={null}
> {
>   "exit_code": 0,
>   "stdout": "…",
>   "stderr": ""
> }
> ```

## Install what is missing

Inside the sandbox you are the `root` user and the network is open, so you can install anything you need, with
the usual tools: `pip` for Python, `npm` for Node and `apt-get` for system packages.

**Installs often take longer than the 30 seconds an exec allows**, so run them as
[background commands](https://docs.fibre.dev/sandboxes/running-commands.md). In the SDKs, `sbx.run()` does that for you:

```bash title="CLI" run theme={null}
# Python packages: into a virtual environment
fibre exec "$SBX" -- 'python3 -m venv /work/.venv && /work/.venv/bin/pip install -q requests'
fibre exec "$SBX" -- /work/.venv/bin/python -c 'import requests; print(requests.__version__)'

# Node packages
fibre exec "$SBX" -- 'mkdir -p /work/app && cd /work/app && npm init -y > /dev/null && npm install --silent zod'

# System packages
fibre exec "$SBX" -- 'apt-get update -qq && apt-get install -y -qq jq > /dev/null'
fibre exec "$SBX" -- jq --version   # jq-1.6
```

```typescript title="TypeScript" run theme={null}
// Python packages: into a virtual environment
await sbx.run("python3 -m venv /work/.venv && /work/.venv/bin/pip install -q requests", { timeout: 300 });
console.log((await sbx.run("/work/.venv/bin/python -c 'import requests; print(requests.__version__)'")).stdout);

// Node packages
await sbx.run("mkdir -p /work/app && cd /work/app && npm init -y > /dev/null && npm install --silent zod", { timeout: 300 });

// System packages
await sbx.run("apt-get update -qq && apt-get install -y -qq jq > /dev/null", { timeout: 300 });
console.log((await sbx.run("jq --version")).stdout); // jq-1.6
```

```python title="Python" run theme={null}
# Python packages: into a virtual environment
sbx.run("python3 -m venv /work/.venv && /work/.venv/bin/pip install -q requests", timeout=300)
print(sbx.run("/work/.venv/bin/python -c 'import requests; print(requests.__version__)'").stdout)

# Node packages
sbx.run("mkdir -p /work/app && cd /work/app && npm init -y > /dev/null && npm install --silent zod", timeout=300)

# System packages
sbx.run("apt-get update -qq && apt-get install -y -qq jq > /dev/null", timeout=300)
print(sbx.run("jq --version").stdout)  # jq-1.6
```

```bash title="curl" run capture=INSTALL=.command_id theme={null}
curl -sS -X POST "$FIBRE_API_URL/v1/sandboxes/$SBX/commands" \
  -H "Authorization: Bearer $FIBRE_API_KEY" -H "Content-Type: application/json" \
  -d '{"command": ["sh", "-c", "python3 -m venv /work/.venv && /work/.venv/bin/pip install -q requests && apt-get update -qq && apt-get install -y -qq jq > /dev/null && jq --version"]}'
```

```bash title="curl: wait for it" run theme={null}
curl -sSN "$FIBRE_API_URL/v1/sandboxes/$SBX/commands/$INSTALL/logs?follow=1" \
  -H "Authorization: Bearer $FIBRE_API_KEY" | tail -n 2
```

> [accordion] Output
>
> ```text title="output" expected theme={null}
> jq-
> ```

> [!WARNING]
>
> **Install Python packages into a virtual environment.** On the default image, the system's Python refuses a plain
> `pip install` and reports an "externally managed environment". Creating a virtual environment with
> `python3 -m venv` takes a second and avoids the problem, as the example above shows.

> [!TIP]
>
> Installing the same things in every new sandbox wastes minutes each time. **Do it once and save the result**,
> either as a [snapshot](https://docs.fibre.dev/setup/snapshots.md) (new sandboxes start with everything installed and already running) or
> as your own [image](https://docs.fibre.dev/setup/images.md).

## Bring your own image

You are not limited to the default image. Any image from a public registry, such as Docker Hub, can be the
starting point for a sandbox. Name it in `image`, and add `"ready": "process"` (explained below):

```bash title="CLI" run theme={null}
fibre run --rm --image python:3.12-slim --process-ready --lifetime 5m --label docs=sizes -- python --version   # Python 3.12.…
fibre delete "$SBX"
```

```typescript title="TypeScript" run theme={null}
const py = await Sandbox.create({ image: "python:3.12-slim", ready: "process", lifetime: 300, labels: { docs: "sizes" } });
console.log((await py.run("python --version")).stdout); // Python 3.12.…
await py.delete();
await sbx.delete();
```

```python title="Python" run theme={null}
py = Sandbox.create(image="python:3.12-slim", ready="process", lifetime=300, labels={"docs": "sizes"})
print(py.run("python --version").stdout)  # Python 3.12.…
py.delete()
sbx.delete()
```

```bash title="curl" run capture=PY=.id theme={null}
curl -sS -X POST "$FIBRE_API_URL/v1/sandboxes" \
  -H "Authorization: Bearer $FIBRE_API_KEY" -H "Content-Type: application/json" \
  -d '{"image": "python:3.12-slim", "ready": "process", "lifetime_sec": 300, "labels": {"docs": "sizes"}}'
```

```bash title="curl: check, then clean up" run theme={null}
curl -sS -X POST "$FIBRE_API_URL/v1/sandboxes/$PY/exec" \
  -H "Authorization: Bearer $FIBRE_API_KEY" -H "Content-Type: application/json" \
  -d '{"command": ["python", "--version"]}'
curl -sS -o /dev/null -X DELETE "$FIBRE_API_URL/v1/sandboxes/$PY" -H "Authorization: Bearer $FIBRE_API_KEY"
curl -sS -o /dev/null -X DELETE "$FIBRE_API_URL/v1/sandboxes/$SBX" -H "Authorization: Bearer $FIBRE_API_KEY"
```

> [accordion] Response
>
> ```json title="response" expected theme={null}
> {
>   "exit_code": 0
> }
> ```

* **The first sandbox from a new image takes a little longer**, because Fibre has to download the image. Later
  sandboxes from the same image start quickly.
* **`"ready": "process"` tells Fibre the sandbox is ready as soon as it starts**, and Fibre keeps it running so
  you can run commands in it. That is what you want for a general-purpose image such as `python`, `node` or
  `ubuntu`.
* **The browser features need Chromium**, which the default image includes. A custom image without Chromium can
  still run code and commands, but not the [browser](https://docs.fibre.dev/connect/browser.md).

> [!WARNING]
>
> **Without `"ready": "process"`, Fibre treats your image as a server**: it runs the image's own command and waits
> for it to answer on its port (`exposed_port`, 8000 unless you set it). A base image whose command exits at once,
> or never listens, fails to start. Use `"ready": "process"` for sandboxes you run commands in, and `exposed_port`
> for images that [serve an app](https://docs.fibre.dev/connect/public-urls.md).

## Related

> [card] [Pricing and limits](https://docs.fibre.dev/get-started/pricing.md)
>
> Plans, storage and a worked monthly cost.

> [card] [Runtimes](https://docs.fibre.dev/sandboxes/runtimes.md)
>
> When the workload needs Docker or a full VM.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.