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

Overview

Object Mounts allow you to attach storage objects to your Devbox at creation time. This is ideal for large files, datasets, model weights, and archives that you want to reuse across multiple Devboxes.
See the Storage Objects guide for more information on creating and managing objects.

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

Use Cases

Object mounts are particularly useful for:
  • 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 using the mounts parameter with type: "object_mount":
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!

Object Mount Parameters

ParameterRequiredDescription
typeYesMust be "object_mount"
object_idYesThe ID of the storage object to mount
object_pathYesAbsolute path where the object should be mounted

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.devbox.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).