Skip to content

Commit 59e649d

Browse files
feat(api): api update
1 parent adb9765 commit 59e649d

File tree

15 files changed

+396
-10
lines changed

15 files changed

+396
-10
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 100
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-2027ff4b25ad2b5574b2ce497f5d0d02ad8804816ffd6b4e36511e2fa955d0cf.yml
3-
openapi_spec_hash: 54a5a26e9c0b179d2f2a532268d3d711
4-
config_hash: ca2bcf0cc299c9d5cba1b16fb49a0d25
1+
configured_endpoints: 101
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-6b4c63a026f224ec02ccd715e063e07107b545bb859218afaac2b3df84cd227a.yml
3+
openapi_spec_hash: 76072cd766a9c45cff8890bb2bb8b1d5
4+
config_hash: a8ac5e38099129b07ae4decb0774719d

api.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,19 @@ Methods:
254254

255255
## Executions
256256

257+
Types:
258+
259+
```python
260+
from runloop_api_client.types.devboxes import ExecutionUpdateChunk
261+
```
262+
257263
Methods:
258264

259265
- <code title="get /v1/devboxes/{devbox_id}/executions/{execution_id}">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">retrieve</a>(execution_id, \*, devbox_id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_retrieve_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
260266
- <code title="post /v1/devboxes/{id}/execute_async">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">execute_async</a>(id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_execute_async_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
261267
- <code title="post /v1/devboxes/{id}/execute_sync">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">execute_sync</a>(id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_execute_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
262-
- <code title="post /v1/devboxes/{devbox_id}/executions/{execution_id}/kill">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">kill</a>(execution_id, \*, devbox_id) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
268+
- <code title="post /v1/devboxes/{devbox_id}/executions/{execution_id}/kill">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">kill</a>(execution_id, \*, devbox_id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_kill_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
269+
- <code title="get /v1/devboxes/{devbox_id}/executions/{execution_id}/stream_updates">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">stream_updates</a>(execution_id, \*, devbox_id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_stream_updates_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
263270

264271
# Scenarios
265272

