execute_command
Execute a whitelisted command on a stopped Vast.ai instance, like listing workspace files to check setup. Only for stopped instances; for running instances, use SSH instead.
Instructions
Execute a constrained remote command on a STOPPED instance (PUT /instances/command/{id}/).
Only works on instances whose actual_status is stopped (transient launch
commands like downloading an image on first start). For running instances,
the API rejects this with: "Execute command only avail on stopped instances.
Use ssh to run commands on running instances." — use ssh_exec instead.
The API additionally enforces a command whitelist — unknown commands return
400 "Invalid command given". ls-style inspection commands are accepted;
nvidia-smi, whoami, arbitrary binaries are not. For arbitrary commands
on a running instance, use ssh_exec.
Examples: execute_command(instance_id=12345, command="ls /workspace")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | ||
| instance_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||