| name | vastai-core-workflow-a |
| description | Execute Vast.ai primary workflow: GPU instance provisioning and job execution.
Use when renting GPUs for training, searching offers by price and specs,
or managing the full instance lifecycle from search to teardown.
Trigger with phrases like "vastai rent gpu", "vastai training job",
"vastai provision instance", "run job on vastai".
|
| allowed-tools | Read, Write, Edit, Bash(vastai:*), Bash(curl:*), Bash(ssh:*), Grep |
| version | 1.11.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","vast-ai","workflow"] |
| compatibility | Designed for Claude Code |
Vast.ai Core Workflow A: Instance Provisioning & Job Execution
Overview
Primary workflow for Vast.ai: search for GPU offers, provision an instance, transfer data, execute a training or inference job, collect artifacts, and destroy the instance to stop billing. This is the money-path operation for every Vast.ai user.
Prerequisites
- Completed
vastai-install-auth setup
- Docker image published to a registry (Docker Hub, GHCR, etc.)
- SSH key uploaded to Vast.ai
- Training data accessible via URL or local path
Instructions
Step 1: Search Offers with Filters
import subprocess, json
def search_offers(gpu_name="RTX_4090", min_vram=24, min_reliability=0.95,
max_price=0.50, num_gpus=1):
"""Search Vast.ai marketplace with specific filters."""
query = (
f"num_gpus={num_gpus} gpu_name={gpu_name} "
f"gpu_ram>={min_vram} reliability>{min_reliability} "
f"inet_down>200 dph_total<={max_price} rentable=true"
)
result = subprocess.run(
["vastai", "search", "offers", query, "--order", "dph_total", "--raw"],
capture_output=True, text=True, check=True,
)
offers = json.loads(result.stdout)
print(f"Found {len(offers)} offers matching criteria")
for o in offers[:5]:
print(
)
offers