
Modal
Run GPU-heavy or batch Python jobs as autoscaling Modal functions without managing your own servers.
Overview
Modal is an agent skill most often used in Build (also Operate) that documents Modal’s Python API for deploying and invoking autoscaling serverless functions and classes.
Install
npx skills add https://github.com/k-dense-ai/scientific-agent-skills --skill modalWhat is this skill?
- Reference for modal.App, modal.Function, and modal.Cls decorators and deployment units
- Documents remote, local, spawn, map, starmap, and parallel batch invocation patterns
- Covers runtime overrides: GPU selection, concurrency, dynamic batching, and autoscaler updates
- Explains cross-app references via from_name and hydration instead of deprecated lookup/resolve
Adoption & trust: 528 installs on skills.sh; 27.6k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need to run Python in the cloud with GPUs and elastic scale but keep mistaking Modal’s App, Function, and remote invocation APIs.
Who is it for?
Indie builders shipping Python APIs, ML inference, or batch jobs on Modal without maintaining fixed servers.
Skip if: Teams that only need static VPS deploys, non-Python stacks with no Modal footprint, or a turnkey CI/CD pipeline skill.
When should I use this skill?
You are implementing or debugging Modal App, Function, or Cls APIs, remote execution, or autoscaler-related options in Python.
What do I get? / Deliverables
You can structure Modal apps, pick the right execution primitive, and tune concurrency or batching when calling deployed functions.
- Correct Modal decorator and invocation patterns in code
- Tuned GPU, concurrency, or batching settings for target workloads
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Modal is most often shelved under Build because teams wire serverless functions and class lifecycles while shipping product backends and ML pipelines. Integrations fits Modal’s core job: connecting app code to Modal’s App, Function, Cls APIs and remote execution patterns.
Where it fits
Wrap a research pipeline as modal.Function with GPU and call .remote from your API.
Model batch scoring with .map over inputs instead of a single long-running VM.
Adjust concurrency and batching after latency spikes without redeploying all code paths.
How it compares
API reference for Modal serverless Python—not a generic Docker or Kubernetes deploy skill.
Common Questions / FAQ
Who is modal for?
Solo and indie builders using Claude Code, Cursor, or Codex who deploy Python workloads on Modal and want accurate decorator and invocation semantics at hand.
When should I use modal?
During Build when wiring backend or agent integrations to Modal; during Operate when tuning autoscalers, GPU options, or parallel map jobs on live functions.
Is modal safe to install?
Treat it as documentation-only guidance; review the Security Audits panel on this Prism page and your own secrets handling before granting agents network or cloud deploy access.
SKILL.md
READMESKILL.md - Modal
# Modal API Reference ## Core Classes ### modal.App The main unit of deployment. Groups related functions. ```python app = modal.App("my-app") ``` | Method | Description | |--------|-------------| | `app.function(**kwargs)` | Decorator to register a function | | `app.cls(**kwargs)` | Decorator to register a class | | `app.local_entrypoint()` | Decorator for local entry point | ### modal.Function A serverless function backed by an autoscaling container pool. | Method | Description | |--------|-------------| | `.remote(*args)` | Execute in the cloud (sync) | | `.local(*args)` | Execute locally | | `.spawn(*args)` | Execute async, returns `FunctionCall` | | `.map(inputs)` | Parallel execution over inputs | | `.starmap(inputs)` | Parallel execution with multiple args | | `.for_each(inputs)` | Like `.map()` but discards outputs | | `.spawn_map(inputs)` | Spawn a parallel map without waiting | | `.from_name(app, fn)` | Reference a deployed function (replaces deprecated `.lookup`) | | `.hydrate()` | Force-fetch server metadata (replaces deprecated `.resolve()`) | | `.with_options(gpu=, ...)` | New autoscaling variant with overridden config | | `.with_concurrency(max_inputs=, target_inputs=)` | Override input concurrency at invocation | | `.with_batching(max_batch_size=, wait_ms=)` | Override dynamic batching at invocation | | `.update_autoscaler(**kwargs)` | Dynamic scaling update | ### modal.Cls A serverless class with lifecycle hooks. ```python @app.cls(gpu="L40S") class MyClass: @modal.enter() def setup(self): ... @modal.method() def run(self, data): ... @modal.exit() def cleanup(self): ... ``` | Decorator | Description | |-----------|-------------| | `@modal.enter()` | Container startup hook | | `@modal.exit()` | Container shutdown hook | | `@modal.method()` | Expose as callable method | | `@modal.parameter()` | Class-level parameter | Look up a deployed Cls with `Model = modal.Cls.from_name("app", "Model")`, then instantiate before calling: `Model().method.remote(...)`. Override config at invocation with `Model.with_options(gpu="H200", max_containers=10)`. ## Image ### modal.Image Defines the container environment. | Method | Description | |--------|-------------| | `.debian_slim(python_version=)` | Debian base image | | `.from_registry(tag)` | Docker Hub image | | `.from_dockerfile(path)` | Build from Dockerfile | | `.micromamba(python_version=)` | Conda/mamba base | | `.uv_pip_install(*pkgs)` | Install with uv (recommended) | | `.pip_install(*pkgs)` | Install with pip | | `.pip_install_from_requirements(path)` | Install from file | | `.apt_install(*pkgs)` | Install system packages | | `.run_commands(*cmds)` | Run shell commands | | `.run_function(fn)` | Run Python during build | | `.add_local_dir(local, remote)` | Add directory | | `.add_local_file(local, remote)` | Add single file | | `.add_local_python_source(module)` | Add Python module | | `.env(dict)` | Set environment variables | | `.pipe(recipe_fn)` | Apply a reusable Image recipe | | `.imports()` | Context manager for remote imports | > `add_local_dir`/`add_local_file`/`add_local_python_source` replace the deprecated > `copy_local_*` methods and the removed `modal.Mount` object / `mount=` / `context_mount=` > parameters. ## Storage ### modal.Volume Distributed persistent file storage. ```python vol = modal.Volume.from_name("name", create_if_missing=True) ``` | Method | Description | |--------|-------------| | `.from_name(name)` | Reference or create a volume | | `.commit()` | Force immediate commit | | `.reload()` | Refresh to see other containers' writes | | `.with_mount_options(read_only=, sub_path=)` | Read-only or subdirectory mount | Mount: `@app.function(volumes={"/path": vol})` ### modal.NetworkFileSystem Legacy shared storage (superseded by Volume). ## Sandboxes ### modal.Sandbox Isolated, programmatically controlled containers for running untrusted or dynamically generated code. ```python app = modal.App.