Skip to main content

runtime-sdk

Python SDK and CLI for Runtime.

Install

Supported host OS for scriptable CLI commands: macOS and Linux only.

The interactive dashboard requires macOS 13+ or 64-bit Linux with glibc 2.17+ or musl 1.2+. On older macOS/Linux environments, the universal wheel keeps scriptable subcommands available, but bare runtime cannot open the OpenTUI dashboard.

Windows is not supported at this time.

uv tool install runtime-sdk

To upgrade an existing install:

uv tool upgrade runtime-sdk

Configure

The CLI talks to https://api.runruntime.dev by default.

For local or self-hosted Runtime, override it with:

export RUNTIME_BASE_URL=http://127.0.0.1:8080

Or pass --base-url per command.

Usage

# Auth
runtime                          # open the interactive dashboard; sign in first if needed
runtime login                    # interactive email + verification code flow
runtime login you@example.com
runtime verify 123456
runtime whoami
runtime logout
runtime login --api-key rt_live_...
runtime api-keys list
runtime api-keys create "my laptop"
runtime api-keys revoke 123
runtime integrate github
runtime github list
runtime github disconnect acme

# Computers
runtime switch --repo owner/repo feature/login      # open or create the branch workspace computer
runtime switch -c feature/login --repo owner/repo   # create a new branch workspace from the repo default branch
runtime checkout --repo owner/repo feature/login    # alias for switch
runtime create                       # creates a computer with the starter app already published
runtime create myapp --command "python3 app.py" --cwd /home/runtime --port 3000
runtime create locked --network allowlist --allow-host api.example.com
runtime enter <name-or-id>         # open an interactive shell; accepts slug/name or computer id
runtime enter <name-or-id> -- claude   # open a real TTY and run an interactive command
runtime enter <name-or-id> -- python   # use enter for REPLs, agents, prompts, and full-screen apps
runtime ssh <name-or-id>           # open SSH through Runtime's authenticated tunnel
runtime ssh <name-or-id> -- uptime # run a command with the local ssh client
runtime list                    # open the computer dashboard in a terminal
runtime list --json             # one JSON response for scripts and agents
runtime list --json --watch 2   # newline-delimited JSON updates
runtime info <id>
runtime share public <id>
runtime share private <id>
runtime start <id>
runtime run <id> "echo hello"      # one-shot foreground command only
runtime run <id> "apt install -y nodejs" --uid 0
runtime exec <id> -- bash -lc 'for i in 1 2 3; do echo $i; sleep 1; done'
printf 'hello' | runtime exec <id> --stdin -- cat
# Use runtime exec for automation and exact exit codes; use runtime enter -- <cmd> for interactive TTY commands.
runtime files ls <id> /home/runtime
runtime files read <id> /home/runtime/app.py --output app.py
runtime files write <id> /home/runtime/app.py --input app.py --mode 0644
runtime files mkdir <id> /home/runtime/data --parents
runtime files upload <id> ./local-app /home/runtime/app
runtime files download <id> /home/runtime/app ./downloaded-app
runtime files rm <id> /home/runtime/data --recursive
runtime startup show <id>
runtime startup set <id> --command "python3 app.py" --cwd /home/runtime --port 3000
runtime startup clear <id>          # low-level durable service config
runtime service show <id>           # user-facing alias for the durable published app
runtime service clear <id>
runtime publish <id> 3000 -- python3 app.py
runtime delete <id>

# Network policy
runtime network default show
runtime network default allowlist api.example.com '*.github.com'
runtime network show <id>
runtime network set <id> none
runtime network set <id> open

# Inside a running computer, the helper installed by Runtime can manage the
# durable app without leaving the sandbox:
#   runtime-env publish 3000 -- python3 app.py
#   runtime-env service show
#   runtime-env service clear

Private public URLs authenticate the browser before forwarding traffic. Apps behind a private URL receive trusted X-Runtime-Account-ID, X-Runtime-User-ID, and X-Runtime-User-Email headers. Runtime strips client-supplied versions of those headers from both public and private traffic; public URLs receive no Runtime identity headers.

Python

from runtime_sdk import RuntimeClient

client = RuntimeClient(base_url="https://api.runruntime.dev", api_key="rt_live_...")

# Create a computer. New computers start with the starter app already published.
computer = client.create_computer()
print(computer["public_url"])  # https://goldbird.runruntime.dev

# Or create one with an explicit durable app command.
# That saved service is replayed after cold restore / start.
app = client.create_computer(
    slug="myapp",
    command="python3 app.py",
    cwd="/home/runtime",
    port=3000,
)

