plato-sdk-v2 2.0.50__py3-none-any.whl → 2.2.4__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 (158) hide show
  1. plato/__init__.py +7 -6
  2. plato/_generated/__init__.py +1 -1
  3. plato/_generated/api/v1/env/evaluate_session.py +3 -3
  4. plato/_generated/api/v1/env/log_state_mutation.py +4 -4
  5. plato/_generated/api/v1/sandbox/checkpoint_vm.py +3 -3
  6. plato/_generated/api/v1/sandbox/save_vm_snapshot.py +3 -3
  7. plato/_generated/api/v1/sandbox/setup_sandbox.py +8 -8
  8. plato/_generated/api/v1/session/__init__.py +2 -0
  9. plato/_generated/api/v1/session/get_sessions_for_archival.py +100 -0
  10. plato/_generated/api/v1/testcases/__init__.py +6 -2
  11. plato/_generated/api/v1/testcases/get_mutation_groups_for_testcase.py +98 -0
  12. plato/_generated/api/v1/testcases/{get_next_output_testcase_for_scoring.py → get_next_testcase_for_scoring.py} +23 -10
  13. plato/_generated/api/v1/testcases/get_testcase_metadata_for_scoring.py +74 -0
  14. plato/_generated/api/v2/__init__.py +2 -1
  15. plato/_generated/api/v2/jobs/__init__.py +4 -0
  16. plato/_generated/api/v2/jobs/checkpoint.py +3 -3
  17. plato/_generated/api/v2/jobs/disk_snapshot.py +3 -3
  18. plato/_generated/api/v2/jobs/log_for_job.py +4 -39
  19. plato/_generated/api/v2/jobs/make.py +4 -4
  20. plato/_generated/api/v2/jobs/setup_sandbox.py +97 -0
  21. plato/_generated/api/v2/jobs/snapshot.py +3 -3
  22. plato/_generated/api/v2/jobs/snapshot_store.py +91 -0
  23. plato/_generated/api/v2/sessions/__init__.py +4 -0
  24. plato/_generated/api/v2/sessions/checkpoint.py +3 -3
  25. plato/_generated/api/v2/sessions/disk_snapshot.py +3 -3
  26. plato/_generated/api/v2/sessions/evaluate.py +3 -3
  27. plato/_generated/api/v2/sessions/log_job_mutation.py +4 -39
  28. plato/_generated/api/v2/sessions/make.py +4 -4
  29. plato/_generated/api/v2/sessions/setup_sandbox.py +98 -0
  30. plato/_generated/api/v2/sessions/snapshot.py +3 -3
  31. plato/_generated/api/v2/sessions/snapshot_store.py +94 -0
  32. plato/_generated/api/v2/user/__init__.py +7 -0
  33. plato/_generated/api/v2/user/get_current_user.py +76 -0
  34. plato/_generated/models/__init__.py +174 -23
  35. plato/_sims_generator/__init__.py +19 -4
  36. plato/_sims_generator/instruction.py +203 -0
  37. plato/_sims_generator/templates/instruction/helpers.py.jinja +161 -0
  38. plato/_sims_generator/templates/instruction/init.py.jinja +43 -0
  39. plato/agents/__init__.py +107 -517
  40. plato/agents/base.py +145 -0
  41. plato/agents/build.py +61 -0
  42. plato/agents/config.py +160 -0
  43. plato/agents/logging.py +401 -0
  44. plato/agents/runner.py +161 -0
  45. plato/agents/trajectory.py +266 -0
  46. plato/chronos/__init__.py +37 -0
  47. plato/chronos/api/__init__.py +3 -0
  48. plato/chronos/api/agents/__init__.py +13 -0
  49. plato/chronos/api/agents/create_agent.py +63 -0
  50. plato/chronos/api/agents/delete_agent.py +61 -0
  51. plato/chronos/api/agents/get_agent.py +62 -0
  52. plato/chronos/api/agents/get_agent_schema.py +72 -0
  53. plato/chronos/api/agents/get_agent_versions.py +62 -0
  54. plato/chronos/api/agents/list_agents.py +57 -0
  55. plato/chronos/api/agents/lookup_agent.py +74 -0
  56. plato/chronos/api/auth/__init__.py +9 -0
  57. plato/chronos/api/auth/debug_auth_api_auth_debug_get.py +43 -0
  58. plato/chronos/api/auth/get_auth_status_api_auth_status_get.py +61 -0
  59. plato/chronos/api/auth/get_current_user_route_api_auth_me_get.py +60 -0
  60. plato/chronos/api/callback/__init__.py +11 -0
  61. plato/chronos/api/callback/push_agent_logs.py +61 -0
  62. plato/chronos/api/callback/update_agent_status.py +57 -0
  63. plato/chronos/api/callback/upload_artifacts.py +59 -0
  64. plato/chronos/api/callback/upload_logs_zip.py +57 -0
  65. plato/chronos/api/callback/upload_trajectory.py +57 -0
  66. plato/chronos/api/default/__init__.py +7 -0
  67. plato/chronos/api/default/health.py +43 -0
  68. plato/chronos/api/jobs/__init__.py +7 -0
  69. plato/chronos/api/jobs/launch_job.py +63 -0
  70. plato/chronos/api/registry/__init__.py +19 -0
  71. plato/chronos/api/registry/get_agent_schema_api_registry_agents__agent_name__schema_get.py +62 -0
  72. plato/chronos/api/registry/get_agent_versions_api_registry_agents__agent_name__versions_get.py +52 -0
  73. plato/chronos/api/registry/get_world_schema_api_registry_worlds__package_name__schema_get.py +68 -0
  74. plato/chronos/api/registry/get_world_versions_api_registry_worlds__package_name__versions_get.py +52 -0
  75. plato/chronos/api/registry/list_registry_agents_api_registry_agents_get.py +44 -0
  76. plato/chronos/api/registry/list_registry_worlds_api_registry_worlds_get.py +44 -0
  77. plato/chronos/api/runtimes/__init__.py +11 -0
  78. plato/chronos/api/runtimes/create_runtime.py +63 -0
  79. plato/chronos/api/runtimes/delete_runtime.py +61 -0
  80. plato/chronos/api/runtimes/get_runtime.py +62 -0
  81. plato/chronos/api/runtimes/list_runtimes.py +57 -0
  82. plato/chronos/api/runtimes/test_runtime.py +67 -0
  83. plato/chronos/api/secrets/__init__.py +11 -0
  84. plato/chronos/api/secrets/create_secret.py +63 -0
  85. plato/chronos/api/secrets/delete_secret.py +61 -0
  86. plato/chronos/api/secrets/get_secret.py +62 -0
  87. plato/chronos/api/secrets/list_secrets.py +57 -0
  88. plato/chronos/api/secrets/update_secret.py +68 -0
  89. plato/chronos/api/sessions/__init__.py +10 -0
  90. plato/chronos/api/sessions/get_session.py +62 -0
  91. plato/chronos/api/sessions/get_session_logs.py +72 -0
  92. plato/chronos/api/sessions/get_session_logs_download.py +62 -0
  93. plato/chronos/api/sessions/list_sessions.py +57 -0
  94. plato/chronos/api/status/__init__.py +8 -0
  95. plato/chronos/api/status/get_status_api_status_get.py +44 -0
  96. plato/chronos/api/status/get_version_info_api_version_get.py +44 -0
  97. plato/chronos/api/templates/__init__.py +11 -0
  98. plato/chronos/api/templates/create_template.py +63 -0
  99. plato/chronos/api/templates/delete_template.py +61 -0
  100. plato/chronos/api/templates/get_template.py +62 -0
  101. plato/chronos/api/templates/list_templates.py +57 -0
  102. plato/chronos/api/templates/update_template.py +68 -0
  103. plato/chronos/api/trajectories/__init__.py +8 -0
  104. plato/chronos/api/trajectories/get_trajectory.py +62 -0
  105. plato/chronos/api/trajectories/list_trajectories.py +62 -0
  106. plato/chronos/api/worlds/__init__.py +10 -0
  107. plato/chronos/api/worlds/create_world.py +63 -0
  108. plato/chronos/api/worlds/delete_world.py +61 -0
  109. plato/chronos/api/worlds/get_world.py +62 -0
  110. plato/chronos/api/worlds/list_worlds.py +57 -0
  111. plato/chronos/client.py +171 -0
  112. plato/chronos/errors.py +141 -0
  113. plato/chronos/models/__init__.py +647 -0
  114. plato/chronos/py.typed +0 -0
  115. plato/sims/cli.py +299 -123
  116. plato/sims/registry.py +77 -4
  117. plato/v1/cli/agent.py +88 -84
  118. plato/v1/cli/main.py +2 -0
  119. plato/v1/cli/pm.py +441 -119
  120. plato/v1/cli/sandbox.py +747 -191
  121. plato/v1/cli/sim.py +11 -0
  122. plato/v1/cli/verify.py +1269 -0
  123. plato/v1/cli/world.py +3 -0
  124. plato/v1/flow_executor.py +21 -17
  125. plato/v1/models/env.py +11 -11
  126. plato/v1/sdk.py +2 -2
  127. plato/v1/sync_env.py +11 -11
  128. plato/v1/sync_flow_executor.py +21 -17
  129. plato/v1/sync_sdk.py +4 -2
  130. plato/v2/__init__.py +2 -0
  131. plato/v2/async_/environment.py +20 -1
  132. plato/v2/async_/session.py +54 -3
  133. plato/v2/sync/environment.py +2 -1
  134. plato/v2/sync/session.py +52 -2
  135. plato/worlds/README.md +218 -0
  136. plato/worlds/__init__.py +54 -18
  137. plato/worlds/base.py +304 -93
  138. plato/worlds/config.py +239 -73
  139. plato/worlds/runner.py +391 -80
  140. {plato_sdk_v2-2.0.50.dist-info → plato_sdk_v2-2.2.4.dist-info}/METADATA +1 -3
  141. {plato_sdk_v2-2.0.50.dist-info → plato_sdk_v2-2.2.4.dist-info}/RECORD +143 -68
  142. {plato_sdk_v2-2.0.50.dist-info → plato_sdk_v2-2.2.4.dist-info}/entry_points.txt +1 -0
  143. plato/_generated/api/v2/interfaces/__init__.py +0 -27
  144. plato/_generated/api/v2/interfaces/v2_interface_browser_create.py +0 -68
  145. plato/_generated/api/v2/interfaces/v2_interface_cdp_url.py +0 -65
  146. plato/_generated/api/v2/interfaces/v2_interface_click.py +0 -64
  147. plato/_generated/api/v2/interfaces/v2_interface_close.py +0 -59
  148. plato/_generated/api/v2/interfaces/v2_interface_computer_create.py +0 -68
  149. plato/_generated/api/v2/interfaces/v2_interface_cursor.py +0 -64
  150. plato/_generated/api/v2/interfaces/v2_interface_key.py +0 -68
  151. plato/_generated/api/v2/interfaces/v2_interface_screenshot.py +0 -65
  152. plato/_generated/api/v2/interfaces/v2_interface_scroll.py +0 -70
  153. plato/_generated/api/v2/interfaces/v2_interface_type.py +0 -64
  154. plato/world/__init__.py +0 -44
  155. plato/world/base.py +0 -267
  156. plato/world/config.py +0 -139
  157. plato/world/types.py +0 -47
  158. {plato_sdk_v2-2.0.50.dist-info → plato_sdk_v2-2.2.4.dist-info}/WHEEL +0 -0
