Skip to content

Commit 1dd716d

Browse files
feat(api): add lifecycle configuration to launch parameters (#8606)
1 parent 118162e commit 1dd716d

10 files changed

Lines changed: 198 additions & 10 deletions

File tree

.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
@@ -761,7 +761,9 @@ def enable_tunnel(
761761
policies, resetting the idle timer. Defaults to true if not specified.
762762
763763
wake_on_http: When true, HTTP traffic to a suspended devbox will automatically trigger a
764-
resume. Defaults to false if not specified.
764+
resume. Defaults to false if not specified. Prefer
765+
lifecycle.resume_triggers.http on launch_parameters for new integrations. If
766+
both are set, lifecycle.resume_triggers.http takes precedence.
765767
766768
extra_headers: Send extra headers
767769
@@ -2394,7 +2396,9 @@ async def enable_tunnel(
23942396
policies, resetting the idle timer. Defaults to true if not specified.
23952397
23962398
wake_on_http: When true, HTTP traffic to a suspended devbox will automatically trigger a
2397-
resume. Defaults to false if not specified.
2399+
resume. Defaults to false if not specified. Prefer
2400+
lifecycle.resume_triggers.http on launch_parameters for new integrations. If
2401+
both are set, lifecycle.resume_triggers.http takes precedence.
23982402
23992403
extra_headers: Send extra headers
24002404

src/runloop_api_client/types/devbox_create_params.py

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

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",
@@ -279,6 +286,13 @@ def test_method_create_from_inspection_with_all_params(self, client: Runloop) ->
279286
"custom_gb_memory": 0,
280287
"keep_alive_time_seconds": 0,
281288
"launch_commands": ["string"],
289+
"lifecycle": {
290+
"after_idle": {
291+
"idle_time_seconds": 0,
292+
"on_idle": "shutdown",
293+
},
294+
"resume_triggers": {"http": True},
295+
},
282296
"network_policy_id": "network_policy_id",
283297
"required_services": ["string"],
284298
"resource_size_request": "X_SMALL",
@@ -437,6 +451,13 @@ def test_method_preview_with_all_params(self, client: Runloop) -> None:
437451
"custom_gb_memory": 0,
438452
"keep_alive_time_seconds": 0,
439453
"launch_commands": ["string"],
454+
"lifecycle": {
455+
"after_idle": {
456+
"idle_time_seconds": 0,
457+
"on_idle": "shutdown",
458+
},
459+
"resume_triggers": {"http": True},
460+
},
440461
"network_policy_id": "network_policy_id",
441462
"required_services": ["string"],
442463
"resource_size_request": "X_SMALL",
@@ -538,6 +559,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
538559
"custom_gb_memory": 0,
539560
"keep_alive_time_seconds": 0,
540561
"launch_commands": ["string"],
562+
"lifecycle": {
563+
"after_idle": {
564+
"idle_time_seconds": 0,
565+
"on_idle": "shutdown",
566+
},
567+
"resume_triggers": {"http": True},
568+
},
541569
"network_policy_id": "network_policy_id",
542570
"required_services": ["string"],
543571
"resource_size_request": "X_SMALL",
@@ -753,6 +781,13 @@ async def test_method_create_from_inspection_with_all_params(self, async_client:
753781
"custom_gb_memory": 0,
754782
"keep_alive_time_seconds": 0,
755783
"launch_commands": ["string"],
784+
"lifecycle": {
785+
"after_idle": {
786+
"idle_time_seconds": 0,
787+
"on_idle": "shutdown",
788+
},
789+
"resume_triggers": {"http": True},
790+
},
756791
"network_policy_id": "network_policy_id",
757792
"required_services": ["string"],
758793
"resource_size_request": "X_SMALL",
@@ -911,6 +946,13 @@ async def test_method_preview_with_all_params(self, async_client: AsyncRunloop)
911946
"custom_gb_memory": 0,
912947
"keep_alive_time_seconds": 0,
913948
"launch_commands": ["string"],
949+
"lifecycle": {
950+
"after_idle": {
951+
"idle_time_seconds": 0,
952+
"on_idle": "shutdown",
953+
},
954+
"resume_triggers": {"http": True},
955+
},
914956
"network_policy_id": "network_policy_id",
915957
"required_services": ["string"],
916958
"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
@@ -84,6 +84,13 @@ def test_method_create_with_all_params(self, client: Runloop) -> None:
8484
"custom_gb_memory": 0,
8585
"keep_alive_time_seconds": 0,
8686
"launch_commands": ["string"],
87+
"lifecycle": {
88+
"after_idle": {
89+
"idle_time_seconds": 0,
90+
"on_idle": "shutdown",
91+
},
92+
"resume_triggers": {"http": True},
93+
},
8794
"network_policy_id": "network_policy_id",
8895
"required_services": ["string"],
8996
"resource_size_request": "X_SMALL",
@@ -1700,6 +1707,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
17001707
"custom_gb_memory": 0,
17011708
"keep_alive_time_seconds": 0,
17021709
"launch_commands": ["string"],
1710+
"lifecycle": {
1711+
"after_idle": {
1712+
"idle_time_seconds": 0,
1713+
"on_idle": "shutdown",
1714+
},
1715+
"resume_triggers": {"http": True},
1716+
},
17031717
"network_policy_id": "network_policy_id",
17041718
"required_services": ["string"],
17051719
"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)