vastai-webhooks-events

Featured

Build event-driven workflows around Vast.ai instance lifecycle events. Use when monitoring instance status changes, implementing auto-recovery, or building event-driven GPU orchestration. Trigger with phrases like "vastai events", "vastai instance monitoring", "vastai status changes", "vastai lifecycle events".

AI & Automation 2,944 stars 440 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Vast.ai Webhooks & Events ## Overview Build event-driven workflows around Vast.ai GPU instance lifecycle. Vast.ai does not provide traditional webhooks, so event detection relies on polling the REST API at `cloud.vast.ai/api/v0` and reacting to instance status transitions (loading, running, exited, error, offline). ## Prerequisites - Vast.ai CLI authenticated - Understanding of instance lifecycle states - Python 3.8+ for event loop implementation ## Instructions ### Step 1: Instance Status Poller ```python import time, json, subprocess from typing import Callable, Dict, List class InstanceEventPoller: """Poll Vast.ai API and emit events on status transitions.""" def __init__(self, api_key: str, poll_interval: int = 30): self.api_key = api_key self.poll_interval = poll_interval self.previous_states: Dict[int, str] = {} self.handlers: Dict[str, List[Callable]] = {} def on(self, event: str, handler: Callable): self.handlers.setdefault(event, []).append(handler) def poll_once(self): result = subprocess.run( ["vastai", "show", "instances", "--raw"], capture_output=True, text=True) instances = json.loads(result.stdout) for inst in instances: inst_id = inst["id"] status = inst.get("actual_status", "unknown") prev = self.previous_states.get(inst_id) if prev and prev != status: event = f"{prev}_to_{status}"...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category