> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runloop.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Mount Storage Objects

> Mount files and data objects to your Devboxes

<Tip>Start with the [Runloop Quickstart](/docs/tutorials/quickstart) to use the examples below.</Tip>

## 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.

<Note>
  See the [Storage Objects](/storage-objects/overview) guide for more information on creating and managing objects.
</Note>

### 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.

<CodeGroup>
  ```python Python theme={null}
  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
  ```

  ```typescript TypeScript theme={null}
  const textContent = 'Hello, world!';
  const objectName = 'hello.txt';
  const storageObject = await runloop.storageObject.uploadFromText(textContent, objectName);
  const storageObjectId = storageObject.id;
  ```
</CodeGroup>

## Mounting Storage Objects to a Devbox

Mount an object to a Devbox using the `mounts` parameter with `type: "object_mount"`:

<CodeGroup>
  ```python Python theme={null}
  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!
  ```

  ```typescript TypeScript theme={null}
  const devbox = await runloop.devbox.create({
    name: 'devbox-with-hello-txt',
    mounts: [{
      type: 'object_mount',
      object_id: storageObjectId,
      object_path: '/home/user/hello.txt'
    }]
  });
  const content = await devbox.file.read('/home/user/hello.txt');
  console.log(`file content: ${content}`);  // Hello, world!
  ```
</CodeGroup>

### Object Mount Parameters

| Parameter     | Required | Description                                      |
| ------------- | -------- | ------------------------------------------------ |
| `type`        | Yes      | Must be `"object_mount"`                         |
| `object_id`   | Yes      | The ID of the storage object to mount            |
| `object_path` | Yes      | Absolute 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](/docs/storage-objects/overview#uploading-and-mounting-an-archive-object) for more information.

<Note>
  Archive objects are automatically extracted to the specified path.
</Note>

Supported archive formats:

* `.gz`
* `.tar`
* `.tgz`
* `.tar.gz`

<CodeGroup>
  ```python Python theme={null}
  # 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}")
  ```

  ```typescript TypeScript theme={null}
  // Archive contents:
  // file1.txt
  // file/file2.txt

  const storageObject = await runloop.storageObject.fromId('ARCHIVE_OBJECT_ID');

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

  const file1Contents = await devbox.file.read('/home/user/archive_dir/file1.txt');
  const file2Contents = await devbox.file.read('/home/user/archive_dir/file/file2.txt');
  console.log(`Archive contents: file1.txt: ${file1Contents}`);
  console.log(`                  file2.txt: ${file2Contents}`);
  ```
</CodeGroup>

### Setup Command Working Directory

When an object mount or object-based agent includes setup commands, the working directory depends on the object's content type:

| Content Type                            | Working Directory                                                         |
| --------------------------------------- | ------------------------------------------------------------------------- |
| Archives (`.tar`, `.tar.gz`, `.tgz`)    | The mount path itself — setup commands run inside the extracted directory |
| Single files (binary, text, gzip, etc.) | The parent directory of the mount path                                    |

For example, if you mount an archive to `/home/user/my-agent`, setup commands run with `/home/user/my-agent` as the working directory. If you mount a single binary file to `/home/user/my-agent.bin`, setup commands run in `/home/user/`.

### Mounting Multiple Objects

You can mount multiple objects to different paths on the same Devbox:

<CodeGroup>
  ```python Python theme={null}
  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');
  ```

  ```typescript TypeScript theme={null}
  const 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');
  ```
</CodeGroup>

<Note>
  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`).
</Note>
