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.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 withruntime 0.3.0
File Size Uploaded
withruntime-0.3.0.tar.gz 51.0 kB Details

Built distribution (wheel)

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

Total release size: 104.7 kB

Release files / withruntime-0.3.0.tar.gz

Download URL withruntime-0.3.0.tar.gz
Size 51.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ea7986bebaa82e2f06814f01f20d1d0c88c1d2181c75cb9f6e84e0b52ebf1f51
BLAKE2b-256 checksum
How to use checksums
980a733ab54f8cf6790359121513a8eb037cc922d131d345a0ffd4119fda5f2b
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.0-py3-none-any.whl

Download URL withruntime-0.3.0-py3-none-any.whl
Size 53.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f517fb2afeca8518a6f802078ded6179fcb390e19b999204a9f28afb7e445cc2
BLAKE2b-256 checksum
How to use checksums
86e214832efc11adc92d67244bf17a6863d2d5cb5eba56687c77e91d280efdd3
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

0.3.1

2 release files

This release

0.3.0 This release

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