Execution

The AsyncExecution class represents an asynchronous command execution in progress.

Async execution management for async commands.

class runloop_api_client.sdk.async_execution.AsyncExecution(client, devbox_id, execution, streaming_group=None)[source]

Manages an asynchronous command execution on a devbox.

Provides coroutines to poll execution state, wait for completion, and terminate the running process. Created by await devbox.cmd.exec_async().

Example

>>> execution = await devbox.cmd.exec_async(command="python train.py")
>>> state = await execution.get_state()
>>> if state.status == "running":
...     await execution.kill()
>>> result = await execution.result()  # Wait for completion
>>> print(await result.stdout())
property execution_id: str

Return the execution identifier.

Returns:

Unique execution ID

Return type:

str

property devbox_id: str

Return the devbox identifier.

Returns:

Devbox ID where the command is running

Return type:

str

async result(**options)[source]

Wait for completion and return an AsyncExecutionResult.

Parameters:

options (Unpack[LongRequestOptions]) – Optional long-running request configuration

Returns:

Wrapper with exit status and output helpers

Return type:

AsyncExecutionResult

async get_state(**options)[source]

Fetch the latest execution state.

Parameters:

options (Unpack[BaseRequestOptions]) – Optional request configuration

Returns:

Current execution metadata

Return type:

DevboxAsyncExecutionDetailView

async kill(**options)[source]

Request termination of the running execution.

Parameters:

options (Unpack[LongRequestOptions]) – Optional long-running request configuration

Return type:

None