You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`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).
12
12
13
13
**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)
18
17
19
18
## How it works
20
19
21
-
dstack operates through three core components:
20
+
`dstack` operates through three core components:
22
21
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`
# 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).
35
34
```
36
35
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`
- 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.
- 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`)
38
83
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
-
44
84
**Best practices:**
45
-
- Prefer giving run configurations a `name` property for easier management and identification
46
85
- Prefer modifying configuration files over passing parameters to `dstack apply` (unless it's an exception)
47
86
- 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)
49
88
50
89
## Configuration types
51
90
52
91
`dstack` supports five main configuration types, each with specific use cases. Configuration files can be named `<name>.dstack.yml` or simply `.dstack.yml`.
53
92
54
93
**Common parameters:** All run configurations (dev environments, tasks, services) support many parameters including:
55
94
-**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)
57
96
-**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
59
98
-**Resources:** Define GPU, CPU, memory, and disk requirements
60
99
100
+
**Best practices:**
101
+
- Prefer giving configurations a `name` property for easier management
102
+
61
103
See configuration reference pages for complete parameter lists.
62
104
63
105
### 1. Dev environments
64
106
**Use for:** Interactive development with IDE integration (VS Code, Cursor, etc.).
**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:**
382
454
383
455
```bash
384
-
# List available GPU offers from all backends
385
-
dstack offer
456
+
# List all available offers across backends
457
+
dstack offer --json
386
458
387
-
# Filter by backend
459
+
# Filter by specific backend
388
460
dstack offer --backend aws
389
461
390
-
# Filter by GPU requirements
462
+
# Filter by GPU type
391
463
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
392
473
```
393
474
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
+
394
481
## Troubleshooting
395
482
396
483
When diagnosing issues with dstack workloads or infrastructure:
@@ -399,6 +486,7 @@ When diagnosing issues with dstack workloads or infrastructure:
399
486
```bash
400
487
dstack fleet get my-fleet --json | jq .
401
488
dstack run get my-run --json | jq .
489
+
dstack ps -n 10 --json | jq .
402
490
```
403
491
404
492
2. **Check verbose run status:**
@@ -416,25 +504,22 @@ When diagnosing issues with dstack workloads or infrastructure:
416
504
dstack attach my-run --logs # See full output from start
417
505
```
418
506
419
-
5. **Check fleet capacity:**
420
-
```bash
421
-
dstack fleet get my-fleet # View current instances and utilization
0 commit comments