# Account defaults are copied only to computers created later.
client.set_default_network("allowlist", ["api.example.com"])
restricted = client.create_computer()
client.set_computer_network(restricted["id"], "none")

# Run a command
result = client.run_command(computer["id"], "echo hello")
print(result["stdout"])

client.write_file(computer["id"], "/home/runtime/hello.txt", b"hello\n")
print(client.read_file(computer["id"], "/home/runtime/hello.txt"))
print(client.list_files(computer["id"], "/home/runtime"))

# Wake a cold computer explicitly
client.start_computer(app["id"])

# Promote the running app on a local port to the durable public app.
# Runtime inspects the listening process and saves its command + cwd when possible.
client.publish_port(computer["id"], 3000)

# List, info, delete
computers = client.list_computers()
info = client.get_computer(computer["id"])
client.delete_computer(computer["id"])

Development

For fast local backend iteration:

make local-backend

For deploying and testing against the Hetzner production server:

make sync SERVER_IP=x.x.x.x SSH_USER=root
make smoke

Use make deploy instead of make sync when migrations, env files, Caddy, or systemd units changed.

Cold restore and explicit runtime start replay the saved published app command. New computers seed that durable app from the starter workspace. Later, runtime publish <id> <port> -- <command...> replaces the durable app command and starts it. Inside a running computer, runtime-env publish <port> -- <command...> does the same thing using a computer-scoped token installed by Runtime. runtime service show|clear and runtime-env service show|clear expose that same durable app state directly. The low-level runtime startup ... commands still map to the same durable state. A one-off runtime run stays one-shot: the filesystem is restored after going cold, but that ad-hoc process is not.

GitHub branch workspaces

runtime switch gives a repo branch its own Runtime computer so you can jump between parallel tasks without local worktrees.

runtime integrate github
runtime github list
runtime switch --repo owner/repo feature/login
runtime switch -c feature/search --repo owner/repo --from main

Rules:

  • GitHub must already be connected with runtime integrate github.
  • Run runtime integrate github again when you want to add another personal account or org.
  • New GitHub connects require user authorization during installation and GITHUB_APP_CLIENT_ID / GITHUB_APP_CLIENT_SECRET on the Runtime API. In GitHub App settings, enable user authorization during installation and set the callback URL to https://api.runruntime.dev/github/callback.
  • runtime switch opens an existing branch workspace, or creates the computer if the branch exists but the workspace does not yet.
  • runtime switch -c creates a new branch first, then opens that branch's workspace.
  • Each repo + branch maps to one dedicated computer.
  • The repo is cloned into /home/runtime/<repo> and new shells in that computer start there automatically.
  • runtime checkout ... is an alias for runtime switch ....

Run the SDK unit tests through the backend project environment:

uv run python -m unittest scripts.tests.test_runtime_sdk

Release

Set and commit the release version first:

cd backend
uv version 0.4.45

Open the Runtime SDK workflow from that commit, enter the exact committed version, and run it. The Blacksmith runner tests the Python CLI and OpenTUI, builds all platform wheels, and publishes them to PyPI.

gh workflow run runtime-sdk.yml --ref <branch> -f version=0.4.45

Preview the runner commands without building:

./scripts/release_runtime_sdk.sh --dry-run

UV_PUBLISH_TOKEN is a GitHub repository secret. The release script never changes the source version and never loads a local .env file.

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

