Esta página se muestra en inglés. Una traducción al español está en curso.
WorkflowsMay 7, 2026·3 min de lectura

Modal Volumes — Persistent Storage for AI Workloads

Modal Volumes are content-addressed persistent storage for Modal. Mount as a Linux filesystem, share across runs, version with .commit().

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: New
Entrada
Asset
Comando CLI universal
npx tokrepo install af427a6d-eecc-4a38-ade8-69caf6274e0b
Introducción

Modal Volumes give your Modal Functions and Sandboxes persistent storage that survives across runs. Mount as a regular Linux filesystem, share between Functions and Sandboxes, version checkpoints with .commit(). Best for: caching pip packages and model weights, ML training datasets, agent workspaces that span multiple runs. Works with: Modal SDK. Setup time: 1 minute.


Create + mount

import modal

app = modal.App("ml-pipeline")
volume = modal.Volume.from_name("model-cache", create_if_missing=True)

@app.function(volumes={"/cache": volume})
def download_model():
    import huggingface_hub
    huggingface_hub.snapshot_download(
        "meta-llama/Llama-3-8B",
        cache_dir="/cache",
    )
    volume.commit()  # checkpoint to durable storage

Cache pip packages across runs

pip_cache = modal.Volume.from_name("pip-cache", create_if_missing=True)

image = modal.Image.debian_slim().run_commands(
    "pip install --target=/pip-cache transformers torch",
).env({"PYTHONPATH": "/pip-cache"})

@app.function(image=image, volumes={"/pip-cache": pip_cache})
def train(): ...

Cold starts drop from minutes to seconds because packages are already on the volume.

Share data between Function and Sandbox

data_vol = modal.Volume.from_name("ingest", create_if_missing=True)

@app.function(volumes={"/data": data_vol})
def ingest():
    download_csv_files("/data/raw/")
    data_vol.commit()

@app.function(volumes={"/data": data_vol})
def analyze():
    data_vol.reload()  # pick up the latest committed snapshot
    return run_analysis("/data/raw/")

Use as agent workspace

workspace = modal.Volume.from_name("agent-runs", create_if_missing=True)

# Each agent run gets its own subdirectory
sb = modal.Sandbox.create(
    image=image,
    volumes={"/work": workspace},
    workdir="/work/run-{run_id}",
)

sb.exec("python", "agent.py")
workspace.commit()  # save the work

Later runs read the workspace history; the agent has long-term memory across sessions.


FAQ

Q: How is Volume different from S3? A: Volumes mount as a Linux filesystem (no S3 API translation). Faster random reads, integrated with Modal's image cache. For purely archival or external access, S3 is still the right choice.

Q: Are Volumes versioned? A: Yes — every .commit() creates a new version. You can read prior versions with volume.reload(commit_id=...). Useful for rollbacks and reproducibility.

Q: How big can a Volume be? A: Practically unlimited. The hot tier is fast (NVMe-class); colder data is offloaded transparently. You're billed for storage used, but the limit isn't hard.


Quick Use

  1. pip install modal
  2. volume = modal.Volume.from_name("my-vol", create_if_missing=True)
  3. Mount in any Function or Sandbox via volumes={"/path": volume}, call .commit() to checkpoint

Intro

Modal Volumes give your Modal Functions and Sandboxes persistent storage that survives across runs. Mount as a regular Linux filesystem, share between Functions and Sandboxes, version checkpoints with .commit(). Best for: caching pip packages and model weights, ML training datasets, agent workspaces that span multiple runs. Works with: Modal SDK. Setup time: 1 minute.


Create + mount

import modal

app = modal.App("ml-pipeline")
volume = modal.Volume.from_name("model-cache", create_if_missing=True)

@app.function(volumes={"/cache": volume})
def download_model():
    import huggingface_hub
    huggingface_hub.snapshot_download(
        "meta-llama/Llama-3-8B",
        cache_dir="/cache",
    )
    volume.commit()  # checkpoint to durable storage

Cache pip packages across runs

pip_cache = modal.Volume.from_name("pip-cache", create_if_missing=True)

image = modal.Image.debian_slim().run_commands(
    "pip install --target=/pip-cache transformers torch",
).env({"PYTHONPATH": "/pip-cache"})

@app.function(image=image, volumes={"/pip-cache": pip_cache})
def train(): ...

Cold starts drop from minutes to seconds because packages are already on the volume.

Share data between Function and Sandbox

data_vol = modal.Volume.from_name("ingest", create_if_missing=True)

@app.function(volumes={"/data": data_vol})
def ingest():
    download_csv_files("/data/raw/")
    data_vol.commit()

@app.function(volumes={"/data": data_vol})
def analyze():
    data_vol.reload()  # pick up the latest committed snapshot
    return run_analysis("/data/raw/")

Use as agent workspace

workspace = modal.Volume.from_name("agent-runs", create_if_missing=True)

# Each agent run gets its own subdirectory
sb = modal.Sandbox.create(
    image=image,
    volumes={"/work": workspace},
    workdir="/work/run-{run_id}",
)

sb.exec("python", "agent.py")
workspace.commit()  # save the work

Later runs read the workspace history; the agent has long-term memory across sessions.


FAQ

Q: How is Volume different from S3? A: Volumes mount as a Linux filesystem (no S3 API translation). Faster random reads, integrated with Modal's image cache. For purely archival or external access, S3 is still the right choice.

Q: Are Volumes versioned? A: Yes — every .commit() creates a new version. You can read prior versions with volume.reload(commit_id=...). Useful for rollbacks and reproducibility.

Q: How big can a Volume be? A: Practically unlimited. The hot tier is fast (NVMe-class); colder data is offloaded transparently. You're billed for storage used, but the limit isn't hard.


Source & Thanks

Built by Modal. Commercial product with free tier.

modal.com/docs — Volumes documentation

🙏

Fuente y agradecimientos

Built by Modal. Commercial product with free tier.

modal.com/docs — Volumes documentation

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados