CoreWeave sandboxes are in public preview. For access, contact your CoreWeave account team, CoreWeave Support, or email support@coreweave.com.
Choose a volume type
Use a scratch volume for working space inside one run. Use a registered Volume for data that outlives a sandbox or that several sandboxes read at once, such as a shared dataset or model weights.
Scratch volumes
A scratch volume is created with the sandbox and destroyed with it. Declare one withScratchVolumeOptions in the volumes list.
ScratchVolumeOptions accepts the following fields:
Choose a storage medium
StorageMedium.DISK backs the volume with local disk. StorageMedium.MEMORY backs it with tmpfs, which is faster but counts against the mounting container’s memory request and against the policy’s memory ceiling.
Because an unbounded RAM-backed volume could exhaust the node, a MEMORY volume must declare a size. It may do so as an absolute quantity, or as an integer percentage of the sandbox’s resolved memory request, such as "50%". The percentage form is valid only for MEMORY. A DISK volume must use an absolute size.
Mount a scratch volume on several containers
mount_path is a convenience that mounts the volume on the primary container. In a multi-container sandbox, omit mount_path and declare the mounts on each container instead, so that more than one container can reach the same volume.
Registered Volumes
A registered Volume points at a PersistentVolumeClaim (PVC) that already exists in one of your clusters. Registering it makes the claim mountable by sandboxes without granting them access to the cluster itself. The Volume is a metadata pointer: CoreWeave never copies the data, and deleting the Volume never touches the claim. Every attach is a live view of the same claim, so a write from one sandbox is visible to every other sandbox mounting it.Register a Volume
Volume.create() returns immediately with the Volume in the VALIDATING state, then the control plane checks that the claim exists and is usable. Poll with wait_until_ready() before you mount it.
The source and the
read_only flag are also immutable after creation. Only description can change later.PvcVolumeSource takes these fields:
Set
read_only=True on Volume.create() to make read-only a property of the Volume itself. That setting is a floor, not a default: a mount can be read-only on a writable Volume, but no mount can write to a read-only Volume.
Mount a registered Volume
Mount the Volume by ID withRegisteredVolumeOptions. The Volume must be READY at start, or the sandbox fails with CWSANDBOX_VOLUME_NOT_READY.
RegisteredVolumeOptions requires name, volume_id, and an absolute mount_path other than /. It also accepts sub_path, which combines with any sub_path set at registration, and read_only.
A sandbox echoes the Volumes it mounted in attached_volume_ids.
Locality and placement
A Volume’slocality reports whether it constrains placement:
cluster_local: the Volume lives in one cluster, so sandboxes mounting it are scheduled onto that cluster’s runner. PVC-backed Volumes are cluster-local.global: the Volume is reachable from any cluster and does not constrain placement.
CWSANDBOX_VOLUME_PLACEMENT_CONFLICT.
Manage registered Volumes
Use the following operations to list, inspect, update, and deregister the Volumes in your organization.Volume.list() paginates automatically and accepts states and runner_ids filters. delete() accepts allow_missing=True, which makes deleting an already-deleted Volume succeed instead of raising.
Deleting a Volume that non-terminal sandboxes still mount fails with CWSANDBOX_VOLUME_IN_USE, which the Python client raises as VolumeInUseError. Stop the attached sandboxes first.
Volume states
A registered Volume moves through the following states over its lifecycle:wait_until_ready() polls until READY. It raises VolumeError if the Volume reaches ERROR or DELETING, and VolumeWaitTimeoutError if the timeout elapses first.
Failure reasons
Use this table to interpret the failure reasons that sandbox and Volume operations can return.Related resources
For more on related sandbox features, see the following resources:- File system snapshots: persist and restore a sandbox’s filesystem.
- Grant sandboxes access to AI Object Storage: read and write buckets from inside a sandbox.
- Sandbox configuration: the rest of the sandbox create options
- Distributed File Storage: create the PersistentVolumeClaims that registered Volumes point at.