kalarislabs/research-agent-skills/modal-serverless-gpu
Claude Code and agent skill by kalarislabs/research-agent-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Serverless GPU cloud platform for running ML workloads. Use when you need on-demand GPU access without infrastructure management, deploying ML models as APIs, or running batch jobs with automatic scaling.
Install
npx vskill@latest install kalarislabs/research-agent-skills/modal-serverless-gpuSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as kalarislabs/research-agent-skills/modal-serverless-gpu.
Modal Serverless GPU
Comprehensive guide to running ML workloads on Modal's serverless GPU cloud platform.
When to use Modal
Use Modal when:
- Running GPU-intensive ML workloads without managing infrastructure
- Deploying ML models as auto-scaling APIs
- Running batch processing jobs (training, inference, data processing)
- Need pay-per-second GPU pricing without idle costs
- Prototyping ML applications quickly
- Running scheduled jobs (cron-like workloads)
Key features:
- Serverless GPUs: T4, L4, A10G, L40S, A100, H100, H200, B200 on-demand
- Python-native: Define infrastructure in Python code, no YAML
- Auto-scaling: Scale to zero, scale to 100+ GPUs instantly
- Sub-second cold starts: Rust-based infrastructure for fast container launches
- Container caching: Image layers cached for rapid iteration
- Web endpoints: Deploy functions as REST APIs with zero-downtime updates
Use alternatives instead:
- RunPod: For longer-running pods with persistent state
- Lambda Labs: For reserved GPU instances
- SkyPilot: For multi-cloud orchestration and cost optimization
- Kubernetes: For complex multi-service architectures
Quick start
Installation
Hello World with GPU
Run: modal run hello_gpu.py
Basic inference endpoint
Core concepts
Key components
| Component | Purpose | |
|---|---|---|
App | Container for functions and resources | |
Function | Serverless function with compute specs | |
Cls | Class-based functions with lifecycle hooks | |
Image | Container image definition | |
Volume | Persistent storage for models/data | |
Secret | Secure credential storage |
Execution modes
| Command | Description | |
|---|---|---|
modal run script.py | Execute and exit | |
modal serve script.py | Development with live reload | |
modal deploy script.py | Persistent cloud deployment |
GPU configuration
Available GPUs
| GPU | VRAM | Best For | |
|---|---|---|---|
T4 | 16GB | Budget inference, small models | |
L4 | 24GB | Inference, Ada Lovelace arch | |
A10G | 24GB | Training/inference, 3.3x faster than T4 | |
L40S | 48GB | Recommended for inference (best cost/perf) | |
A100-40GB | 40GB | Large model training | |
A100-80GB | 80GB | Very large models | |
H100 | 80GB | Fastest, FP8 + Transformer Engine | |
H200 | 141GB | Auto-upgrade from H100, 4.8TB/s bandwidth | |
B200 | Latest | Blackwell architecture |
GPU specification patterns
Container images
Persistent storage
Web endpoints
FastAPI endpoint decorator
Full ASGI app
Web endpoint types
| Decorator | Use Case | |
|---|---|---|
@modal.fastapi_endpoint() | Simple function → API | |
@modal.asgi_app() | Full FastAPI/Starlette apps | |
@modal.wsgi_app() | Django/Flask apps | |
@modal.web_server(port) | Arbitrary HTTP servers |
Dynamic batching
Secrets management
Scheduling
Performance optimization
Cold start mitigation
Model loading best practices
Parallel processing
Common configuration
Debugging
Common issues
| Issue | Solution | |
|---|---|---|
| Cold start latency | Increase container_idle_timeout, use @modal.enter() | |
| GPU OOM | Use larger GPU (A100-80GB), enable gradient checkpointing | |
| Image build fails | Pin dependency versions, check CUDA compatibility | |
| Timeout errors | Increase timeout, add checkpointing |
References
- [Advanced Usage](references/advanced-usage.md) - Multi-GPU, distributed training, cost optimization
- [Troubleshooting](references/troubleshooting.md) - Common issues and solutions
Resources
- Documentation: https://modal.com/docs
- Examples: https://github.com/modal-labs/modal-examples
- Pricing: https://modal.com/pricing
- Discord: https://discord.gg/modal
Agent operating procedure
- Check the environment. Confirm hardware, framework and server versions, model format, and expected load.
- Pin down the inputs. Confirm formats, identifiers and parameters from the data or the user. Ask rather than guess any value that changes the result.
- Run a small version first. Serve or log a single request or run end to end before scaling.
- Execute the full task using the instructions and references above.
- Validate the result. Measure latency, throughput and output correctness against a reference; check resource usage and costs.
- Report. State what was run (versions, commands, parameters), what was checked, and what is still uncertain.
| If this happens | Do this | |
|---|---|---|
| The server fails to start or OOMs | Check model size versus memory, quantization and parallelism settings. | |
| A function, flag or endpoint in these instructions is missing in the installed version | Check the installed version's own documentation (help(), --help, official docs), adapt, and tell the user. Never invent an API. | |
| A required input, identifier or parameter is ambiguous | Ask the user, or state the assumption explicitly before running. |
Integrity rules
- Never fabricate results, parameters, identifiers, citations or statistics. If something cannot be run or verified, say so plainly.
- Do not expose services or credentials publicly; confirm cloud costs before provisioning.
- Treat version-specific details here as possibly outdated: confirm them against the official documentation for the installed version.
- Ask before actions that cost money, consume shared GPUs or cloud quota, touch personal or patient data, or cannot be undone.
Related skills
modal: Modal is a serverless cloud platform for running Python on demand, including on-demand GPUs.skypilot-multi-cloud-orchestration: Multi-cloud orchestration for ML workloads with automatic cost optimization.lambda-labs-gpu-cloud: Reserved and on-demand GPU cloud instances for ML training and inference.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/modal-serverless-gpu/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kalarislabs/research-agent-skills/modal-serverless-gpu)