# Orble docs

> Orble docs: the CLI, the MCP server and the API for creating, forking, snapshotting and suspending Linux VMs for AI agents.

## Account limits

Limits apply across all projects on an account. These are the defaults. An account can have a custom sandbox or snapshot count.

### What counts

Suspended sandboxes count toward the sandbox limit. Creating and running sandboxes count toward the vCPU limit. Suspended storage, named snapshots and GitHub Actions runner storage count toward the storage limit.

### Storage

Orble measures allocated space in each writable disk above the starter disk baseline, plus saved memory and device state when present. The shared OS image and Orble's backup copies are excluded. The limit is 32 GiB before the first top-up, 128 GiB after it and 256 GiB on Pro. It applies when creating, forking or saving a snapshot. Restores and forks can reserve the measured size of their source until Orble samples the new sandbox. Writes to existing sandboxes continue, so an account that grows past the limit can still access its data and free space.

### Before the first top-up

3 saved sandboxes and 8 vCPUs at a time. 32 GiB of measured storage.

### Pay as you go

10 saved sandboxes and 16 vCPUs at a time after the first top-up. 128 GiB of measured storage.

### Pro

20 saved sandboxes and 128 vCPUs at a time. 256 GiB of measured storage for new sandboxes, forks and snapshots.

### Snapshots

10 saved snapshots per account by default.

### Sandbox sizes

Micro (μ) has 1 vCPU and 2 GiB RAM, S has 2 vCPUs and 4 GiB RAM, M has 4 vCPUs and 8 GiB RAM, and L has 8 vCPUs and 16 GiB RAM. Each has a 64 GiB writable disk.


## Operation limits

### Sandbox creation

60 per minute per account, with a burst of 10. Forked sandboxes count toward this rate.

### Forks

Up to 10 copies per request.

### Snapshot creation

10 per minute per account, with a burst of 10.

### Sandbox wakes

60 per minute per account, with a burst of 30.

### Commands

600 executions per minute per account, with a burst of 120. Up to 600 seconds per command and 64 KiB of output per stream.

### Files

Up to 4 GiB per file.

### Shared ports

20 per sandbox. At most 20 publicly shared ports per account.

### Private networks

10 per account and 50 boxes per network.

### Secrets

50 per account. Each secret can list up to 10 hosts.

### Egress rules

100 entries per sandbox.


## Install

```sh
curl -fsSL https://orble.tech/install.sh | sh
orble new
```

## Verify the CLI

We sign every CLI release. `orble update` and the install script check the signature. To check a build yourself with minisign, download it with the release's manifest and signature:

```sh
curl -fsSLO https://orble.tech/dl/orble-darwin-arm64 -O https://orble.tech/dl/orble-release.txt -O https://orble.tech/dl/orble-release.txt.minisig
minisign -Vm orble-release.txt -P RWSzEPa/+F9PS9K775yzpKKQFhykubsqNs9fyKUWcPg7YM80DySa6H1u
grep orble-darwin-arm64 orble-release.txt && shasum -a 256 orble-darwin-arm64
```

## Boxes

- `orble new`: Create a Linux virtual machine, called a box
  - `--size micro|s|m|l`: Select the CPU and memory allocation (see [Pricing](/pricing)). Short option: `-s`
  - `--name <name>`: Assign a name to the new box
- `orble rename <box> <name>`: Assign an alias to a box. The original name, hostname and SSH address remain valid
- `orble resize <box> <s|m|l>`: Resize a box to a larger CPU and memory allocation. Disk contents are preserved, but the VM restarts and running processes are terminated
- `orble ls`: List boxes and lifecycle states, with forked boxes grouped under their source. Use `--json` for JSON output
- `orble ssh <box> [ssh args]`: Connect to a box over SSH. With IPv6 connectivity, use `ssh <box>.<account>.orble.tech` for direct access
- `orble exec <box> <command>`: Run a shell command in a box, print its output and exit with its exit code
  - `--root`: Run the command as root
- `orble vnc <box>`: Open the box's graphical desktop in a browser
- `orble desktop <box> [--off]`: Connect to the box's graphical desktop using a VNC client
- `orble keep-awake <box> [off]`: Disable automatic suspension for a box. Use `off` to restore suspension when idle
- `orble suspend <box>`: Suspend a box with guest memory and process state preserved
- `orble resume <box>`: Resume a suspended box from its saved memory and process state
- `orble start <box>`: Start a stopped box from its disk. A box is stopped when its own software powers it off (`poweroff`, `halt`, `shutdown -h`); nothing else wakes it, and it's billed for storage only
- `orble rm <box> [-y]`: Permanently delete the box and its disk
- `orble fork <box> [-n N]`: Create 1–10 copies of a box, including disk contents, guest memory and running processes
- `orble port <box> [port]`: Expose a port at a dedicated HTTPS address with account authentication. Omit the port number to list shared ports
  - `--public`: Allow access to the shared port without account authentication
  - `--private`: Require account authentication to access the shared port
  - `--off`: Remove the HTTPS endpoint for the shared port
- `orble exit-node [box...]`: Route outbound traffic from the specified boxes through the machine running this command
  - `--lan`: Allow the selected boxes to access the exit-node machine's local network
  - `--fallback`: Use Orble's network for outbound traffic when the exit-node machine is offline

## Projects

Each account starts with a Default project. A box belongs to the project where it was created. Forks and private snapshots inherit that project. Use a project slug with the CLI or set `ORBLE_PROJECT` in your environment.

- `orble project list`: List project names and slugs
- `orble project create <name>`: Create a project
- `orble --project <slug> new`: Create a box in the selected project

## Snapshots

Create snapshots from a Dockerfile or an existing box. Snapshots of existing boxes include disk contents, guest memory and process state. Snapshot storage is billed at the storage rate.

- `orble snapshot <box> [name]`: Create a snapshot of a box, including disk contents, memory and running processes
- `orble snapshot build [-f Dockerfile] [name]`: Build a snapshot from a Dockerfile. Use `FROM orble.tech/base` or `FROM orble.tech/<snapshot>` as the base
  - `--start <command>`: Include the specified running program in the snapshot so it is available in boxes restored from that snapshot
- `orble snapshots`: List account snapshots and the Orble snapshot gallery. Use `--json` for JSON output
- `orble new --from <snapshot>`: Create a box from a snapshot. Use `-s` to select a larger size
- `orble snapshot rm <snapshot>`: Permanently delete a snapshot
- `orble snapshot rename <snapshot> <name>`: Assign a new name to a snapshot

## Account

- `orble login`: Authenticate the CLI using Google or GitHub
- `orble logout`: Sign this CLI out
- `orble keys`: List the account's registered SSH public keys
- `orble keys add [file]`: Register an SSH public key for access to boxes
- `orble keys rm <fingerprint>`: Remove an SSH public key from the account
- `orble account`: Display account details, credit balance and subscription plan
- `orble topup [amount]`: Add prepaid credit to the account

## Hooks

Hooks are executable files that Orble runs inside a box after resume, fork or snapshot restore. Use a script or compiled binary to re-establish an SSH tunnel, remount a FUSE filesystem or initialize application state.

Place user hooks in `~/.config/orble/on-resume.d/` inside the box; these run as the `agent` user. For hooks that require root privileges, use `/etc/orble/on-resume.d/`.


## Create a hook

Inside the box, create the user hook directory and save the following script as `~/.config/orble/on-resume.d/10-record-event.sh`.

```sh
mkdir -p ~/.config/orble/on-resume.d
```

```
#!/bin/sh
set -eu

printf '%s %s\n' "$(date -u +%FT%TZ)" "$ORBLE_EVENT" \
  >> "$HOME/hook-events.log"
printf 'Recorded %s\n' "$ORBLE_EVENT"
```

## Enable and test the hook

Make the file executable, then test it inside the box by setting `ORBLE_EVENT=resume`. The script appends a UTC timestamp and event name to `~/hook-events.log` and prints `Recorded resume`. Your log will contain a line like the example below, with the timestamp of your test.

```sh
chmod +x ~/.config/orble/on-resume.d/10-record-event.sh
ORBLE_EVENT=resume ~/.config/orble/on-resume.d/10-record-event.sh
tail -n 1 ~/hook-events.log
```

```
2026-11-19T12:00:00Z resume
```

## Execution order

Orble runs system hooks as `root` before running user hooks as `agent`. Within each directory, executable files are processed in filename order. Use prefixes such as `10-prepare` and `20-connect` when one hook depends on another. Files without execute permission are skipped.


## Timing

The node starts hooks after the guest clock and network have been initialized. Hook execution is asynchronous: Orble does not wait for hooks to finish before making the box available. Applications that depend on a connection or resource initialized by a hook should check that the resource is ready before using it.


## Timeout

Orble applies a five-minute timeout to each hook. If a hook times out or exits with a nonzero status, the exit status is logged and execution continues with the next hook.


## Logging

For each lifecycle-triggered execution, Orble writes the timestamp, event name and executable path to `/var/log/orble-on-resume.log`, followed by the hook's standard output and standard error. Nonzero exit codes are recorded in the same file.

After the resume example below, inspect this log inside the box with `sudo tail -n 20 /var/log/orble-on-resume.log`. The example hook also keeps its own event history in `~/hook-events.log`.


## Run after a resume

From your local machine, suspend and resume the box, replacing `<box>` with its name. After the hook finishes, another `resume` entry will be present in `~/hook-events.log`, and `Recorded resume` will be present in Orble's hook log.

The same executable is run with `ORBLE_EVENT=fork` in a forked box or `ORBLE_EVENT=restore` in a box created from a snapshot.

```sh
orble suspend <box>
orble resume <box>
```

## Egress rules

Requires Orble Pro.

Allow or deny traffic from a box to specific Internet hosts, IPv4 addresses or CIDR ranges. You can update egress rules while the box is running.

- `orble net <box>`: Display egress rules for a box
- `orble net block <box>`: Block outbound traffic except to destinations in the box's allow list
- `orble net allow <box> <entry...>`: Add destinations to the allow list: IPv4 addresses, CIDR ranges, domains such as `example.com`, or wildcard domains such as `*.example.com`
- `orble net deny <box> <entry...>`: Add the specified destinations to the box's deny list
- `orble net rm <box> <entry...>`: Remove the specified destinations from both the allow and deny lists
- `orble net open <box>`: Clear the box's allow and deny lists and disable default-deny mode
- `Limits`: Up to 100 entries per box. Egress configuration is inherited by forks and snapshots. Egress rules and exit-node routing cannot be enabled together

## Secrets

Requires Orble Pro.

Secrets are set as environment variables whose values are placeholders. When requests leave the sandbox, they get automatically overwritten by the secrets you set up.

### Environment variables

`$NAME` contains the placeholder value. Use `$NAME_URL/<path>` to send an authenticated request through the gateway to the secret's first configured host.

### Base URLs

For secrets configured for `api.anthropic.com`, `api.openai.com` or `api.github.com`, Orble also sets the corresponding `ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL` or `GITHUB_API_URL` environment variable.

### Limits

Configure up to 50 secrets per account. Credential injection is limited to HTTP headers.

### HTTPS interception

With `--intercept`, the account's certificate authority is installed in the box's trust store.

```sh
orble secret set STRIPE_API_KEY --host api.stripe.com
curl $STRIPE_API_KEY_URL/v1/balance
```

- `orble secret set <NAME> --host <host>`: Create or update a secret. Provide the value at the prompt or through standard input
  - `--header <name> --format <format>`: Specify the HTTP header and value format for secret injection, for example `Authorization` and `Bearer {}`. Defaults depend on the destination host
  - `--box <box>`: Restrict the secret to the specified box; repeat for additional boxes. Without this option, the secret is available to all current and future boxes in the project
  - `--intercept`: Enable HTTPS interception to replace the `$NAME` placeholder in the configured header of requests to the secret's hosts
- `orble secret ls`: List secret names and configuration without revealing secret values
- `orble secret rm <NAME>`: Delete a secret from the project

## Box networks

Requires Orble Pro.

Connect boxes on a private network using their assigned addresses or `<box>.<network>.internal` hostnames. Connections are permitted on any port, and suspended destination boxes are resumed automatically.

- `orble net create <network>`: Create a private box network
- `orble net join <network> <box>`: Add a box to the specified private network
- `orble net leave <network> <box>`: Remove a box from the specified private network
- `orble net ls`: List private networks, member boxes and assigned addresses
- `orble net delete <network>`: Delete the specified private network
- `Limits`: Up to 10 networks per account and 50 boxes per network. Forked boxes are added to the source box's networks

## Python SDK: Install

GitHub: https://github.com/orbletech/orble-sdk

Requires Python 3.9 or later. Import the package as `orble`.

```sh
pip install orble-sdk
```

```python
import orble

box = orble.create(size="s")
r = box.exec("npm test", cwd="app", env={"CI": "1"})
print(r.code, r.stdout)
box.delete()
```

## Python SDK: Authentication

Authenticate with an API key or with credentials saved by the Orble CLI. The SDK loads credentials automatically unless you provide a key when configuring a client.

### Use an API key

Create an API key in [Settings](/settings/api), then set `ORBLE_API_KEY` in the environment where your application runs.

```sh
export ORBLE_API_KEY=orble_...
```

### Use CLI credentials

For local development, run `orble login` to save credentials. If no key is provided explicitly or through `ORBLE_API_KEY`, the SDK uses the saved CLI token.

The default configuration file is `~/.config/orble/config.json` on Linux, `~/Library/Application Support/orble/config.json` on macOS, or `%APPDATA%/orble/config.json` on Windows. On Linux, `XDG_CONFIG_HOME` overrides the `~/.config` directory.

```sh
orble login
```

### Configure a client

Pass credentials directly when you need an explicitly configured client. The client key takes precedence over `ORBLE_API_KEY` and CLI credentials. Pass the client with `client=` to SDK functions or to `orble.Box`.

```python
import os
import orble

client = orble.Client(
    key=os.environ["ORBLE_API_KEY"],
    url="https://orble.tech",
)
box = orble.Box("my-box", client=client)
```

### Choose an API URL

Set `ORBLE_API_URL` to use another Orble deployment, such as staging. Use credentials created for that deployment.

The SDK selects the URL in this order: the client's explicit `url` argument, `ORBLE_API_URL`, the API URL saved by the CLI, then `https://orble.tech`.

```sh
export ORBLE_API_URL=https://staging.orble.tech
```


## Python SDK: Calls

- `orble.create(size=None, name=None, from_snapshot=None)`: Create a box and return a `Box` instance. Set `size` to `micro`, `s` (default), `m` or `l`, and `from_snapshot` to a snapshot name
- `orble.Box(name)`: Get a client-side reference to an existing box by name
- `orble.boxes()`: Return the account's boxes as a list of `Box` instances
- `orble.snapshots()`: Return available snapshots as a list of `Snapshot` instances
- `box.exec(command, timeout=None, env=None, cwd=None, user=None)`: Execute a shell command and wait for completion. Set `user="root"` to run it as root. Return a `Result` containing `code`, `stdout`, `stderr` and `timed_out`
- `box.write(path, content, user=None)`: Write text, bytes or a file opened in binary mode to a file, replacing existing contents and creating missing parent directories
- `box.read(path, binary=False, user=None)`: Read a whole file as text, or as bytes when `binary=True`
- `box.port(port, public=False)`: Expose a port and return its HTTPS URL. Access is restricted to the account unless public access is requested
- `box.fork(count=1)`: Create 1–10 copies of the box with disk contents, memory and process state preserved. Return the copies as a list of `Box` instances
- `box.snapshot(name=None)`: Create a snapshot of the box and return a `Snapshot` instance
- `box.suspend()`: Suspend the box with guest memory and process state preserved
- `box.resume()`: Resume the box from its saved memory and process state
- `box.start()`: Start a stopped box (its own software powered it off) from its disk. Nothing else wakes a stopped box
- `box.keep_awake(on=True)`: Disable automatic suspension when `on=True`; restore suspension when idle with `on=False`
- `box.delete()`: Permanently delete the box and its disk
- `box.refresh()`: Retrieve the current API representation as a dictionary and update `box.info`
- `box.state`: Current lifecycle state of the box, such as `running` or `suspended`
- `snapshot.delete()`: Permanently delete the snapshot

## Python SDK: Commands, files and ports

- `Commands`: Commands are executed with `/bin/sh -c` as the `agent` user in `/home/agent`, with passwordless sudo available, or as `root` in `/root` with the `user` option. Maximum timeout: 600 seconds; exit code on timeout: 124. Output is limited to the last 64 KiB of each stream
- `Files`: Relative file paths are resolved from `/home/agent`. Files are streamed in both directions. Maximum file size: 4 GiB
- `Suspended boxes`: Suspended boxes are resumed automatically for command execution and file reads or writes
- `Ports`: Private ports require account authentication. Public ports are accessible without authentication and require account credit. Limit: 20 shared ports per box
- `Errors`: SDK exceptions: `orble.Error` in Python and `OrbleError` in TypeScript, with the HTTP `status` and error message

## TypeScript SDK: Install

GitHub: https://github.com/orbletech/orble-sdk

Requires Node.js 20 or later, or Bun.

```sh
npm install @orble/sdk
```

```ts
import { Orble } from "@orble/sdk";

const orble = new Orble();
const box = await orble.create({ size: "s" });
const { code, stdout } = await box.exec("npm test", { cwd: "app", env: { CI: "1" } });
console.log(code, stdout);
await box.delete();
```

## TypeScript SDK: Authentication

Authenticate with an API key or with credentials saved by the Orble CLI. The SDK loads credentials automatically unless you provide a key when configuring a client.

### Use an API key

Create an API key in [Settings](/settings/api), then set `ORBLE_API_KEY` in the environment where your application runs.

```sh
export ORBLE_API_KEY=orble_...
```

### Use CLI credentials

For local development, run `orble login` to save credentials. If no key is provided explicitly or through `ORBLE_API_KEY`, the SDK uses the saved CLI token.

The default configuration file is `~/.config/orble/config.json` on Linux, `~/Library/Application Support/orble/config.json` on macOS, or `%APPDATA%/orble/config.json` on Windows. On Linux, `XDG_CONFIG_HOME` overrides the `~/.config` directory.

```sh
orble login
```

### Configure a client

Pass credentials directly when you need an explicitly configured client. The client key takes precedence over `ORBLE_API_KEY` and CLI credentials. Use this client for subsequent SDK calls.

```ts
import { Orble } from "@orble/sdk";

const orble = new Orble({
  key: process.env.ORBLE_API_KEY,
  url: "https://orble.tech",
});
const box = orble.box("my-box");
```

### Choose an API URL

Set `ORBLE_API_URL` to use another Orble deployment, such as staging. Use credentials created for that deployment.

The SDK selects the URL in this order: the client's explicit `url` argument, `ORBLE_API_URL`, the API URL saved by the CLI, then `https://orble.tech`.

```sh
export ORBLE_API_URL=https://staging.orble.tech
```


## TypeScript SDK: Calls

- `new Orble({ key, url })`: Create an API client. `key` and `url` are optional; see Authentication
- `orble.create({ size, name, fromSnapshot })`: Create a box and return a `Box` instance. Set `size` to `"s"` (default), `"m"` or `"l"`, and `fromSnapshot` to a snapshot name
- `orble.box(name)`: Get a client-side reference to an existing box by name
- `orble.boxes()`: Return the account's boxes as `Box[]`
- `orble.snapshots()`: Return available snapshots as `Snapshot[]`
- `box.exec(command, { cwd, env, timeout, user })`: Execute a shell command and wait for completion. Set `user: "root"` to run it as root. Return `{ code, stdout, stderr, timedOut }`
- `box.write(path, content, { user })`: Write a string, `Uint8Array` or `ReadableStream` to a file, replacing existing contents and creating missing parent directories
- `box.read(path, { user })`: Read a whole file as a string
- `box.readBytes(path, { user })`: Read a whole file as a `Uint8Array`
- `box.readStream(path, { user })`: Read a file as it arrives. Return a `Response` whose `body` is a `ReadableStream`
- `box.port(port, { public })`: Expose a port and return its HTTPS URL. Access is restricted to the account unless public access is requested
- `box.fork(count = 1)`: Create 1–10 copies of the box with disk contents, memory and process state preserved. Return the copies as `Box[]`
- `box.snapshot(name?)`: Create a snapshot of the box and return a `Snapshot` instance
- `box.suspend()`: Suspend the box with guest memory and process state preserved
- `box.resume()`: Resume the box from its saved memory and process state
- `box.start()`: Start a stopped box (its own software powered it off) from its disk. Nothing else wakes a stopped box
- `box.keepAwake(on = true)`: Disable automatic suspension when `on` is `true`; restore suspension when idle when `on` is `false`
- `box.delete()`: Permanently delete the box and its disk
- `box.refresh()`: Retrieve the current API representation and update `box.info`
- `snapshot.delete()`: Permanently delete the snapshot

