Skip to content

Commit 73be681

Browse files
Deploying to gh-pages from @ dstackai/dstack@70bb5aa 🚀
1 parent c48cf19 commit 73be681

File tree

3 files changed

+459
-204
lines changed

3 files changed

+459
-204
lines changed

.well-known/skills/dstack/SKILL.md

Lines changed: 153 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,108 @@ description: |
88

99
## Overview
1010

11-
`dstack` is a unified control plane that provisions and orchestrates GPU workloads across [GPU clouds and Kubernetes clusters](https://dstack.ai/docs/concepts/backends.md) or on-prem clusters (SSH fleets).
11+
`dstack` is a tool that allows to provision and orchestrate GPU workloads across [GPU clouds and Kubernetes clusters](https://dstack.ai/docs/concepts/backends.md) or on-prem clusters (SSH fleets).
1212

1313
**When to use this skill:**
14-
- Running GPU workloads (development, training, batch jobs, inference) across GPU clouds or on-prem GPU clusters
15-
- Managing fleets of GPU instances (cloud or on-prem)
16-
- Creating, editing, and running dstack configurations
17-
- Troubleshooting GPU infrastructure and running workloads
14+
- Running/managing GPU workloads (dev environments, tasks for training or other batch jobs, services to run inference or deploy web apps)
15+
- Creating, editing, and running `dstack` configurations
16+
- Managing fleets of compute (instances/clusters)
1817

1918
## How it works
2019

21-
dstack operates through three core components:
20+
`dstack` operates through three core components:
2221

23-
1. `dstack` server - Control plane running locally, self-hosted, or via dstack Sky (managed)
24-
2. `dstack` CLI - Command-line tool for applying configurations and managing workloads
25-
3. `dstack` configuration files - YAML files ending with `.dstack.yml`
22+
1. `dstack` server - Can run locally, remotely, or via dstack Sky (managed)
23+
2. `dstack` CLI - For applying configurations and managing resources; CLI can be pointed to the server and a particular default project (`~/.dstack/config.yml` or via `dstack project` CLI command); other CLI commands use the default project
24+
3. `dstack` configuration files - YAML files ending with `.dstack.yml`
2625

2726
**Typical workflow:**
2827
```bash
2928
# 1. Define configuration in YAML file (e.g., train.dstack.yml, .dstack.yml, llama-serve.dstack.yml)
3029
# 2. Apply configuration
3130
dstack apply -f train.dstack.yml
3231

33-
# 3. dstack provisions infrastructure and runs workload
34-
# 4. Monitor with dstack ps, attach with dstack attach
32+
# 3. dstack prepares a plan, and once confirmed, provisions instances (according to created fleets) and runs workloads
33+
# 4. Monitor with `dstack ps`, `dstack logs`, `dstack attach`, etc. (these commands support various options).
3534
```
3635

37-
The CLI applies configurations via `dstack apply`, which provisions infrastructure, schedules workloads, and manages lifecycle. Runs can be "attached" mode (by default) - interactive, blocks terminal with port forwarding and SSH access, or detached (via `-d`) – background, non-interactive.
36+
By default, `dstack apply` requires a confirmation, and once first job within the run is `running` - it "attaches" establishes an SSH tunnel, forwards ports if any and streams logs in real-time; if you pass `-d`, it runs in the detached mode and exits once the run is submitted.
37+
38+
**CRITICAL: Never propose `dstack` CLI commands or YAML syntaxes that don't exist.**
39+
- Only use CLI commands and YAML syntax explicitly documented in this skill file or verified via `--help`
40+
- If uncertain about a command or its syntax, check the links or use `--help`
41+
42+
**NEVER do the following:**
43+
- Invent CLI flags not documented here or shown in `--help`
44+
- Guess YAML property names - verify in configuration reference links
45+
- Run `dstack apply` for runs without `-d` in automated contexts (blocks indefinitely)
46+
- Retry failed commands without addressing the underlying error
47+
- Summarize or reformat tabular CLI output - show it as-is
48+
- Use `echo "y" |` when `-y` flag is available
49+
- Assume a command succeeded without checking output for errors
50+
51+
## Agent execution guidelines
52+
53+
**This section provides critical guidance for AI agents executing dstack commands.**
54+
55+
### Output accuracy
56+
- **NEVER reformat, summarize, or paraphrase CLI output.** Display tables, status output, and error messages exactly as returned.
57+
- When showing command results, use code blocks to preserve formatting.
58+
- If output is truncated due to length, indicate this clearly (e.g., "Output truncated. Full output shows X entries.").
59+
60+
### Verification before execution
61+
- **When uncertain about any CLI flag or YAML property, run `dstack <command> --help` first.**
62+
- Never guess or invent flags. Example verification commands:
63+
```bash
64+
dstack --help # List all commands
65+
dstack apply --help <configuration tpye> # Flags for apply per configuration type (dev-environment, task, service, fleet, etc)
66+
dstack fleet --help # Fleet subcommands
67+
dstack ps --help # Flags for ps
68+
```
69+
- If a command or flag isn't documented, it doesn't exist.
70+
71+
### Command timing and confirmation handling
72+
73+
**Commands that stream indefinitely (use timeout to capture output, then exit):**
74+
- `dstack attach` - maintains connection until interrupted
75+
- `dstack apply` without `-d` for runs - streams logs after provisioning
76+
77+
**All other commands:** Use 10-60s timeout. Most complete within this range. **While waiting, monitor the output** - it may contain errors, warnings, or prompts requiring attention.
78+
79+
**Confirmation handling:**
80+
- `dstack apply`, `dstack stop`, `dstack fleet delete` require confirmation
81+
- Use `-y` flag to auto-confirm when user has already approved
82+
- Use `echo "n" |` to preview `dstack apply` plan without executing (avoid `echo "y" |`, prefer `-y`)
3883

39-
**CRITICAL: Never propose dstack commands or command syntaxes that don't exist.**
40-
- Only use commands and syntaxes explicitly documented in this skill file or verified via `--help`
41-
- If uncertain about a command or its syntax, check the documentation or use `--help` rather than guessing
42-
- Do not invent or assume command names, flags, or argument patterns
43-
4484
**Best practices:**
45-
- Prefer giving run configurations a `name` property for easier management and identification
4685
- Prefer modifying configuration files over passing parameters to `dstack apply` (unless it's an exception)
4786
- When user confirms deletion/stop operations, use `-y` flag to skip confirmation prompts
48-
- Many dstack commands require confirmation - pay attention to command output and respond appropriately rather than waiting indefinitely
87+
- Avoid waiting indefinitely; display essential output once command is finished (even if by timeout)
4988

5089
## Configuration types
5190

5291
`dstack` supports five main configuration types, each with specific use cases. Configuration files can be named `<name>.dstack.yml` or simply `.dstack.yml`.
5392

5493
**Common parameters:** All run configurations (dev environments, tasks, services) support many parameters including:
5594
- **Git integration:** Clone repos automatically (`repo`), mount existing repos (`repos`), upload local files (`working_dir`)
56-
- **Docker support:** Use custom Docker images (`image`), enable Docker CLI inside workloads with `docker: true` (VM-based backends only)
95+
- **Docker support:** Use custom Docker images (`image`); Also if needed, use `docker: true` if you want to use `docker` from inside the container (VM-based backends only)
5796
- **Environment & secrets:** Set environment variables (`env`), reference secrets
58-
- **Storage:** Mount persistent volumes (`volumes`), specify disk size
97+
- **Storage:** Persistent network volumes (`volumes`), specify disk size
5998
- **Resources:** Define GPU, CPU, memory, and disk requirements
6099

100+
**Best practices:**
101+
- Prefer giving configurations a `name` property for easier management
102+
61103
See configuration reference pages for complete parameter lists.
62104

63105
### 1. Dev environments
64106
**Use for:** Interactive development with IDE integration (VS Code, Cursor, etc.).
65107

66108
```yaml
67109
type: dev-environment
68-
python: "3.11"
110+
name: cursor
111+
112+
python: "3.12"
69113
ide: vscode
70114

71115
resources:
@@ -82,12 +126,14 @@ resources:
82126
83127
```yaml
84128
type: task
85-
python: "3.11"
129+
name: train
130+
131+
python: "3.12"
86132
env:
87133
- HUGGING_FACE_HUB_TOKEN
88134
commands:
89-
- pip install -r requirements.txt
90-
- python train.py
135+
- uv pip install -r requirements.txt
136+
- uv run python train.py
91137
ports:
92138
- 8501 # Optional: expose ports for web apps
93139

@@ -115,24 +161,25 @@ resources:
115161

116162
```yaml
117163
type: service
118-
python: "3.11"
164+
name: llama31
165+
166+
python: "3.12"
119167
env:
120168
- HF_TOKEN
121169
commands:
122-
- pip install vllm
123-
- vllm serve meta-llama/Meta-Llama-3.1-8B-Instruct
170+
- uv pip install vllm
171+
- uv run vllm serve meta-llama/Meta-Llama-3.1-8B-Instruct
124172
port: 8000
125173
model: meta-llama/Meta-Llama-3.1-8B-Instruct
126174
127175
resources:
128176
gpu: 80GB
129177
disk: 200GB
130178
131-
scaling:
132-
metric: rps
133-
target: 10
134179
```
135180

181+
Once a service is `running` and its health probes are green:
182+
136183
**Service endpoints:**
137184
- Without gateway: `<dstack server URL>/proxy/services/<project name>/<run name>/`
138185
- With gateway: `https://<run name>.<gateway domain>/`
@@ -172,7 +219,7 @@ nodes: 0..2 # Range: creates template when starting with 0, provisions on-deman
172219
173220
resources:
174221
gpu: 24GB.. # 24GB or more
175-
disk: 100GB
222+
disk: 200GB
176223
177224
spot_policy: auto # auto (default), spot, or on-demand
178225
idle_duration: 5m # Terminate idle instances after 5 minutes
@@ -197,8 +244,6 @@ ssh_config:
197244
- 192.168.1.11
198245
```
199246

200-
**Requirements:** Hosts must have Docker, GPU drivers, passwordless sudo, and SSH port forwarding enabled.
201-
202247
[Concept documentation](https://dstack.ai/docs/concepts/fleets.md) | [Configuration reference](https://dstack.ai/docs/reference/dstack.yml/fleet.md)
203248

204249
### 5. Volumes
@@ -258,23 +303,50 @@ volumes:
258303

259304
**Workflow for applying configurations:**
260305

261-
**Important: When displaying CLI output, keep it close to the original format. Prefer showing tables as-is rather than reformatting or summarizing.**
306+
> **Critical for agents:** Always show the plan first, wait for user confirmation, THEN execute. Never auto-execute without user approval.
262307

263-
**For run configurations (dev-environment, task, service):**
264-
1. Show the plan by running `echo "n" | dstack apply -f <dstack config file>` and display output as-is
265-
2. Ask user for confirmation
266-
3. Once confirmed, run `dstack apply -f <dstack config file> -y -d` (detached mode with auto-confirm)
267-
4. Show run status with `dstack ps`
308+
**Step-by-step for run configurations (dev-environment, task, service):**
268309

269-
**For other configurations (fleet, volume, gateway):**
270-
1. Show the plan by running `dstack apply -f <dstack config file>` (these don't support the "n" trick or `-d` flag)
271-
2. Ask user for confirmation
272-
3. Once confirmed, run `dstack apply -f <dstack config file> -y`
273-
4. Show status with the appropriate command:
274-
- Fleets: `dstack fleet`
275-
- Volumes: `dstack volume`
276-
- Gateways: `dstack gateway`
310+
1. **Show plan:**
311+
```bash
312+
echo "n" | dstack apply -f config.dstack.yml
313+
```
314+
Display the FULL output including the offers table and cost estimate. **Do NOT summarize or reformat.**
315+
316+
2. **Wait for user confirmation.** Do NOT proceed if:
317+
- Output shows "No offers found" or similar errors
318+
- Output shows validation errors
319+
- User has not explicitly confirmed
277320

321+
3. **Execute (only after user confirms):**
322+
```bash
323+
dstack apply -f config.dstack.yml -y -d
324+
```
325+
326+
4. **Verify submission:**
327+
```bash
328+
dstack ps -v
329+
```
330+
Show the run status. Look for the run name and status column.
331+
332+
**Step-by-step for infrastructure (fleet, volume, gateway):**
333+
334+
1. **Show plan:**
335+
```bash
336+
echo "n" | dstack apply -f fleet.dstack.yml
337+
```
338+
Display the FULL output. **Do NOT summarize or reformat.**
339+
340+
2. **Wait for user confirmation.**
341+
342+
3. **Execute:**
343+
```bash
344+
dstack apply -f fleet.dstack.yml -y
345+
```
346+
347+
4. **Verify:** Use `dstack fleet`, `dstack volume`, or `dstack gateway` respectively.
348+
349+
**Common apply patterns:**
278350
```bash
279351
# Apply and attach (interactive, blocks terminal with port forwarding)
280352
dstack apply -f train.dstack.yml
@@ -285,7 +357,7 @@ dstack apply -f train.dstack.yml -y
285357
# Apply detached (background, no attachment)
286358
dstack apply -f serve.dstack.yml -d
287359
288-
# Force rerun
360+
# Force rerun (recreates even if run with same name exists)
289361
dstack apply -f finetune.dstack.yml --force
290362
291363
# Override defaults (prefer modifying config file instead, unless it's an exception)
@@ -311,7 +383,7 @@ dstack fleet get my-fleet --json
311383
dstack fleet delete my-fleet -y
312384
313385
# Delete specific instance from fleet (use -y when user already confirmed)
314-
dstack fleet delete-instance my-fleet <instance-id> -y
386+
dstack fleet delete my-fleet -i <instance num> -y
315387
```
316388

317389
### Monitor Runs
@@ -347,7 +419,7 @@ dstack attach my-run-name --logs
347419
dstack attach my-run-name
348420
```
349421

350-
### View Logs
422+
### View logs
351423

352424
```bash
353425
# Stream logs (tail mode)
@@ -378,19 +450,34 @@ dstack stop my-run-name --abort
378450

379451
### Check available resources
380452

381-
**Note:** `dstack offer` shows all available GPU instances from configured backends, not just those in fleets. Use it to discover what resources are available for provisioning.
453+
**Use `dstack offer` to verify GPU availability before provisioning:**
382454

383455
```bash
384-
# List available GPU offers from all backends
385-
dstack offer
456+
# List all available offers across backends
457+
dstack offer --json
386458
387-
# Filter by backend
459+
# Filter by specific backend
388460
dstack offer --backend aws
389461
390-
# Filter by GPU requirements
462+
# Filter by GPU type
391463
dstack offer --gpu A100
464+
465+
# Filter by GPU memory
466+
dstack offer --gpu 24GB..80GB
467+
468+
# JSON output for detailed inspection
469+
dstack offer --json
470+
471+
# Combine filters
472+
dstack offer --backend aws --gpu A100:80GB
392473
```
393474

475+
**Note:** `dstack offer` shows all available GPU instances from configured backends, not just those matching configured fleets. Use it to check backend availability, but remember: an offer appearing here doesn't guarantee a fleet will provision it - fleets have their own resource constraints.
476+
477+
### Expected Output Formats
478+
479+
**Agents should display these tables as-is, preserving column alignment.**
480+
394481
## Troubleshooting
395482

396483
When diagnosing issues with dstack workloads or infrastructure:
@@ -399,6 +486,7 @@ When diagnosing issues with dstack workloads or infrastructure:
399486
```bash
400487
dstack fleet get my-fleet --json | jq .
401488
dstack run get my-run --json | jq .
489+
dstack ps -n 10 --json | jq .
402490
```
403491

404492
2. **Check verbose run status:**
@@ -416,25 +504,22 @@ When diagnosing issues with dstack workloads or infrastructure:
416504
dstack attach my-run --logs # See full output from start
417505
```
418506

419-
5. **Check fleet capacity:**
420-
```bash
421-
dstack fleet get my-fleet # View current instances and utilization
422-
```
423-
424-
6. **Verify resource availability:**
507+
5. **Verify resource availability:**
425508
```bash
426-
dstack offer --backend aws --gpu A100 # Check if resources exist
509+
dstack offer --backend aws --gpu A100 --spot-auto --json # Check if resources exist
427510
```
428511

429512
Common issues:
430-
- **No capacity errors:** Check `dstack offer` for availability, adjust resource requirements, or enable more backends
431-
- **No matching fleet:** Ensure at least one fleet matches workload resource requirements; use `dstack fleet` to list configured fleets
513+
- **No offers:** Check `dstack offer` and ensure that at least one fleet matches requirements
514+
- **No fleet:** Ensure at least one fleet is created
432515
- **Configuration errors:** Validate YAML syntax; check `dstack apply` output for specific errors
433516
- **Provisioning timeouts:** Use `dstack ps -v` to see provisioning status; consider spot vs on-demand
434517
- **Connection issues:** Verify server status, check authentication, ensure network access to backends
435-
- **Resource mismatch:** Check that fleet resource specs (GPU type, memory, disk) are compatible with workload requirements
436518

437-
[Troubleshooting guide](https://dstack.ai/docs/guides/troubleshooting.md)
519+
**When errors occur:**
520+
1. Display the full error message unchanged
521+
2. Do NOT retry the same command without addressing the error
522+
3. Refer to the [Troubleshooting guide](https://dstack.ai/docs/guides/troubleshooting.md) for guidance
438523

439524
## Additional Resources
440525

@@ -458,4 +543,4 @@ Common issues:
458543
- [Google TPU](https://dstack.ai/examples/accelerators/tpu/index.md)
459544
- [Tenstorrent](https://dstack.ai/examples/accelerators/tenstorrent/index.md)
460545

461-
**Full Documentation:** https://dstack.ai/llms-full.txt
546+
**Full documentation:** https://dstack.ai/llms-full.txt

0 commit comments

Comments
 (0)