Skip to content

K-Dense-AI/scientific-agent-skills / skills/modal

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.

FileKindSize
SKILL.mdskill md17.6 KB
references/api_reference.mdmarkdown8.5 KB
references/examples.mdmarkdown10.3 KB
references/functions.mdmarkdown8.3 KB
references/getting-started.mdmarkdown4.7 KB
references/gpu.mdmarkdown6.5 KB
references/images.mdmarkdown7.3 KB
references/resources.mdmarkdown3.2 KB
references/scaling.mdmarkdown6.5 KB
references/scheduled-jobs.mdmarkdown4.3 KB
references/secrets.mdmarkdown3.9 KB
references/volumes.mdmarkdown6.8 KB
references/web-endpoints.mdmarkdown8.2 KB

references/resources.md

View on GitHub
# Modal Resource Configuration

Reviewed against SDK 1.6.0 and the official [resource guide](https://modal.com/docs/guide/resources)
and [timeout guide](https://modal.com/docs/guide/timeouts). Examples are configuration
fragments; no remote allocation or billing was measured.

## CPU

### Requesting CPU

```python
@app.function(cpu=4.0)
def compute():
    ...
```

- Values are **physical cores**, not vCPUs
- Default: 0.125 cores
- Modal auto-sets `OPENBLAS_NUM_THREADS`, `OMP_NUM_THREADS`, `MKL_NUM_THREADS` based on your CPU request

### CPU Limits

- Default soft limit: 16 physical cores above the CPU request
- Set explicit limits to prevent noisy-neighbor effects:

```python
@app.function(cpu=(1.0, 4.0))  # Request 1 core, soft limit 4 cores
def bounded_compute():
    ...
```

## Memory

### Requesting Memory

```python
@app.function(memory=16384)  # 16 GiB in MiB
def large_data():
    ...
```

- Value in **MiB** (mebibytes)
- Default: 128 MiB

### Memory Limits

Set hard memory limits to OOM-kill containers that exceed them:

```python
@app.function(memory=(8192, 16384))  # 8 GiB request, 16 GiB hard limit
def bounded_memory():
    ...
```

This prevents paying for runaway memory leaks.
A scalar `memory=8192` is a request, not an explicit hard limit. Requests/limits
are validated against platform capacity; do not assume a requested allocation is available.

## Ephemeral Disk

For temporary storage within a container's lifetime:

```python
@app.function(ephemeral_disk=102400)  # 100 GiB in MiB
def process_dataset():
    # Temporary files at /tmp or anywhere in the container filesystem
    ...
```

- Value in **MiB**
- Default: 512 GiB quota per container
- Maximum: 3,145,728 MiB (3 TiB)
- Data is lost when the container shuts down
- Use Volumes for persistent storage

Larger disk requests increase the memory request at a 20:1 ratio for billing purposes.

## Timeout

```python
@app.function(timeout=3600)  # 1 hour in seconds
def long_running():
    ...
```

- Default: 300 seconds (5 minutes)
- Maximum: 86,400 seconds (24 hours)
- Execution timeout is per attempt; configured retries get a fresh timeout
- Queue time is excluded; `startup_timeout` controls startup independently
- Expiry is approximate and eventually raises `modal.exception.FunctionTimeoutError`

## Billing

You are charged based on **whichever is higher**: your resource request or actual usage.

| Resource | Billing Basis |
|----------|--------------|
| CPU | max(requested, used) |
| Memory | max(requested, used) |
| GPU | Time GPU is allocated |
| Disk | Increases memory billing at 20:1 ratio |

### Cost Optimization Tips

- Request only what you need
- Use appropriate GPU tiers (L40S over H100 for inference)
- Set `scaledown_window` to minimize idle time
- Use `min_containers=0` when cold starts are acceptable
- Batch inputs with `.map()` instead of individual `.remote()` calls

## Complete Example

```python
@app.function(
    cpu=8.0,              # 8 physical cores
    memory=32768,         # 32 GiB
    gpu="L40S",           # L40S GPU
    ephemeral_disk=204800, # 200 GiB temp disk
    timeout=7200,         # 2 hours
    max_containers=50,
    min_containers=1,
)
def full_pipeline(data_path: str):
    ...
```
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall