---
name: rsibox
description: Run workloads in rsibox CPU or GPU Boxes using the rsi CLI or Python SDK. Use for creating Boxes, executing commands, transferring files, collecting results, and diagnosing rsibox task failures. Also use for rsibox setup and Harbor integration; repository development and platform administration are outside this skill.
metadata:
  source: https://rsibox.ai/skill.md
---

# rsibox

Use rsibox to carry out the user's task on an isolated remote machine called a
Box. Prefer the `rsi` CLI for terminal work and the Python SDK for an existing
Python workflow. A Box is a VM with its own disk, optional GPUs, and a bounded
lifetime. Stopping it permanently discards the disk.

Keep the user's selected project, hardware, budget, and existing Box. Create a
Box only when the task calls for one. If given this skill without a task, ask what
the user wants to run. Fetch only the linked documentation needed for the task;
use installed command help to check flags rather than guessing them.

## Set up the client and credentials

Check `rsi version` first. The `rsibox` Python package includes the CLI and SDK.
If missing or outdated, install or upgrade it in a virtual environment with
Python 3.14 or newer:

```sh
python -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade rsibox
rsi version
```

Supported client platforms are Linux x86-64, Linux ARM64, and macOS ARM64. See
[Quickstart](https://rsibox.ai/docs/quickstart/) for current requirements.

Reuse the current login or an injected `RSIBOX_API_KEY`. Check access with
`rsi project list`; do not print tokens or put them in source files, prompts,
or guest commands. If login is needed, `rsi login` starts a device flow for the
user to approve. With `RSIBOX_API_KEY` set, it verifies the key instead. An
unattended job needs a key from the user's secret store. Compute also requires an
invited account, a provisioned project, and team credits. When `RSIBOX_API_URL`
is set, it selects a non-default HTTPS gateway origin (or loopback HTTP);
preserve any preconfigured `RSIBOX_API_URL`.

Project precedence is `rsi --project SLUG ...`, then `RSIBOX_PROJECT`, then the
saved `rsi project use SLUG` choice, then the key's project or the gateway default.
Prefer a per-command flag or a job-specific environment over changing the user's
saved preference. Keep the project stable for the entire job, including retries
and cleanup. A project-scoped key cannot access a different project.

Read [Authentication](https://rsibox.ai/docs/guides/authentication/) for login and
key problems, or [Projects](https://rsibox.ai/docs/guides/teams-and-projects/)
for selection and permissions.

## Run a task

1. Inspect a supplied Box with `rsi box get ID`; otherwise choose resources and
   a lifetime appropriate to the requested work. A short CPU smoke test can use
   2 cores, 4096 MiB memory, 20480 MiB disk, and `10m`. For GPU work or exact
   machine pinning (`spec.hardware`), get current models, availability, and
   hardware profiles from `GET /v1/prices` and `GET /v1/hardware` as described in
   [Boxes](https://rsibox.ai/docs/guides/boxes/); do not invent GPU names,
   hardware profiles, or prices.
2. Choose `--network none` for work that needs no internet, or `--network gateway`
   for fetching packages, repositories, and data. With gateway networking,
   omitting allowed hosts permits public egress. Inspect `/etc/os-release` before
   choosing a guest package manager.
3. Generate and retain one idempotency key before creating a Box. On an uncertain
   result, reuse the exact project, key, and request. A new key creates a new Box.
4. Upload inputs, execute the workload with a suitable timeout, inspect its exit
   code and output, and download the requested artifacts.
5. Stop a temporary Box created for this task after preserving results, including
   after a failed workload. Preserve a pre-existing Box or one the user wants to
   keep. If cleanup fails, report its ID and state so it can be recovered.

This CLI example assumes the intended project has been selected. Adapt the
workload and resources to the user's task:

```sh
create_key=$(python -c 'import uuid; print(uuid.uuid4().hex)')
# Retain this key before submission, including across process restarts in durable jobs.
box=$(rsi box create --name agent-task \
  --cores 2 --memory-mb 4096 --disk-mb 20480 \
  --network none --life 10m --idempotency-key "$create_key")
rsi box exec --timeout 60 "$box" -- uname -s
rsi box get "$box"
```

`box create` waits for `running` and prints the compute ID. A local wait timeout
does not prove creation failed: replay the original create and key to recover
the Box before making another. `life` starts at first `running`. A requested
duration above the team limit or affordable duration is rejected without creating
a Box; it is never silently shortened. Queued time is not billed.

`box exec` waits, prints stdout and stderr, and returns the guest command's POSIX
exit code (`124` for guest timeout, `128+sig` for guest signals; `--json` and SDK
`exec_output` return the raw signed `exit_code`). Arguments are passed directly;
use `-- sh -c '...'` for pipes, redirection, or multiple shell commands. Use a
stable `--idempotency-key` for an execution that must be retried without
submitting it twice. See `rsi box exec --help` for working-directory,
environment, and output options.

Transfers use paths relative to the guest root; commands use normal guest paths:

```sh
rsi box upload --mode 600 "$box" ./input.txt tmp/input.txt
rsi box exec --timeout 60 "$box" -- sh -c 'cp /tmp/input.txt /tmp/result.txt'
rsi box download "$box" tmp/result.txt ./result.txt
# After collecting all needed results from this temporary Box:
rsi box stop "$box"
rsi box get "$box"
```

Downloads verify size, SHA-256, and completion. A stop response may still say
`terminating`; resources and billing are released after shutdown finishes.
Inspect `rsi box events ID` (SDK `get_sandbox_events`) when startup, queueing, or
termination needs diagnosis, and `rsi box gpu ID` (SDK `get_sandbox_gpu_status`)
for live GPU utilization and VRAM readings. Report the Box ID, task outcome,
artifact locations, and whether it was stopped or deliberately kept running. Do
not claim successful execution from creation alone.

## Python, HTTP, and integrations

- **Python:** Read [Python SDK](https://rsibox.ai/docs/guides/python-sdk/) before
  writing orchestration. `RsiboxClient` shares CLI credentials and project.
  `create_sandbox` returns before startup completes; loop on `wait_sandbox` with
  an overall deadline. `exec` returns an execution ID; poll `exec_output`, advance
  both output cursors, and wait for `output_complete`. The client context manager
  does not stop Boxes: use explicit cleanup in `finally` for temporary workloads.
- **HTTP:** Read [Compute API](https://rsibox.ai/docs/api/compute/) before writing
  requests. CLI/SDK compute IDs differ from `/v1/boxes` console billing IDs.
  Compute create uses nested `cpu` and `accelerator`; console create uses flat
  `vcpus` and `gpu`. Do not mix these schemas or IDs.
- **Harbor:** Read [Harbor](https://rsibox.ai/docs/guides/harbor/) for benchmarks.
  Install `'rsibox[harbor]'` (quoted for shells such as zsh) and use
  `-e rsibox.harbor:RsiboxEnvironment`. Follow the guide's supported image and
  networking options.
- **Editor access:** Read [VS Code](https://rsibox.ai/docs/guides/vscode/) when the
  user asks to edit interactively inside a Box.

## Recover from errors

Use HTTP status and structured error code, not message text. The SDK exposes
`RsiboxAPIError.status`, `.code`, `.detail`, and `.request_id` (from
`X-Request-Id`). Preserve `.request_id` / `X-Request-Id` when reporting API
errors. Read [Errors](https://rsibox.ai/docs/api/errors/) for details.

- `401`: repair login or the injected key. `403`: check scope, membership, and
  permissions; changing the project cannot widen a key's access.
- `400 life_limit_exceeded`: report the maximum lifetime in the error. Request a
  shorter duration only if it still meets the user's needs, or ask an administrator
  to raise the limit. The rejected request did not create a Box.
- `402 insufficient_credits`: report the balance blocker (including depleted or
  expired credit grants or an unaffordable requested lifetime; check `GET /v1/credits` and `next_expiry`) before
  another create.
- `409 gpu_unavailable` or `hardware_unavailable`: inspect the live catalog and
  project's inventory (`GET /v1/prices` and `GET /v1/hardware`); do not silently
  substitute requested hardware.
- Limit-related `429`: inspect active Boxes and report the limit. Do not stop
  unrelated Boxes to make room.
- Retryable `429`/`502`/`503` with `Retry-After` (`service_busy`, `create_pending`,
  transient `compute_error`): the CLI and SDK auto-retry with the same
  `Idempotency-Key`. For custom HTTP callers, honor `Retry-After`, keep write
  keys and request bodies unchanged, and bound retries.
- Non-retryable `503` without `Retry-After` (`node_pool_sync_pending`,
  `pricing_unavailable`, `compute_unavailable`): report to an administrator with
  the request ID; do not retry.
- Timeout, disconnect, or uncertain write: recover the original operation with
  its key or inspect its ID. A network-policy timeout also leaves its application
  unconfirmed. Do not report that a policy changed until confirmed.
- `409 create_failed` or `410 sandbox_gone`: the old create cannot provide a live
  Box. Start a fresh attempt with a new key only if the task still needs one.

## Install for future tasks

Reading this file is sufficient for the current task. If the user asks to install
the skill for future tasks, use `rsi skills`; it fetches this same file through the
open `skills` installer and lets the user choose their agent. It requires Node.js
22.20 or newer with `npx`, and does not require rsibox login.

```sh
rsi skills --agent codex -y
rsi skills --agent claude-code --global -y
rsi skills update
```

The default install is project-local; `--global` selects user-level installation.
Updates refresh only the installed rsibox skill in the selected scope. If an older
rsibox client has no `skills` command, the equivalent direct install is:

```sh
npx --yes skills@latest add https://rsibox.ai/skill.md --skill rsibox
```
