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-cloud

The client uses RUNTIME_API_KEY when it is set, and otherwise the connection this machine saved when npx @withruntime/cloud 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 runtime_cloud 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 runtime_cloud 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.

Release files for withruntime-cloud 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 withruntime-cloud 0.2.0
File Size Uploaded
withruntime_cloud-0.2.0.tar.gz 50.5 kB Details

Built distribution (wheel)

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

Total release size: 104.3 kB

Release files / withruntime_cloud-0.2.0.tar.gz

Download URL withruntime_cloud-0.2.0.tar.gz
Size 50.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ac75f95e22f6a22555b67e7ce23ce5f50cc00f86d188db954006dc7281679fa5
BLAKE2b-256 checksum
How to use checksums
876ab58164f343184498a4ac8e5c09d73bf7e93296a40eaeb81b034ee68cf95f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.11

Release files / withruntime_cloud-0.2.0-py3-none-any.whl

Download URL withruntime_cloud-0.2.0-py3-none-any.whl
Size 53.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2914e04d3328bed1568f77d9c6990a9665313ddffd22268c01c8d8bc891661c
BLAKE2b-256 checksum
How to use checksums
1fd5649aec54c61c7f638ac592838afc5614e8dd0292820744765706e2d540f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.11

Release history Release notifications | RSS feed

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.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