Skip to main content

Runtime Cloud Python SDK

One client for every Runtime Cloud product, sync and async. Python 3.10 or later, standard library only.

pip install withruntime

The client uses RUNTIME_API_KEY when it is set, and otherwise the connection this machine saved when npx withruntime login connected it (one browser approval, no key to copy). On a server, set RUNTIME_API_KEY from your secret manager (create a key at https://withruntime.com/account/keys). Never put a key in source code, a URL or a command-line argument.

from withruntime import Sandbox

with Sandbox.create() as sbx:
    result = sbx.exec("python3 -c 'print(6 * 7)'")
    print(result.exit_code, result.stdout)

Sandbox.create() needs no arguments and returns once the sandbox is running; leaving the with block stops it. AsyncRuntime is the same client for asyncio, method for method:

import asyncio
from withruntime import AsyncRuntime


async def main():
    async with AsyncRuntime() as runtime:
        async with await runtime.sandboxes.create() as sbx:
            print((await sbx.exec("uname -a")).stdout)


asyncio.run(main())

A sandbox has exec, exec_stream, spawn, terminal, files (read, write, list, glob, stat, move, remove, upload and download directories), pause, wake, extend, fork and snapshot, and the interpreter, network, previews and desktop products. The client has sandboxes, images, volumes, snapshots, feedback and support. Every write carries an idempotency key, so retries never do anything twice; errors are typed and carry code, hint and request_id.

Docs: https://withruntime.com/docs/python.

The package was called withruntime-cloud, imported as runtime_cloud, until 0.3.0. Both names still work: withruntime-cloud installs this package and import runtime_cloud gives you the same classes.

Release files for withruntime 0.3.1

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

Source distribution (sdist)

Source distribution for withruntime 0.3.1
File Size Uploaded
withruntime-0.3.1.tar.gz 51.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for withruntime 0.3.1
File Interpreter ABI Platform
withruntime-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 107.0 kB

Release files / withruntime-0.3.1.tar.gz

Download URL withruntime-0.3.1.tar.gz
Size 51.9 kB
Tags Source
SHA-256 checksum
How to use checksums
762ffce862fe6a3cd514a112529dc7f7f190a7a854328296159d696fc4162443
BLAKE2b-256 checksum
How to use checksums
51d3c3c4a079b2f185cfc92c7f6f9b53de3a2625558aa803002a926cda852088
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / withruntime-0.3.1-py3-none-any.whl

Download URL withruntime-0.3.1-py3-none-any.whl
Size 55.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05e9660f55a8bcd1498761ac19a7bbb0d5d6f57d1dda2cb667fdb1b0d7f2bbfc
BLAKE2b-256 checksum
How to use checksums
90b27ef6dcb1d1423e532575e9da473208025575a047a95afa2b42ee5e50c5d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 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