## E2B API

Configure the E2B SDK to use Orble by setting `E2B_DOMAIN` and `E2B_API_KEY`. Create an Orble API key in [Settings](/settings/api).

```sh
export E2B_DOMAIN=orble.tech
export E2B_API_KEY=orble_...
```

```python
from e2b import Sandbox

sbx = Sandbox.create()
print(sbx.commands.run("echo hello").stdout)
sbx.kill()
```

- `Supported APIs`: Sandbox.create, connect, list, kill, set_timeout, pause, create_snapshot, fork, commands, PTY, files, watch_dir and get_host, in the Python and JavaScript SDKs, and the code interpreter and desktop SDKs
- `Templates`: `base` (2 vCPU, 4 GiB), `micro` (1 vCPU, 2 GiB), `m` (4 vCPU, 8 GiB) and `l` (8 vCPU, 16 GiB), all Debian 13 with Python, Node.js and Docker
- `Pro`: Configure egress through `allow_internet_access`, `allowOut`, `denyOut` and `update_network`. Requires [Orble Pro](/docs/egress)
- `Unsupported`: `Template.build`, volumes and secrets

## Daytona API

Configure the Daytona SDK to use Orble by setting `DAYTONA_API_URL` and `DAYTONA_API_KEY`. Create an Orble API key in [Settings](/settings/api).

```sh
export DAYTONA_API_URL=https://api.orble.tech/daytona
export DAYTONA_API_KEY=orble_...
```

```python
from daytona import Daytona

sandbox = Daytona().create()
print(sandbox.process.exec("echo hello").result)
sandbox.delete()
```

- `Supported APIs`: create, get, list, start, stop, delete, labels, auto-stop, auto-delete, preview links, snapshots, fork, process.exec, code_run, sessions, PTY sessions, files, signed file URLs, git, LSP and computer use, in the Python and JavaScript SDKs
- `Sizes`: The smallest size that satisfies the requested `cpu` and `memory`: 1 vCPU / 2 GiB, 2 vCPU / 4 GiB, 4 vCPU / 8 GiB, or 8 vCPU / 16 GiB. All sizes use Debian 13 with Python, Node.js and Docker
- `Pro`: Configure egress through `networkBlockAll`, `networkAllowList`, `domainAllowList` and network settings on a running sandbox. Requires [Orble Pro](/docs/egress)
- `Unsupported`: Custom images, volumes, secrets, computer-use recordings and the accessibility tree

## Amp orbs

