Skip to content

Commit 38b3ec3

Browse files
feat(api): add lifecycle configuration to launch parameters (#8606)
1 parent 5712d86 commit 38b3ec3

File tree

10 files changed

+198
-10
lines changed

10 files changed

+198
-10
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 109
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-07efaf8d4a6487d9682186239706cf0da903131db3ca8ce52fb09a8103f4a091.yml
3-
openapi_spec_hash: b29e96f8962659b2977a0bb178cfe404
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-72e5e6463144100abe3cc23ed837d5ebba4b95d97f9d58406954a3c48f27c310.yml
3+
openapi_spec_hash: fee1880d8e4bb34c1cf97f5eef3b3248
44
config_hash: ecb1ff09d29b565ed1452b5e0362e64d

src/runloop_api_client/resources/devboxes/devboxes.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,9 @@ def enable_tunnel(
558558
policies, resetting the idle timer. Defaults to true if not specified.
559559
560560
wake_on_http: When true, HTTP traffic to a suspended devbox will automatically trigger a
561-
resume. Defaults to false if not specified.
561+
resume. Defaults to false if not specified. Prefer
562+
lifecycle.resume_triggers.http on launch_parameters for new integrations. If
563+
both are set, lifecycle.resume_triggers.http takes precedence.
562564
563565
extra_headers: Send extra headers
564566
@@ -1953,7 +1955,9 @@ async def enable_tunnel(
19531955
policies, resetting the idle timer. Defaults to true if not specified.
19541956
19551957
wake_on_http: When true, HTTP traffic to a suspended devbox will automatically trigger a
1956-
resume. Defaults to false if not specified.
1958+
resume. Defaults to false if not specified. Prefer
1959+
lifecycle.resume_triggers.http on launch_parameters for new integrations. If
1960+
both are set, lifecycle.resume_triggers.http takes precedence.
19571961
19581962
extra_headers: Send extra headers
19591963

src/runloop_api_client/types/devbox_create_params.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,7 @@ class Tunnel(TypedDict, total=False):
141141
wake_on_http: Optional[bool]
142142
"""
143143
When true, HTTP traffic to a suspended devbox will automatically trigger a
144-
resume. Defaults to false if not specified.
144+
resume. Defaults to false if not specified. Prefer
145+
lifecycle.resume_triggers.http on launch_parameters for new integrations. If
146+
both are set, lifecycle.resume_triggers.http takes precedence.
145147
"""

src/runloop_api_client/types/devbox_enable_tunnel_params.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ class DevboxEnableTunnelParams(TypedDict, total=False):
2121
wake_on_http: Optional[bool]
2222
"""
2323
When true, HTTP traffic to a suspended devbox will automatically trigger a
24-
resume. Defaults to false if not specified.
24+
resume. Defaults to false if not specified. Prefer
25+
lifecycle.resume_triggers.http on launch_parameters for new integrations. If
26+
both are set, lifecycle.resume_triggers.http takes precedence.
2527
"""

src/runloop_api_client/types/shared/launch_parameters.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,31 @@
66
from ..._models import BaseModel
77
from .after_idle import AfterIdle
88

9-
__all__ = ["LaunchParameters", "UserParameters"]
9+
__all__ = ["LaunchParameters", "Lifecycle", "LifecycleResumeTriggers", "UserParameters"]
10+
11+
12+
class LifecycleResumeTriggers(BaseModel):
13+
"""Triggers that can resume a suspended Devbox."""
14+
15+
http: Optional[bool] = None
16+
"""When true, HTTP traffic to a suspended Devbox via tunnel will trigger a resume."""
17+
18+
19+
class Lifecycle(BaseModel):
20+
"""Lifecycle configuration for idle and resume behavior.
21+
22+
Configure idle policy via lifecycle.after_idle (if both this and the top-level after_idle are set, they must match) and resume triggers via lifecycle.resume_triggers.
23+
"""
24+
25+
after_idle: Optional[AfterIdle] = None
26+
"""Configure Devbox lifecycle based on idle activity.
27+
28+
If both this and the top-level after_idle are set, they must have the same
29+
value. Prefer this field for new integrations.
30+
"""
31+
32+
resume_triggers: Optional[LifecycleResumeTriggers] = None
33+
"""Triggers that can resume a suspended Devbox."""
1034

1135

1236
class UserParameters(BaseModel):
@@ -30,7 +54,9 @@ class LaunchParameters(BaseModel):
3054
after_idle: Optional[AfterIdle] = None
3155
"""Configure Devbox lifecycle based on idle activity.
3256
33-
If after_idle is set, Devbox will ignore keep_alive_time_seconds.
57+
If after_idle is set, Devbox will ignore keep_alive_time_seconds. If both
58+
after_idle and lifecycle.after_idle are set, they must have the same value. Use
59+
lifecycle.after_idle instead.
3460
"""
3561

3662
architecture: Optional[Literal["x86_64", "arm64"]] = None
@@ -60,6 +86,14 @@ class LaunchParameters(BaseModel):
6086
launch_commands: Optional[List[str]] = None
6187
"""Set of commands to be run at launch time, before the entrypoint process is run."""
6288

89+
lifecycle: Optional[Lifecycle] = None
90+
"""Lifecycle configuration for idle and resume behavior.
91+
92+
Configure idle policy via lifecycle.after_idle (if both this and the top-level
93+
after_idle are set, they must match) and resume triggers via
94+
lifecycle.resume_triggers.
95+
"""
96+
6397
network_policy_id: Optional[str] = None
6498
"""
6599
(Optional) ID of the network policy to apply to Devboxes launched with these

src/runloop_api_client/types/shared_params/launch_parameters.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,31 @@
88
from ..._types import SequenceNotStr
99
from .after_idle import AfterIdle
1010

11-
__all__ = ["LaunchParameters", "UserParameters"]
11+
__all__ = ["LaunchParameters", "Lifecycle", "LifecycleResumeTriggers", "UserParameters"]
12+
13+
14+
class LifecycleResumeTriggers(TypedDict, total=False):
15+
"""Triggers that can resume a suspended Devbox."""
16+
17+
http: Optional[bool]
18+
"""When true, HTTP traffic to a suspended Devbox via tunnel will trigger a resume."""
19+
20+
21+
class Lifecycle(TypedDict, total=False):
22+
"""Lifecycle configuration for idle and resume behavior.
23+
24+
Configure idle policy via lifecycle.after_idle (if both this and the top-level after_idle are set, they must match) and resume triggers via lifecycle.resume_triggers.
25+
"""
26+
27+
after_idle: Optional[AfterIdle]
28+
"""Configure Devbox lifecycle based on idle activity.
29+
30+
If both this and the top-level after_idle are set, they must have the same
31+
value. Prefer this field for new integrations.
32+
"""
33+
34+
resume_triggers: Optional[LifecycleResumeTriggers]
35+
"""Triggers that can resume a suspended Devbox."""
1236

1337

1438
class UserParameters(TypedDict, total=False):
@@ -32,7 +56,9 @@ class LaunchParameters(TypedDict, total=False):
3256
after_idle: Optional[AfterIdle]
3357
"""Configure Devbox lifecycle based on idle activity.
3458
35-
If after_idle is set, Devbox will ignore keep_alive_time_seconds.
59+
If after_idle is set, Devbox will ignore keep_alive_time_seconds. If both
60+
after_idle and lifecycle.after_idle are set, they must have the same value. Use
61+
lifecycle.after_idle instead.
3662
"""
3763

3864
architecture: Optional[Literal["x86_64", "arm64"]]
@@ -62,6 +88,14 @@ class LaunchParameters(TypedDict, total=False):
6288
launch_commands: Optional[SequenceNotStr[str]]
6389
"""Set of commands to be run at launch time, before the entrypoint process is run."""
6490

91+
lifecycle: Optional[Lifecycle]
92+
"""Lifecycle configuration for idle and resume behavior.
93+
94+
Configure idle policy via lifecycle.after_idle (if both this and the top-level
95+
after_idle are set, they must match) and resume triggers via
96+
lifecycle.resume_triggers.
97+
"""
98+
6599
network_policy_id: Optional[str]
66100
"""
67101
(Optional) ID of the network policy to apply to Devboxes launched with these

tests/api_resources/test_benchmarks.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,13 @@ def test_method_start_run_with_all_params(self, client: Runloop) -> None:
299299
"custom_gb_memory": 0,
300300
"keep_alive_time_seconds": 0,
301301
"launch_commands": ["string"],
302+
"lifecycle": {
303+
"after_idle": {
304+
"idle_time_seconds": 0,
305+
"on_idle": "shutdown",
306+
},
307+
"resume_triggers": {"http": True},
308+
},
302309
"network_policy_id": "network_policy_id",
303310
"required_services": ["string"],
304311
"resource_size_request": "X_SMALL",
@@ -674,6 +681,13 @@ async def test_method_start_run_with_all_params(self, async_client: AsyncRunloop
674681
"custom_gb_memory": 0,
675682
"keep_alive_time_seconds": 0,
676683
"launch_commands": ["string"],
684+
"lifecycle": {
685+
"after_idle": {
686+
"idle_time_seconds": 0,
687+
"on_idle": "shutdown",
688+
},
689+
"resume_triggers": {"http": True},
690+
},
677691
"network_policy_id": "network_policy_id",
678692
"required_services": ["string"],
679693
"resource_size_request": "X_SMALL",

tests/api_resources/test_blueprints.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ def test_method_create_with_all_params(self, client: Runloop) -> None:
6464
"custom_gb_memory": 0,
6565
"keep_alive_time_seconds": 0,
6666
"launch_commands": ["string"],
67+
"lifecycle": {
68+
"after_idle": {
69+
"idle_time_seconds": 0,
70+
"on_idle": "shutdown",
71+
},
72+
"resume_triggers": {"http": True},
73+
},
6774
"network_policy_id": "network_policy_id",
6875
"required_services": ["string"],
6976
"resource_size_request": "X_SMALL",
@@ -257,6 +264,13 @@ def test_method_create_from_inspection_with_all_params(self, client: Runloop) ->
257264
"custom_gb_memory": 0,
258265
"keep_alive_time_seconds": 0,
259266
"launch_commands": ["string"],
267+
"lifecycle": {
268+
"after_idle": {
269+
"idle_time_seconds": 0,
270+
"on_idle": "shutdown",
271+
},
272+
"resume_triggers": {"http": True},
273+
},
260274
"network_policy_id": "network_policy_id",
261275
"required_services": ["string"],
262276
"resource_size_request": "X_SMALL",
@@ -415,6 +429,13 @@ def test_method_preview_with_all_params(self, client: Runloop) -> None:
415429
"custom_gb_memory": 0,
416430
"keep_alive_time_seconds": 0,
417431
"launch_commands": ["string"],
432+
"lifecycle": {
433+
"after_idle": {
434+
"idle_time_seconds": 0,
435+
"on_idle": "shutdown",
436+
},
437+
"resume_triggers": {"http": True},
438+
},
418439
"network_policy_id": "network_policy_id",
419440
"required_services": ["string"],
420441
"resource_size_request": "X_SMALL",
@@ -516,6 +537,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
516537
"custom_gb_memory": 0,
517538
"keep_alive_time_seconds": 0,
518539
"launch_commands": ["string"],
540+
"lifecycle": {
541+
"after_idle": {
542+
"idle_time_seconds": 0,
543+
"on_idle": "shutdown",
544+
},
545+
"resume_triggers": {"http": True},
546+
},
519547
"network_policy_id": "network_policy_id",
520548
"required_services": ["string"],
521549
"resource_size_request": "X_SMALL",
@@ -709,6 +737,13 @@ async def test_method_create_from_inspection_with_all_params(self, async_client:
709737
"custom_gb_memory": 0,
710738
"keep_alive_time_seconds": 0,
711739
"launch_commands": ["string"],
740+
"lifecycle": {
741+
"after_idle": {
742+
"idle_time_seconds": 0,
743+
"on_idle": "shutdown",
744+
},
745+
"resume_triggers": {"http": True},
746+
},
712747
"network_policy_id": "network_policy_id",
713748
"required_services": ["string"],
714749
"resource_size_request": "X_SMALL",
@@ -867,6 +902,13 @@ async def test_method_preview_with_all_params(self, async_client: AsyncRunloop)
867902
"custom_gb_memory": 0,
868903
"keep_alive_time_seconds": 0,
869904
"launch_commands": ["string"],
905+
"lifecycle": {
906+
"after_idle": {
907+
"idle_time_seconds": 0,
908+
"on_idle": "shutdown",
909+
},
910+
"resume_triggers": {"http": True},
911+
},
870912
"network_policy_id": "network_policy_id",
871913
"required_services": ["string"],
872914
"resource_size_request": "X_SMALL",

tests/api_resources/test_devboxes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ def test_method_create_with_all_params(self, client: Runloop) -> None:
8080
"custom_gb_memory": 0,
8181
"keep_alive_time_seconds": 0,
8282
"launch_commands": ["string"],
83+
"lifecycle": {
84+
"after_idle": {
85+
"idle_time_seconds": 0,
86+
"on_idle": "shutdown",
87+
},
88+
"resume_triggers": {"http": True},
89+
},
8390
"network_policy_id": "network_policy_id",
8491
"required_services": ["string"],
8592
"resource_size_request": "X_SMALL",
@@ -1223,6 +1230,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
12231230
"custom_gb_memory": 0,
12241231
"keep_alive_time_seconds": 0,
12251232
"launch_commands": ["string"],
1233+
"lifecycle": {
1234+
"after_idle": {
1235+
"idle_time_seconds": 0,
1236+
"on_idle": "shutdown",
1237+
},
1238+
"resume_triggers": {"http": True},
1239+
},
12261240
"network_policy_id": "network_policy_id",
12271241
"required_services": ["string"],
12281242
"resource_size_request": "X_SMALL",

tests/api_resources/test_scenarios.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ def test_method_create_with_all_params(self, client: Runloop) -> None:
7878
"custom_gb_memory": 0,
7979
"keep_alive_time_seconds": 0,
8080
"launch_commands": ["string"],
81+
"lifecycle": {
82+
"after_idle": {
83+
"idle_time_seconds": 0,
84+
"on_idle": "shutdown",
85+
},
86+
"resume_triggers": {"http": True},
87+
},
8188
"network_policy_id": "network_policy_id",
8289
"required_services": ["string"],
8390
"resource_size_request": "X_SMALL",
@@ -213,6 +220,13 @@ def test_method_update_with_all_params(self, client: Runloop) -> None:
213220
"custom_gb_memory": 0,
214221
"keep_alive_time_seconds": 0,
215222
"launch_commands": ["string"],
223+
"lifecycle": {
224+
"after_idle": {
225+
"idle_time_seconds": 0,
226+
"on_idle": "shutdown",
227+
},
228+
"resume_triggers": {"http": True},
229+
},
216230
"network_policy_id": "network_policy_id",
217231
"required_services": ["string"],
218232
"resource_size_request": "X_SMALL",
@@ -421,6 +435,13 @@ def test_method_start_run_with_all_params(self, client: Runloop) -> None:
421435
"custom_gb_memory": 0,
422436
"keep_alive_time_seconds": 0,
423437
"launch_commands": ["string"],
438+
"lifecycle": {
439+
"after_idle": {
440+
"idle_time_seconds": 0,
441+
"on_idle": "shutdown",
442+
},
443+
"resume_triggers": {"http": True},
444+
},
424445
"network_policy_id": "network_policy_id",
425446
"required_services": ["string"],
426447
"resource_size_request": "X_SMALL",
@@ -529,6 +550,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
529550
"custom_gb_memory": 0,
530551
"keep_alive_time_seconds": 0,
531552
"launch_commands": ["string"],
553+
"lifecycle": {
554+
"after_idle": {
555+
"idle_time_seconds": 0,
556+
"on_idle": "shutdown",
557+
},
558+
"resume_triggers": {"http": True},
559+
},
532560
"network_policy_id": "network_policy_id",
533561
"required_services": ["string"],
534562
"resource_size_request": "X_SMALL",
@@ -664,6 +692,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncRunloop) -
664692
"custom_gb_memory": 0,
665693
"keep_alive_time_seconds": 0,
666694
"launch_commands": ["string"],
695+
"lifecycle": {
696+
"after_idle": {
697+
"idle_time_seconds": 0,
698+
"on_idle": "shutdown",
699+
},
700+
"resume_triggers": {"http": True},
701+
},
667702
"network_policy_id": "network_policy_id",
668703
"required_services": ["string"],
669704
"resource_size_request": "X_SMALL",
@@ -872,6 +907,13 @@ async def test_method_start_run_with_all_params(self, async_client: AsyncRunloop
872907
"custom_gb_memory": 0,
873908
"keep_alive_time_seconds": 0,
874909
"launch_commands": ["string"],
910+
"lifecycle": {
911+
"after_idle": {
912+
"idle_time_seconds": 0,
913+
"on_idle": "shutdown",
914+
},
915+
"resume_triggers": {"http": True},
916+
},
875917
"network_policy_id": "network_policy_id",
876918
"required_services": ["string"],
877919
"resource_size_request": "X_SMALL",

0 commit comments

Comments
 (0)