Skip to main content
Create persistent volumes with Volume.create(). Volume creation is idempotent - calling create with the same name returns the existing volume.

Basic Usage

from moru import Volume

# Create a volume
vol = Volume.create(name="my-workspace")

print(f"Volume ID: {vol.volume_id}")
print(f"Name: {vol.name}")

Idempotent Creation

Creating a volume with a name that already exists returns the existing volume:
from moru import Volume

# First create
vol1 = Volume.create(name="shared-data")

# Second create with same name returns existing
vol2 = Volume.create(name="shared-data")

assert vol1.volume_id == vol2.volume_id  # Same volume!

Volume Naming

Volume names must follow these rules:
  • Start with a lowercase letter
  • Contain only lowercase letters, numbers, and hyphens
  • Maximum 63 characters
  • No uppercase letters
# Valid names
Volume.create(name="my-workspace")
Volume.create(name="agent-data-v2")
Volume.create(name="project123")

# Invalid names (will raise error)
Volume.create(name="MyWorkspace")    # No uppercase
Volume.create(name="123-data")       # Must start with letter
Volume.create(name="")               # Cannot be empty

Get Volume

Retrieve a volume by ID or name:
from moru import Volume

# Get by ID
vol = Volume.get("vol_abc123...")

# Get by name
vol = Volume.get("my-workspace")

print(f"Size: {vol.total_size_bytes} bytes")
print(f"Files: {vol.total_file_count}")

List Volumes

List all volumes in your team:
from moru import Volume

volumes = Volume.list()

for vol in volumes:
    print(f"{vol.name}: {vol.total_size_bytes} bytes")

Delete Volume

Delete a volume and all its data:
from moru import Volume

vol = Volume.get("my-workspace")
vol.delete()

# Or delete by name directly
Volume.get("old-data").delete()
Deleting a volume permanently removes all data. This cannot be undone.

Volume Info

The volume object includes:
PropertyDescription
volume_id / volumeIdUnique identifier (vol_xxx)
nameVolume name
total_size_bytes / totalSizeBytesTotal storage used
total_file_count / totalFileCountNumber of files
created_at / createdAtCreation timestamp
updated_at / updatedAtLast modification timestamp

Next Steps