Use Orble boxes to host [Amp](https://ampcode.com) orbs. Guest memory and process state are preserved when an orb is paused, and Amp project snapshots are stored as Orble snapshots.

Create a provider token in Amp under Settings → Orbs → Add Provider, and an Orble API key in [Settings](/settings/api). Run `dispatch.sh` on an always-on machine with Bash, curl and jq installed. Run `./dispatch.sh prepare` once to create the `amp-orb` snapshot used for new orbs.

```sh
curl -fsSLO https://orble.tech/amp/dispatch.sh && chmod +x dispatch.sh
export ORBLE_API_KEY=orble_...
./dispatch.sh prepare
export AMP_ORB_PROVIDER_TOKEN=aop_live_...
amp orb provider "$PWD/dispatch.sh"
```

```
#!/usr/bin/env bash
# Amp orbs on Orble (https://orble.tech/docs?tab=amp). Needs bash, curl, jq and ORBLE_API_KEY.
#   ./dispatch.sh prepare                  once: saves the amp-orb snapshot new orbs start from
#   amp orb provider "$PWD/dispatch.sh"    then: Amp runs it for each spawn, pause and delete
# Each orb is a box named amp-<hash of ORB_ID>, kept awake while Amp uses it. A pause suspends it with its memory,
# so the orb's programs keep running when it wakes, and saves Amp's project snapshots as Orble snapshots.
set -euo pipefail

API="${ORBLE_API_URL:-https://orble.tech}"
BASE="${ORBLE_AMP_SNAPSHOT:-amp-orb}"
KEEP="${ORBLE_AMP_KEEP_SNAPSHOTS:-3}" # project snapshots to keep; Amp never deletes them
OP="${1:-${ORB_OPERATION:-}}"
hash() { printf %s "$1" | sha256sum | cut -c1-12; }
BOX="amp-$(hash "${ORB_ID:-prepare}")"
[ "$OP" = prepare ] && BOX="amp-orb-$(hash "$$$(date +%s%N)" | cut -c1-6)"
SNAP=""
[ -n "${ORB_SNAPSHOT_ID:-}" ] && SNAP="amps-$(hash "$ORB_SNAPSHOT_ID")"

# api METHOD PATH [JSON]: Orble's answer on stdout; fails on an error, or on a 404 unless ALLOW404 is set.
api() {
	local out code
	out=$(curl -sS -X "$1" "$API$2" -H "Authorization: Bearer $ORBLE_API_KEY" -H 'Content-Type: application/json' \
		${3:+--data "$3"} -w '\n%{http_code}')
	code=${out##*$'\n'} out=${out%$'\n'*}
	if [ "$code" -ge 300 ] && ! { [ "$code" = 404 ] && [ -n "${ALLOW404:-}" ]; }; then
		echo "orble: $1 $2: $code $out" >&2
		return 1
	fi
	printf '%s' "$out"
}
has_box() { [ -n "$(ALLOW404=1 api GET "/v1/boxes/$BOX" | jq -r '.name // empty')" ]; }
has_snap() { api GET /v1/snapshots | jq -e --arg n "$1" 'any(.[]; .name == $n or .alias == $n)' >/dev/null; }
# run SCRIPT: runs a script in the box as root, with ORB_TOKEN and AMP_URL set, and prints its output.
run() {
	local r
	r=$(api POST "/v1/boxes/$BOX/exec" "$(jq -n --arg c "echo $(printf %s "$1" | base64 -w0) | base64 -d | sudo -E bash" \
		--arg t "${ORB_TOKEN:-}" --arg u "${AMP_URL:-}" \
		'{command: $c, timeout_s: 240, env: ({ORB_TOKEN: $t, AMP_URL: $u} | with_entries(select(.value != "")))}')")
	jq -r '.stdout, .stderr | select(. != null and . != "")' <<<"$r" >&2
	[ "$(jq -r '.exit_code // 0' <<<"$r")" = 0 ]
}

# What an orb needs (ampcode.com/docs/orbs/self-hosted): a "user" account with sudo and its own home, amp at
# /usr/local/bin/amp, and Node. Orble's image answers any unknown user name as its own user, agent, so useradd would
# refuse; the entries are written directly.
SETUP='
if ! grep -q "^user:" /etc/passwd; then
	! mountpoint -q /home/user || umount /home/user
	echo "user:x:1001:1001::/home/user:/bin/bash" >>/etc/passwd
	echo "user:x:1001:" >>/etc/group
	echo "user:!:20000:0:99999:7:::" >>/etc/shadow
	usermod -aG docker user
	mkdir -p /home/user && cp -an /etc/skel/. /home/user/ && chown -R user:user /home/user
	echo "user ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/amp-user && chmod 440 /etc/sudoers.d/amp-user
fi
if [ ! -x /usr/local/bin/amp ]; then
	curl -fsSL https://ampcode.com/install.sh | HOME=/root bash >/dev/null 2>&1
	install -m 755 /root/.amp/bin/amp /usr/local/bin/amp
fi
for t in node npm npx; do
	[ -e /usr/local/bin/$t ] || ln -s "$(sudo -iu agent mise which $t)" /usr/local/bin/$t
done
chmod o+rx /home/agent /home/agent/.local /home/agent/.local/share /home/agent/.local/share/mise
'

case "$OP" in
prepare) # a box with SETUP done, saved as the snapshot new orbs start from
	api POST /v1/boxes "$(jq -n --arg n "$BOX" '{name: $n}')" >/dev/null
	trap 'ALLOW404=1 api DELETE "/v1/boxes/$BOX" >/dev/null' EXIT
	run "set -e; $SETUP"
	ALLOW404=1 api DELETE "/v1/snapshots/$BASE" >/dev/null || true
	api POST "/v1/boxes/$BOX/snapshot" "$(jq -n --arg n "$BASE" '{name: $n}')" >/dev/null
	echo "saved $BASE"
	;;
spawn)
	fresh=""
	if ! has_box; then
		from=""
		if [ -n "$SNAP" ] && has_snap "$SNAP"; then
			from=$SNAP
		elif has_snap "$BASE"; then
			from=$BASE
		fi
		size=$(case "${ORB_TYPE:-}" in small) echo s ;; medium) echo m ;; large) echo l ;; esac)
		api POST /v1/boxes "$(jq -n --arg n "$BOX" --arg f "$from" --arg s "$size" \
			'{name: $n} + (if $f != "" then {from: $f} else {} end) + (if $s != "" then {size: $s} else {} end)')" >/dev/null
		echo "$ORB_ID: made $BOX${from:+ from $from}" >&2
		fresh=1
	fi
	api PATCH "/v1/boxes/$BOX" '{"keep_awake": true}' >/dev/null # wakes a suspended box too
	# A box from a project snapshot carries the processes of the orb it was saved from, and a woken box its last
	# bootstrap, which would compete with the new one: stop those, and leave the woken box's other programs running.
	run "set -e
		if [ -n '$fresh' ] && grep -q '^user:' /etc/passwd; then pkill -KILL -u user || true
		else pkill -f '^amp orb bootstrap' || true; fi
		$SETUP
		cd /home/user
		sudo -u user -H --preserve-env=ORB_TOKEN,AMP_URL setsid bash -lc 'exec amp orb bootstrap' \
			</dev/null >>/home/user/.amp-bootstrap.log 2>&1 &
		echo started amp orb bootstrap"
	;;
pause)
	has_box || exit 0
	api PATCH "/v1/boxes/$BOX" '{"keep_awake": false}' >/dev/null
	api POST "/v1/boxes/$BOX/suspend" >/dev/null
	if [ -n "$SNAP" ] && ! has_snap "$SNAP"; then
		api POST "/v1/boxes/$BOX/snapshot" "$(jq -n --arg n "$SNAP" '{name: $n}')" >/dev/null
		echo "$ORB_ID: saved project snapshot $SNAP" >&2
		api GET /v1/snapshots | jq -r --argjson k "$KEEP" \
			'[.[] | select(.name | startswith("amps-"))] | sort_by(.created_at) | reverse | .[$k:][] | .name' |
			while read -r old; do
				ALLOW404=1 api DELETE "/v1/snapshots/$old" >/dev/null && echo "$ORB_ID: deleted snapshot $old" >&2
			done
	fi
	;;
delete)
	ALLOW404=1 api DELETE "/v1/boxes/$BOX" >/dev/null
	;;
*)
	echo "usage: $0 prepare, or run by amp orb provider" >&2
	exit 2
	;;
esac
```

- `Spawn`: Create the thread's box from its project snapshot, or from `amp-orb` when no project snapshot exists. Automatic suspension is disabled while the orb is active
- `Pause`: Suspend the box with memory preserved and save a project snapshot when requested by Amp. The three most recent snapshots are retained by default; configure retention with `ORBLE_AMP_KEEP_SNAPSHOTS`
- `Delete`: Delete the box when the associated Amp thread is deleted
- `Orb types`: Use `small`, `medium` or `large` for S, M or L boxes. If no type is specified, use the size of the `amp-orb` snapshot
- `Unsupported`: Amp's Desktop tab

## OpenAI Agents API

Use Orble boxes as [self-hosted environments](https://developers.openai.com/api/docs/guides/agents-api/environments/self-hosted) for the OpenAI Agents API. `codex exec-server` runs in the box and connects to the session over an outbound WebSocket. Guest memory and process state are preserved when the box is suspended between turns, so the same executor reconnects on resume.

Create an Orble API key in [Settings](/settings/api), an OpenAI API key, and an environment key on the Agents tab of the OpenAI platform dashboard. Pass only the environment key into the box, as `CODEX_API_KEY`.

```sh
pip install orble-sdk openai
export ORBLE_API_KEY=orble_...
export OPENAI_API_KEY=sk-...
export OPENAI_EXECUTOR_API_KEY=sk-...
python main.py
```

```python
import os

import orble
from openai import OpenAI

client = OpenAI()
session = client.beta.agents.sessions.create(
    agent={"model": "gpt-5.6-sol"},
    environment={"type": "self_hosted", "workspace_directory": "/workspace"},
)

box = orble.create()
box.keep_awake()
box.exec("sudo mkdir -p /workspace && sudo chown agent /workspace"
         " && npm install -g @openai/codex@alpha", timeout=300)
box.exec(
    "setsid nohup codex exec-server"
    f" --remote {session.environment.remote_url}"
    f" --environment-id {session.environment.id}"
    " > /tmp/codex-executor.log 2>&1 < /dev/null &",
    cwd="/workspace",
    env={"CODEX_API_KEY": os.environ["OPENAI_EXECUTOR_API_KEY"]},
)

with client.beta.agents.sessions.stream(
    session.id, input="Write hello to hello.txt."
) as events:
    for event in events:
        if event.type == "agent.session.turn.output_text.delta":
            print(event.delta, end="")

print(box.read("/workspace/hello.txt"))
box.suspend()  # files, memory and the executor are kept until box.resume()
```

- `Executor`: Create one box per session. Install the executor with `npm install -g @openai/codex@alpha` and run `codex exec-server` in the background with the session's `remote_url` and environment ID
- `Keep awake`: Disable automatic suspension while a turn runs, so the box stays up while the model works between commands
- `Between turns`: Suspend the box, or restore automatic suspension, to stop CPU charges. Files, memory and the running executor are preserved. Resume the box before sending the next input
- `Webhooks`: Create or resume the box on `agent.session.action_required` with an `environment_connection` action, disable automatic suspension on `agent.session.in_progress`, restore it on `agent.session.idle`, and delete the box on `agent.session.failed`
- `Cleanup`: Delete the box and the session separately. Deleting a session leaves its box running
- `Network`: The executor needs outbound HTTPS to `api.openai.com` and `codex-cloud-environments.chatgpt.com`. With [Orble Pro](/docs/egress) egress rules, allow both hosts

## OpenComputer

OpenComputer setup guide: https://github.com/lxe/opencomputer/blob/dd194120b8b811934da64d2400cc26481eb5a953/computer/deploy/orble/README.md

Use a dedicated Orble box to host one organization's OpenComputer runtime. The runtime connects to its gateway over an outbound WebSocket and runs each session in a separate rootless Podman container.

### Run the Slack gateway

Choose a dedicated M or L box with at least 8 GiB of RAM. From a committed checkout, run `computer/deploy/orble/setup-slack.sh` with the box name and an allowed Slack member ID. The script builds the OpenComputer gateway image, runs it under rootless Podman, and exposes its Slack callbacks through an Orble HTTPS shared port.

### Install the Slack app

Use the gateway's protected setup page to create the Slack app, register its callbacks and install it in your workspace. Configure a model credential before sending work. If your terminal wraps a Claude setup token, copy the full value as one line.

### Verify Slack delivery

Check the gateway's `/healthz` endpoint for Slack mode and the connected host. From an allowed Slack account, ask Computer to write and run a shell script that prints the current UTC time. Check that the script and its output appear in the Slack thread.

### Suspension and cold boots

Orble wakes a suspended box when Slack calls its shared HTTPS port. Enable Keep awake if wake latency causes callbacks to miss Slack's three-second acknowledgement window. If a cold boot leaves the services stopped, rerun the setup script from the same commit with the same box name and Slack member ID.

### Optional Cloudflare gateway

A Cloudflare Worker can acknowledge and queue Slack events while OpenComputer is offline. Follow the setup guide to connect a self-managed host to the Worker's `/v1/computer/host` endpoint. Use Keep awake to process work as it arrives, or resume the box to reconnect and receive queued work.


## AI apps (MCP)

```text
Read https://orble.tech/setup.md and follow it to set up Orble for me.
```

Server URL: `https://orble.tech/mcp`

### Claude

- [Add to Claude](https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=Orble&connectorUrl=https%3A%2F%2Forble.tech%2Fmcp)

### Claude Code

```sh
claude mcp add --transport http orble https://orble.tech/mcp
```

Authenticate with `/mcp` in Claude Code.

### Codex

In `~/.codex/config.toml`:

```toml
[mcp_servers.orble]
url = "https://orble.tech/mcp"
```

Authenticate with `codex mcp login orble`.

### Cursor

- [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=orble&config=eyJ1cmwiOiJodHRwczovL29yYmxlLnRlY2gvbWNwIn0%3D)

For manual configuration:

In `~/.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "orble": {
      "url": "https://orble.tech/mcp"
    }
  }
}
```

### opencode

In `opencode.json`:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "orble": {
        "type": "remote",
        "url": "https://orble.tech/mcp"
      }
    }
  }
}
```

Sign-in: `opencode mcp auth orble`.

### Zed

Add the server to Zed's settings:

In `settings.json`:

```json
"context_servers": {
  "orble": {
    "url": "https://orble.tech/mcp"
  }
}
```


## Self API

The Self API is an HTTP interface for suspending, forking or deleting a box from a process running inside that box. No account API key is required, and each request applies only to the calling box.

Base URL: `http://169.254.77.77`.


