Modal Run logo

Modal Run

OrganizationPopular
ai4s-research
modal-run

Use when the user asks to run heavy or GPU work on Modal (the cloud compute platform) — writing a Modal function in the workspace, running it with the user's own `modal` CLI + token, and bringing results back. Data-to-compute for jobs too big for the laptop, without a Slurm cluster.

Overview

Publisherai4s-research
Repositoryopen-science
Skill namemodal-run
Stars
1.7K
Forks
201
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by ai4s-research on GitHub. Read the source before you install it.

Installation

Install the Modal Run AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ai4s-research/open-science.git /tmp/open-science
mkdir -p .claude/skills
cp -r /tmp/open-science/runtime/skills/core/modal-run .claude/skills/modal-run
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Modal Run in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Modal Run on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Modal Run is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Run compute on Modal

Modal runs code in the cloud on demand (CPU/GPU), billed to the user's own Modal account. Like the HPC/Slurm path, the app never handles credentials — you use the user's installed modal CLI and their token. Prefer local execution or Slurm first; reach for Modal when the job needs cloud GPUs or elastic scale and no cluster is available.

1 · Check Modal is ready

Modal must be installed and authenticated (the Settings Cloud compute (Modal) card shows this). Verify before writing code:

bash
modal --version          # installed?
test -f ~/.modal.toml && echo "authenticated" || echo "run: modal token new"

If it is not installed, tell the user to pip install modal; if not authenticated, ask them to run modal token new in their terminal (it opens a browser). Do not attempt to create or store tokens yourself.

2 · Write the Modal function into the workspace

Put the script in the workspace so provenance records it. Pin dependencies in the image so the run is reproducible, and fix any random seed.

python
# compute.py — run with:  modal run compute.py
import modal

app = modal.App("open-science-job")
image = modal.Image.debian_slim().pip_install("numpy==1.26.4", "scipy==1.13.1")

@app.function(image=image, gpu=None, timeout=1800)  # set gpu="A10G" etc. if needed
def run(n: int = 1_000_000):
    import numpy as np
    rng = np.random.default_rng(0)          # fixed seed → reproducible
    x = rng.standard_normal(n)
    return {"n": n, "mean": float(x.mean()), "std": float(x.std())}

@app.local_entrypoint()
def main():
    result = run.remote()
    print(result)                            # printed locally; capture it below

3 · Run it and capture the result

modal run executes remotely and streams logs + the local entrypoint's stdout back. Write the result into a fresh, immutable result directory so it becomes a traceable artifact and does not overwrite a previous run:

bash
RESULT=results/<job-name>/<YYYYmmdd-HHMMSS>
mkdir -p "$RESULT"
modal run compute.py | tee "$RESULT"/modal_result.txt

For large outputs, have the function write to a Modal Volume and download with modal volume get, rather than returning big objects. Download every run into its own RESULT directory; never reuse a recorded output path.

4 · Record the run (reproducibility) — REQUIRED, every time

Modal runs on remote cloud hardware the app can't see, so this call is the ONLY thing that makes the run exist in Runs. Do it after every completed run — including quick re-runs. Skipping it loses the run entirely (it shows in neither the global Runs view nor the session). Record it after it completes (from the workspace root):

Record it completely: --code once per script that ran, and --output once per file you captured or downloaded (the streamed result and any modal volume get files) — not just the summary. Output paths must be under the fresh RESULT directory; the helper refuses to record paths used by earlier runs.

bash
python "$XDG_CONFIG_HOME/opencode/skills/modal-run/record_run.py" \
  --surface modal --command "modal run compute.py" \
  --status <ok|failed> --host "modal:<app-name>" \
  --hardware "<the gpu= from @app.function, e.g. A10G — or 'CPU'>" \
  --code compute.py --output "$RESULT"/modal_result.txt \
  --output "$RESULT"/<each downloaded file> \
  --session-id "$(cat .openscience/session.txt 2>/dev/null)"

--session-id attaches the run to this session (empty-safe if the marker's absent).

The environment is reproduced by the modal.Image definition in compute.py (pinned pip_install + base image — already versioned in the workspace), so record the GPU/hardware string, not a package list, and no --env-file is needed. Use --status failed if the run errored.

Rules

  • User's account only. Never handle, print, or store Modal tokens.
  • Reproducible. Pin image packages and fix seeds; record the script + result in the workspace (provenance captures them).
  • Cost-aware. Modal bills the user — keep timeout bounded, don't request a GPU unless the work needs one, and say what you're about to run before a large job.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Modal Run AI skill do?

Use when the user asks to run heavy or GPU work on Modal (the cloud compute platform) — writing a Modal function in the workspace, running it with the user's own `modal` CLI + token, and bringing results back. Data-to-compute for jobs too big for the laptop, without a Slurm cluster.

Why use Modal Run on TypingMind?

Because you install it once and use it with any model. Modal Run is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Modal Run in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/ai4s-research/open-science/tree/master/runtime/skills/core/modal-run. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Modal Run?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Modal Run?

As many as you like. As long as a model supports skills, you can use Modal Run with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Modal Run AI skill free?

It is published on GitHub by ai4s-research. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