src/runloop_api_client/resources/blueprints.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def create(
7373
*,
7474
name: str,
7575
base_blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
76+
base_blueprint_name: Optional[str] | NotGiven = NOT_GIVEN,
7677
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
7778
dockerfile: Optional[str] | NotGiven = NOT_GIVEN,
7879
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
@@ -101,6 +102,11 @@ def create(
101102
base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
102103
build.
103104
105+
base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
106+
this build. When set, this will load the latest successfully built Blueprint
107+
with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
108+
be specified.
109+
104110
code_mounts: A list of code mounts to be included in the Blueprint.
105111
106112
dockerfile: Dockerfile contents to be used to build the Blueprint.
@@ -133,6 +139,7 @@ def create(
133139
{
134140
"name": name,
135141
"base_blueprint_id": base_blueprint_id,
142+
"base_blueprint_name": base_blueprint_name,
136143
"code_mounts": code_mounts,
137144
"dockerfile": dockerfile,
138145
"file_mounts": file_mounts,
@@ -472,6 +479,7 @@ def preview(
472479
*,
473480
name: str,
474481
base_blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
482+
base_blueprint_name: Optional[str] | NotGiven = NOT_GIVEN,
475483
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
476484
dockerfile: Optional[str] | NotGiven = NOT_GIVEN,
477485
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
@@ -498,6 +506,11 @@ def preview(
498506
base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
499507
build.
500508
509+
base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
510+
this build. When set, this will load the latest successfully built Blueprint
511+
with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
512+
be specified.
513+
501514
code_mounts: A list of code mounts to be included in the Blueprint.
502515
503516
dockerfile: Dockerfile contents to be used to build the Blueprint.
@@ -530,6 +543,7 @@ def preview(
530543
{
531544
"name": name,
532545
"base_blueprint_id": base_blueprint_id,
546+
"base_blueprint_name": base_blueprint_name,
533547
"code_mounts": code_mounts,
534548
"dockerfile": dockerfile,
535549
"file_mounts": file_mounts,
@@ -576,6 +590,7 @@ async def create(
576590
*,
577591
name: str,
578592
base_blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
593+
base_blueprint_name: Optional[str] | NotGiven = NOT_GIVEN,
579594
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
580595
dockerfile: Optional[str] | NotGiven = NOT_GIVEN,
581596
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
@@ -604,6 +619,11 @@ async def create(
604619
base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
605620
build.
606621
622+
base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
623+
this build. When set, this will load the latest successfully built Blueprint
624+
with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
625+
be specified.
626+
607627
code_mounts: A list of code mounts to be included in the Blueprint.
608628
609629
dockerfile: Dockerfile contents to be used to build the Blueprint.
@@ -636,6 +656,7 @@ async def create(
636656
{
637657
"name": name,
638658
"base_blueprint_id": base_blueprint_id,
659+
"base_blueprint_name": base_blueprint_name,
639660
"code_mounts": code_mounts,
640661
"dockerfile": dockerfile,
641662
"file_mounts": file_mounts,
@@ -975,6 +996,7 @@ async def preview(
975996
*,
976997
name: str,
977998
base_blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
999+
base_blueprint_name: Optional[str] | NotGiven = NOT_GIVEN,
9781000
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
9791001
dockerfile: Optional[str] | NotGiven = NOT_GIVEN,
9801002
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
@@ -1001,6 +1023,11 @@ async def preview(
10011023
base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
10021024
build.
10031025
1026+
base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
1027+
this build. When set, this will load the latest successfully built Blueprint
1028+
with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
1029+
be specified.
1030+
10041031
code_mounts: A list of code mounts to be included in the Blueprint.
10051032
10061033
dockerfile: Dockerfile contents to be used to build the Blueprint.
@@ -1033,6 +1060,7 @@ async def preview(
10331060
{
10341061
"name": name,
10351062
"base_blueprint_id": base_blueprint_id,
1063+
"base_blueprint_name": base_blueprint_name,
10361064
"code_mounts": code_mounts,
10371065
"dockerfile": dockerfile,
10381066
"file_mounts": file_mounts,

src/runloop_api_client/resources/devboxes/executions.py

Lines changed: 121 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@
1919
from ..._constants import DEFAULT_TIMEOUT
2020
from ..._exceptions import APIStatusError, APITimeoutError
2121
from ...lib.polling import PollingConfig, poll_until
22+
from ..._streaming import Stream, AsyncStream
2223
from ..._base_client import make_request_options
23-
from ...types.devboxes import execution_retrieve_params, execution_execute_sync_params, execution_execute_async_params
24+
from ...types.devboxes import (
25+
execution_kill_params,
26+
execution_retrieve_params,
27+
execution_execute_sync_params,
28+
execution_execute_async_params,
29+
execution_stream_updates_params,
30+
)
2431
from ...lib.polling_async import async_poll_until
2532
from ...types.devbox_execution_detail_view import DevboxExecutionDetailView
33+
from ...types.devboxes.execution_update_chunk import ExecutionUpdateChunk
2634
from ...types.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView
2735

2836
__all__ = ["ExecutionsResource", "AsyncExecutionsResource"]
@@ -277,6 +285,7 @@ def kill(
277285
execution_id: str,
278286
*,
279287
devbox_id: str,
288+
kill_process_group: Optional[bool] | NotGiven = NOT_GIVEN,
280289
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
281290
# The extra values given here take precedence over values defined on the client or passed to this method.
282291
extra_headers: Headers | None = None,
@@ -287,7 +296,7 @@ def kill(
287296
) -> DevboxAsyncExecutionDetailView:
288297
"""
289298
Kill a previously launched asynchronous execution if it is still running by
290-
killing the launched process.
299+
killing the launched process. Optionally kill the entire process group.
291300
292301
Args:
293302
extra_headers: Send extra headers
@@ -306,6 +315,7 @@ def kill(
306315
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
307316
return self._post(
308317
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/kill",
318+
body=maybe_transform({"kill_process_group": kill_process_group}, execution_kill_params.ExecutionKillParams),
309319
options=make_request_options(
310320
extra_headers=extra_headers,
311321
extra_query=extra_query,
@@ -316,6 +326,51 @@ def kill(
316326
cast_to=DevboxAsyncExecutionDetailView,
317327
)
318328

329+
def stream_updates(
330+
self,
331+
execution_id: str,
332+
*,
333+
devbox_id: str,
334+
offset: str | NotGiven = NOT_GIVEN,
335+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
336+
# The extra values given here take precedence over values defined on the client or passed to this method.
337+
extra_headers: Headers | None = None,
338+
extra_query: Query | None = None,
339+
extra_body: Body | None = None,
340+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
341+
) -> Stream[ExecutionUpdateChunk]:
342+
"""
343+
Tails the logs for the given execution with SSE streaming
344+
345+
Args:
346+
offset: The byte offset to start the stream from
347+
348+
extra_headers: Send extra headers
349+
350+
extra_query: Add additional query parameters to the request
351+
352+
extra_body: Add additional JSON properties to the request
353+
354+
timeout: Override the client-level default timeout for this request, in seconds
355+
"""
356+
if not devbox_id:
357+
raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}")
358+
if not execution_id:
359+
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
360+
return self._get(
361+
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/stream_updates",
362+
options=make_request_options(
363+
extra_headers=extra_headers,
364+
extra_query=extra_query,
365+
extra_body=extra_body,
366+
timeout=timeout,
367+
query=maybe_transform({"offset": offset}, execution_stream_updates_params.ExecutionStreamUpdatesParams),
368+
),
369+
cast_to=DevboxAsyncExecutionDetailView,
370+
stream=True,
371+
stream_cls=Stream[ExecutionUpdateChunk],
372+
)
373+
319374

320375
class AsyncExecutionsResource(AsyncAPIResource):
321376
@cached_property
@@ -554,6 +609,7 @@ async def kill(
554609
execution_id: str,
555610
*,
556611
devbox_id: str,
612+
kill_process_group: Optional[bool] | NotGiven = NOT_GIVEN,
557613
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
558614
# The extra values given here take precedence over values defined on the client or passed to this method.
559615
extra_headers: Headers | None = None,
@@ -564,7 +620,7 @@ async def kill(
564620
) -> DevboxAsyncExecutionDetailView:
565621
"""
566622
Kill a previously launched asynchronous execution if it is still running by
567-
killing the launched process.
623+
killing the launched process. Optionally kill the entire process group.
568624
569625
Args:
570626
extra_headers: Send extra headers
@@ -583,6 +639,9 @@ async def kill(
583639
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
584640
return await self._post(
585641
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/kill",
642+
body=await async_maybe_transform(
643+
{"kill_process_group": kill_process_group}, execution_kill_params.ExecutionKillParams
644+
),
586645
options=make_request_options(
587646
extra_headers=extra_headers,
588647
extra_query=extra_query,
@@ -593,6 +652,53 @@ async def kill(
593652
cast_to=DevboxAsyncExecutionDetailView,
594653
)
595654

655+
async def stream_updates(
656+
self,
657+
execution_id: str,
658+
*,
659+
devbox_id: str,
660+
offset: str | NotGiven = NOT_GIVEN,
661+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
662+
# The extra values given here take precedence over values defined on the client or passed to this method.
663+
extra_headers: Headers | None = None,
664+
extra_query: Query | None = None,
665+
extra_body: Body | None = None,
666+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
667+
) -> AsyncStream[ExecutionUpdateChunk]:
668+
"""
669+
Tails the logs for the given execution with SSE streaming
670+
671+
Args:
672+
offset: The byte offset to start the stream from
673+
674+
extra_headers: Send extra headers
675+
676+
extra_query: Add additional query parameters to the request
677+
678+
extra_body: Add additional JSON properties to the request
679+
680+
timeout: Override the client-level default timeout for this request, in seconds
681+
"""
682+
if not devbox_id:
683+
raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}")
684+
if not execution_id:
685+
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
686+
return await self._get(
687+
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/stream_updates",
688+
options=make_request_options(
689+
extra_headers=extra_headers,
690+
extra_query=extra_query,
691+
extra_body=extra_body,
692+
timeout=timeout,
693+
query=await async_maybe_transform(
694+
{"offset": offset}, execution_stream_updates_params.ExecutionStreamUpdatesParams
695+
),
696+
),
697+
cast_to=DevboxAsyncExecutionDetailView,
698+
stream=True,
699+
stream_cls=AsyncStream[ExecutionUpdateChunk],
700+
)
701+
596702

597703
class ExecutionsResourceWithRawResponse:
598704
def __init__(self, executions: ExecutionsResource) -> None:
@@ -610,6 +716,9 @@ def __init__(self, executions: ExecutionsResource) -> None:
610716
self.kill = to_raw_response_wrapper(
611717
executions.kill,
612718
)
719+
self.stream_updates = to_raw_response_wrapper(
720+
executions.stream_updates,
721+
)
613722

614723

615724
class AsyncExecutionsResourceWithRawResponse:
@@ -628,6 +737,9 @@ def __init__(self, executions: AsyncExecutionsResource) -> None:
628737
self.kill = async_to_raw_response_wrapper(
629738
executions.kill,
630739
)
740+
self.stream_updates = async_to_raw_response_wrapper(
741+
executions.stream_updates,
742+
)
631743

632744

633745
class ExecutionsResourceWithStreamingResponse:
@@ -646,6 +758,9 @@ def __init__(self, executions: ExecutionsResource) -> None:
646758
self.kill = to_streamed_response_wrapper(
647759
executions.kill,
648760
)
761+
self.stream_updates = to_streamed_response_wrapper(
762+
executions.stream_updates,
763+
)
649764

650765

651766
class AsyncExecutionsResourceWithStreamingResponse:
@@ -664,3 +779,6 @@ def __init__(self, executions: AsyncExecutionsResource) -> None:
664779
self.kill = async_to_streamed_response_wrapper(
665780
executions.kill,
666781
)
782+
self.stream_updates = async_to_streamed_response_wrapper(
783+
executions.stream_updates,
784+
)

src/runloop_api_client/types/blueprint_build_parameters.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ class BlueprintBuildParameters(BaseModel):
5050
build.
5151
"""
5252

53+
base_blueprint_name: Optional[str] = None
54+
"""
55+
(Optional) Name of previously built blueprint to use as a base blueprint for
56+
this build. When set, this will load the latest successfully built Blueprint
57+
with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
58+
be specified.
59+
"""
60+
5361
code_mounts: Optional[List[CodeMountParameters]] = None
5462
"""A list of code mounts to be included in the Blueprint."""
5563

src/runloop_api_client/types/blueprint_create_params.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ class BlueprintCreateParams(TypedDict, total=False):
2222
build.
2323
"""
2424

25+
base_blueprint_name: Optional[str]
26+
"""
27+
(Optional) Name of previously built blueprint to use as a base blueprint for
28+
this build. When set, this will load the latest successfully built Blueprint
29+
with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
30+
be specified.
31+
"""
32+
2533
code_mounts: Optional[Iterable[CodeMountParameters]]
2634
"""A list of code mounts to be included in the Blueprint."""
2735

0 commit comments

Comments
 (0)