Skip to main content

nf-ai-sandbox-cli

Installs the ai-sandbox command. The distribution is named nf-ai-sandbox-cli because ai-sandbox-cli was already taken on PyPI.

Section 8.2 / Build Order 42.

pip install -e .   # also installs the ai_sandbox SDK as a dependency

ai-sandbox login
ai-sandbox launch --template llama-3-8b
ai-sandbox launch --gpu H100 --provider auto --template llama-3-8b --hours 4
ai-sandbox status <instance-id>
ai-sandbox templates
ai-sandbox whoami
ai-sandbox logout

login uses the same browser-based device-authorization flow described in ai_sandbox's README / Section 8.2 — never a manual API key copy-paste. Credentials (including a refresh token — see Auth refresh below) are stored at ~/.ai-sandbox/credentials.json and are shared with any script using from ai_sandbox import Client.

Commands

Command Does
login [--no-browser] Device-authorization login. --no-browser prints the verification URL instead of opening one.
logout Deletes ~/.ai-sandbox/credentials.json.
whoami Shows the logged-in user's email/name.
templates Lists the sandbox template catalog.
launch --template <id> [flags] Launches a sandbox; blocks and streams progress, then prints the connection URL. --free-text "<request>" is the alternative to --template for Section 7.4 catalog-miss requests — exactly one of the two is required. --git-repo/--run-command or --notebook runs a workload automatically once the sandbox is up.
status <instance-id> Current status + connection details (Jupyter URL / SSH command).
tunnel <instance-id> --port <port> [--local-port <port>] SSH-forwards a local port to a port inside the sandbox (TensorBoard, Gradio, MLflow, ...) — see OI-42 note below. Blocks until Ctrl+C.
workload-run <instance-id> [--rerun] [--attach-git-repo <url> --run-command <cmd> [--git-ref <ref>]] [--cancel] Checks on a --git-repo/--notebook workload started by launch, re-runs it, attaches a new one to an instance launched with none yet, or cancels the currently attached run.
metrics <instance-id> Latest live GPU/CPU/RAM/disk utilization snapshot for a running instance.
metrics-history <instance-id> [--since <iso-timestamp>] The raw utilization time series behind metrics (charting it is a frontend-only surface, but the data is available here for scripting).
stop <instance-id> Pauses a running sandbox, preserving disk/state.
resume <instance-id> Un-pauses a grace-stopped (or plain stopped) sandbox — the counterpart to stop.
terminate <instance-id> Terminates a sandbox permanently.
migrate <instance-id> <target-provider> Moves a running sandbox to a different provider — relaunches there and copies the workspace over, then terminates the old instance.
instances Every sandbox you've launched, newest first.
organization The shared org budget your usage is billed against, if you're a member of one.
usage Your usage/billing summary — GPU hours, storage, free-quota-covered spend, and any real card charges.
quota-request --amount <usd> --reason <text> Asks an admin to raise your free quota above the platform default (OI-39).
pricing Lists every published hourly rate you'd actually pay, cheapest first.
memory [--set-gpu/--set-provider/--set-framework/--set-budget <val>] [--enable/--disable] [--forget] Shows or updates what the Copilot remembers about you. With no flags, just shows the current state.
experiments Lists every experiment you've saved.
experiment <experiment-id> Shows one experiment's config and results.
experiment-rerun <experiment-id> Re-launches the sandbox an experiment recorded, from the same config.
experiments-compare <id> <id> [<id> ...] Compares 2+ experiments' recorded results side by side.
benchmarks [--type <type>] Lists your recorded benchmark results.
benchmark-run <instance-id> --type <type> [--metric-key <key>] Runs a benchmark against one running instance.

Every command accepts --api-url (or AI_SANDBOX_API_URL) to point at a non-default backend; otherwise it resolves the same way the SDK's Client does (stored credentials file, then http://localhost:8000).

Reaching a non-Jupyter service in your sandbox (OI-42)

The platform only ever exposes SSH and Jupyter publicly, by design (Master Spec §21) — a security boundary the project deliberately keeps narrow rather than widening per-template. If you're running TensorBoard, a Gradio demo, or anything else with its own port, tunnel reuses the SSH access you already have instead of opening a new port on the instance:

ai-sandbox tunnel <instance-id> --port 6006   # TensorBoard, say
# now open http://localhost:6006

No provider or platform change, no new attack surface — this is the same ssh -L port-forwarding pattern you'd use manually, just wrapped for convenience.

Auth refresh

You never need to re-run login just because time has passed. Access tokens are short-lived by design; the CLI (via ai_sandbox.Client) transparently exchanges the stored refresh token for a new access token on the first 401 it sees and retries the request once, with no visible interruption. This matters most for launch, which can poll for minutes while a sandbox provisions. Only a second 401 — meaning the refresh token itself is gone, e.g. after logout or on a machine that's been idle long enough for it to expire — surfaces as Not logged in. Run \ai-sandbox login` first.`. See the SDK README's "Token refresh" section for the full mechanism.

Error handling

Every command exits non-zero on failure and prints a one-line message to stderr rather than a raw traceback. The pattern throughout main.py is to catch the specific ai_sandbox exception types that call for different wording (NotAuthenticatedError, DeviceLoginDeniedError, DeviceLoginTimeoutError, FreeTextReviewQueuedError) and fall back to the AiSandboxError base class for everything else. launch additionally treats FreeTextReviewQueuedError as a non-error: no instance was created, but the request was queued for admin review, so it prints the review queue id and exits 0. See ai_sandbox's README for the full exception hierarchy these messages are built from.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nf_ai_sandbox_cli-0.1.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nf_ai_sandbox_cli-0.1.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file nf_ai_sandbox_cli-0.1.0.tar.gz.

File metadata

  • Download URL: nf_ai_sandbox_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nf_ai_sandbox_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e9618db835a174f628e5a0aaa8d7daea955462dc7ec4cb426e11869dc0db01aa
MD5 0c2bd2426384dc7e29cdf8daaa81aad6
BLAKE2b-256 c32d34228e7384b536248c126335fc4c953b19038bbbd0dd7605aee4eff86a03

See more details on using hashes here.

Provenance

The following attestation bundles were made for nf_ai_sandbox_cli-0.1.0.tar.gz:

Publisher: publish-packages.yml on NuovoForte-Co/Docker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nf_ai_sandbox_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nf_ai_sandbox_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a120e5fe1fbfea90f701309cd296ed7399fbd98f31e8b34cabd107f3cdfdbe62
MD5 03a1dc00ea873a1ff0da69462125b645
BLAKE2b-256 891202f7bc4535dfb297c6fb0d40c59827141c4265ac1bda792a1f20b63c8658

See more details on using hashes here.

Provenance

The following attestation bundles were made for nf_ai_sandbox_cli-0.1.0-py3-none-any.whl:

Publisher: publish-packages.yml on NuovoForte-Co/Docker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page