Sandbox
An isolated, pre-configured, low-latency Serverless compute environment for running code.
Create a sandbox, wait until its state is SANDBOX_STATE_RUNNING, then run commands in it
with ExecuteCommandSync. The data in its home directory persists across stop and start and
is removed when the sandbox is deleted. See
Databricks Sandbox.
Sandbox object
An isolated, pre-configured, low-latency Serverless compute environment for running code.
Create a sandbox, wait until its state is SANDBOX_STATE_RUNNING, then run commands in it
with ExecuteCommandSync. The data in its home directory persists across stop and start and
is removed when the sandbox is deleted. See
Databricks Sandbox.
- metadataobjectBeta
Tags and other metadata associated with the sandbox.
Show child attributesHide child attributes
- custom_tagsobjectBeta
Key-value tags associated with the sandbox. Supports up to 54 tags. Keys must be between 1 and 512 characters, and values must not exceed 256 characters.
- specobjectBeta
The desired configuration of the sandbox, supplied by the caller at creation time.
Show child attributesHide child attributes
- computeobjectBeta
Compute settings requested for the sandbox, such as the inactivity timeout.
Show child attributesHide child attributes
- inactivity_timeoutstringBeta
Idle time after which the sandbox is automatically stopped. Unset or 0 disables inactivity auto-stop. Negative values are rejected. Can be changed on an existing sandbox with UpdateSandbox.
- environmentobjectBeta
Software environment for the sandbox, such as the container image it runs.
Show child attributesHide child attributes
- image_uristringBeta
The Unity Catalog container image to run the sandbox from, in the form
catalog.schema.artifact:tag, orcatalog.schema.artifact@sha256:<digest>to pin an exact version. When omitted, the sandbox runs the default sandbox image. See custom images.
- networkobjectBeta
Network configuration requested for the sandbox.
Show child attributesHide child attributes
- internet_accessbooleanBetaImmutable
Whether the sandbox can reach the public internet. Defaults to true. Control-plane, PrivateLink, and workspace/UC/Delta-shared storage stay reachable either way.
- statusobjectBetaOutput only
The observed runtime state of the sandbox, populated by the server.
Show child attributesHide child attributes
- statestringBetaOutput only
Lifecycle state of the sandbox.
SANDBOX_STATE_PENDING: The sandbox is being provisioned after a create or start request and cannot run commands yet.SANDBOX_STATE_RUNNING: The sandbox is ready and commands can run in it.SANDBOX_STATE_STOPPING: The sandbox is shutting down. It settles toSANDBOX_STATE_STOPPED, or disappears if it is being deleted.SANDBOX_STATE_STOPPED: The sandbox is stopped, by a stop request, inactivity auto-stop, or a failed provisioning. Its home directory is kept and it can be started again with StartSandbox.
SANDBOX_STATE_PENDINGSANDBOX_STATE_RUNNINGSANDBOX_STATE_STOPPEDSANDBOX_STATE_STOPPING
- namestringBetaIDImmutable
The sandbox resource name, in the form
sandboxes/{sandbox_id}. Derived fromsandbox_id; any value supplied in a create or update request body is ignored.
- create_timestringBetaOutput only
Output only. The creation time of the sandbox.
- update_timestringBetaOutput only
Output only. The last update time of the sandbox metadata and spec.
- display_namestringBeta
Human-readable display label for the sandbox. At most 256 characters.
Get a sandbox Beta
GET
Retrieves a Sandbox by name.
API scopes: sandbox
Parameters
- namestringRequiredpath
Resource name of the sandbox to retrieve, in the form
sandboxes/{sandbox_id}.
Response
Returns the Sandbox object.
List sandboxes Beta
GET
Lists the sandboxes in the workspace that are visible to the caller, including stopped sandboxes. Sandboxes that are being deleted are not returned.
API scopes: sandbox
Parameters
- page_tokenstringquery
Page token from the
next_page_tokenof a previous ListSandboxes response. Omit it to retrieve the first page.
- page_sizeint32query
Maximum number of sandboxes to return in one page. When unset or 0 the server returns up to 1000 sandboxes; values above 5000 are reduced to 5000.
Response
Returns a list of Sandbox objects.
Create a sandbox Beta
POST
Creates a sandbox with the given sandbox_id and starts provisioning it. Provisioning
is asynchronous: the response usually shows the sandbox in SANDBOX_STATE_PENDING, so
poll GetSandbox until the state is SANDBOX_STATE_RUNNING before running commands in it.
A sandbox that fails to provision ends in SANDBOX_STATE_STOPPED. Returns ALREADY_EXISTS
if a sandbox with the same ID already exists in the workspace.
API scopes: sandbox
Parameters
- sandbox_idstringRequiredquery
Client-supplied ID that becomes the final path segment of the resource name. It must start with a lowercase letter, contain only lowercase letters, digits and hyphens, end with a letter or digit, and be at most 63 characters long. Values shaped like a UUID are rejected.
Request body
The sandbox to create. An empty body creates a sandbox with the default configuration.
- metadataobject
Tags and other metadata associated with the sandbox.
Show child attributesHide child attributes
- custom_tagsobject
Key-value tags associated with the sandbox. Supports up to 54 tags. Keys must be between 1 and 512 characters, and values must not exceed 256 characters.
- specobject
The desired configuration of the sandbox, supplied by the caller at creation time.
Show child attributesHide child attributes
- computeobject
Compute settings requested for the sandbox, such as the inactivity timeout.
Show child attributesHide child attributes
- inactivity_timeoutstring
Idle time after which the sandbox is automatically stopped. Unset or 0 disables inactivity auto-stop. Negative values are rejected. Can be changed on an existing sandbox with UpdateSandbox.
- environmentobject
Software environment for the sandbox, such as the container image it runs.
Show child attributesHide child attributes
- image_uristring
The Unity Catalog container image to run the sandbox from, in the form
catalog.schema.artifact:tag, orcatalog.schema.artifact@sha256:<digest>to pin an exact version. When omitted, the sandbox runs the default sandbox image. See custom images.
- networkobject
Network configuration requested for the sandbox.
Show child attributesHide child attributes
- internet_accessbooleanImmutable
Whether the sandbox can reach the public internet. Defaults to true. Control-plane, PrivateLink, and workspace/UC/Delta-shared storage stay reachable either way.
- namestringIDImmutable
The sandbox resource name, in the form
sandboxes/{sandbox_id}. Derived fromsandbox_id; any value supplied in a create or update request body is ignored.
- display_namestring
Human-readable display label for the sandbox. At most 256 characters.
Response
Returns the Sandbox object.
Update a sandbox Beta
PATCH
Updates mutable fields on an existing Sandbox. Allowlisted update_mask paths today: display_name, spec.compute.inactivity_timeout. Returns INVALID_PARAMETER_VALUE for empty masks or unknown paths; NOT_FOUND if the sandbox does not exist.
API scopes: sandbox
Parameters
- namestringRequiredpath
Resource name of the sandbox to update, in the form
sandboxes/{sandbox_id}.
- update_maskstringRequiredquery
Field paths to update. Must be a non-empty subset of:
- display_name
- spec.compute.inactivity_timeout Any other path returns INVALID_PARAMETER_VALUE.
Request body
The Sandbox resource carrying new field values. Only fields named in
update_mask are read; unmasked fields are ignored.
- metadataobject
Tags and other metadata associated with the sandbox.
Show child attributesHide child attributes
- custom_tagsobject
Key-value tags associated with the sandbox. Supports up to 54 tags. Keys must be between 1 and 512 characters, and values must not exceed 256 characters.
- specobject
The desired configuration of the sandbox, supplied by the caller at creation time.
Show child attributesHide child attributes
- computeobject
Compute settings requested for the sandbox, such as the inactivity timeout.
Show child attributesHide child attributes
- inactivity_timeoutstring
Idle time after which the sandbox is automatically stopped. Unset or 0 disables inactivity auto-stop. Negative values are rejected. Can be changed on an existing sandbox with UpdateSandbox.
- environmentobject
Software environment for the sandbox, such as the container image it runs.
Show child attributesHide child attributes
- image_uristring
The Unity Catalog container image to run the sandbox from, in the form
catalog.schema.artifact:tag, orcatalog.schema.artifact@sha256:<digest>to pin an exact version. When omitted, the sandbox runs the default sandbox image. See custom images.
- networkobject
Network configuration requested for the sandbox.
Show child attributesHide child attributes
- internet_accessbooleanImmutable
Whether the sandbox can reach the public internet. Defaults to true. Control-plane, PrivateLink, and workspace/UC/Delta-shared storage stay reachable either way.
- namestringIDImmutable
The sandbox resource name, in the form
sandboxes/{sandbox_id}. Derived fromsandbox_id; any value supplied in a create or update request body is ignored.
- display_namestring
Human-readable display label for the sandbox. At most 256 characters.
Response
Returns the Sandbox object.
Delete a sandbox Beta
DELETE
Deletes a sandbox, including the data in its home directory. A pending or running sandbox is stopped first and is removed once the teardown completes, after which GetSandbox returns NOT_FOUND. Deleting a sandbox that is already being deleted succeeds.
API scopes: sandbox
Parameters
- namestringRequiredpath
Resource name of the sandbox to delete, in the form
sandboxes/{sandbox_id}.
Start a sandbox Beta
POST
Starts a previously stopped sandbox under the same sandbox name, with the data in its
home directory intact. Starting is asynchronous: the response usually shows the sandbox
in SANDBOX_STATE_PENDING, so poll GetSandbox until the state is SANDBOX_STATE_RUNNING.
Returns NOT_FOUND if the sandbox does not exist, FAILED_PRECONDITION if it is pending or
running, and ABORTED while it is still stopping.
API scopes: sandbox
Parameters
- namestringRequiredpath
Resource name of the sandbox to start, in the form
sandboxes/{sandbox_id}.
Response
Returns the Sandbox object.
Stop a sandbox Beta
POST
Stops a running sandbox, preserving it so it can later be restarted with a Start
request. Stopping is asynchronous: the response usually shows the sandbox in
SANDBOX_STATE_STOPPING, and it settles to SANDBOX_STATE_STOPPED once the shutdown
completes. The data in the home directory is kept; other local changes are discarded.
Stopping a sandbox that is already stopped or stopping succeeds without changes.
API scopes: sandbox
Parameters
- namestringRequiredpath
Resource name of the sandbox to stop, in the form
sandboxes/{sandbox_id}.
Response
Returns the Sandbox object.
Run a command in a sandbox and wait for its result Beta
POST
Runs a command in the sandbox and blocks until it exits, returning the captured stdout, stderr and exit code in a single response.
API scopes: sandbox
Parameters
- namestringRequiredpath
Resource name of the sandbox to run the command in, in the form
sandboxes/{sandbox_id}. Bound from the URL path.
Request body
- cmdstringRequired
Executable or command to run (e.g.
/bin/echo,python3).
- argsarray of string
Arguments passed to
cmd.
- envsobject
Extra environment variables for the command's process, merged over the sandbox's default environment.
- execution_timeoutstring
Maximum time to wait for the command to finish. When it elapses the command is terminated and the response carries status
TIMED_OUT. The server applies a default when unset and clamps to an upper bound; negative or otherwise invalid durations are rejected withINVALID_ARGUMENT.
Response
- exit_codeint32Output only
Process exit code. Unset when the process was terminated by a signal (e.g. on
TIMED_OUT) or never started (FAILED) rather than exiting normally.
- statusstringOutput only
Terminal status of the command execution. Always set on a successful response; never
EXECUTE_COMMAND_STATUS_UNSPECIFIED.EXECUTE_COMMAND_STATUS_COMPLETEDEXECUTE_COMMAND_STATUS_TIMED_OUTEXECUTE_COMMAND_STATUS_FAILED
- stdoutstringOutput only
Captured standard output as UTF-8 text. Invalid UTF-8 bytes are replaced with the Unicode replacement character (U+FFFD).
- stderrstringOutput only
Captured standard error, with the same UTF-8 semantics as
stdout.
- command_idstringOutput only
Daemon-generated identifier for this command execution, for correlation (for example in
ListCommands).
- truncatedbooleanOutput only
True when
stdout/stderrwere truncated because the captured output exceeded the server's per-response size cap. The dropped output is not included in this response and is not recoverable through this unary API.
List the tracked command executions in a sandbox Beta
GET
Lists the tracked command executions (running and completed) in a sandbox.
API scopes: sandbox
Parameters
- parentstringRequiredpath
The sandbox whose commands to list, in the form
sandboxes/{sandbox_id}.
- page_sizeint32query
Maximum number of commands to return. The server may return fewer. If unspecified, the server returns all commands.
- page_tokenstringquery
Page token returned by a previous ListCommands call. Use this to retrieve the next page of results.
Response
- commandsarray of object
Commands in this page of results.
Show child attributesHide child attributes
- command_idstring
Stable identifier for this command.
- cmdstring
The program that was executed.
- argsarray of string
Arguments passed to the program.
- pidint64
PID of the spawned process. Absent if the process failed to start.
- finishedboolean
Whether the command has finished executing.
- exit_codeint32
Process exit code. Only present when finished is true and the process exited normally (not killed by signal or failed to start).
- next_page_tokenstring
Token to retrieve the next page. Empty when there are no more results.