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.
- runloop_api_client/__init__.py +95 -0
- runloop_api_client/_base_client.py +2127 -0
- runloop_api_client/_client.py +866 -0
- runloop_api_client/_compat.py +219 -0
- runloop_api_client/_constants.py +23 -0
- runloop_api_client/_exceptions.py +108 -0
- runloop_api_client/_files.py +123 -0
- runloop_api_client/_models.py +872 -0
- runloop_api_client/_qs.py +150 -0
- runloop_api_client/_resource.py +43 -0
- runloop_api_client/_response.py +832 -0
- runloop_api_client/_streaming.py +518 -0
- runloop_api_client/_types.py +270 -0
- runloop_api_client/_utils/__init__.py +65 -0
- runloop_api_client/_utils/_compat.py +45 -0
- runloop_api_client/_utils/_datetime_parse.py +136 -0
- runloop_api_client/_utils/_json.py +35 -0
- runloop_api_client/_utils/_logs.py +25 -0
- runloop_api_client/_utils/_proxy.py +65 -0
- runloop_api_client/_utils/_reflection.py +42 -0
- runloop_api_client/_utils/_resources_proxy.py +24 -0
- runloop_api_client/_utils/_streams.py +12 -0
- runloop_api_client/_utils/_sync.py +58 -0
- runloop_api_client/_utils/_transform.py +457 -0
- runloop_api_client/_utils/_typing.py +156 -0
- runloop_api_client/_utils/_utils.py +421 -0
- runloop_api_client/_utils/_validation.py +31 -0
- runloop_api_client/_version.py +4 -0
- runloop_api_client/lib/.keep +4 -0
- runloop_api_client/lib/__init__.py +3 -0
- runloop_api_client/lib/_ignore.py +496 -0
- runloop_api_client/lib/context_loader.py +78 -0
- runloop_api_client/lib/polling.py +75 -0
- runloop_api_client/lib/polling_async.py +60 -0
- runloop_api_client/pagination.py +986 -0
- runloop_api_client/py.typed +0 -0
- runloop_api_client/resources/__init__.py +173 -0
- runloop_api_client/resources/agents.py +431 -0
- runloop_api_client/resources/benchmark_jobs.py +394 -0
- runloop_api_client/resources/benchmark_runs.py +595 -0
- runloop_api_client/resources/benchmarks.py +1085 -0
- runloop_api_client/resources/blueprints.py +1563 -0
- runloop_api_client/resources/devboxes/__init__.py +89 -0
- runloop_api_client/resources/devboxes/browsers.py +267 -0
- runloop_api_client/resources/devboxes/computers.py +648 -0
- runloop_api_client/resources/devboxes/devboxes.py +3784 -0
- runloop_api_client/resources/devboxes/disk_snapshots.py +602 -0
- runloop_api_client/resources/devboxes/executions.py +1212 -0
- runloop_api_client/resources/devboxes/logs.py +197 -0
- runloop_api_client/resources/gateway_configs.py +658 -0
- runloop_api_client/resources/network_policies.py +680 -0
- runloop_api_client/resources/objects.py +870 -0
- runloop_api_client/resources/repositories.py +918 -0
- runloop_api_client/resources/scenarios/__init__.py +47 -0
- runloop_api_client/resources/scenarios/runs.py +973 -0
- runloop_api_client/resources/scenarios/scenarios.py +1101 -0
- runloop_api_client/resources/scenarios/scorers.py +629 -0
- runloop_api_client/resources/secrets.py +500 -0
- runloop_api_client/sdk/__init__.py +117 -0
- runloop_api_client/sdk/_helpers.py +49 -0
- runloop_api_client/sdk/_types.py +264 -0
- runloop_api_client/sdk/agent.py +70 -0
- runloop_api_client/sdk/async_.py +1036 -0
- runloop_api_client/sdk/async_agent.py +70 -0
- runloop_api_client/sdk/async_benchmark.py +169 -0
- runloop_api_client/sdk/async_benchmark_run.py +127 -0
- runloop_api_client/sdk/async_blueprint.py +104 -0
- runloop_api_client/sdk/async_devbox.py +797 -0
- runloop_api_client/sdk/async_execution.py +144 -0
- runloop_api_client/sdk/async_execution_result.py +175 -0
- runloop_api_client/sdk/async_network_policy.py +80 -0
- runloop_api_client/sdk/async_scenario.py +118 -0
- runloop_api_client/sdk/async_scenario_builder.py +480 -0
- runloop_api_client/sdk/async_scenario_run.py +242 -0
- runloop_api_client/sdk/async_scorer.py +77 -0
- runloop_api_client/sdk/async_snapshot.py +125 -0
- runloop_api_client/sdk/async_storage_object.py +188 -0
- runloop_api_client/sdk/benchmark.py +167 -0
- runloop_api_client/sdk/benchmark_run.py +127 -0
- runloop_api_client/sdk/blueprint.py +104 -0
- runloop_api_client/sdk/devbox.py +800 -0
- runloop_api_client/sdk/execution.py +132 -0
- runloop_api_client/sdk/execution_result.py +173 -0
- runloop_api_client/sdk/network_policy.py +80 -0
- runloop_api_client/sdk/scenario.py +118 -0
- runloop_api_client/sdk/scenario_builder.py +480 -0
- runloop_api_client/sdk/scenario_run.py +242 -0
- runloop_api_client/sdk/scorer.py +77 -0
- runloop_api_client/sdk/snapshot.py +125 -0
- runloop_api_client/sdk/storage_object.py +188 -0
- runloop_api_client/sdk/sync.py +1061 -0
- runloop_api_client/types/__init__.py +130 -0
- runloop_api_client/types/agent_create_params.py +21 -0
- runloop_api_client/types/agent_list_params.py +27 -0
- runloop_api_client/types/agent_list_view.py +24 -0
- runloop_api_client/types/agent_view.py +30 -0
- runloop_api_client/types/benchmark_create_params.py +40 -0
- runloop_api_client/types/benchmark_definitions_params.py +15 -0
- runloop_api_client/types/benchmark_job_create_params.py +220 -0
- runloop_api_client/types/benchmark_job_list_params.py +18 -0
- runloop_api_client/types/benchmark_job_list_view.py +19 -0
- runloop_api_client/types/benchmark_job_view.py +344 -0
- runloop_api_client/types/benchmark_list_params.py +18 -0
- runloop_api_client/types/benchmark_list_public_params.py +15 -0
- runloop_api_client/types/benchmark_run_list_params.py +21 -0
- runloop_api_client/types/benchmark_run_list_scenario_runs_params.py +18 -0
- runloop_api_client/types/benchmark_run_list_view.py +19 -0
- runloop_api_client/types/benchmark_run_view.py +58 -0
- runloop_api_client/types/benchmark_start_run_params.py +29 -0
- runloop_api_client/types/benchmark_update_params.py +42 -0
- runloop_api_client/types/benchmark_update_scenarios_params.py +18 -0
- runloop_api_client/types/benchmark_view.py +49 -0
- runloop_api_client/types/blueprint_build_log.py +16 -0
- runloop_api_client/types/blueprint_build_logs_list_view.py +16 -0
- runloop_api_client/types/blueprint_build_parameters.py +119 -0
- runloop_api_client/types/blueprint_create_from_inspection_params.py +49 -0
- runloop_api_client/types/blueprint_create_params.py +121 -0
- runloop_api_client/types/blueprint_list_params.py +21 -0
- runloop_api_client/types/blueprint_list_public_params.py +21 -0
- runloop_api_client/types/blueprint_list_view.py +19 -0
- runloop_api_client/types/blueprint_preview_params.py +121 -0
- runloop_api_client/types/blueprint_preview_view.py +10 -0
- runloop_api_client/types/blueprint_view.py +93 -0
- runloop_api_client/types/devbox_async_execution_detail_view.py +46 -0
- runloop_api_client/types/devbox_create_params.py +124 -0
- runloop_api_client/types/devbox_create_ssh_key_response.py +19 -0
- runloop_api_client/types/devbox_create_tunnel_params.py +12 -0
- runloop_api_client/types/devbox_download_file_params.py +15 -0
- runloop_api_client/types/devbox_enable_tunnel_params.py +13 -0
- runloop_api_client/types/devbox_execute_async_params.py +33 -0
- runloop_api_client/types/devbox_execute_params.py +37 -0
- runloop_api_client/types/devbox_execute_sync_params.py +31 -0
- runloop_api_client/types/devbox_execution_detail_view.py +24 -0
- runloop_api_client/types/devbox_list_disk_snapshots_params.py +32 -0
- runloop_api_client/types/devbox_list_params.py +20 -0
- runloop_api_client/types/devbox_list_view.py +19 -0
- runloop_api_client/types/devbox_read_file_contents_params.py +15 -0
- runloop_api_client/types/devbox_read_file_contents_response.py +7 -0
- runloop_api_client/types/devbox_remove_tunnel_params.py +12 -0
- runloop_api_client/types/devbox_send_std_in_result.py +16 -0
- runloop_api_client/types/devbox_snapshot_disk_async_params.py +19 -0
- runloop_api_client/types/devbox_snapshot_disk_params.py +19 -0
- runloop_api_client/types/devbox_snapshot_list_view.py +19 -0
- runloop_api_client/types/devbox_snapshot_view.py +30 -0
- runloop_api_client/types/devbox_tunnel_view.py +16 -0
- runloop_api_client/types/devbox_update_params.py +16 -0
- runloop_api_client/types/devbox_upload_file_params.py +19 -0
- runloop_api_client/types/devbox_view.py +121 -0
- runloop_api_client/types/devbox_wait_for_command_params.py +28 -0
- runloop_api_client/types/devbox_write_file_contents_params.py +18 -0
- runloop_api_client/types/devboxes/__init__.py +33 -0
- runloop_api_client/types/devboxes/browser_create_params.py +13 -0
- runloop_api_client/types/devboxes/browser_view.py +29 -0
- runloop_api_client/types/devboxes/computer_create_params.py +26 -0
- runloop_api_client/types/devboxes/computer_keyboard_interaction_params.py +16 -0
- runloop_api_client/types/devboxes/computer_keyboard_interaction_response.py +15 -0
- runloop_api_client/types/devboxes/computer_mouse_interaction_params.py +35 -0
- runloop_api_client/types/devboxes/computer_mouse_interaction_response.py +15 -0
- runloop_api_client/types/devboxes/computer_screen_interaction_params.py +12 -0
- runloop_api_client/types/devboxes/computer_screen_interaction_response.py +15 -0
- runloop_api_client/types/devboxes/computer_view.py +23 -0
- runloop_api_client/types/devboxes/devbox_logs_list_view.py +39 -0
- runloop_api_client/types/devboxes/devbox_snapshot_async_status_view.py +20 -0
- runloop_api_client/types/devboxes/disk_snapshot_list_params.py +32 -0
- runloop_api_client/types/devboxes/disk_snapshot_update_params.py +19 -0
- runloop_api_client/types/devboxes/execution_execute_async_params.py +31 -0
- runloop_api_client/types/devboxes/execution_execute_sync_params.py +31 -0
- runloop_api_client/types/devboxes/execution_kill_params.py +18 -0
- runloop_api_client/types/devboxes/execution_retrieve_params.py +14 -0
- runloop_api_client/types/devboxes/execution_send_std_in_params.py +18 -0
- runloop_api_client/types/devboxes/execution_stream_stderr_updates_params.py +17 -0
- runloop_api_client/types/devboxes/execution_stream_stdout_updates_params.py +17 -0
- runloop_api_client/types/devboxes/execution_update_chunk.py +15 -0
- runloop_api_client/types/devboxes/log_list_params.py +15 -0
- runloop_api_client/types/gateway_config_create_params.py +41 -0
- runloop_api_client/types/gateway_config_list_params.py +21 -0
- runloop_api_client/types/gateway_config_list_view.py +21 -0
- runloop_api_client/types/gateway_config_update_params.py +32 -0
- runloop_api_client/types/gateway_config_view.py +47 -0
- runloop_api_client/types/input_context.py +19 -0
- runloop_api_client/types/input_context_param.py +20 -0
- runloop_api_client/types/input_context_update_param.py +16 -0
- runloop_api_client/types/inspection_source_param.py +18 -0
- runloop_api_client/types/network_policy_create_params.py +40 -0
- runloop_api_client/types/network_policy_list_params.py +21 -0
- runloop_api_client/types/network_policy_list_view.py +21 -0
- runloop_api_client/types/network_policy_update_params.py +30 -0
- runloop_api_client/types/network_policy_view.py +52 -0
- runloop_api_client/types/object_create_params.py +30 -0
- runloop_api_client/types/object_download_params.py +12 -0
- runloop_api_client/types/object_download_url_view.py +12 -0
- runloop_api_client/types/object_list_params.py +27 -0
- runloop_api_client/types/object_list_public_params.py +27 -0
- runloop_api_client/types/object_list_view.py +24 -0
- runloop_api_client/types/object_view.py +36 -0
- runloop_api_client/types/repository_connection_list_view.py +19 -0
- runloop_api_client/types/repository_connection_view.py +18 -0
- runloop_api_client/types/repository_create_params.py +22 -0
- runloop_api_client/types/repository_inspect_params.py +13 -0
- runloop_api_client/types/repository_inspection_details.py +83 -0
- runloop_api_client/types/repository_inspection_list_view.py +13 -0
- runloop_api_client/types/repository_list_params.py +21 -0
- runloop_api_client/types/repository_manifest_view.py +174 -0
- runloop_api_client/types/repository_refresh_params.py +16 -0
- runloop_api_client/types/scenario_create_params.py +53 -0
- runloop_api_client/types/scenario_definition_list_view.py +19 -0
- runloop_api_client/types/scenario_environment.py +29 -0
- runloop_api_client/types/scenario_environment_param.py +31 -0
- runloop_api_client/types/scenario_list_params.py +24 -0
- runloop_api_client/types/scenario_list_public_params.py +18 -0
- runloop_api_client/types/scenario_run_list_view.py +19 -0
- runloop_api_client/types/scenario_run_view.py +55 -0
- runloop_api_client/types/scenario_start_run_params.py +30 -0
- runloop_api_client/types/scenario_update_params.py +49 -0
- runloop_api_client/types/scenario_view.py +61 -0
- runloop_api_client/types/scenarios/__init__.py +14 -0
- runloop_api_client/types/scenarios/run_list_params.py +27 -0
- runloop_api_client/types/scenarios/scorer_create_params.py +18 -0
- runloop_api_client/types/scenarios/scorer_create_response.py +18 -0
- runloop_api_client/types/scenarios/scorer_list_params.py +15 -0
- runloop_api_client/types/scenarios/scorer_list_response.py +18 -0
- runloop_api_client/types/scenarios/scorer_retrieve_response.py +18 -0
- runloop_api_client/types/scenarios/scorer_update_params.py +18 -0
- runloop_api_client/types/scenarios/scorer_update_response.py +18 -0
- runloop_api_client/types/scenarios/scorer_validate_params.py +17 -0
- runloop_api_client/types/scenarios/scorer_validate_response.py +23 -0
- runloop_api_client/types/scoring_contract.py +17 -0
- runloop_api_client/types/scoring_contract_param.py +19 -0
- runloop_api_client/types/scoring_contract_result_view.py +20 -0
- runloop_api_client/types/scoring_contract_update_param.py +15 -0
- runloop_api_client/types/scoring_function.py +157 -0
- runloop_api_client/types/scoring_function_param.py +153 -0
- runloop_api_client/types/scoring_function_result_view.py +25 -0
- runloop_api_client/types/secret_create_params.py +23 -0
- runloop_api_client/types/secret_list_params.py +12 -0
- runloop_api_client/types/secret_list_view.py +24 -0
- runloop_api_client/types/secret_update_params.py +16 -0
- runloop_api_client/types/secret_view.py +26 -0
- runloop_api_client/types/shared/__init__.py +10 -0
- runloop_api_client/types/shared/after_idle.py +15 -0
- runloop_api_client/types/shared/agent_mount.py +31 -0
- runloop_api_client/types/shared/agent_source.py +75 -0
- runloop_api_client/types/shared/code_mount_parameters.py +24 -0
- runloop_api_client/types/shared/launch_parameters.py +86 -0
- runloop_api_client/types/shared/mount.py +43 -0
- runloop_api_client/types/shared/object_mount.py +21 -0
- runloop_api_client/types/shared/run_profile.py +37 -0
- runloop_api_client/types/shared_params/__init__.py +10 -0
- runloop_api_client/types/shared_params/after_idle.py +15 -0
- runloop_api_client/types/shared_params/agent_mount.py +31 -0
- runloop_api_client/types/shared_params/agent_source.py +78 -0
- runloop_api_client/types/shared_params/code_mount_parameters.py +25 -0
- runloop_api_client/types/shared_params/launch_parameters.py +88 -0
- runloop_api_client/types/shared_params/mount.py +43 -0
- runloop_api_client/types/shared_params/object_mount.py +21 -0
- runloop_api_client/types/shared_params/run_profile.py +38 -0
- runloop_api_client/types/tunnel_view.py +34 -0
- runloop_api_client-1.5.1.dist-info/METADATA +522 -0
- runloop_api_client-1.5.1.dist-info/RECORD +261 -0
- runloop_api_client-1.5.1.dist-info/WHEEL +4 -0
- runloop_api_client-1.5.1.dist-info/licenses/LICENSE +7 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Agent resource class for asynchronous operations."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing_extensions import Unpack, override
|
|
7
|
+
|
|
8
|
+
from ._types import (
|
|
9
|
+
BaseRequestOptions,
|
|
10
|
+
)
|
|
11
|
+
from .._client import AsyncRunloop
|
|
12
|
+
from ..types.agent_view import AgentView
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class AsyncAgent:
|
|
16
|
+
"""Async wrapper around agent operations.
|
|
17
|
+
|
|
18
|
+
This class provides an asynchronous interface for interacting with agents,
|
|
19
|
+
including retrieving agent information.
|
|
20
|
+
|
|
21
|
+
Example:
|
|
22
|
+
>>> agent = await runloop.agent.create_from_npm(name="my-agent", package_name="@runloop/example-agent")
|
|
23
|
+
>>> info = await agent.get_info()
|
|
24
|
+
>>> print(info.name)
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(
|
|
28
|
+
self,
|
|
29
|
+
client: AsyncRunloop,
|
|
30
|
+
agent_id: str,
|
|
31
|
+
agent_view: Optional[AgentView] = None,
|
|
32
|
+
) -> None:
|
|
33
|
+
"""Initialize the wrapper.
|
|
34
|
+
|
|
35
|
+
:param client: Generated AsyncRunloop client
|
|
36
|
+
:type client: AsyncRunloop
|
|
37
|
+
:param agent_id: Agent identifier returned by the API
|
|
38
|
+
:type agent_id: str
|
|
39
|
+
"""
|
|
40
|
+
self._client = client
|
|
41
|
+
self._id = agent_id
|
|
42
|
+
self._agent_view = agent_view
|
|
43
|
+
|
|
44
|
+
@override
|
|
45
|
+
def __repr__(self) -> str:
|
|
46
|
+
return f"<AsyncAgent id={self._id!r}>"
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def id(self) -> str:
|
|
50
|
+
"""Return the agent identifier.
|
|
51
|
+
|
|
52
|
+
:return: Unique agent ID
|
|
53
|
+
:rtype: str
|
|
54
|
+
"""
|
|
55
|
+
return self._id
|
|
56
|
+
|
|
57
|
+
async def get_info(
|
|
58
|
+
self,
|
|
59
|
+
**options: Unpack[BaseRequestOptions],
|
|
60
|
+
) -> AgentView:
|
|
61
|
+
"""Retrieve the latest agent information.
|
|
62
|
+
|
|
63
|
+
:param options: Optional request configuration
|
|
64
|
+
:return: Agent details
|
|
65
|
+
:rtype: AgentView
|
|
66
|
+
"""
|
|
67
|
+
return await self._client.agents.retrieve(
|
|
68
|
+
self._id,
|
|
69
|
+
**options,
|
|
70
|
+
)
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"""AsyncBenchmark resource class for asynchronous operations."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import List
|
|
6
|
+
from typing_extensions import Unpack, override
|
|
7
|
+
|
|
8
|
+
from ..types import BenchmarkView
|
|
9
|
+
from ._types import (
|
|
10
|
+
BaseRequestOptions,
|
|
11
|
+
LongRequestOptions,
|
|
12
|
+
SDKBenchmarkUpdateParams,
|
|
13
|
+
SDKBenchmarkListRunsParams,
|
|
14
|
+
SDKBenchmarkStartRunParams,
|
|
15
|
+
)
|
|
16
|
+
from .._types import SequenceNotStr
|
|
17
|
+
from .._client import AsyncRunloop
|
|
18
|
+
from .async_benchmark_run import AsyncBenchmarkRun
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AsyncBenchmark:
|
|
22
|
+
"""A benchmark for evaluating agent performance across scenarios (async).
|
|
23
|
+
|
|
24
|
+
Provides async methods for retrieving benchmark details, updating the benchmark,
|
|
25
|
+
managing scenarios, and starting benchmark runs. Obtain instances via
|
|
26
|
+
``runloop.benchmark.from_id()`` or ``runloop.benchmark.list()``.
|
|
27
|
+
|
|
28
|
+
Example:
|
|
29
|
+
>>> benchmark = runloop.benchmark.from_id("bmd_xxx")
|
|
30
|
+
>>> info = await benchmark.get_info()
|
|
31
|
+
>>> run = await benchmark.start_run(run_name="evaluation-v1")
|
|
32
|
+
>>> for scenario_id in info.scenario_ids:
|
|
33
|
+
... scenario = await runloop.scenario.from_id(scenario_id)
|
|
34
|
+
... scenario_run = await scenario.run(benchmark_run_id=run.id, run_name="evaluation-v1")
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def __init__(self, client: AsyncRunloop, benchmark_id: str) -> None:
|
|
38
|
+
"""Create an AsyncBenchmark instance.
|
|
39
|
+
|
|
40
|
+
:param client: AsyncRunloop client instance
|
|
41
|
+
:type client: AsyncRunloop
|
|
42
|
+
:param benchmark_id: Benchmark ID
|
|
43
|
+
:type benchmark_id: str
|
|
44
|
+
"""
|
|
45
|
+
self._client = client
|
|
46
|
+
self._id = benchmark_id
|
|
47
|
+
|
|
48
|
+
@override
|
|
49
|
+
def __repr__(self) -> str:
|
|
50
|
+
return f"<AsyncBenchmark id={self._id!r}>"
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def id(self) -> str:
|
|
54
|
+
"""Return the benchmark ID.
|
|
55
|
+
|
|
56
|
+
:return: Unique benchmark ID
|
|
57
|
+
:rtype: str
|
|
58
|
+
"""
|
|
59
|
+
return self._id
|
|
60
|
+
|
|
61
|
+
async def get_info(
|
|
62
|
+
self,
|
|
63
|
+
**options: Unpack[BaseRequestOptions],
|
|
64
|
+
) -> BenchmarkView:
|
|
65
|
+
"""Retrieve current benchmark details.
|
|
66
|
+
|
|
67
|
+
:param options: See :typeddict:`~runloop_api_client.sdk._types.BaseRequestOptions` for available options
|
|
68
|
+
:return: Current benchmark info
|
|
69
|
+
:rtype: BenchmarkView
|
|
70
|
+
"""
|
|
71
|
+
return await self._client.benchmarks.retrieve(
|
|
72
|
+
self._id,
|
|
73
|
+
**options,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
async def update(
|
|
77
|
+
self,
|
|
78
|
+
**params: Unpack[SDKBenchmarkUpdateParams],
|
|
79
|
+
) -> BenchmarkView:
|
|
80
|
+
"""Update the benchmark.
|
|
81
|
+
|
|
82
|
+
Only provided fields will be updated.
|
|
83
|
+
|
|
84
|
+
:param params: See :typeddict:`~runloop_api_client.sdk._types.SDKBenchmarkUpdateParams` for available parameters
|
|
85
|
+
:return: Updated benchmark info
|
|
86
|
+
:rtype: BenchmarkView
|
|
87
|
+
"""
|
|
88
|
+
return await self._client.benchmarks.update(
|
|
89
|
+
self._id,
|
|
90
|
+
**params,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
async def start_run(
|
|
94
|
+
self,
|
|
95
|
+
**params: Unpack[SDKBenchmarkStartRunParams],
|
|
96
|
+
) -> AsyncBenchmarkRun:
|
|
97
|
+
"""Start a new benchmark run.
|
|
98
|
+
|
|
99
|
+
Creates a new benchmark run and returns an AsyncBenchmarkRun instance for
|
|
100
|
+
managing the run lifecycle.
|
|
101
|
+
|
|
102
|
+
:param params: See :typeddict:`~runloop_api_client.sdk._types.SDKBenchmarkStartRunParams` for available parameters
|
|
103
|
+
:return: AsyncBenchmarkRun instance for managing the run
|
|
104
|
+
:rtype: AsyncBenchmarkRun
|
|
105
|
+
"""
|
|
106
|
+
run_view = await self._client.benchmarks.start_run(
|
|
107
|
+
benchmark_id=self._id,
|
|
108
|
+
**params,
|
|
109
|
+
)
|
|
110
|
+
assert run_view.benchmark_id is not None, "benchmark_id should be set for runs created from a benchmark"
|
|
111
|
+
return AsyncBenchmarkRun(self._client, run_view.id, run_view.benchmark_id)
|
|
112
|
+
|
|
113
|
+
async def add_scenarios(
|
|
114
|
+
self,
|
|
115
|
+
scenario_ids: SequenceNotStr[str],
|
|
116
|
+
**options: Unpack[LongRequestOptions],
|
|
117
|
+
) -> BenchmarkView:
|
|
118
|
+
"""Add scenarios to the benchmark.
|
|
119
|
+
|
|
120
|
+
:param scenario_ids: List of scenario IDs to add
|
|
121
|
+
:type scenario_ids: SequenceNotStr[str]
|
|
122
|
+
:param options: See :typeddict:`~runloop_api_client.sdk._types.LongRequestOptions` for available options
|
|
123
|
+
:return: Updated benchmark info
|
|
124
|
+
:rtype: BenchmarkView
|
|
125
|
+
"""
|
|
126
|
+
return await self._client.benchmarks.update_scenarios(
|
|
127
|
+
self._id,
|
|
128
|
+
scenarios_to_add=scenario_ids,
|
|
129
|
+
**options,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
async def remove_scenarios(
|
|
133
|
+
self,
|
|
134
|
+
scenario_ids: SequenceNotStr[str],
|
|
135
|
+
**options: Unpack[LongRequestOptions],
|
|
136
|
+
) -> BenchmarkView:
|
|
137
|
+
"""Remove scenarios from the benchmark.
|
|
138
|
+
|
|
139
|
+
:param scenario_ids: List of scenario IDs to remove
|
|
140
|
+
:type scenario_ids: SequenceNotStr[str]
|
|
141
|
+
:param options: See :typeddict:`~runloop_api_client.sdk._types.LongRequestOptions` for available options
|
|
142
|
+
:return: Updated benchmark info
|
|
143
|
+
:rtype: BenchmarkView
|
|
144
|
+
"""
|
|
145
|
+
return await self._client.benchmarks.update_scenarios(
|
|
146
|
+
self._id,
|
|
147
|
+
scenarios_to_remove=scenario_ids,
|
|
148
|
+
**options,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
async def list_runs(
|
|
152
|
+
self,
|
|
153
|
+
**params: Unpack[SDKBenchmarkListRunsParams],
|
|
154
|
+
) -> List[AsyncBenchmarkRun]:
|
|
155
|
+
"""List all runs for this benchmark.
|
|
156
|
+
|
|
157
|
+
:param params: See :typeddict:`~runloop_api_client.sdk._types.SDKBenchmarkListRunsParams` for available parameters
|
|
158
|
+
:return: List of async benchmark runs
|
|
159
|
+
:rtype: List[AsyncBenchmarkRun]
|
|
160
|
+
"""
|
|
161
|
+
page = await self._client.benchmark_runs.list(
|
|
162
|
+
benchmark_id=self._id,
|
|
163
|
+
**params,
|
|
164
|
+
)
|
|
165
|
+
return [
|
|
166
|
+
AsyncBenchmarkRun(self._client, run.id, run.benchmark_id)
|
|
167
|
+
for run in page.runs
|
|
168
|
+
if run.benchmark_id is not None
|
|
169
|
+
]
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""AsyncBenchmarkRun resource class for asynchronous operations."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import List
|
|
6
|
+
from typing_extensions import Unpack, override
|
|
7
|
+
|
|
8
|
+
from ..types import BenchmarkRunView
|
|
9
|
+
from ._types import BaseRequestOptions, LongRequestOptions, SDKBenchmarkRunListScenarioRunsParams
|
|
10
|
+
from .._client import AsyncRunloop
|
|
11
|
+
from .async_scenario_run import AsyncScenarioRun
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class AsyncBenchmarkRun:
|
|
15
|
+
"""A benchmark run for evaluating agent performance across scenarios (async).
|
|
16
|
+
|
|
17
|
+
Provides async methods for monitoring run status, managing the run lifecycle,
|
|
18
|
+
and accessing scenario run results. Obtain instances via
|
|
19
|
+
``benchmark.start_run()`` or ``benchmark.list_runs()``.
|
|
20
|
+
|
|
21
|
+
Example:
|
|
22
|
+
>>> benchmark = runloop.benchmark.from_id("bench-xxx")
|
|
23
|
+
>>> run = await benchmark.start_run(run_name="evaluation-v1")
|
|
24
|
+
>>> info = await run.get_info()
|
|
25
|
+
>>> scenario_runs = await run.list_scenario_runs()
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def __init__(self, client: AsyncRunloop, run_id: str, benchmark_id: str) -> None:
|
|
29
|
+
"""Create an AsyncBenchmarkRun instance.
|
|
30
|
+
|
|
31
|
+
:param client: AsyncRunloop client instance
|
|
32
|
+
:type client: AsyncRunloop
|
|
33
|
+
:param run_id: Benchmark run ID
|
|
34
|
+
:type run_id: str
|
|
35
|
+
:param benchmark_id: Parent benchmark ID
|
|
36
|
+
:type benchmark_id: str
|
|
37
|
+
"""
|
|
38
|
+
self._client = client
|
|
39
|
+
self._id = run_id
|
|
40
|
+
self._benchmark_id = benchmark_id
|
|
41
|
+
|
|
42
|
+
@override
|
|
43
|
+
def __repr__(self) -> str:
|
|
44
|
+
return f"<AsyncBenchmarkRun id={self._id!r}>"
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def id(self) -> str:
|
|
48
|
+
"""Return the benchmark run ID.
|
|
49
|
+
|
|
50
|
+
:return: Unique benchmark run ID
|
|
51
|
+
:rtype: str
|
|
52
|
+
"""
|
|
53
|
+
return self._id
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def benchmark_id(self) -> str:
|
|
57
|
+
"""Return the parent benchmark ID.
|
|
58
|
+
|
|
59
|
+
:return: Parent benchmark ID
|
|
60
|
+
:rtype: str
|
|
61
|
+
"""
|
|
62
|
+
return self._benchmark_id
|
|
63
|
+
|
|
64
|
+
async def get_info(
|
|
65
|
+
self,
|
|
66
|
+
**options: Unpack[BaseRequestOptions],
|
|
67
|
+
) -> BenchmarkRunView:
|
|
68
|
+
"""Retrieve current benchmark run status and metadata.
|
|
69
|
+
|
|
70
|
+
:param options: See :typeddict:`~runloop_api_client.sdk._types.BaseRequestOptions` for available options
|
|
71
|
+
:return: Current benchmark run state info
|
|
72
|
+
:rtype: BenchmarkRunView
|
|
73
|
+
"""
|
|
74
|
+
return await self._client.benchmark_runs.retrieve(
|
|
75
|
+
self._id,
|
|
76
|
+
**options,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
async def cancel(
|
|
80
|
+
self,
|
|
81
|
+
**options: Unpack[LongRequestOptions],
|
|
82
|
+
) -> BenchmarkRunView:
|
|
83
|
+
"""Cancel the benchmark run.
|
|
84
|
+
|
|
85
|
+
Stops all running scenarios and marks the run as canceled.
|
|
86
|
+
|
|
87
|
+
:param options: See :typeddict:`~runloop_api_client.sdk._types.LongRequestOptions` for available options
|
|
88
|
+
:return: Updated benchmark run state
|
|
89
|
+
:rtype: BenchmarkRunView
|
|
90
|
+
"""
|
|
91
|
+
return await self._client.benchmark_runs.cancel(
|
|
92
|
+
self._id,
|
|
93
|
+
**options,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
async def complete(
|
|
97
|
+
self,
|
|
98
|
+
**options: Unpack[LongRequestOptions],
|
|
99
|
+
) -> BenchmarkRunView:
|
|
100
|
+
"""Complete the benchmark run.
|
|
101
|
+
|
|
102
|
+
Marks the run as completed. Call this after all scenarios have finished.
|
|
103
|
+
|
|
104
|
+
:param options: See :typeddict:`~runloop_api_client.sdk._types.LongRequestOptions` for available options
|
|
105
|
+
:return: Completed benchmark run state
|
|
106
|
+
:rtype: BenchmarkRunView
|
|
107
|
+
"""
|
|
108
|
+
return await self._client.benchmark_runs.complete(
|
|
109
|
+
self._id,
|
|
110
|
+
**options,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
async def list_scenario_runs(
|
|
114
|
+
self,
|
|
115
|
+
**params: Unpack[SDKBenchmarkRunListScenarioRunsParams],
|
|
116
|
+
) -> List[AsyncScenarioRun]:
|
|
117
|
+
"""List all scenario runs for this benchmark run.
|
|
118
|
+
|
|
119
|
+
:param params: See :typeddict:`~runloop_api_client.sdk._types.SDKBenchmarkRunListScenarioRunsParams` for available parameters
|
|
120
|
+
:return: List of async scenario run objects
|
|
121
|
+
:rtype: List[AsyncScenarioRun]
|
|
122
|
+
"""
|
|
123
|
+
page = await self._client.benchmark_runs.list_scenario_runs(
|
|
124
|
+
self._id,
|
|
125
|
+
**params,
|
|
126
|
+
)
|
|
127
|
+
return [AsyncScenarioRun(self._client, run.id, run.devbox_id) for run in page.runs]
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""Blueprint resource class for asynchronous operations."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Unpack, override
|
|
6
|
+
|
|
7
|
+
from ..types import BlueprintView
|
|
8
|
+
from ._types import BaseRequestOptions, LongRequestOptions, SDKDevboxCreateFromImageParams
|
|
9
|
+
from .._client import AsyncRunloop
|
|
10
|
+
from .async_devbox import AsyncDevbox
|
|
11
|
+
from ..types.blueprint_build_logs_list_view import BlueprintBuildLogsListView
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class AsyncBlueprint:
|
|
15
|
+
"""Asynchronous wrapper around a blueprint resource."""
|
|
16
|
+
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
client: AsyncRunloop,
|
|
20
|
+
blueprint_id: str,
|
|
21
|
+
) -> None:
|
|
22
|
+
"""Initialize the wrapper.
|
|
23
|
+
|
|
24
|
+
:param client: Generated AsyncRunloop client
|
|
25
|
+
:type client: AsyncRunloop
|
|
26
|
+
:param blueprint_id: Blueprint ID returned by the API
|
|
27
|
+
:type blueprint_id: str
|
|
28
|
+
"""
|
|
29
|
+
self._client = client
|
|
30
|
+
self._id = blueprint_id
|
|
31
|
+
|
|
32
|
+
@override
|
|
33
|
+
def __repr__(self) -> str:
|
|
34
|
+
return f"<AsyncBlueprint id={self._id!r}>"
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def id(self) -> str:
|
|
38
|
+
"""Return the blueprint ID.
|
|
39
|
+
|
|
40
|
+
:return: Unique blueprint ID
|
|
41
|
+
:rtype: str
|
|
42
|
+
"""
|
|
43
|
+
return self._id
|
|
44
|
+
|
|
45
|
+
async def get_info(
|
|
46
|
+
self,
|
|
47
|
+
**options: Unpack[BaseRequestOptions],
|
|
48
|
+
) -> BlueprintView:
|
|
49
|
+
"""Retrieve the latest blueprint details.
|
|
50
|
+
|
|
51
|
+
:param options: Optional request configuration
|
|
52
|
+
:return: API response describing the blueprint
|
|
53
|
+
:rtype: BlueprintView
|
|
54
|
+
"""
|
|
55
|
+
return await self._client.blueprints.retrieve(
|
|
56
|
+
self._id,
|
|
57
|
+
**options,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
async def logs(
|
|
61
|
+
self,
|
|
62
|
+
**options: Unpack[BaseRequestOptions],
|
|
63
|
+
) -> BlueprintBuildLogsListView:
|
|
64
|
+
"""Retrieve build logs for the blueprint.
|
|
65
|
+
|
|
66
|
+
:param options: Optional request configuration
|
|
67
|
+
:return: Log entries for the most recent build
|
|
68
|
+
:rtype: BlueprintBuildLogsListView
|
|
69
|
+
"""
|
|
70
|
+
return await self._client.blueprints.logs(
|
|
71
|
+
self._id,
|
|
72
|
+
**options,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
async def delete(
|
|
76
|
+
self,
|
|
77
|
+
**options: Unpack[LongRequestOptions],
|
|
78
|
+
) -> object:
|
|
79
|
+
"""Delete the blueprint.
|
|
80
|
+
|
|
81
|
+
:param options: Optional long-running request configuration
|
|
82
|
+
:return: API response acknowledging deletion
|
|
83
|
+
:rtype: object
|
|
84
|
+
"""
|
|
85
|
+
return await self._client.blueprints.delete(
|
|
86
|
+
self._id,
|
|
87
|
+
**options,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
async def create_devbox(
|
|
91
|
+
self,
|
|
92
|
+
**params: Unpack[SDKDevboxCreateFromImageParams],
|
|
93
|
+
) -> "AsyncDevbox":
|
|
94
|
+
"""Create a devbox derived from the blueprint.
|
|
95
|
+
|
|
96
|
+
:param params: See :typeddict:`~runloop_api_client.sdk._types.SDKDevboxCreateFromImageParams` for available parameters
|
|
97
|
+
:return: Wrapper bound to the running devbox
|
|
98
|
+
:rtype: AsyncDevbox
|
|
99
|
+
"""
|
|
100
|
+
devbox_view = await self._client.devboxes.create_and_await_running(
|
|
101
|
+
blueprint_id=self._id,
|
|
102
|
+
**params,
|
|
103
|
+
)
|
|
104
|
+
return AsyncDevbox(self._client, devbox_view.id)
|