Skip to main content

ruos

Ultra-lite Python client for ruOS: your cloud desktops, ruOS Lite browsers, and the hosted ruOS MCP tools, from Python.

The library is a single compiled Rust extension (PyO3, abi3 wheels for Python 3.8+). It has no Python dependencies, uses rustls (no OpenSSL), and releases the GIL during every network call.

pip install ruos

Sign in

The Python package has no login flow of its own. Use one of these:

  1. npx ruos login, which stores tokens in ~/.config/ruos/credentials.json (mode 0600; $RUOS_CONFIG_DIR or $XDG_CONFIG_HOME/ruos if set). The Python client reads the same file and refreshes the access token automatically. On refresh it writes the file back in the format npx ruos expects (version: 1, expires_at in epoch milliseconds, all other fields kept), so one login covers both tools.
  2. Set RUOS_TOKEN to an access token or a tenant API token (ruos_mcp_…, minted in the dashboard).
  3. Pass Client(token="...").

Precedence is token=, then RUOS_TOKEN, then the credentials file. Only file-based credentials are refreshed.

Use

import ruos

c = ruos.Client()

c.whoami()          # {"tier": "pro", "token_source": "credentials_file", "plan": {...}, ...}
c.desktops()        # [{"machine_id": "...", "name": "dev", "state": "started", ...}, ...]
c.lite()            # saved ruOS Lite browsers ([] if none)

c.start("dev")      # by machine id, Fly id, name or display name; or "lite"
c.stop("dev")

c.tools()           # hosted MCP tools/list
c.call("desktop_status")                       # hosted MCP tools/call
c.call("desktop_exec", machine_id="...", command="uname -a")

png_or_jpeg = c.screenshot()                   # machine="lite" by default
open("screen.jpg", "wb").write(png_or_jpeg)

c.act("lite", "click", x=640, y=360)
c.act("lite", "type", text="hello")
c.act("lite", "key", keys="ctrl+l")

print(ruos.__version__)

act takes these actions: mouse_move, click, double_click, drag, scroll, type, key, cursor_position, screen_size. Its keyword arguments are x, y, to_x, to_y, button, direction, amount, text and keys. Anything else raises ValueError before a request is sent.

Jobs

A job is a command that runs detached on a desktop for up to six hours. Its output stays on the desktop, and you read it by byte offset (ADR-105).

job = c.jobs_start("dev", "cargo test --workspace", timeout=3600)
job["job_id"], job["idempotency_key"]          # retry with key=... to get the same job

for chunk in c.jobs_follow(job["job_id"]):     # bytes, until the job ends
    sys.stdout.buffer.write(chunk)

p = c.jobs_poll(job["job_id"], offset=0, wait_ms=25000)
p["chunk"], p["next_offset"], p["state"], p["exit_code"]

c.jobs_list()                                  # newest first; or jobs_list("dev")
c.jobs_cancel(job["job_id"])

The command must be one line. jobs_start refuses ruOS Lite. A reused key with a different command raises RuosError (HTTP 409). More than 4 active jobs raises RateLimited. An unknown job id raises NotFound. jobs_follow releases the GIL while it long-polls. It polls every second while output flows and backs off to every 10 s when it does not. Its job attribute holds the final state and exit_code.

Options

ruos.Client(
    token=None,              # explicit bearer
    base_url=None,           # default: $RUOS_BASE_URL or https://ruos.cognitum.one
    credentials_path=None,   # default: ~/.config/ruos/credentials.json
    timeout=None,            # seconds, default 60
)

Errors

Every API error is a ruos.RuosError:

Exception When
ruos.AuthError no credentials, HTTP 401/403, or a failed token refresh
ruos.NotFound HTTP 404, or no desktop matches the name you gave
ruos.RateLimited HTTP 429; retry_after holds the server's hint in seconds
ruos.RuosError anything else (5xx, transport, MCP tool errors)

Invalid arguments raise ValueError or TypeError. Tokens never appear in exception messages or repr(Client).

Notes

  • whoami() reports the tenant's plan and where the token came from. ruOS does not yet have a route that returns your identity.
  • The hosted MCP endpoint (/mcp) is stateless Streamable HTTP. The client sends each JSON-RPC request on its own and accepts both SSE and JSON replies.
  • Source: packages/ruos-py. Design: ADR-100.

License: MIT OR Apache-2.0.

Metadata

Release files for ruos 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ruos 0.2.0
File Size Uploaded
ruos-0.2.0.tar.gz 41.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for ruos 0.2.0
File
ruos-0.2.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
ruos-0.2.0-cp38-abi3-manylinux_2_28_aarch64.whl CPython 3.8 abi3 Linux glibc 2.28+ ARM64 Details
ruos-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
ruos-0.2.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64, macOS 10.12+ x86-64 Details

Total release size: 5.0 MB

Release files / ruos-0.2.0.tar.gz

Download URL ruos-0.2.0.tar.gz
Size 41.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5fa28a2ef7100646cb629af810060e78f5b394282bac4217e0bc69d5775190b6
BLAKE2b-256 checksum
How to use checksums
ef96ed70672ec9d2ef6037ae32d4dc399f7fe7246baaf3e0e2eacd995a0fee5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ruos-0.2.0-cp38-abi3-win_amd64.whl

Download URL ruos-0.2.0-cp38-abi3-win_amd64.whl
Size 975.5 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
29b9815b8660ef272446b685e44a4cf64ce19bdb9602d0f44513a65a27461d78
BLAKE2b-256 checksum
How to use checksums
f7e9862ebaebfb825aa0417fa4987f915e1fb97b7b648b2deca8c22248a8befe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ruos-0.2.0-cp38-abi3-manylinux_2_28_aarch64.whl

Download URL ruos-0.2.0-cp38-abi3-manylinux_2_28_aarch64.whl
Size 1.0 MB
Tags CPython 3.8 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
f93c1c12496cc622c24df5adf30ae73f350ddea56346a37db007bf1a933b5430
BLAKE2b-256 checksum
How to use checksums
9d5fc3f53bd071e1c5ee1d07f71868c6f864e087282c6c32bc17502c741c0000
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ruos-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ruos-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.1 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
af54395a0a2e01ec53bbbb232d654f293892701b18c15b5d5208522336d46fa1
BLAKE2b-256 checksum
How to use checksums
1c9ebb707d2c3ab43235a6bd42bd38c3f4e4184ffe9062b9e5d7e427a7d8dd60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ruos-0.2.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL ruos-0.2.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 1.9 MB
Tags CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b0a4e4ab08af97c25cc716e3a7bd458414db16b35662491c4b6000ecc4014767
BLAKE2b-256 checksum
How to use checksums
7e7d60666c044481c376cdacc04b64dadd4809665206cd33750a1646f455cda2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.2.0 This release

5 release files

0.1.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page