## POST /orble/suspend

Suspend the box with guest memory and process state preserved.

```sh
curl -fsS -X POST http://169.254.77.77/orble/suspend
```

### Input schema

No request body.


### Output schema

`202 Accepted` · `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `accepted` | `boolean` | The value is `true` when the suspension request has been accepted. |
| `action` | `string` | The value is always `"suspend"`. |

### Behavior

- `Exec wait`: Suspension is deferred until active Orble exec calls return. If any call remains active after 2 minutes, the suspension request is canceled
- `Wake`: The box can be resumed through the usual access methods, including SSH and shared ports
- `Node restart`: Pending suspension requests are discarded if the node restarts

## POST /orble/fork

Create copies of the box with disk contents, guest memory and process state preserved.

```sh
curl -fsS -X POST http://169.254.77.77/orble/fork \
  -H 'Content-Type: application/json' \
  -d '{"count":1}'
```

### Input schema

Optional JSON body. Unknown fields are rejected.

| Field | Type | Description |
| --- | --- | --- |
| `count` | `integer` (optional) | Use an integer from 1 to 10. If omitted or set to `0`, the requested count is `1`. |

### Output schema

`200 OK` · `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `boxes` | `Box[]` | Orble returns the created boxes in this array, including a `name` and `hostname` for each box. |
| `errors` | `string[]` (optional) | If Orble creates only some requested copies, error messages for the remaining copies are included in this array. |
| `notices` | `string[]` (optional) | If a copied port must be made private, the reason is included in this array. |

### Behavior

- `Copies`: Copies have the same CPU and memory allocation as the source, with new names and addresses. Standard port-sharing rules apply
- `Limits`: Forked boxes are subject to account limits and standard usage charges
- `Retry`: After an interrupted response, check for created boxes before retrying the fork request

## POST /orble/delete

Permanently delete the box and its disk.

```sh
curl -fsS -X POST http://169.254.77.77/orble/delete
```

### Input schema

No request body.


### Output schema

`202 Accepted` · `text/plain`

Body: `Orble is deleting this box.` followed by a newline.


### Behavior

- `Exec wait`: Deletion is deferred until active Orble exec calls return, for up to 2 minutes
