Skip to main content
The cwsandbox Python client provides a high-level SDK for creating and managing CoreWeave sandbox environments. It supports both synchronous and asynchronous workflows through a unified API.

Prepare your Python environment

Install uv. In your project directory, activate an existing Python 3.11 or later virtual environment, or create one:
Run the installation commands and example scripts from this environment.

Choose authentication

These examples run on serverless capacity unless a section specifies CKS. Choose the credential for the account that owns your sandboxes. See Choose and get credentials to obtain a key or token. Save the Python code from your credential tab as sandbox_auth.py beside the Python scripts you run from this page. It stores the authentication choice, not your credential. The examples import AUTH from that file and pass it explicitly to each new sandbox or session.
Use your Forge API key through the SDK’s W&B authentication strategy:
sandbox_auth.py
For CKS placement, choose the CoreWeave token, enable a runner, and set placement_mode="cks" on sandbox creation or in SandboxDefaults. Creating a session with auth=AUTH also authenticates the sandboxes it owns. Keep the same credential when reconnecting, listing, or cleaning up sandboxes.

Quick start

Create a sandbox, run a command, and retrieve the result:
The same API works in async contexts:

Next steps

Get started

Authenticate and run your first serverless sandbox with the SDK.

Tutorial

Learn to configure sandboxes, run commands, transfer files, and clean up with the Python SDK.

Guides

In-depth guides about specific topics including lifecycle management, file operations, execution patterns, and troubleshooting.
Last modified on October 21, 2026