Skip to main content
Volumes persist data independently of a sandbox. Mount them into sandboxes for runtime access, or manage their files directly through volume.files.

Volume Objects

MethodUse
Volume.create(name=...)Create a persistent volume.
Volume.get(id) / Volume.from_id(id)Load by ID.
Volume.get_by_name(name) / Volume.from_name(name, create_if_missing=True)Load by name, optionally creating it.
Volume.list(...)List volumes with filters and field selection.
volume.get_info(fields=...)Refresh or inspect volume metadata.
volume.delete()Delete the volume and its persistent data.
volume.mount(path=..., read_only=False, subpath=None)Create a mount descriptor for Sandbox.create(volumes=[...]).
volume.attachments()List sandbox attachments that currently reference the volume.
Use volume.mount(...) for create-time sandbox mounts. Use sandbox.attach_volume(...), sandbox.detach_volume(...), sandbox.get_volume_health(...), and sandbox.remount_volume(...) for runtime attachment management on a running sandbox.

Direct Volume Files

NamespaceUse
volume.files.read/write/write_filesManage persistent files without starting a sandbox.
volume.files.list/info/existsInspect volume paths and metadata.
volume.files.upload_file/upload_dir/resume_uploadUpload data directly to a volume.
volume.files.download_file/download_dirDownload files or directory archives.
volume.files.find_files/search_files/replace_in_files/watch_dirSearch, replace, and watch persistent data.
from nullspace import Sandbox, Volume

volume = Volume.from_name("team-data", create_if_missing=True)

with Sandbox.create(template="base", volumes=[volume.mount("/data")]) as sandbox:
    sandbox.commands.run("echo hello > /data/hello.txt", shell=True)

print(volume.files.read("/hello.txt"))