runtime_sdk-0.4.47-py3-none-musllinux_1_2_x86_64.whl (42.4 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

runtime_sdk-0.4.47-py3-none-musllinux_1_2_aarch64.whl (42.2 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

runtime_sdk-0.4.47-py3-none-manylinux_2_17_x86_64.whl (43.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

runtime_sdk-0.4.47-py3-none-manylinux_2_17_aarch64.whl (43.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

runtime_sdk-0.4.47-py3-none-macosx_13_0_x86_64.whl (28.2 MB view details)

Uploaded Python 3macOS 13.0+ x86-64

runtime_sdk-0.4.47-py3-none-macosx_13_0_arm64.whl (25.7 MB view details)

Uploaded Python 3macOS 13.0+ ARM64

runtime_sdk-0.4.47-py3-none-any.whl (43.7 kB view details)

Uploaded Python 3

File details

Details for the file runtime_sdk-0.4.47-py3-none-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: runtime_sdk-0.4.47-py3-none-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 42.4 MB
  • Tags: Python 3, musllinux: musl 1.2+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for runtime_sdk-0.4.47-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d00fc348d52268856cfebb6964483976107e662855b0d085da5c5c74644b5839
MD5 c92cfd6486ed7c3f91d21cb0b842be30
BLAKE2b-256 76ec9e73fffd17d62472017425a5233a68ded7fbacdef585c4faef5183b370db

See more details on using hashes here.

File details

Details for the file runtime_sdk-0.4.47-py3-none-musllinux_1_2_aarch64.whl.

File metadata

  • Download URL: runtime_sdk-0.4.47-py3-none-musllinux_1_2_aarch64.whl
  • Upload date:
  • Size: 42.2 MB
  • Tags: Python 3, musllinux: musl 1.2+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for runtime_sdk-0.4.47-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 d5e478a267077a3ec9f8f929340575a3464ac4efe120b03f9d5e37cc12ba75f8
MD5 726af9695e9722aef289cf74c439597f
BLAKE2b-256 28573281a3a780eac94aea8bbb87248ec3afbe43e918e5ecd9c584c405749dbf

See more details on using hashes here.

File details

Details for the file runtime_sdk-0.4.47-py3-none-manylinux_2_17_x86_64.whl.

File metadata

  • Download URL: runtime_sdk-0.4.47-py3-none-manylinux_2_17_x86_64.whl
  • Upload date:
  • Size: 43.6 MB
  • Tags: Python 3, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for runtime_sdk-0.4.47-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0d94c1e1f71741a0d2099f66dd507966c7d37c2caf119a7824ddc23d4dfaf4c0
MD5 fa57bd8e4e9b081f360c557439fd34eb
BLAKE2b-256 fa74b1259c018e7055b7e566a61ef550ebe694f8494b7edd3ad3ade8c83e2ab3

See more details on using hashes here.

File details

Details for the file runtime_sdk-0.4.47-py3-none-manylinux_2_17_aarch64.whl.

File metadata

  • Download URL: runtime_sdk-0.4.47-py3-none-manylinux_2_17_aarch64.whl
  • Upload date:
  • Size: 43.6 MB
  • Tags: Python 3, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for runtime_sdk-0.4.47-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 7509bb03809be6f848caee09ebe61c1a5f4d6aa9e3af3574bdae5d028ba79cf2
MD5 25b491fa71c4896036d46201ede9a64b
BLAKE2b-256 1f2b800afed3eee0953c1ac13fc0cc660b2d2df2292684a2fd2b302501e8e112

See more details on using hashes here.

File details

Details for the file runtime_sdk-0.4.47-py3-none-macosx_13_0_x86_64.whl.

File metadata

  • Download URL: runtime_sdk-0.4.47-py3-none-macosx_13_0_x86_64.whl
  • Upload date:
  • Size: 28.2 MB
  • Tags: Python 3, macOS 13.0+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for runtime_sdk-0.4.47-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 7bd307193857b269ac8101f83f6e6e9292999b982feefccf9a198e3a4d9981c0
MD5 1b4831919b33eaf31b819d653d59189b
BLAKE2b-256 25a6f8a569bcd216d4f4c288ebf5af3ad0708f8ca51c0b7173f598516b2d90dc

See more details on using hashes here.

File details

Details for the file runtime_sdk-0.4.47-py3-none-macosx_13_0_arm64.whl.

File metadata

  • Download URL: runtime_sdk-0.4.47-py3-none-macosx_13_0_arm64.whl
  • Upload date:
  • Size: 25.7 MB
  • Tags: Python 3, macOS 13.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for runtime_sdk-0.4.47-py3-none-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 4140594fc72e2c0784be1edc527c89371113732f1e2034c254740416aa04a8a5
MD5 30f3c1835d89b74c3367351755e9310b
BLAKE2b-256 fe8ae174b72d0544026f09cf467e2f6c867ea85cacb07f328e8e273d8d75d224

See more details on using hashes here.

File details

Details for the file runtime_sdk-0.4.47-py3-none-any.whl.

File metadata

  • Download URL: runtime_sdk-0.4.47-py3-none-any.whl
  • Upload date:
  • Size: 43.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for runtime_sdk-0.4.47-py3-none-any.whl
Algorithm Hash digest
SHA256 a85990ca2b76dfe0fa97dcf18ddf540800ba6c3dd9e6ee266ff6a3f8d1903218
MD5 9a106ab012227b23ac85a44051d4b3fb
BLAKE2b-256 0fd3b09d869defea2ac381b5a7ee0abca8fac64b1122a590967cadde71b83079

See more details on using hashes here.

Supported by

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