Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README-SDK.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ devbox.await_suspended()
devbox.shutdown()
```

> **State-waiting behavior:** In the synchronous SDK, `runloop.devbox.from_id()` and `devbox.resume()` block until the devbox reaches the `running` state, and `devbox.suspend()` blocks until the devbox is `suspended`. The async counterparts return immediately; call `await_running()` / `await_suspended()` explicitly if you need to wait for the state transition.

#### Context Manager Support

Devboxes support context managers for automatic cleanup:
Expand Down
4 changes: 4 additions & 0 deletions src/runloop_api_client/sdk/async_.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ async def create_from_snapshot(
def from_id(self, devbox_id: str) -> AsyncDevbox:
"""Attach to an existing devbox by ID.

Returns immediately without waiting for the devbox to reach ``running``
state. Call ``await_running()`` on the returned :class:`AsyncDevbox` if
you need to wait for readiness (contrast with the synchronous SDK, which blocks).

Args:
devbox_id: Existing devbox ID.

Expand Down
8 changes: 8 additions & 0 deletions src/runloop_api_client/sdk/async_devbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ async def suspend(
) -> DevboxView:
"""Suspend the devbox without destroying state.

Returns immediately after issuing the suspend request. Call
:meth:`await_suspended` if you need to wait for the devbox to reach the
``suspended`` state (contrast with the synchronous SDK, which blocks).

Args:
**options: Optional long-running request configuration.

Expand All @@ -186,6 +190,10 @@ async def resume(
) -> DevboxView:
"""Resume a suspended devbox.

Returns immediately after issuing the resume request. Call
:meth:`await_running` if you need to wait for the devbox to reach the
``running`` state (contrast with the synchronous SDK, which blocks).

Args:
**options: Optional long-running request configuration.

Expand Down
3 changes: 3 additions & 0 deletions src/runloop_api_client/sdk/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ def create_from_snapshot(
def from_id(self, devbox_id: str) -> Devbox:
"""Attach to an existing devbox by ID.

Blocks until the devbox reaches ``running`` state so callers can begin
issuing commands immediately.

Args:
devbox_id: Existing devbox ID.

Expand Down
Loading