Asynchronous SDK¶
The asynchronous SDK provides a non-blocking interface for managing devboxes, blueprints, snapshots, and storage objects. Use this variant when working with async/await Python code.
Core Module¶
The core asynchronous SDK module provides async operation classes.
- class runloop_api_client.sdk.async_.AsyncRunloopSDK(*, bearer_token=None, base_url=None, timeout=NOT_GIVEN, max_retries=5, default_headers=None, default_query=None, http_client=None)¶
High-level asynchronous entry point for the Runloop SDK.
Provides a Pythonic, object-oriented interface for managing devboxes, blueprints, snapshots, and storage objects. Exposes the generated async REST client via the
apiattribute for advanced use cases.- Variables:
api (AsyncRunloop) – Direct access to the generated async REST API client
devbox (AsyncDevboxOps) – High-level async interface for devbox management
blueprint (AsyncBlueprintOps) – High-level async interface for blueprint management
snapshot (AsyncSnapshotOps) – High-level async interface for snapshot management
storage_object (AsyncStorageObjectOps) – High-level async interface for storage object management
Example
>>> runloop = AsyncRunloopSDK() # Uses RUNLOOP_API_KEY env var >>> devbox = await runloop.devbox.create(name="my-devbox") >>> result = await devbox.cmd.exec(command="echo 'hello'") >>> print(await result.stdout()) >>> await devbox.shutdown()
Asynchronous SDK entry points and management interfaces.
- class runloop_api_client.sdk.async_.AsyncBlueprintOps(client)[source]¶
High-level async manager for creating and managing blueprints.
Accessed via
runloop.blueprintfromAsyncRunloopSDK, provides coroutines to create Dockerfile-based blueprints, inspect build logs, and list existing blueprints.Example
>>> runloop = AsyncRunloopSDK() >>> blueprint = await runloop.blueprint.create( ... name="my-blueprint", ... dockerfile="FROM ubuntu:22.04\nRUN apt-get update", ... ) >>> blueprints = await runloop.blueprint.list()
- async create(**params)[source]¶
Create a blueprint and wait for the build to finish.
- Parameters:
params (
Unpack[SDKBlueprintCreateParams]) – SeeSDKBlueprintCreateParamsfor available parameters- Returns:
Wrapper bound to the finished blueprint
- Return type:
- from_id(blueprint_id)[source]¶
Return a blueprint wrapper for the given ID.
- Parameters:
blueprint_id (str) – Blueprint ID to wrap
- Returns:
Wrapper for the blueprint resource
- Return type:
- async list(**params)[source]¶
List available blueprints.
- Parameters:
params (
Unpack[SDKBlueprintListParams]) – SeeSDKBlueprintListParamsfor available parameters- Returns:
Blueprint wrappers for each record
- Return type:
- class runloop_api_client.sdk.async_.AsyncDevboxOps(client)[source]¶
High-level async manager for creating and managing AsyncDevbox instances.
Accessed via
runloop.devboxfromAsyncRunloopSDK, provides coroutines to create devboxes from scratch, blueprints, or snapshots, and to list existing devboxes.Example
>>> runloop = AsyncRunloopSDK() >>> devbox = await runloop.devbox.create(name="my-devbox") >>> devboxes = await runloop.devbox.list(limit=10)
- async create(**params)[source]¶
Provision a new devbox and wait until it reaches
runningstate.- Parameters:
params (
Unpack[SDKDevboxCreateParams]) – SeeSDKDevboxCreateParamsfor available parameters- Returns:
Wrapper bound to the newly created devbox
- Return type:
- async create_from_blueprint_id(blueprint_id, **params)[source]¶
Create a devbox from an existing blueprint by identifier.
- Parameters:
blueprint_id (str) – Blueprint ID to create from
params (
Unpack[SDKDevboxCreateFromImageParams]) – SeeSDKDevboxCreateFromImageParamsfor available parameters
- Returns:
Wrapper bound to the newly created devbox
- Return type:
- async create_from_blueprint_name(blueprint_name, **params)[source]¶
Create a devbox from the latest blueprint with the given name.
- Parameters:
blueprint_name (str) – Blueprint name to create from
params (
Unpack[SDKDevboxCreateFromImageParams]) – SeeSDKDevboxCreateFromImageParamsfor available parameters
- Returns:
Wrapper bound to the newly created devbox
- Return type:
- async create_from_snapshot(snapshot_id, **params)[source]¶
Create a devbox initialized from a snapshot.
- Parameters:
snapshot_id (str) – Snapshot ID to create from
params (
Unpack[SDKDevboxCreateFromImageParams]) – SeeSDKDevboxCreateFromImageParamsfor available parameters
- Returns:
Wrapper bound to the newly created devbox
- Return type:
- from_id(devbox_id)[source]¶
Attach to an existing devbox by ID.
Returns immediately without waiting for the devbox to reach
runningstate. Callawait_running()on the returnedAsyncDevboxif you need to wait for readiness (contrast with the synchronous SDK, which blocks).- Parameters:
devbox_id (str) – Existing devbox ID
- Returns:
Wrapper bound to the requested devbox
- Return type:
- async list(**params)[source]¶
List devboxes accessible to the caller.
- Parameters:
params (
Unpack[SDKDevboxListParams]) – SeeSDKDevboxListParamsfor available parameters- Returns:
Collection of devbox wrappers
- Return type:
- class runloop_api_client.sdk.async_.AsyncSnapshotOps(client)[source]¶
High-level async manager for working with disk snapshots.
Accessed via
runloop.snapshotfromAsyncRunloopSDK, provides coroutines to list snapshots and access snapshot details.Example
>>> runloop = AsyncRunloopSDK() >>> snapshots = await runloop.snapshot.list(devbox_id="dev-123") >>> snapshot = await runloop.snapshot.from_id("snap-123")
- from_id(snapshot_id)[source]¶
Return a snapshot wrapper for the given ID.
- Parameters:
snapshot_id (str) – Snapshot ID to wrap
- Returns:
Wrapper for the snapshot resource
- Return type:
- async list(**params)[source]¶
List snapshots created from devboxes.
- Parameters:
params (
Unpack[SDKDiskSnapshotListParams]) – SeeSDKDiskSnapshotListParamsfor available parameters- Returns:
Snapshot wrappers for each record
- Return type:
- class runloop_api_client.sdk.async_.AsyncStorageObjectOps(client)[source]¶
High-level async manager for creating and managing storage objects.
Accessed via
runloop.storage_objectfromAsyncRunloopSDK, provides coroutines to create, upload, download, and list storage objects with convenient helpers for file and text uploads.Example
>>> runloop = AsyncRunloopSDK() >>> obj = await runloop.storage_object.upload_from_text("Hello!", "greeting.txt") >>> content = await obj.download_as_text() >>> objects = await runloop.storage_object.list()
- async create(**params)[source]¶
Create a storage object and obtain an upload URL.
- Parameters:
params (
Unpack[SDKObjectCreateParams]) – SeeSDKObjectCreateParamsfor available parameters- Returns:
Wrapper with upload URL set for immediate uploads
- Return type:
- from_id(object_id)[source]¶
Return a storage object wrapper by identifier.
- Parameters:
object_id (str) – Storage object identifier to wrap
- Returns:
Wrapper for the storage object resource
- Return type:
- async list(**params)[source]¶
List storage objects owned by the caller.
- Parameters:
params (
Unpack[SDKObjectListParams]) – SeeSDKObjectListParamsfor available parameters- Returns:
Storage object wrappers for each record
- Return type:
- async upload_from_bytes(data, name, *, content_type, metadata=None, **options)[source]¶
Create and upload an object from a bytes payload.
- Parameters:
data (bytes) – Binary payload to upload
name (str) – Object display name
content_type (ContentType) – MIME type describing the payload
metadata (Optional[Dict[str, str]], optional) – Optional key-value metadata, defaults to None
options (
Unpack[LongRequestOptions]) – SeeLongRequestOptionsfor available options
- Returns:
Wrapper for the uploaded object
- Return type:
- async upload_from_file(file_path, name=None, *, content_type=None, metadata=None, **options)[source]¶
Create and upload an object from a local file path.
- Parameters:
file_path (str | Path) – Local filesystem path to read
name (str | None, optional) – Optional object name; defaults to the file name, defaults to None
content_type (ContentType | None, optional) – Optional MIME type to apply to the object, defaults to None
metadata (Optional[Dict[str, str]], optional) – Optional key-value metadata, defaults to None
options (Unpack[LongRequestOptions]) – See
LongRequestOptionsfor available options
- Returns:
Wrapper for the uploaded object
- Return type:
- Raises:
OSError – If the local file cannot be read
- async upload_from_text(text, name, *, metadata=None, **options)[source]¶
Create and upload an object from a text payload.
- Parameters:
text (str) – Text content to upload
name (str) – Object display name
metadata (Optional[Dict[str, str]], optional) – Optional key-value metadata, defaults to None
options (
Unpack[LongRequestOptions]) – SeeLongRequestOptionsfor available options
- Returns:
Wrapper for the uploaded object
- Return type:
Resource Modules¶
Asynchronous resource classes for working with devboxes, blueprints, snapshots, and more.