@@ -12,7 +12,7 @@ from plato._generated.models import CreateDiskSnapshotRequest, CreateDiskSnapsho
12
12
 
13
13
  def _build_request_args(
14
14
  job_id: str,
15
- body: CreateDiskSnapshotRequest | Any,
15
+ body: CreateDiskSnapshotRequest,
16
16
  authorization: str | None = None,
17
17
  x_api_key: str | None = None,
18
18
  ) -> dict[str, Any]:
@@ -36,7 +36,7 @@ def _build_request_args(
36
36
  def sync(
37
37
  client: httpx.Client,
38
38
  job_id: str,
39
- body: CreateDiskSnapshotRequest | Any,
39
+ body: CreateDiskSnapshotRequest,
40
40
  authorization: str | None = None,
41
41
  x_api_key: str | None = None,
42
42
  ) -> CreateDiskSnapshotResult:
@@ -66,7 +66,7 @@ def sync(
66
66
  async def asyncio(
67
67
  client: httpx.AsyncClient,
68
68
  job_id: str,
69
- body: CreateDiskSnapshotRequest | Any,
69
+ body: CreateDiskSnapshotRequest,
70
70
  authorization: str | None = None,
71
71
  x_api_key: str | None = None,
72
72
  ) -> CreateDiskSnapshotResult:
@@ -7,31 +7,12 @@ from typing import Any
7
7
  import httpx
8
8
 
9
9
  from plato._generated.errors import raise_for_status
10
- from plato._generated.models import (
11
- AgentLogInput,
12
- AppApiV2SchemasSessionBatchLogRequest,
13
- LogResponse,
14
- OODRequestLogInput,
15
- PassthroughRequestLogInput,
16
- ScreenRecordingStartedLogInput,
17
- SessionBackupLogInput,
18
- SimResetLogInput,
19
- StateMutationLogInput,
20
- SystemLogInput,
21
- )
10
+ from plato._generated.models import LogResponse, SystemLogInput
22
11
 
23
12
 
24
13
  def _build_request_args(
25
14
  job_id: str,
26
- body: SystemLogInput
27
- | AgentLogInput
28
- | StateMutationLogInput
29
- | OODRequestLogInput
30
- | PassthroughRequestLogInput
31
- | ScreenRecordingStartedLogInput
32
- | SimResetLogInput
33
- | SessionBackupLogInput
34
- | AppApiV2SchemasSessionBatchLogRequest,
15
+ body: SystemLogInput,
35
16
  ) -> dict[str, Any]:
36
17
  """Build request arguments."""
37
18
  url = f"/api/v2/jobs/{job_id}/log"
@@ -46,15 +27,7 @@ def _build_request_args(
46
27
  def sync(
47
28
  client: httpx.Client,
48
29
  job_id: str,
49
- body: SystemLogInput
50
- | AgentLogInput
51
- | StateMutationLogInput
52
- | OODRequestLogInput
53
- | PassthroughRequestLogInput
54
- | ScreenRecordingStartedLogInput
55
- | SimResetLogInput
56
- | SessionBackupLogInput
57
- | AppApiV2SchemasSessionBatchLogRequest,
30
+ body: SystemLogInput,
58
31
  ) -> LogResponse:
59
32
  """Log a state mutation or batch of mutations for a specific job.
60
33
 
@@ -83,15 +56,7 @@ def sync(
83
56
  async def asyncio(
84
57
  client: httpx.AsyncClient,
85
58
  job_id: str,
86
- body: SystemLogInput
87
- | AgentLogInput
88
- | StateMutationLogInput
89
- | OODRequestLogInput
90
- | PassthroughRequestLogInput
91
- | ScreenRecordingStartedLogInput
92
- | SimResetLogInput
93
- | SessionBackupLogInput
94
- | AppApiV2SchemasSessionBatchLogRequest,
59
+ body: SystemLogInput,
95
60
  ) -> LogResponse:
96
61
  """Log a state mutation or batch of mutations for a specific job.
97
62
 
@@ -7,11 +7,11 @@ from typing import Any
7
7
  import httpx
8
8
 
9
9
  from plato._generated.errors import raise_for_status
10
- from plato._generated.models import EnvFromArtifact, EnvFromResource, EnvFromSimulator, EnvInfo
10
+ from plato._generated.models import EnvFromSimulator, EnvInfo
11
11
 
12
12
 
13
13
  def _build_request_args(
14
- body: EnvFromSimulator | EnvFromArtifact | EnvFromResource,
14
+ body: EnvFromSimulator,
15
15
  authorization: str | None = None,
16
16
  x_api_key: str | None = None,
17
17
  ) -> dict[str, Any]:
@@ -34,7 +34,7 @@ def _build_request_args(
34
34
 
35
35
  def sync(
36
36
  client: httpx.Client,
37
- body: EnvFromSimulator | EnvFromArtifact | EnvFromResource,
37
+ body: EnvFromSimulator,
38
38
  authorization: str | None = None,
39
39
  x_api_key: str | None = None,
40
40
  ) -> EnvInfo:
@@ -57,7 +57,7 @@ def sync(
57
57
 
58
58
  async def asyncio(
59
59
  client: httpx.AsyncClient,
60
- body: EnvFromSimulator | EnvFromArtifact | EnvFromResource,
60
+ body: EnvFromSimulator,
61
61
  authorization: str | None = None,
62
62
  x_api_key: str | None = None,
63
63
  ) -> EnvInfo:
@@ -0,0 +1,97 @@
1
+ """Setup Sandbox"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ import httpx
8
+
9
+ from plato._generated.errors import raise_for_status
10
+ from plato._generated.models import AppApiV2SchemasSessionSetupSandboxRequest, SetupSandboxResult
11
+
12
+
13
+ def _build_request_args(
14
+ job_id: str,
15
+ body: AppApiV2SchemasSessionSetupSandboxRequest,
16
+ authorization: str | None = None,
17
+ x_api_key: str | None = None,
18
+ ) -> dict[str, Any]:
19
+ """Build request arguments."""
20
+ url = f"/api/v2/jobs/{job_id}/setup_sandbox"
21
+
22
+ headers: dict[str, str] = {}
23
+ if authorization is not None:
24
+ headers["authorization"] = authorization
25
+ if x_api_key is not None:
26
+ headers["X-API-Key"] = x_api_key
27
+
28
+ return {
29
+ "method": "POST",
30
+ "url": url,
31
+ "json": body.model_dump(mode="json", exclude_none=True),
32
+ "headers": headers,
33
+ }
34
+
35
+
36
+ def sync(
37
+ client: httpx.Client,
38
+ job_id: str,
39
+ body: AppApiV2SchemasSessionSetupSandboxRequest,
40
+ authorization: str | None = None,
41
+ x_api_key: str | None = None,
42
+ ) -> SetupSandboxResult:
43
+ """Setup sandbox environment with Docker overlay on a specific job.
44
+
45
+ This configures the VM for Docker usage with overlay2 storage driver,
46
+ which is significantly faster than the default vfs driver. Should be called
47
+ after job creation and before pulling Docker images.
48
+
49
+ Args:
50
+ job_id: The job public ID.
51
+ request: Optional SetupSandboxRequest with timeout.
52
+
53
+ Returns:
54
+ SetupSandboxResult with success status and command output."""
55
+
56
+ request_args = _build_request_args(
57
+ job_id=job_id,
58
+ body=body,
59
+ authorization=authorization,
60
+ x_api_key=x_api_key,
61
+ )
62
+
63
+ response = client.request(**request_args)
64
+ raise_for_status(response)
65
+ return SetupSandboxResult.model_validate(response.json())
66
+
67
+
68
+ async def asyncio(
69
+ client: httpx.AsyncClient,
70
+ job_id: str,
71
+ body: AppApiV2SchemasSessionSetupSandboxRequest,
72
+ authorization: str | None = None,
73
+ x_api_key: str | None = None,
74
+ ) -> SetupSandboxResult:
75
+ """Setup sandbox environment with Docker overlay on a specific job.
76
+
77
+ This configures the VM for Docker usage with overlay2 storage driver,
78
+ which is significantly faster than the default vfs driver. Should be called
79
+ after job creation and before pulling Docker images.
80
+
81
+ Args:
82
+ job_id: The job public ID.
83
+ request: Optional SetupSandboxRequest with timeout.
84
+
85
+ Returns:
86
+ SetupSandboxResult with success status and command output."""
87
+
88
+ request_args = _build_request_args(
89
+ job_id=job_id,
90
+ body=body,
91
+ authorization=authorization,
92
+ x_api_key=x_api_key,
93
+ )
94
+
95
+ response = await client.request(**request_args)
96
+ raise_for_status(response)
97
+ return SetupSandboxResult.model_validate(response.json())
@@ -12,7 +12,7 @@ from plato._generated.models import AppApiV2SchemasSessionCreateSnapshotRequest,
12
12
 
13
13
  def _build_request_args(
14
14
  job_id: str,
15
- body: AppApiV2SchemasSessionCreateSnapshotRequest | Any,
15
+ body: AppApiV2SchemasSessionCreateSnapshotRequest,
16
16
  authorization: str | None = None,
17
17
  x_api_key: str | None = None,
18
18
  ) -> dict[str, Any]:
@@ -36,7 +36,7 @@ def _build_request_args(
36
36
  def sync(
37
37
  client: httpx.Client,
38
38
  job_id: str,
39
- body: AppApiV2SchemasSessionCreateSnapshotRequest | Any,
39
+ body: AppApiV2SchemasSessionCreateSnapshotRequest,
40
40
  authorization: str | None = None,
41
41
  x_api_key: str | None = None,
42
42
  ) -> CreateSnapshotResult:
@@ -62,7 +62,7 @@ def sync(
62
62
  async def asyncio(
63
63
  client: httpx.AsyncClient,
64
64
  job_id: str,
65
- body: AppApiV2SchemasSessionCreateSnapshotRequest | Any,
65
+ body: AppApiV2SchemasSessionCreateSnapshotRequest,
66
66
  authorization: str | None = None,
67
67
  x_api_key: str | None = None,
68
68
  ) -> CreateSnapshotResult:
@@ -0,0 +1,91 @@
1
+ """Snapshot Store"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ import httpx
8
+
9
+ from plato._generated.errors import raise_for_status
10
+ from plato._generated.models import AppApiV2SchemasSessionCreateSnapshotRequest, CreateSnapshotResult
11
+
12
+
13
+ def _build_request_args(
14
+ job_id: str,
15
+ body: AppApiV2SchemasSessionCreateSnapshotRequest,
16
+ authorization: str | None = None,
17
+ x_api_key: str | None = None,
18
+ ) -> dict[str, Any]:
19
+ """Build request arguments."""
20
+ url = f"/api/v2/jobs/{job_id}/snapshot_store"
21
+
22
+ headers: dict[str, str] = {}
23
+ if authorization is not None:
24
+ headers["authorization"] = authorization
25
+ if x_api_key is not None:
26
+ headers["X-API-Key"] = x_api_key
27
+
28
+ return {
29
+ "method": "POST",
30
+ "url": url,
31
+ "json": body.model_dump(mode="json", exclude_none=True),
32
+ "headers": headers,
33
+ }
34
+
35
+
36
+ def sync(
37
+ client: httpx.Client,
38
+ job_id: str,
39
+ body: AppApiV2SchemasSessionCreateSnapshotRequest,
40
+ authorization: str | None = None,
41
+ x_api_key: str | None = None,
42
+ ) -> CreateSnapshotResult:
43
+ """Create a snapshot-store snapshot of a specific job (disk + memory).
44
+
45
+ Uses the snapshot-store pipeline for chunk-based deduplication and
46
+ efficient storage. This is the preferred method for new base snapshots.
47
+
48
+ Optional request body allows overriding artifact metadata:
49
+ - override_service: Override simulator/service name
50
+ - override_version: Override version/git_hash
51
+ - override_dataset: Override dataset name"""
52
+
53
+ request_args = _build_request_args(
54
+ job_id=job_id,
55
+ body=body,
56
+ authorization=authorization,
57
+ x_api_key=x_api_key,
58
+ )
59
+
60
+ response = client.request(**request_args)
61
+ raise_for_status(response)
62
+ return CreateSnapshotResult.model_validate(response.json())
63
+
64
+
65
+ async def asyncio(
66
+ client: httpx.AsyncClient,
67
+ job_id: str,
68
+ body: AppApiV2SchemasSessionCreateSnapshotRequest,
69
+ authorization: str | None = None,
70
+ x_api_key: str | None = None,
71
+ ) -> CreateSnapshotResult:
72
+ """Create a snapshot-store snapshot of a specific job (disk + memory).
73
+
74
+ Uses the snapshot-store pipeline for chunk-based deduplication and
75
+ efficient storage. This is the preferred method for new base snapshots.
76
+
77
+ Optional request body allows overriding artifact metadata:
78
+ - override_service: Override simulator/service name
79
+ - override_version: Override version/git_hash
80
+ - override_dataset: Override dataset name"""
81
+
82
+ request_args = _build_request_args(
83
+ job_id=job_id,
84
+ body=body,
85
+ authorization=authorization,
86
+ x_api_key=x_api_key,
87
+ )
88
+
89
+ response = await client.request(**request_args)
90
+ raise_for_status(response)
91
+ return CreateSnapshotResult.model_validate(response.json())
@@ -22,7 +22,9 @@ from . import (
22
22
  make,
23
23
  reset,
24
24
  set_date,
25
+ setup_sandbox,
25
26
  snapshot,
27
+ snapshot_store,
26
28
  state,
27
29
  upload_session_documents,
28
30
  wait_for_ready,
@@ -38,7 +40,9 @@ __all__ = [
38
40
  "evaluate",
39
41
  "execute",
40
42
  "set_date",
43
+ "setup_sandbox",
41
44
  "snapshot",
45
+ "snapshot_store",
42
46
  "checkpoint",
43
47
  "disk_snapshot",
44
48
  "state",
@@ -12,7 +12,7 @@ from plato._generated.models import CreateCheckpointRequest, CreateCheckpointRes
12
12
 
13
13
  def _build_request_args(
14
14
  session_id: str,
15
- body: CreateCheckpointRequest | Any,
15
+ body: CreateCheckpointRequest,
16
16
  authorization: str | None = None,
17
17
  x_api_key: str | None = None,
18
18
  ) -> dict[str, Any]:
@@ -36,7 +36,7 @@ def _build_request_args(
36
36
  def sync(
37
37
  client: httpx.Client,
38
38
  session_id: str,
39
- body: CreateCheckpointRequest | Any,
39
+ body: CreateCheckpointRequest,
40
40
  authorization: str | None = None,
41
41
  x_api_key: str | None = None,
42
42
  ) -> CreateCheckpointResponse:
@@ -68,7 +68,7 @@ def sync(
68
68
  async def asyncio(
69
69
  client: httpx.AsyncClient,
70
70
  session_id: str,
71
- body: CreateCheckpointRequest | Any,
71
+ body: CreateCheckpointRequest,
72
72
  authorization: str | None = None,
73
73
  x_api_key: str | None = None,
74
74
  ) -> CreateCheckpointResponse:
@@ -12,7 +12,7 @@ from plato._generated.models import CreateDiskSnapshotRequest, CreateDiskSnapsho
12
12
 
13
13
  def _build_request_args(
14
14
  session_id: str,
15
- body: CreateDiskSnapshotRequest | Any,
15
+ body: CreateDiskSnapshotRequest,
16
16
  authorization: str | None = None,
17
17
  x_api_key: str | None = None,
18
18
  ) -> dict[str, Any]:
@@ -36,7 +36,7 @@ def _build_request_args(
36
36
  def sync(
37
37
  client: httpx.Client,
38
38
  session_id: str,
39
- body: CreateDiskSnapshotRequest | Any,
39
+ body: CreateDiskSnapshotRequest,
40
40
  authorization: str | None = None,
41
41
  x_api_key: str | None = None,
42
42
  ) -> CreateDiskSnapshotResponse:
@@ -66,7 +66,7 @@ def sync(
66
66
  async def asyncio(
67
67
  client: httpx.AsyncClient,
68
68
  session_id: str,
69
- body: CreateDiskSnapshotRequest | Any,
69
+ body: CreateDiskSnapshotRequest,
70
70
  authorization: str | None = None,
71
71
  x_api_key: str | None = None,
72
72
  ) -> CreateDiskSnapshotResponse:
@@ -12,7 +12,7 @@ from plato._generated.models import AppApiV2SchemasSessionEvaluateRequest, AppAp
12
12
 
13
13
  def _build_request_args(
14
14
  session_id: str,
15
- body: AppApiV2SchemasSessionEvaluateRequest | Any,
15
+ body: AppApiV2SchemasSessionEvaluateRequest,
16
16
  authorization: str | None = None,
17
17
  x_api_key: str | None = None,
18
18
  ) -> dict[str, Any]:
@@ -36,7 +36,7 @@ def _build_request_args(
36
36
  def sync(
37
37
  client: httpx.Client,
38
38
  session_id: str,
39
- body: AppApiV2SchemasSessionEvaluateRequest | Any,
39
+ body: AppApiV2SchemasSessionEvaluateRequest,
40
40
  authorization: str | None = None,
41
41
  x_api_key: str | None = None,
42
42
  ) -> AppApiV2SchemasSessionEvaluateResponse:
@@ -57,7 +57,7 @@ def sync(
57
57
  async def asyncio(
58
58
  client: httpx.AsyncClient,
59
59
  session_id: str,
60
- body: AppApiV2SchemasSessionEvaluateRequest | Any,
60
+ body: AppApiV2SchemasSessionEvaluateRequest,
61
61
  authorization: str | None = None,
62
62
  x_api_key: str | None = None,
63
63
  ) -> AppApiV2SchemasSessionEvaluateResponse:
@@ -7,32 +7,13 @@ from typing import Any
7
7
  import httpx
8
8
 
9
9
  from plato._generated.errors import raise_for_status
10
- from plato._generated.models import (
11
- AgentLogInput,
12
- AppApiV2SchemasSessionBatchLogRequest,
13
- LogResponse,
14
- OODRequestLogInput,
15
- PassthroughRequestLogInput,
16
- ScreenRecordingStartedLogInput,
17
- SessionBackupLogInput,
18
- SimResetLogInput,
19
- StateMutationLogInput,
20
- SystemLogInput,
21
- )
10
+ from plato._generated.models import LogResponse, SystemLogInput
22
11
 
23
12
 
24
13
  def _build_request_args(
25
14
  session_id: str,
26
15
  job_id: str,
27
- body: SystemLogInput
28
- | AgentLogInput
29
- | StateMutationLogInput
30
- | OODRequestLogInput
31
- | PassthroughRequestLogInput
32
- | ScreenRecordingStartedLogInput
33
- | SimResetLogInput
34
- | SessionBackupLogInput
35
- | AppApiV2SchemasSessionBatchLogRequest,
16
+ body: SystemLogInput,
36
17
  ) -> dict[str, Any]:
37
18
  """Build request arguments."""
38
19
  url = f"/api/v2/sessions/{session_id}/jobs/{job_id}/log"
@@ -48,15 +29,7 @@ def sync(
48
29
  client: httpx.Client,
49
30
  session_id: str,
50
31
  job_id: str,
51
- body: SystemLogInput
52
- | AgentLogInput
53
- | StateMutationLogInput
54
- | OODRequestLogInput
55
- | PassthroughRequestLogInput
56
- | ScreenRecordingStartedLogInput
57
- | SimResetLogInput
58
- | SessionBackupLogInput
59
- | AppApiV2SchemasSessionBatchLogRequest,
32
+ body: SystemLogInput,
60
33
  ) -> LogResponse:
61
34
  """Log agent mutations/events for a specific job in a session.
62
35
 
@@ -80,15 +53,7 @@ async def asyncio(
80
53
  client: httpx.AsyncClient,
81
54
  session_id: str,
82
55
  job_id: str,
83
- body: SystemLogInput
84
- | AgentLogInput
85
- | StateMutationLogInput
86
- | OODRequestLogInput
87
- | PassthroughRequestLogInput
88
- | ScreenRecordingStartedLogInput
89
- | SimResetLogInput
90
- | SessionBackupLogInput
91
- | AppApiV2SchemasSessionBatchLogRequest,
56
+ body: SystemLogInput,
92
57
  ) -> LogResponse:
93
58
  """Log agent mutations/events for a specific job in a session.
94
59
 
@@ -7,11 +7,11 @@ from typing import Any
7
7
  import httpx
8
8
 
9
9
  from plato._generated.errors import raise_for_status
10
- from plato._generated.models import CreateSessionFromEnvs, CreateSessionFromTask, CreateSessionResponse
10
+ from plato._generated.models import CreateSessionFromEnvs, CreateSessionResponse
11
11
 
12
12
 
13
13
  def _build_request_args(
14
- body: CreateSessionFromEnvs | CreateSessionFromTask,
14
+ body: CreateSessionFromEnvs,
15
15
  authorization: str | None = None,
16
16
  x_api_key: str | None = None,
17
17
  ) -> dict[str, Any]:
@@ -34,7 +34,7 @@ def _build_request_args(
34
34
 
35
35
  def sync(
36
36
  client: httpx.Client,
37
- body: CreateSessionFromEnvs | CreateSessionFromTask,
37
+ body: CreateSessionFromEnvs,
38
38
  authorization: str | None = None,
39
39
  x_api_key: str | None = None,
40
40
  ) -> CreateSessionResponse:
@@ -57,7 +57,7 @@ def sync(
57
57
 
58
58
  async def asyncio(
59
59
  client: httpx.AsyncClient,
60
- body: CreateSessionFromEnvs | CreateSessionFromTask,
60
+ body: CreateSessionFromEnvs,
61
61
  authorization: str | None = None,
62
62
  x_api_key: str | None = None,
63
63
  ) -> CreateSessionResponse:
@@ -0,0 +1,98 @@
1
+ """Setup Sandbox"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ import httpx
8
+
9
+ from plato._generated.errors import raise_for_status
10
+ from plato._generated.models import (
11
+ AppApiV2SchemasSessionSetupSandboxRequest,
12
+ AppApiV2SchemasSessionSetupSandboxResponse,
13
+ )
14
+
15
+
16
+ def _build_request_args(
17
+ session_id: str,
18
+ body: AppApiV2SchemasSessionSetupSandboxRequest,
19
+ authorization: str | None = None,
20
+ x_api_key: str | None = None,
21
+ ) -> dict[str, Any]:
22
+ """Build request arguments."""
23
+ url = f"/api/v2/sessions/{session_id}/setup_sandbox"
24
+
25
+ headers: dict[str, str] = {}
26
+ if authorization is not None:
27
+ headers["authorization"] = authorization
28
+ if x_api_key is not None:
29
+ headers["X-API-Key"] = x_api_key
30
+
31
+ return {
32
+ "method": "POST",
33
+ "url": url,
34
+ "json": body.model_dump(mode="json", exclude_none=True),
35
+ "headers": headers,
36
+ }
37
+
38
+
39
+ def sync(
40
+ client: httpx.Client,
41
+ session_id: str,
42
+ body: AppApiV2SchemasSessionSetupSandboxRequest,
43
+ authorization: str | None = None,
44
+ x_api_key: str | None = None,
45
+ ) -> AppApiV2SchemasSessionSetupSandboxResponse:
46
+ """Setup sandbox environment with Docker overlay on all jobs in the session.
47
+
48
+ This configures the VM for Docker usage with overlay2 storage driver,
49
+ which is significantly faster than the default vfs driver. Should be called
50
+ after session creation and before pulling Docker images.
51
+
52
+ The setup includes:
53
+ - Mounting /dev/vdb to /mnt/docker for Docker storage
54
+ - Configuring Docker with overlay2 storage driver
55
+ - Setting up ECR and Docker Hub authentication
56
+ - Creating a docker-user service for non-root Docker access"""
57
+
58
+ request_args = _build_request_args(
59
+ session_id=session_id,
60
+ body=body,
61
+ authorization=authorization,
62
+ x_api_key=x_api_key,
63
+ )
64
+
65
+ response = client.request(**request_args)
66
+ raise_for_status(response)
67
+ return AppApiV2SchemasSessionSetupSandboxResponse.model_validate(response.json())
68
+
69
+
70
+ async def asyncio(
71
+ client: httpx.AsyncClient,
72
+ session_id: str,
73
+ body: AppApiV2SchemasSessionSetupSandboxRequest,
74
+ authorization: str | None = None,
75
+ x_api_key: str | None = None,
76
+ ) -> AppApiV2SchemasSessionSetupSandboxResponse:
77
+ """Setup sandbox environment with Docker overlay on all jobs in the session.
78
+
79
+ This configures the VM for Docker usage with overlay2 storage driver,
80
+ which is significantly faster than the default vfs driver. Should be called
81
+ after session creation and before pulling Docker images.
82
+
83
+ The setup includes:
84
+ - Mounting /dev/vdb to /mnt/docker for Docker storage
85
+ - Configuring Docker with overlay2 storage driver
86
+ - Setting up ECR and Docker Hub authentication
87
+ - Creating a docker-user service for non-root Docker access"""
88
+
89
+ request_args = _build_request_args(
90
+ session_id=session_id,
91
+ body=body,
92
+ authorization=authorization,
93
+ x_api_key=x_api_key,
94
+ )
95
+
96
+ response = await client.request(**request_args)
97
+ raise_for_status(response)
98
+ return AppApiV2SchemasSessionSetupSandboxResponse.model_validate(response.json())
@@ -15,7 +15,7 @@ from plato._generated.models import (
15
15
 
16
16
  def _build_request_args(
17
17
  session_id: str,
18
- body: AppApiV2SchemasSessionCreateSnapshotRequest | Any,
18
+ body: AppApiV2SchemasSessionCreateSnapshotRequest,
19
19
  authorization: str | None = None,
20
20
  x_api_key: str | None = None,
21
21
  ) -> dict[str, Any]:
@@ -39,7 +39,7 @@ def _build_request_args(
39
39
  def sync(
40
40
  client: httpx.Client,
41
41
  session_id: str,
42
- body: AppApiV2SchemasSessionCreateSnapshotRequest | Any,
42
+ body: AppApiV2SchemasSessionCreateSnapshotRequest,
43
43
  authorization: str | None = None,
44
44
  x_api_key: str | None = None,
45
45
  ) -> AppApiV2SchemasSessionCreateSnapshotResponse:
@@ -65,7 +65,7 @@ def sync(
65
65
  async def asyncio(
66
66
  client: httpx.AsyncClient,
67
67
  session_id: str,
68
- body: AppApiV2SchemasSessionCreateSnapshotRequest | Any,
68
+ body: AppApiV2SchemasSessionCreateSnapshotRequest,
69
69
  authorization: str | None = None,
70
70
  x_api_key: str | None = None,
71
71
  ) -> AppApiV2SchemasSessionCreateSnapshotResponse: