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                          # first run in a real terminal prompts for email + verification code, then creates your first computer
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/ubuntu --port 3000
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
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/ubuntu
runtime files read <id> /home/ubuntu/app.py --output app.py
runtime files write <id> /home/ubuntu/app.py --input app.py --mode 0644
runtime files mkdir <id> /home/ubuntu/data --parents
runtime files upload <id> ./local-app /home/ubuntu/app
runtime files download <id> /home/ubuntu/app ./downloaded-app
runtime files rm <id> /home/ubuntu/data --recursive
runtime startup show <id>
runtime startup set <id> --command "python3 app.py" --cwd /home/ubuntu --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           # promote the running app on port 3000 to the public durable app
runtime delete <id>

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

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/ubuntu",
    port=3000,
)

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

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

# 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> can promote a running listener into the saved public app definition by inspecting the live process. Inside a running computer, runtime-env publish <port> 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/ubuntu/<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

Preview the next release without changing files:

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

Publish a patch release:

./scripts/release_runtime_sdk.sh --publish

Publish a different version bump:

./scripts/release_runtime_sdk.sh --bump minor --publish

The script loads backend/.env automatically, so UV_PUBLISH_TOKEN can live there.

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.42-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.42-py3-none-musllinux_1_2_aarch64.whl (42.2 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

runtime_sdk-0.4.42-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.42-py3-none-manylinux_2_17_aarch64.whl (43.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 13.0+ x86-64

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

Uploaded Python 3macOS 13.0+ ARM64

runtime_sdk-0.4.42-py3-none-any.whl (41.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for runtime_sdk-0.4.42-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 203d2a62541f47eebcbef84b31b8a1fc6571ebdc56221fb24c8277f943e2ac2b
MD5 64750e80f70e6b0bdcd4a319353731f0
BLAKE2b-256 a49f7dea6689b7b33cbe071ac97cc277a5ef0a79b8a891a7963ba6ea4494f6cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for runtime_sdk-0.4.42-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4ea5aea28635eae38c33cf63ea6519ed0c0db45354f3003918f90e7acf54f8c7
MD5 d779d077ef4b5ea08e7a6209f6b19662
BLAKE2b-256 7260d0c0efb13757a7163c118dc8c22d29a37c0ce34b90be0039d0f3bc444356

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for runtime_sdk-0.4.42-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 2afd127434d82d1b1a29d32da8a53eae6075117b228924d88b7332c07e609fc0
MD5 1f40e8c8fb21875da3d45c93e58b404b
BLAKE2b-256 62656b68f7e7342903936ebdfdd3426013a9ce7882ed91bb50229029b7bb4584

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for runtime_sdk-0.4.42-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 c647c481156296e8bb94d9ec2b3625e69fdb43ec606b16a60aa03447683bc2eb
MD5 5677969c08612a057b2a02cb1d252893
BLAKE2b-256 f4a21f0944ef38d98cb09f0475e8d774bdaf42f7a0f6b20bfa29404e6f59b416

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for runtime_sdk-0.4.42-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 7a1a7b23db19c63caf24d81d3cbe0489421deaf3b7aeb5dc195ddce0c0df0308
MD5 4ec6c758d7b948e4fcf9b0c817217cd0
BLAKE2b-256 41c53ea4bf69ac566bf66ccd2e35d567eebdde37b7048f9ed677cf060498681d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for runtime_sdk-0.4.42-py3-none-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 fa20e4ed56b025f36055ebecf53bf70a0b0feccba4c60985a241a9dd39e27a05
MD5 553fc3f791facaae039916134cec0718
BLAKE2b-256 79311a1a453a58f4cd637013836000ab799f844940a824471028ca77464cc4f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for runtime_sdk-0.4.42-py3-none-any.whl
Algorithm Hash digest
SHA256 d761cca6906b5ddd98ff4c6110742405af0290c1c1a29d6dcaed5ac9a834dda7
MD5 4158fcee3b429045caff1c93201f03ca
BLAKE2b-256 efd705db9cb6703c00b1808b977fa8746087526bb93bf04e3d352e6d571ed69b

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