Skip to main content
Start with the Runloop Quickstart to use the examples below.

Overview

Storage Objects provide a way to store and manage files, data, and other resources that can be shared across Devboxes or made publicly available. The Storage Objects API supports uploading, downloading, listing, and managing access to stored content.
See the Storage Objects guide for more information on objects and their capabilities.

Key Features

  • File Storage: Upload and store files of various types and sizes
  • Public/Private Access: Control whether objects are publicly accessible or private
  • Download URLs: Generate secure, time-limited download URLs for objects
  • Cross-Devbox Sharing: Access objects from multiple Devboxes within your account

Mount Use Cases

Object mounts are particularly useful for a variety of larger files, including:
  • Pre-loading datasets: Mount training data or test datasets before running experiments
  • Configuration files: Inject configuration files or environment-specific settings
  • Model weights: Load pre-trained model weights or checkpoints
  • Static assets: Include images, templates, or other static resources
  • Shared data: Use the same data across multiple Devboxes by mounting the same object

Creating Objects

Upload a new object to store files or data that can be accessed by your Devboxes.
text_content = 'Hello, world!'
object_name = 'hello.txt'
storage_object = await runloop.storage_object.upload_from_text(text=text_content, name=object_name)
storage_object_id = storage_object.id

Mounting Storage Objects to a Devbox

Mount an object to a Devbox to make it available to the Devbox’s filesystem.
devbox = await runloop.devbox.create(
  name='devbox-with-hello-txt',
  mounts=[{
    type='object_mount',
    object_id=storage_object_id,
    object_path='/home/user/hello.txt'
  }]
)
content = await devbox.file.read('/home/user/hello.txt')
print(f"file content: {content}")  # Hello, world!

Mounting an Archive Object

You can mount an archive object to a Devbox to make it available to the Devbox’s filesystem. See how to upload an archive object for more information.
Archive objects are automatically extracted to the specified path.
Supported archive formats:
  • .gz
  • .tar
  • .tgz
  • .tar.gz
# Archive contents:
# file1.txt
# file/file2.txt

storage_object = await runloop.storage_object.from_id('ARCHIVE_OBJECT_ID');

devbox = await runloop.devbox.create(
  name='devbox-with-archive-object',
  mounts=[{
    type='object_mount',
    object_id=storage_object.id,
    object_path='/home/user/archive_dir'
  }]
)

file1_contents = devbox.file.read('/home/user/archive_dir/file1.txt')
file2_contents = devbox.file.read('/home/user/archive_dir/file/file2.txt')
print(f"Archive contents: file1.txt: {file1_contents}")
print(f"                  file2.txt: {file2_contents}")

Mounting Multiple Objects

You can mount multiple objects to different paths on the same Devbox:
devbox = await runloop.devboxes.create(
  name="multi-data-devbox",
  mounts=[
    {
      "type": "object_mount",
      "object_id": "TRAINING_DATA_OBJECT_ID",
      "object_path": "/home/user/training_data.csv"
    },
    {
      "type": "object_mount",
      "object_id": "CONFIG_OBJECT_ID",
      "object_path": "/home/user/config.json"
    },
    {
      "type": "object_mount",
      "object_id": "MODEL_OBJECT_ID",
      "object_path": "/home/user/model.pkl"
    }
  ]
)
await devbox.file.read('/home/user/training_data.csv');
await devbox.file.read('/home/user/config.json');
await devbox.file.read('/home/user/model.pkl');
Object paths must be absolute paths (e.g., /home/user/file.txt). If the object is an archive, specify the directory where it should be extracted (e.g., /home/user/archive_dir).