runloop_api_client 1.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. runloop_api_client/__init__.py +95 -0
  2. runloop_api_client/_base_client.py +2127 -0
  3. runloop_api_client/_client.py +866 -0
  4. runloop_api_client/_compat.py +219 -0
  5. runloop_api_client/_constants.py +23 -0
  6. runloop_api_client/_exceptions.py +108 -0
  7. runloop_api_client/_files.py +123 -0
  8. runloop_api_client/_models.py +872 -0
  9. runloop_api_client/_qs.py +150 -0
  10. runloop_api_client/_resource.py +43 -0
  11. runloop_api_client/_response.py +832 -0
  12. runloop_api_client/_streaming.py +518 -0
  13. runloop_api_client/_types.py +270 -0
  14. runloop_api_client/_utils/__init__.py +65 -0
  15. runloop_api_client/_utils/_compat.py +45 -0
  16. runloop_api_client/_utils/_datetime_parse.py +136 -0
  17. runloop_api_client/_utils/_json.py +35 -0
  18. runloop_api_client/_utils/_logs.py +25 -0
  19. runloop_api_client/_utils/_proxy.py +65 -0
  20. runloop_api_client/_utils/_reflection.py +42 -0
  21. runloop_api_client/_utils/_resources_proxy.py +24 -0
  22. runloop_api_client/_utils/_streams.py +12 -0
  23. runloop_api_client/_utils/_sync.py +58 -0
  24. runloop_api_client/_utils/_transform.py +457 -0
  25. runloop_api_client/_utils/_typing.py +156 -0
  26. runloop_api_client/_utils/_utils.py +421 -0
  27. runloop_api_client/_utils/_validation.py +31 -0
  28. runloop_api_client/_version.py +4 -0
  29. runloop_api_client/lib/.keep +4 -0
  30. runloop_api_client/lib/__init__.py +3 -0
  31. runloop_api_client/lib/_ignore.py +496 -0
  32. runloop_api_client/lib/context_loader.py +78 -0
  33. runloop_api_client/lib/polling.py +75 -0
  34. runloop_api_client/lib/polling_async.py +60 -0
  35. runloop_api_client/pagination.py +986 -0
  36. runloop_api_client/py.typed +0 -0
  37. runloop_api_client/resources/__init__.py +173 -0
  38. runloop_api_client/resources/agents.py +431 -0
  39. runloop_api_client/resources/benchmark_jobs.py +394 -0
  40. runloop_api_client/resources/benchmark_runs.py +595 -0
  41. runloop_api_client/resources/benchmarks.py +1085 -0
  42. runloop_api_client/resources/blueprints.py +1563 -0
  43. runloop_api_client/resources/devboxes/__init__.py +89 -0
  44. runloop_api_client/resources/devboxes/browsers.py +267 -0
  45. runloop_api_client/resources/devboxes/computers.py +648 -0
  46. runloop_api_client/resources/devboxes/devboxes.py +3784 -0
  47. runloop_api_client/resources/devboxes/disk_snapshots.py +602 -0
  48. runloop_api_client/resources/devboxes/executions.py +1212 -0
  49. runloop_api_client/resources/devboxes/logs.py +197 -0
  50. runloop_api_client/resources/gateway_configs.py +658 -0
  51. runloop_api_client/resources/network_policies.py +680 -0
  52. runloop_api_client/resources/objects.py +870 -0
  53. runloop_api_client/resources/repositories.py +918 -0
  54. runloop_api_client/resources/scenarios/__init__.py +47 -0
  55. runloop_api_client/resources/scenarios/runs.py +973 -0
  56. runloop_api_client/resources/scenarios/scenarios.py +1101 -0
  57. runloop_api_client/resources/scenarios/scorers.py +629 -0
  58. runloop_api_client/resources/secrets.py +500 -0
  59. runloop_api_client/sdk/__init__.py +117 -0
  60. runloop_api_client/sdk/_helpers.py +49 -0
  61. runloop_api_client/sdk/_types.py +264 -0
  62. runloop_api_client/sdk/agent.py +70 -0
  63. runloop_api_client/sdk/async_.py +1036 -0
  64. runloop_api_client/sdk/async_agent.py +70 -0
  65. runloop_api_client/sdk/async_benchmark.py +169 -0
  66. runloop_api_client/sdk/async_benchmark_run.py +127 -0
  67. runloop_api_client/sdk/async_blueprint.py +104 -0
  68. runloop_api_client/sdk/async_devbox.py +797 -0
  69. runloop_api_client/sdk/async_execution.py +144 -0
  70. runloop_api_client/sdk/async_execution_result.py +175 -0
  71. runloop_api_client/sdk/async_network_policy.py +80 -0
  72. runloop_api_client/sdk/async_scenario.py +118 -0
  73. runloop_api_client/sdk/async_scenario_builder.py +480 -0
  74. runloop_api_client/sdk/async_scenario_run.py +242 -0
  75. runloop_api_client/sdk/async_scorer.py +77 -0
  76. runloop_api_client/sdk/async_snapshot.py +125 -0
  77. runloop_api_client/sdk/async_storage_object.py +188 -0
  78. runloop_api_client/sdk/benchmark.py +167 -0
  79. runloop_api_client/sdk/benchmark_run.py +127 -0
  80. runloop_api_client/sdk/blueprint.py +104 -0
  81. runloop_api_client/sdk/devbox.py +800 -0
  82. runloop_api_client/sdk/execution.py +132 -0
  83. runloop_api_client/sdk/execution_result.py +173 -0
  84. runloop_api_client/sdk/network_policy.py +80 -0
  85. runloop_api_client/sdk/scenario.py +118 -0
  86. runloop_api_client/sdk/scenario_builder.py +480 -0
  87. runloop_api_client/sdk/scenario_run.py +242 -0
  88. runloop_api_client/sdk/scorer.py +77 -0
  89. runloop_api_client/sdk/snapshot.py +125 -0
  90. runloop_api_client/sdk/storage_object.py +188 -0
  91. runloop_api_client/sdk/sync.py +1061 -0
  92. runloop_api_client/types/__init__.py +130 -0
  93. runloop_api_client/types/agent_create_params.py +21 -0
  94. runloop_api_client/types/agent_list_params.py +27 -0
  95. runloop_api_client/types/agent_list_view.py +24 -0
  96. runloop_api_client/types/agent_view.py +30 -0
  97. runloop_api_client/types/benchmark_create_params.py +40 -0
  98. runloop_api_client/types/benchmark_definitions_params.py +15 -0
  99. runloop_api_client/types/benchmark_job_create_params.py +220 -0
  100. runloop_api_client/types/benchmark_job_list_params.py +18 -0
  101. runloop_api_client/types/benchmark_job_list_view.py +19 -0
  102. runloop_api_client/types/benchmark_job_view.py +344 -0
  103. runloop_api_client/types/benchmark_list_params.py +18 -0
  104. runloop_api_client/types/benchmark_list_public_params.py +15 -0
  105. runloop_api_client/types/benchmark_run_list_params.py +21 -0
  106. runloop_api_client/types/benchmark_run_list_scenario_runs_params.py +18 -0
  107. runloop_api_client/types/benchmark_run_list_view.py +19 -0
  108. runloop_api_client/types/benchmark_run_view.py +58 -0
  109. runloop_api_client/types/benchmark_start_run_params.py +29 -0
  110. runloop_api_client/types/benchmark_update_params.py +42 -0
  111. runloop_api_client/types/benchmark_update_scenarios_params.py +18 -0
  112. runloop_api_client/types/benchmark_view.py +49 -0
  113. runloop_api_client/types/blueprint_build_log.py +16 -0
  114. runloop_api_client/types/blueprint_build_logs_list_view.py +16 -0
  115. runloop_api_client/types/blueprint_build_parameters.py +119 -0
  116. runloop_api_client/types/blueprint_create_from_inspection_params.py +49 -0
  117. runloop_api_client/types/blueprint_create_params.py +121 -0
  118. runloop_api_client/types/blueprint_list_params.py +21 -0
  119. runloop_api_client/types/blueprint_list_public_params.py +21 -0
  120. runloop_api_client/types/blueprint_list_view.py +19 -0
  121. runloop_api_client/types/blueprint_preview_params.py +121 -0
  122. runloop_api_client/types/blueprint_preview_view.py +10 -0
  123. runloop_api_client/types/blueprint_view.py +93 -0
  124. runloop_api_client/types/devbox_async_execution_detail_view.py +46 -0
  125. runloop_api_client/types/devbox_create_params.py +124 -0
  126. runloop_api_client/types/devbox_create_ssh_key_response.py +19 -0
  127. runloop_api_client/types/devbox_create_tunnel_params.py +12 -0
  128. runloop_api_client/types/devbox_download_file_params.py +15 -0
  129. runloop_api_client/types/devbox_enable_tunnel_params.py +13 -0
  130. runloop_api_client/types/devbox_execute_async_params.py +33 -0
  131. runloop_api_client/types/devbox_execute_params.py +37 -0
  132. runloop_api_client/types/devbox_execute_sync_params.py +31 -0
  133. runloop_api_client/types/devbox_execution_detail_view.py +24 -0
  134. runloop_api_client/types/devbox_list_disk_snapshots_params.py +32 -0
  135. runloop_api_client/types/devbox_list_params.py +20 -0
  136. runloop_api_client/types/devbox_list_view.py +19 -0
  137. runloop_api_client/types/devbox_read_file_contents_params.py +15 -0
  138. runloop_api_client/types/devbox_read_file_contents_response.py +7 -0
  139. runloop_api_client/types/devbox_remove_tunnel_params.py +12 -0
  140. runloop_api_client/types/devbox_send_std_in_result.py +16 -0
  141. runloop_api_client/types/devbox_snapshot_disk_async_params.py +19 -0
  142. runloop_api_client/types/devbox_snapshot_disk_params.py +19 -0
  143. runloop_api_client/types/devbox_snapshot_list_view.py +19 -0
  144. runloop_api_client/types/devbox_snapshot_view.py +30 -0
  145. runloop_api_client/types/devbox_tunnel_view.py +16 -0
  146. runloop_api_client/types/devbox_update_params.py +16 -0
  147. runloop_api_client/types/devbox_upload_file_params.py +19 -0
  148. runloop_api_client/types/devbox_view.py +121 -0
  149. runloop_api_client/types/devbox_wait_for_command_params.py +28 -0
  150. runloop_api_client/types/devbox_write_file_contents_params.py +18 -0
  151. runloop_api_client/types/devboxes/__init__.py +33 -0
  152. runloop_api_client/types/devboxes/browser_create_params.py +13 -0
  153. runloop_api_client/types/devboxes/browser_view.py +29 -0
  154. runloop_api_client/types/devboxes/computer_create_params.py +26 -0
  155. runloop_api_client/types/devboxes/computer_keyboard_interaction_params.py +16 -0
  156. runloop_api_client/types/devboxes/computer_keyboard_interaction_response.py +15 -0
  157. runloop_api_client/types/devboxes/computer_mouse_interaction_params.py +35 -0
  158. runloop_api_client/types/devboxes/computer_mouse_interaction_response.py +15 -0
  159. runloop_api_client/types/devboxes/computer_screen_interaction_params.py +12 -0
  160. runloop_api_client/types/devboxes/computer_screen_interaction_response.py +15 -0
  161. runloop_api_client/types/devboxes/computer_view.py +23 -0
  162. runloop_api_client/types/devboxes/devbox_logs_list_view.py +39 -0
  163. runloop_api_client/types/devboxes/devbox_snapshot_async_status_view.py +20 -0
  164. runloop_api_client/types/devboxes/disk_snapshot_list_params.py +32 -0
  165. runloop_api_client/types/devboxes/disk_snapshot_update_params.py +19 -0
  166. runloop_api_client/types/devboxes/execution_execute_async_params.py +31 -0
  167. runloop_api_client/types/devboxes/execution_execute_sync_params.py +31 -0
  168. runloop_api_client/types/devboxes/execution_kill_params.py +18 -0
  169. runloop_api_client/types/devboxes/execution_retrieve_params.py +14 -0
  170. runloop_api_client/types/devboxes/execution_send_std_in_params.py +18 -0
  171. runloop_api_client/types/devboxes/execution_stream_stderr_updates_params.py +17 -0
  172. runloop_api_client/types/devboxes/execution_stream_stdout_updates_params.py +17 -0
  173. runloop_api_client/types/devboxes/execution_update_chunk.py +15 -0
  174. runloop_api_client/types/devboxes/log_list_params.py +15 -0
  175. runloop_api_client/types/gateway_config_create_params.py +41 -0
  176. runloop_api_client/types/gateway_config_list_params.py +21 -0
  177. runloop_api_client/types/gateway_config_list_view.py +21 -0
  178. runloop_api_client/types/gateway_config_update_params.py +32 -0
  179. runloop_api_client/types/gateway_config_view.py +47 -0
  180. runloop_api_client/types/input_context.py +19 -0
  181. runloop_api_client/types/input_context_param.py +20 -0
  182. runloop_api_client/types/input_context_update_param.py +16 -0
  183. runloop_api_client/types/inspection_source_param.py +18 -0
  184. runloop_api_client/types/network_policy_create_params.py +40 -0
  185. runloop_api_client/types/network_policy_list_params.py +21 -0
  186. runloop_api_client/types/network_policy_list_view.py +21 -0
  187. runloop_api_client/types/network_policy_update_params.py +30 -0
  188. runloop_api_client/types/network_policy_view.py +52 -0
  189. runloop_api_client/types/object_create_params.py +30 -0
  190. runloop_api_client/types/object_download_params.py +12 -0
  191. runloop_api_client/types/object_download_url_view.py +12 -0
  192. runloop_api_client/types/object_list_params.py +27 -0
  193. runloop_api_client/types/object_list_public_params.py +27 -0
  194. runloop_api_client/types/object_list_view.py +24 -0
  195. runloop_api_client/types/object_view.py +36 -0
  196. runloop_api_client/types/repository_connection_list_view.py +19 -0
  197. runloop_api_client/types/repository_connection_view.py +18 -0
  198. runloop_api_client/types/repository_create_params.py +22 -0
  199. runloop_api_client/types/repository_inspect_params.py +13 -0
  200. runloop_api_client/types/repository_inspection_details.py +83 -0
  201. runloop_api_client/types/repository_inspection_list_view.py +13 -0
  202. runloop_api_client/types/repository_list_params.py +21 -0
  203. runloop_api_client/types/repository_manifest_view.py +174 -0
  204. runloop_api_client/types/repository_refresh_params.py +16 -0
  205. runloop_api_client/types/scenario_create_params.py +53 -0
  206. runloop_api_client/types/scenario_definition_list_view.py +19 -0
  207. runloop_api_client/types/scenario_environment.py +29 -0
  208. runloop_api_client/types/scenario_environment_param.py +31 -0
  209. runloop_api_client/types/scenario_list_params.py +24 -0
  210. runloop_api_client/types/scenario_list_public_params.py +18 -0
  211. runloop_api_client/types/scenario_run_list_view.py +19 -0
  212. runloop_api_client/types/scenario_run_view.py +55 -0
  213. runloop_api_client/types/scenario_start_run_params.py +30 -0
  214. runloop_api_client/types/scenario_update_params.py +49 -0
  215. runloop_api_client/types/scenario_view.py +61 -0
  216. runloop_api_client/types/scenarios/__init__.py +14 -0
  217. runloop_api_client/types/scenarios/run_list_params.py +27 -0
  218. runloop_api_client/types/scenarios/scorer_create_params.py +18 -0
  219. runloop_api_client/types/scenarios/scorer_create_response.py +18 -0
  220. runloop_api_client/types/scenarios/scorer_list_params.py +15 -0
  221. runloop_api_client/types/scenarios/scorer_list_response.py +18 -0
  222. runloop_api_client/types/scenarios/scorer_retrieve_response.py +18 -0
  223. runloop_api_client/types/scenarios/scorer_update_params.py +18 -0
  224. runloop_api_client/types/scenarios/scorer_update_response.py +18 -0
  225. runloop_api_client/types/scenarios/scorer_validate_params.py +17 -0
  226. runloop_api_client/types/scenarios/scorer_validate_response.py +23 -0
  227. runloop_api_client/types/scoring_contract.py +17 -0
  228. runloop_api_client/types/scoring_contract_param.py +19 -0
  229. runloop_api_client/types/scoring_contract_result_view.py +20 -0
  230. runloop_api_client/types/scoring_contract_update_param.py +15 -0
  231. runloop_api_client/types/scoring_function.py +157 -0
  232. runloop_api_client/types/scoring_function_param.py +153 -0
  233. runloop_api_client/types/scoring_function_result_view.py +25 -0
  234. runloop_api_client/types/secret_create_params.py +23 -0
  235. runloop_api_client/types/secret_list_params.py +12 -0
  236. runloop_api_client/types/secret_list_view.py +24 -0
  237. runloop_api_client/types/secret_update_params.py +16 -0
  238. runloop_api_client/types/secret_view.py +26 -0
  239. runloop_api_client/types/shared/__init__.py +10 -0
  240. runloop_api_client/types/shared/after_idle.py +15 -0
  241. runloop_api_client/types/shared/agent_mount.py +31 -0
  242. runloop_api_client/types/shared/agent_source.py +75 -0
  243. runloop_api_client/types/shared/code_mount_parameters.py +24 -0
  244. runloop_api_client/types/shared/launch_parameters.py +86 -0
  245. runloop_api_client/types/shared/mount.py +43 -0
  246. runloop_api_client/types/shared/object_mount.py +21 -0
  247. runloop_api_client/types/shared/run_profile.py +37 -0
  248. runloop_api_client/types/shared_params/__init__.py +10 -0
  249. runloop_api_client/types/shared_params/after_idle.py +15 -0
  250. runloop_api_client/types/shared_params/agent_mount.py +31 -0
  251. runloop_api_client/types/shared_params/agent_source.py +78 -0
  252. runloop_api_client/types/shared_params/code_mount_parameters.py +25 -0
  253. runloop_api_client/types/shared_params/launch_parameters.py +88 -0
  254. runloop_api_client/types/shared_params/mount.py +43 -0
  255. runloop_api_client/types/shared_params/object_mount.py +21 -0
  256. runloop_api_client/types/shared_params/run_profile.py +38 -0
  257. runloop_api_client/types/tunnel_view.py +34 -0
  258. runloop_api_client-1.5.1.dist-info/METADATA +522 -0
  259. runloop_api_client-1.5.1.dist-info/RECORD +261 -0
  260. runloop_api_client-1.5.1.dist-info/WHEEL +4 -0
  261. runloop_api_client-1.5.1.dist-info/licenses/LICENSE +7 -0
@@ -0,0 +1,973 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import httpx
6
+
7
+ from ..._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, omit, not_given
8
+ from ..._utils import maybe_transform
9
+ from ..._compat import cached_property
10
+ from ..._resource import SyncAPIResource, AsyncAPIResource
11
+ from ..._response import (
12
+ BinaryAPIResponse,
13
+ AsyncBinaryAPIResponse,
14
+ StreamedBinaryAPIResponse,
15
+ AsyncStreamedBinaryAPIResponse,
16
+ to_raw_response_wrapper,
17
+ to_streamed_response_wrapper,
18
+ async_to_raw_response_wrapper,
19
+ to_custom_raw_response_wrapper,
20
+ async_to_streamed_response_wrapper,
21
+ to_custom_streamed_response_wrapper,
22
+ async_to_custom_raw_response_wrapper,
23
+ async_to_custom_streamed_response_wrapper,
24
+ )
25
+ from ...pagination import SyncBenchmarkRunsCursorIDPage, AsyncBenchmarkRunsCursorIDPage
26
+ from ..._exceptions import RunloopError
27
+ from ...lib.polling import PollingConfig, poll_until
28
+ from ..._base_client import AsyncPaginator, make_request_options
29
+ from ...types.scenarios import run_list_params
30
+ from ...lib.polling_async import async_poll_until
31
+ from ...types.scenario_run_view import ScenarioRunView
32
+
33
+ __all__ = ["RunsResource", "AsyncRunsResource"]
34
+
35
+
36
+ class RunsResource(SyncAPIResource):
37
+ @cached_property
38
+ def with_raw_response(self) -> RunsResourceWithRawResponse:
39
+ """
40
+ This property can be used as a prefix for any HTTP method call to return
41
+ the raw response object instead of the parsed content.
42
+
43
+ For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers
44
+ """
45
+ return RunsResourceWithRawResponse(self)
46
+
47
+ @cached_property
48
+ def with_streaming_response(self) -> RunsResourceWithStreamingResponse:
49
+ """
50
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
51
+
52
+ For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response
53
+ """
54
+ return RunsResourceWithStreamingResponse(self)
55
+
56
+ def retrieve(
57
+ self,
58
+ id: str,
59
+ *,
60
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61
+ # The extra values given here take precedence over values defined on the client or passed to this method.
62
+ extra_headers: Headers | None = None,
63
+ extra_query: Query | None = None,
64
+ extra_body: Body | None = None,
65
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
66
+ ) -> ScenarioRunView:
67
+ """
68
+ Get a ScenarioRun given ID.
69
+
70
+ Args:
71
+ extra_headers: Send extra headers
72
+
73
+ extra_query: Add additional query parameters to the request
74
+
75
+ extra_body: Add additional JSON properties to the request
76
+
77
+ timeout: Override the client-level default timeout for this request, in seconds
78
+ """
79
+ if not id:
80
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
81
+ return self._get(
82
+ f"/v1/scenarios/runs/{id}",
83
+ options=make_request_options(
84
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
85
+ ),
86
+ cast_to=ScenarioRunView,
87
+ )
88
+
89
+ def list(
90
+ self,
91
+ *,
92
+ benchmark_run_id: str | Omit = omit,
93
+ limit: int | Omit = omit,
94
+ name: str | Omit = omit,
95
+ scenario_id: str | Omit = omit,
96
+ starting_after: str | Omit = omit,
97
+ state: str | Omit = omit,
98
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
99
+ # The extra values given here take precedence over values defined on the client or passed to this method.
100
+ extra_headers: Headers | None = None,
101
+ extra_query: Query | None = None,
102
+ extra_body: Body | None = None,
103
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
104
+ ) -> SyncBenchmarkRunsCursorIDPage[ScenarioRunView]:
105
+ """
106
+ List all ScenarioRuns matching filter.
107
+
108
+ Args:
109
+ benchmark_run_id: Filter by benchmark run ID
110
+
111
+ limit: The limit of items to return. Default is 20. Max is 5000.
112
+
113
+ name: Filter by name
114
+
115
+ scenario_id: Filter runs associated to Scenario given ID
116
+
117
+ starting_after: Load the next page of data starting after the item with the given ID.
118
+
119
+ state: Filter by state
120
+
121
+ extra_headers: Send extra headers
122
+
123
+ extra_query: Add additional query parameters to the request
124
+
125
+ extra_body: Add additional JSON properties to the request
126
+
127
+ timeout: Override the client-level default timeout for this request, in seconds
128
+ """
129
+ return self._get_api_list(
130
+ "/v1/scenarios/runs",
131
+ page=SyncBenchmarkRunsCursorIDPage[ScenarioRunView],
132
+ options=make_request_options(
133
+ extra_headers=extra_headers,
134
+ extra_query=extra_query,
135
+ extra_body=extra_body,
136
+ timeout=timeout,
137
+ query=maybe_transform(
138
+ {
139
+ "benchmark_run_id": benchmark_run_id,
140
+ "limit": limit,
141
+ "name": name,
142
+ "scenario_id": scenario_id,
143
+ "starting_after": starting_after,
144
+ "state": state,
145
+ },
146
+ run_list_params.RunListParams,
147
+ ),
148
+ ),
149
+ model=ScenarioRunView,
150
+ )
151
+
152
+ def cancel(
153
+ self,
154
+ id: str,
155
+ *,
156
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
157
+ # The extra values given here take precedence over values defined on the client or passed to this method.
158
+ extra_headers: Headers | None = None,
159
+ extra_query: Query | None = None,
160
+ extra_body: Body | None = None,
161
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
162
+ idempotency_key: str | None = None,
163
+ ) -> ScenarioRunView:
164
+ """Cancel a currently running Scenario run.
165
+
166
+ This will shutdown the underlying
167
+ Devbox resource.
168
+
169
+ Args:
170
+ extra_headers: Send extra headers
171
+
172
+ extra_query: Add additional query parameters to the request
173
+
174
+ extra_body: Add additional JSON properties to the request
175
+
176
+ timeout: Override the client-level default timeout for this request, in seconds
177
+
178
+ idempotency_key: Specify a custom idempotency key for this request
179
+ """
180
+ if not id:
181
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
182
+ return self._post(
183
+ f"/v1/scenarios/runs/{id}/cancel",
184
+ options=make_request_options(
185
+ extra_headers=extra_headers,
186
+ extra_query=extra_query,
187
+ extra_body=extra_body,
188
+ timeout=timeout,
189
+ idempotency_key=idempotency_key,
190
+ ),
191
+ cast_to=ScenarioRunView,
192
+ )
193
+
194
+ def complete(
195
+ self,
196
+ id: str,
197
+ *,
198
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
199
+ # The extra values given here take precedence over values defined on the client or passed to this method.
200
+ extra_headers: Headers | None = None,
201
+ extra_query: Query | None = None,
202
+ extra_body: Body | None = None,
203
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
204
+ idempotency_key: str | None = None,
205
+ ) -> ScenarioRunView:
206
+ """Complete a currently running ScenarioRun.
207
+
208
+ Calling complete will shutdown
209
+ underlying Devbox resource.
210
+
211
+ Args:
212
+ extra_headers: Send extra headers
213
+
214
+ extra_query: Add additional query parameters to the request
215
+
216
+ extra_body: Add additional JSON properties to the request
217
+
218
+ timeout: Override the client-level default timeout for this request, in seconds
219
+
220
+ idempotency_key: Specify a custom idempotency key for this request
221
+ """
222
+ if not id:
223
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
224
+ return self._post(
225
+ f"/v1/scenarios/runs/{id}/complete",
226
+ options=make_request_options(
227
+ extra_headers=extra_headers,
228
+ extra_query=extra_query,
229
+ extra_body=extra_body,
230
+ timeout=timeout,
231
+ idempotency_key=idempotency_key,
232
+ ),
233
+ cast_to=ScenarioRunView,
234
+ )
235
+
236
+ def download_logs(
237
+ self,
238
+ id: str,
239
+ *,
240
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
241
+ # The extra values given here take precedence over values defined on the client or passed to this method.
242
+ extra_headers: Headers | None = None,
243
+ extra_query: Query | None = None,
244
+ extra_body: Body | None = None,
245
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
246
+ idempotency_key: str | None = None,
247
+ ) -> BinaryAPIResponse:
248
+ """
249
+ Download a zip file containing all logs for a Scenario run from the associated
250
+ devbox.
251
+
252
+ Args:
253
+ extra_headers: Send extra headers
254
+
255
+ extra_query: Add additional query parameters to the request
256
+
257
+ extra_body: Add additional JSON properties to the request
258
+
259
+ timeout: Override the client-level default timeout for this request, in seconds
260
+
261
+ idempotency_key: Specify a custom idempotency key for this request
262
+ """
263
+ if not id:
264
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
265
+ extra_headers = {"Accept": "application/zip", **(extra_headers or {})}
266
+ return self._post(
267
+ f"/v1/scenarios/runs/{id}/download_logs",
268
+ options=make_request_options(
269
+ extra_headers=extra_headers,
270
+ extra_query=extra_query,
271
+ extra_body=extra_body,
272
+ timeout=timeout,
273
+ idempotency_key=idempotency_key,
274
+ ),
275
+ cast_to=BinaryAPIResponse,
276
+ )
277
+
278
+ def score(
279
+ self,
280
+ id: str,
281
+ *,
282
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
283
+ # The extra values given here take precedence over values defined on the client or passed to this method.
284
+ extra_headers: Headers | None = None,
285
+ extra_query: Query | None = None,
286
+ extra_body: Body | None = None,
287
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
288
+ idempotency_key: str | None = None,
289
+ ) -> ScenarioRunView:
290
+ """
291
+ Score a currently running ScenarioRun.
292
+
293
+ Args:
294
+ extra_headers: Send extra headers
295
+
296
+ extra_query: Add additional query parameters to the request
297
+
298
+ extra_body: Add additional JSON properties to the request
299
+
300
+ timeout: Override the client-level default timeout for this request, in seconds
301
+
302
+ idempotency_key: Specify a custom idempotency key for this request
303
+ """
304
+ if not id:
305
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
306
+ return self._post(
307
+ f"/v1/scenarios/runs/{id}/score",
308
+ options=make_request_options(
309
+ extra_headers=extra_headers,
310
+ extra_query=extra_query,
311
+ extra_body=extra_body,
312
+ timeout=timeout,
313
+ idempotency_key=idempotency_key,
314
+ ),
315
+ cast_to=ScenarioRunView,
316
+ )
317
+
318
+ def await_scored(
319
+ self,
320
+ id: str,
321
+ *,
322
+ polling_config: PollingConfig | None = None,
323
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
324
+ # The extra values given here take precedence over values defined on the client or passed to this method.
325
+ extra_headers: Headers | None = None,
326
+ extra_query: Query | None = None,
327
+ extra_body: Body | None = None,
328
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
329
+ ) -> ScenarioRunView:
330
+ """Wait for a scenario run to be scored.
331
+
332
+ Args:
333
+ id: The ID of the scenario run to wait for
334
+ polling_config: Optional polling configuration
335
+ extra_headers: Send extra headers
336
+ extra_query: Add additional query parameters to the request
337
+ extra_body: Add additional JSON properties to the request
338
+ timeout: Override the client-level default timeout for this request, in seconds
339
+
340
+ Returns:
341
+ The scored scenario run
342
+
343
+ Raises:
344
+ PollingTimeout: If polling times out before scenario run is scored
345
+ RunloopError: If scenario run enters a non-scored terminal state
346
+ """
347
+
348
+ def retrieve_run() -> ScenarioRunView:
349
+ return self.retrieve(
350
+ id, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
351
+ )
352
+
353
+ def is_done_scoring(run: ScenarioRunView) -> bool:
354
+ return run.state not in ["scoring"]
355
+
356
+ run = poll_until(retrieve_run, is_done_scoring, polling_config)
357
+
358
+ if run.state != "scored":
359
+ raise RunloopError(f"Scenario run entered non-scored state unexpectedly: {run.state}")
360
+
361
+ return run
362
+
363
+ def score_and_await(
364
+ self,
365
+ id: str,
366
+ *,
367
+ polling_config: PollingConfig | None = None,
368
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
369
+ # The extra values given here take precedence over values defined on the client or passed to this method.
370
+ extra_headers: Headers | None = None,
371
+ extra_query: Query | None = None,
372
+ extra_body: Body | None = None,
373
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
374
+ ) -> ScenarioRunView:
375
+ """Score a scenario run and wait for it to be scored.
376
+
377
+ Args:
378
+ id: The ID of the scenario run to score and wait for
379
+ polling_config: Optional polling configuration
380
+ extra_headers: Send extra headers
381
+ extra_query: Add additional query parameters to the request
382
+ extra_body: Add additional JSON properties to the request
383
+ timeout: Override the client-level default timeout for this request, in seconds
384
+
385
+ Returns:
386
+ The scored scenario run
387
+
388
+ Raises:
389
+ PollingTimeout: If polling times out before scenario run is scored
390
+ RunloopError: If scenario run enters a non-scored terminal state
391
+ """
392
+ self.score(
393
+ id,
394
+ extra_headers=extra_headers,
395
+ extra_query=extra_query,
396
+ extra_body=extra_body,
397
+ timeout=timeout,
398
+ )
399
+
400
+ return self.await_scored(
401
+ id,
402
+ polling_config=polling_config,
403
+ extra_headers=extra_headers,
404
+ extra_query=extra_query,
405
+ extra_body=extra_body,
406
+ timeout=timeout,
407
+ )
408
+
409
+ def score_and_complete(
410
+ self,
411
+ id: str,
412
+ *,
413
+ polling_config: PollingConfig | None = None,
414
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
415
+ # The extra values given here take precedence over values defined on the client or passed to this method.
416
+ extra_headers: Headers | None = None,
417
+ extra_query: Query | None = None,
418
+ extra_body: Body | None = None,
419
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
420
+ ) -> ScenarioRunView:
421
+ """Score a scenario run, wait for it to be scored, then complete it.
422
+
423
+ Args:
424
+ id: The ID of the scenario run to score, wait for, and complete
425
+ polling_config: Optional polling configuration
426
+ extra_headers: Send extra headers
427
+ extra_query: Add additional query parameters to the request
428
+ extra_body: Add additional JSON properties to the request
429
+ timeout: Override the client-level default timeout for this request, in seconds
430
+
431
+ Returns:
432
+ The completed scenario run
433
+
434
+ Raises:
435
+ PollingTimeout: If polling times out before scenario run is scored
436
+ RunloopError: If scenario run enters a non-scored terminal state
437
+ """
438
+ self.score_and_await(
439
+ id,
440
+ polling_config=polling_config,
441
+ extra_headers=extra_headers,
442
+ extra_query=extra_query,
443
+ extra_body=extra_body,
444
+ timeout=timeout,
445
+ )
446
+
447
+ return self.complete(
448
+ id,
449
+ extra_headers=extra_headers,
450
+ extra_query=extra_query,
451
+ extra_body=extra_body,
452
+ timeout=timeout,
453
+ )
454
+
455
+
456
+ class AsyncRunsResource(AsyncAPIResource):
457
+ @cached_property
458
+ def with_raw_response(self) -> AsyncRunsResourceWithRawResponse:
459
+ """
460
+ This property can be used as a prefix for any HTTP method call to return
461
+ the raw response object instead of the parsed content.
462
+
463
+ For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers
464
+ """
465
+ return AsyncRunsResourceWithRawResponse(self)
466
+
467
+ @cached_property
468
+ def with_streaming_response(self) -> AsyncRunsResourceWithStreamingResponse:
469
+ """
470
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
471
+
472
+ For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response
473
+ """
474
+ return AsyncRunsResourceWithStreamingResponse(self)
475
+
476
+ async def retrieve(
477
+ self,
478
+ id: str,
479
+ *,
480
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
481
+ # The extra values given here take precedence over values defined on the client or passed to this method.
482
+ extra_headers: Headers | None = None,
483
+ extra_query: Query | None = None,
484
+ extra_body: Body | None = None,
485
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
486
+ ) -> ScenarioRunView:
487
+ """
488
+ Get a ScenarioRun given ID.
489
+
490
+ Args:
491
+ extra_headers: Send extra headers
492
+
493
+ extra_query: Add additional query parameters to the request
494
+
495
+ extra_body: Add additional JSON properties to the request
496
+
497
+ timeout: Override the client-level default timeout for this request, in seconds
498
+ """
499
+ if not id:
500
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
501
+ return await self._get(
502
+ f"/v1/scenarios/runs/{id}",
503
+ options=make_request_options(
504
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
505
+ ),
506
+ cast_to=ScenarioRunView,
507
+ )
508
+
509
+ def list(
510
+ self,
511
+ *,
512
+ benchmark_run_id: str | Omit = omit,
513
+ limit: int | Omit = omit,
514
+ name: str | Omit = omit,
515
+ scenario_id: str | Omit = omit,
516
+ starting_after: str | Omit = omit,
517
+ state: str | Omit = omit,
518
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
519
+ # The extra values given here take precedence over values defined on the client or passed to this method.
520
+ extra_headers: Headers | None = None,
521
+ extra_query: Query | None = None,
522
+ extra_body: Body | None = None,
523
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
524
+ ) -> AsyncPaginator[ScenarioRunView, AsyncBenchmarkRunsCursorIDPage[ScenarioRunView]]:
525
+ """
526
+ List all ScenarioRuns matching filter.
527
+
528
+ Args:
529
+ benchmark_run_id: Filter by benchmark run ID
530
+
531
+ limit: The limit of items to return. Default is 20. Max is 5000.
532
+
533
+ name: Filter by name
534
+
535
+ scenario_id: Filter runs associated to Scenario given ID
536
+
537
+ starting_after: Load the next page of data starting after the item with the given ID.
538
+
539
+ state: Filter by state
540
+
541
+ extra_headers: Send extra headers
542
+
543
+ extra_query: Add additional query parameters to the request
544
+
545
+ extra_body: Add additional JSON properties to the request
546
+
547
+ timeout: Override the client-level default timeout for this request, in seconds
548
+ """
549
+ return self._get_api_list(
550
+ "/v1/scenarios/runs",
551
+ page=AsyncBenchmarkRunsCursorIDPage[ScenarioRunView],
552
+ options=make_request_options(
553
+ extra_headers=extra_headers,
554
+ extra_query=extra_query,
555
+ extra_body=extra_body,
556
+ timeout=timeout,
557
+ query=maybe_transform(
558
+ {
559
+ "benchmark_run_id": benchmark_run_id,
560
+ "limit": limit,
561
+ "name": name,
562
+ "scenario_id": scenario_id,
563
+ "starting_after": starting_after,
564
+ "state": state,
565
+ },
566
+ run_list_params.RunListParams,
567
+ ),
568
+ ),
569
+ model=ScenarioRunView,
570
+ )
571
+
572
+ async def cancel(
573
+ self,
574
+ id: str,
575
+ *,
576
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
577
+ # The extra values given here take precedence over values defined on the client or passed to this method.
578
+ extra_headers: Headers | None = None,
579
+ extra_query: Query | None = None,
580
+ extra_body: Body | None = None,
581
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
582
+ idempotency_key: str | None = None,
583
+ ) -> ScenarioRunView:
584
+ """Cancel a currently running Scenario run.
585
+
586
+ This will shutdown the underlying
587
+ Devbox resource.
588
+
589
+ Args:
590
+ extra_headers: Send extra headers
591
+
592
+ extra_query: Add additional query parameters to the request
593
+
594
+ extra_body: Add additional JSON properties to the request
595
+
596
+ timeout: Override the client-level default timeout for this request, in seconds
597
+
598
+ idempotency_key: Specify a custom idempotency key for this request
599
+ """
600
+ if not id:
601
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
602
+ return await self._post(
603
+ f"/v1/scenarios/runs/{id}/cancel",
604
+ options=make_request_options(
605
+ extra_headers=extra_headers,
606
+ extra_query=extra_query,
607
+ extra_body=extra_body,
608
+ timeout=timeout,
609
+ idempotency_key=idempotency_key,
610
+ ),
611
+ cast_to=ScenarioRunView,
612
+ )
613
+
614
+ async def complete(
615
+ self,
616
+ id: str,
617
+ *,
618
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
619
+ # The extra values given here take precedence over values defined on the client or passed to this method.
620
+ extra_headers: Headers | None = None,
621
+ extra_query: Query | None = None,
622
+ extra_body: Body | None = None,
623
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
624
+ idempotency_key: str | None = None,
625
+ ) -> ScenarioRunView:
626
+ """Complete a currently running ScenarioRun.
627
+
628
+ Calling complete will shutdown
629
+ underlying Devbox resource.
630
+
631
+ Args:
632
+ extra_headers: Send extra headers
633
+
634
+ extra_query: Add additional query parameters to the request
635
+
636
+ extra_body: Add additional JSON properties to the request
637
+
638
+ timeout: Override the client-level default timeout for this request, in seconds
639
+
640
+ idempotency_key: Specify a custom idempotency key for this request
641
+ """
642
+ if not id:
643
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
644
+ return await self._post(
645
+ f"/v1/scenarios/runs/{id}/complete",
646
+ options=make_request_options(
647
+ extra_headers=extra_headers,
648
+ extra_query=extra_query,
649
+ extra_body=extra_body,
650
+ timeout=timeout,
651
+ idempotency_key=idempotency_key,
652
+ ),
653
+ cast_to=ScenarioRunView,
654
+ )
655
+
656
+ async def download_logs(
657
+ self,
658
+ id: str,
659
+ *,
660
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
661
+ # The extra values given here take precedence over values defined on the client or passed to this method.
662
+ extra_headers: Headers | None = None,
663
+ extra_query: Query | None = None,
664
+ extra_body: Body | None = None,
665
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
666
+ idempotency_key: str | None = None,
667
+ ) -> AsyncBinaryAPIResponse:
668
+ """
669
+ Download a zip file containing all logs for a Scenario run from the associated
670
+ devbox.
671
+
672
+ Args:
673
+ extra_headers: Send extra headers
674
+
675
+ extra_query: Add additional query parameters to the request
676
+
677
+ extra_body: Add additional JSON properties to the request
678
+
679
+ timeout: Override the client-level default timeout for this request, in seconds
680
+
681
+ idempotency_key: Specify a custom idempotency key for this request
682
+ """
683
+ if not id:
684
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
685
+ extra_headers = {"Accept": "application/zip", **(extra_headers or {})}
686
+ return await self._post(
687
+ f"/v1/scenarios/runs/{id}/download_logs",
688
+ options=make_request_options(
689
+ extra_headers=extra_headers,
690
+ extra_query=extra_query,
691
+ extra_body=extra_body,
692
+ timeout=timeout,
693
+ idempotency_key=idempotency_key,
694
+ ),
695
+ cast_to=AsyncBinaryAPIResponse,
696
+ )
697
+
698
+ async def score(
699
+ self,
700
+ id: str,
701
+ *,
702
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
703
+ # The extra values given here take precedence over values defined on the client or passed to this method.
704
+ extra_headers: Headers | None = None,
705
+ extra_query: Query | None = None,
706
+ extra_body: Body | None = None,
707
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
708
+ idempotency_key: str | None = None,
709
+ ) -> ScenarioRunView:
710
+ """
711
+ Score a currently running ScenarioRun.
712
+
713
+ Args:
714
+ extra_headers: Send extra headers
715
+
716
+ extra_query: Add additional query parameters to the request
717
+
718
+ extra_body: Add additional JSON properties to the request
719
+
720
+ timeout: Override the client-level default timeout for this request, in seconds
721
+
722
+ idempotency_key: Specify a custom idempotency key for this request
723
+ """
724
+ if not id:
725
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
726
+ return await self._post(
727
+ f"/v1/scenarios/runs/{id}/score",
728
+ options=make_request_options(
729
+ extra_headers=extra_headers,
730
+ extra_query=extra_query,
731
+ extra_body=extra_body,
732
+ timeout=timeout,
733
+ idempotency_key=idempotency_key,
734
+ ),
735
+ cast_to=ScenarioRunView,
736
+ )
737
+
738
+ async def await_scored(
739
+ self,
740
+ id: str,
741
+ *,
742
+ polling_config: PollingConfig | None = None,
743
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
744
+ # The extra values given here take precedence over values defined on the client or passed to this method.
745
+ extra_headers: Headers | None = None,
746
+ extra_query: Query | None = None,
747
+ extra_body: Body | None = None,
748
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
749
+ ) -> ScenarioRunView:
750
+ """Wait for a scenario run to be scored.
751
+
752
+ Args:
753
+ id: The ID of the scenario run to wait for
754
+ polling_config: Optional polling configuration
755
+ extra_headers: Send extra headers
756
+ extra_query: Add additional query parameters to the request
757
+ extra_body: Add additional JSON properties to the request
758
+ timeout: Override the client-level default timeout for this request, in seconds
759
+
760
+ Returns:
761
+ The scored scenario run
762
+
763
+ Raises:
764
+ PollingTimeout: If polling times out before scenario run is scored
765
+ RunloopError: If scenario run enters a non-scored terminal state
766
+ """
767
+
768
+ async def retrieve_run() -> ScenarioRunView:
769
+ return await self.retrieve(
770
+ id, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
771
+ )
772
+
773
+ def is_done_scoring(run: ScenarioRunView) -> bool:
774
+ return run.state not in ["scoring"]
775
+
776
+ run = await async_poll_until(retrieve_run, is_done_scoring, polling_config)
777
+
778
+ if run.state != "scored":
779
+ raise RunloopError(f"Scenario run entered non-scored state unexpectedly: {run.state}")
780
+
781
+ return run
782
+
783
+ async def score_and_await(
784
+ self,
785
+ id: str,
786
+ *,
787
+ polling_config: PollingConfig | None = None,
788
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
789
+ # The extra values given here take precedence over values defined on the client or passed to this method.
790
+ extra_headers: Headers | None = None,
791
+ extra_query: Query | None = None,
792
+ extra_body: Body | None = None,
793
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
794
+ ) -> ScenarioRunView:
795
+ """Score a scenario run and wait for it to be scored.
796
+
797
+ Args:
798
+ id: The ID of the scenario run to score and wait for
799
+ polling_config: Optional polling configuration
800
+ extra_headers: Send extra headers
801
+ extra_query: Add additional query parameters to the request
802
+ extra_body: Add additional JSON properties to the request
803
+ timeout: Override the client-level default timeout for this request, in seconds
804
+
805
+ Returns:
806
+ The scored scenario run
807
+
808
+ Raises:
809
+ PollingTimeout: If polling times out before scenario run is scored
810
+ RunloopError: If scenario run enters a non-scored terminal state
811
+ """
812
+ await self.score(
813
+ id,
814
+ extra_headers=extra_headers,
815
+ extra_query=extra_query,
816
+ extra_body=extra_body,
817
+ timeout=timeout,
818
+ )
819
+
820
+ return await self.await_scored(
821
+ id,
822
+ polling_config=polling_config,
823
+ extra_headers=extra_headers,
824
+ extra_query=extra_query,
825
+ extra_body=extra_body,
826
+ timeout=timeout,
827
+ )
828
+
829
+ async def score_and_complete(
830
+ self,
831
+ id: str,
832
+ *,
833
+ polling_config: PollingConfig | None = None,
834
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
835
+ # The extra values given here take precedence over values defined on the client or passed to this method.
836
+ extra_headers: Headers | None = None,
837
+ extra_query: Query | None = None,
838
+ extra_body: Body | None = None,
839
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
840
+ ) -> ScenarioRunView:
841
+ """Score a scenario run, wait for it to be scored, then complete it.
842
+
843
+ Args:
844
+ id: The ID of the scenario run to score, wait for, and complete
845
+ polling_config: Optional polling configuration
846
+ extra_headers: Send extra headers
847
+ extra_query: Add additional query parameters to the request
848
+ extra_body: Add additional JSON properties to the request
849
+ timeout: Override the client-level default timeout for this request, in seconds
850
+
851
+ Returns:
852
+ The completed scenario run
853
+
854
+ Raises:
855
+ PollingTimeout: If polling times out before scenario run is scored
856
+ RunloopError: If scenario run enters a non-scored terminal state
857
+ """
858
+ await self.score_and_await(
859
+ id,
860
+ polling_config=polling_config,
861
+ extra_headers=extra_headers,
862
+ extra_query=extra_query,
863
+ extra_body=extra_body,
864
+ timeout=timeout,
865
+ )
866
+
867
+ return await self.complete(
868
+ id,
869
+ extra_headers=extra_headers,
870
+ extra_query=extra_query,
871
+ extra_body=extra_body,
872
+ timeout=timeout,
873
+ )
874
+
875
+
876
+ class RunsResourceWithRawResponse:
877
+ def __init__(self, runs: RunsResource) -> None:
878
+ self._runs = runs
879
+
880
+ self.retrieve = to_raw_response_wrapper(
881
+ runs.retrieve,
882
+ )
883
+ self.list = to_raw_response_wrapper(
884
+ runs.list,
885
+ )
886
+ self.cancel = to_raw_response_wrapper(
887
+ runs.cancel,
888
+ )
889
+ self.complete = to_raw_response_wrapper(
890
+ runs.complete,
891
+ )
892
+ self.download_logs = to_custom_raw_response_wrapper(
893
+ runs.download_logs,
894
+ BinaryAPIResponse,
895
+ )
896
+ self.score = to_raw_response_wrapper(
897
+ runs.score,
898
+ )
899
+
900
+
901
+ class AsyncRunsResourceWithRawResponse:
902
+ def __init__(self, runs: AsyncRunsResource) -> None:
903
+ self._runs = runs
904
+
905
+ self.retrieve = async_to_raw_response_wrapper(
906
+ runs.retrieve,
907
+ )
908
+ self.list = async_to_raw_response_wrapper(
909
+ runs.list,
910
+ )
911
+ self.cancel = async_to_raw_response_wrapper(
912
+ runs.cancel,
913
+ )
914
+ self.complete = async_to_raw_response_wrapper(
915
+ runs.complete,
916
+ )
917
+ self.download_logs = async_to_custom_raw_response_wrapper(
918
+ runs.download_logs,
919
+ AsyncBinaryAPIResponse,
920
+ )
921
+ self.score = async_to_raw_response_wrapper(
922
+ runs.score,
923
+ )
924
+
925
+
926
+ class RunsResourceWithStreamingResponse:
927
+ def __init__(self, runs: RunsResource) -> None:
928
+ self._runs = runs
929
+
930
+ self.retrieve = to_streamed_response_wrapper(
931
+ runs.retrieve,
932
+ )
933
+ self.list = to_streamed_response_wrapper(
934
+ runs.list,
935
+ )
936
+ self.cancel = to_streamed_response_wrapper(
937
+ runs.cancel,
938
+ )
939
+ self.complete = to_streamed_response_wrapper(
940
+ runs.complete,
941
+ )
942
+ self.download_logs = to_custom_streamed_response_wrapper(
943
+ runs.download_logs,
944
+ StreamedBinaryAPIResponse,
945
+ )
946
+ self.score = to_streamed_response_wrapper(
947
+ runs.score,
948
+ )
949
+
950
+
951
+ class AsyncRunsResourceWithStreamingResponse:
952
+ def __init__(self, runs: AsyncRunsResource) -> None:
953
+ self._runs = runs
954
+
955
+ self.retrieve = async_to_streamed_response_wrapper(
956
+ runs.retrieve,
957
+ )
958
+ self.list = async_to_streamed_response_wrapper(
959
+ runs.list,
960
+ )
961
+ self.cancel = async_to_streamed_response_wrapper(
962
+ runs.cancel,
963
+ )
964
+ self.complete = async_to_streamed_response_wrapper(
965
+ runs.complete,
966
+ )
967
+ self.download_logs = async_to_custom_streamed_response_wrapper(
968
+ runs.download_logs,
969
+ AsyncStreamedBinaryAPIResponse,
970
+ )
971
+ self.score = async_to_streamed_response_wrapper(
972
+ runs.score,
973
+ )