databricks-sandbox
Databricks Sandbox
Databricks Sandbox is a serverless, isolated compute environment for humans and agents to run untrusted code. Drive it from code with the Databricks SDK, available in Python, Java, Go, and JavaScript. Lifecycle, file operations, and synchronous execute_command_sync are available in all four SDKs; streaming execute_command is currently Python-only. The examples in this skill use the Python SDK.
SDK reference (Python): https://databricks-sdk-py.readthedocs.io/en/latest/workspace/sandbox/sandbox.html Product docs: https://docs.databricks.com/compute/serverless/sandbox SDK user guide: https://docs.databricks.com/compute/serverless/sandbox-usage-guide REST API reference: https://docs.databricks.com/api/sandbox/v1/sandbox
Other language SDKs: Java, Go, JavaScript.
For the full per-method signature table, see references/sdk-reference.md.
Environment Setup
- Install the SDK with the sandbox extra:
uv pip install "databricks-sdk[sandbox]>=0.154.0". Thesandboxextra supplies the gRPC dependencies that streamingexecute_commandneeds (the plaindatabricks-sdkpackage omits them); lifecycle, file operations, and unaryexecute_command_syncwork without the extra. 0.154.0 is the first release with the file-operation methods used below. - Authentication, profiles, and
~/.databrickscfgare covered by thedatabricks-coreskill. The sandbox client authenticates like any otherWorkspaceClient. - Your workspace must be in a supported region (see Features with limited regional availability) and have the Databricks Sandbox preview enabled on the workspace Previews page.