enterprise_ai.sandbox
Source: sdks/python/src/enterprise_ai/sandbox/__init__.py. Back to the Python SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Class SandboxClient
/v1/sandbox/executions.
Resource
SandboxClient.execute
execute(image: str, command: list[str] | None = None, profile: str = 'gvisor', limits: dict[str, Any] | None = None, env: dict[str, str] | None = None, run_id: str | None = None, **extra: Any) -> Any
Run a command in a sandbox. Creates a sandbox execution: the image and command run as a Kubernetes Job with the runtime class of the profile (gVisor, Kata, Wasm) when Kubernetes is configured (status: submitted, or failed if the submission fails). Needs tenant_admin, developer or agent; the profile none needs tenant_admin (403). Invalid profile, image or limits answer 422 invalid_sandbox. The usage is metered and the request audited as sandbox.execute.
Route: /v1/sandbox/executions (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
image | str | yes | Container image reference (1 to 500 characters, lowercase registry path, tag or digest allowed). | |
command | list[str] | None | None | no | Command and arguments, one item per argument. |
profile | str | 'gvisor' | no | Isolation profile: gvisor (default), kata, wasm or none (no isolation, tenant_admin only). |
limits | dict[str, Any] | None | None | no | Resource limits: cpu (default 500m, at most 4 cores), memory (default 512Mi, at most 8Gi), timeout_seconds (1 to 3600, default 300), gpu (at most 1), max_steps. |
env | dict[str, str] | None | None | no | Environment variables, string values. |
run_id | str | None | None | no | Run the execution belongs to (must exist); used for metering. |
**extra | Any | no | Extra fields merged into the request body. |
Returns: Any. Decoded JSON answer of the operation "Run a command in a sandbox".
Raises: ValueError, the typed errors of the transport (Errors).
SandboxClient.get
get(execution_id: str) -> Any
Get a sandbox execution. Returns the sandbox execution: profile, image, command, limits, generated Kubernetes Job spec, status, executor and result. 404 sandbox_execution_not_found.
Route: /v1/sandbox/executions/{execution_id} (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
execution_id | str | yes | Identifier (UUID) of the sandbox execution. |
Returns: Any. Decoded JSON answer of the operation "Get a sandbox execution".
Raises: the typed errors of the transport (Errors).
SandboxClient.wait
wait(execution_id: str, timeout: float = 300.0, interval: float = 1.0) -> dict[str, Any]
Poll until the execution finishes (sync client only).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
execution_id | str | yes | Identifier of the sandbox execution. | |
timeout | float | 300.0 | no | Maximum wait in seconds (default 300); the last read is then returned without error. |
interval | float | 1.0 | no | Seconds between two reads (default 1). |
Returns: dict[str, Any]. The execution, final when its status is succeeded, failed, timeout, killed or cancelled.
Raises: TypeError.
SandboxClient.wait_async
async wait_async(execution_id: str, timeout: float = 300.0, interval: float = 1.0) -> dict[str, Any]
Async poll until the execution finishes.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
execution_id | str | yes | Identifier of the sandbox execution. | |
timeout | float | 300.0 | no | Maximum wait in seconds (default 300); the last read is then returned without error. |
interval | float | 1.0 | no | Seconds between two reads (default 1). |
Returns: dict[str, Any]. The execution, final when its status is succeeded, failed, timeout, killed or cancelled.