Skip to content
Data
Skill

/modal

Modal token secret.

From plugin
scientific-agent-skills
56k177 skills

Claude Code

$ npx -y skills add K-Dense-AI/scientific-agent-skills --skill modal --agent claude-code

SKILL.md

modal.SKILL.md
name: modal
description: Modal is a serverless cloud platform for running Python on demand, including on-demand GPUs. Use when deploying or serving AI/ML models, running GPU-accelerated workloads (training, fine-tuning, inference), serving web endpoints, scheduling batch jobs, or scaling Python code to cloud containers with the Modal SDK.
license: Apache-2.0
compatibility: Requires Python 3.10-3.14 and modal 1.6.0. Cloud execution needs a Modal account, authentication and network access; GPU use needs a payment method. Workload dependencies belong in their container Images.
metadata:
  version: "1.5"
  last-reviewed: "2026-09-30"
  tested-sdk: "modal 1.6.0"
  skill-author: K-Dense Inc.
  openclaw:
    envVars:
    - name: MODAL_TOKEN_ID
      required: false
      description: Modal token id.
    - name: MODAL_TOKEN_SECRET
      required: false
      description: Modal token secret.

Modal

Overview

Modal is a cloud platform for running Python code serverlessly, with a focus on AI/ML workloads. Key capabilities:

  • **GPU compute** on demand (including H100, H200, B200 and B300)
  • **Serverless functions** with autoscaling from zero to thousands of containers
  • **Custom container images** built entirely in Python code
  • **Persistent storage** via Volumes for model weights and datasets
  • **Web endpoints** for serving models and APIs
  • **Scheduled jobs** via cron or fixed intervals
  • **Container reuse** and warm pools to reduce cold starts (model loading still takes time)

Modal Apps and Images are defined in Python; existing Dockerfiles are also supported.

When to Use This Skill

Use this skill when:

  • Deploy or serve AI/ML models in the cloud
  • Run GPU-accelerated computations (training, inference, fine-tuning)
  • Create serverless web APIs or endpoints
  • Scale batch processing jobs in parallel
  • Schedule recurring tasks (data pipelines, retraining, scraping)
  • Need persistent cloud storage for model weights or datasets
  • Want to run code in custom container environments
  • Build job queues or async task processing systems

Installation and Authentication

Install

uv pip install "modal==1.6.0"

Reviewed against SDK 1.6.0 and current [release notes](https://modal.com/docs/sdk/py/releases). Local SDK construction and selected handlers were tested; remote builds, deployments, GPU inference and cloud limits were not executed. Snippets using model/data placeholders or third-party workloads are illustrative and require their stated dependencies.

Authenticate

Prefer existing credentials before creating new ones. Only the two Modal-specific variables below are relevant โ€” do not read, load, or expose any other environment variables or `.env` file contents:

1. Reuse an existing Modal profile, or check whether both `MODAL_TOKEN_ID` and `MODAL_TOKEN_SECRET` are set; report presence only. 2. If not, look up only those two keys in a local `.env` file (ignore all other entries) and load them if appropriate for the workflow. 3. Only fall back to interactive `modal setup` if no usable profile or token pair exists. The SDK supports profiles in `.modal.toml`; environment tokens are optional when a profile authenticates.

modal setup

This opens a browser for authentication. For CI/CD or headless environments, use environment variables:

export MODAL_TOKEN_ID=<your-token-id>
export MODAL_TOKEN_SECRET=<your-token-secret>

If neither an existing profile nor a token pair is available, create credentials at https://modal.com/settings

Check [current pricing](https://modal.com/pricing) and workspace quotas before sizing a run. GPU use requires a payment method even when credits remain.

**Reference**: See `references/getting-started.md` for detailed setup and first app walkthrough.

Core Concepts

App and Functions

A Modal `App` groups related functions. Functions decorated with `@app.function()` run remotely in the cloud:

import modal

app = modal.App("my-app")

@app.function()
def square(x):
    return x ** 2

@app.local_entrypoint()
def main():
    # .remote() runs in the cloud
    print(square.remote(42))

Run with `modal run script.py`. Deploy with `modal deploy script.py`.

**Reference**: See `references/functions.md` for lifecycle hooks, classes, `.map()`, `.spawn()`, and more.

Container Images

Modal builds container images from Python code. The recommended package installer is `uv`:

image = (
    modal.Image.debian_slim(python_version="3.11")
    .uv_pip_install("torch==2.12.0", "transformers==5.9.0", "accelerate==1.13.0")
    .apt_install("git")
)

@app.function(image=image, gpu="L40S")
def inference(prompt):
    from transformers import pipeline
    pipe = pipeline("text-generation", model="openai-community/gpt2", device=0)
    return pipe(prompt)

Key image methods:

  • `.uv_pip_install()` โ€” Install Python packages with uv (recommended)
  • `.pip_install()` โ€” Install with pip (fallback)
  • `.apt_install()` โ€” Install system packages
  • `.run_commands()` โ€” Run shell commands during build
  • `.run_function()` โ€” Run Python during build (e.g., download model weights)
  • `.add_local_python_source()` โ€” Add local modules
  • `.env()` โ€” Set environment variables

**Reference**: See `references/images.md` for Dockerfiles, micromamba, caching, GPU build steps.

GPU Compute

Request GPUs via the `gpu` parameter:

@app.function(gpu="H100")
def train_model():
    import torch
    device = torch.device("cuda")
    # GPU training code here

# Multiple GPUs
@app.function(gpu="H100:4")
def distributed_training():
    ...

# GPU fallback chain
@app.function(gpu=["H100", "A100-80GB", "A100-40GB"])
def flexible_inference():
    ...

Available GPU strings include T4, L4, A10, L40S, A100, A100-40GB, A100-80GB, RTX-PRO-6000, H100, H200, B200, B200+ and B300.

  • GPUs are always specified as **strings** (e.g. `gpu="H100"`, `gpu="H100:4"`). The old `modal.gpu.*` objects are deprecated as of v0.73.31.
  • Up to 8 GPU
Read more
@k-dense-ai
Ships withscientific-agent-skills

๐Ÿ”” Claude Scientific Skills is now Scientific Agent Skills. Same skills, broader compatibility โ€” now works with any AI agent that supports the open Agent Skills standard, not just Claude.

Stars on GitHub

Momentum

stars in total
55.6k
Star history of K-Dense-AI/scientific-agent-skills on GitHub, a chart by star-history.com

Other skills on scientific-agent-skills.

aeon

aeon

This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting,โ€ฆ

More skills from other plugins.

paddleocr-doc-parsing

paddleocr-doc-parsing

Use this skill to extract structured Markdown/JSON from PDFs and document imagesโ€”tables with cell-level precision, formulas asโ€ฆ

@paddlepaddle@paddlepaddleInstall Skill
context-loader
Auto-invoked

context-loader

Search memories from earlier Pi sessions in this repository. Use it when earlier work may already explain the code, error,โ€ฆ

mem04d69k
@mem0ai@mem0aiInstall Skill
analyzing-ai-citations

analyzing-ai-citations

Answer AI citation and answer engine optimization (AEO) questions in PostHog: whether AI answer engines (ChatGPT, Claude, and anโ€ฆ

posthog10d41k
@posthog@posthogInstall Skill
qmd

qmd

Search local markdown knowledge bases, notes, docs, and wikis with QMD. Use when users ask to find notes, retrieve documents,โ€ฆ

qmd3w31k
@tobi@tobiInstall Skill

Questions about modal.

Which coding agents can use modal?
modal installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.