> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trycassian.com/llms.txt
> Use this file to discover all available pages before exploring further.

# cassian run

> One-shot: up, sync, exec, down.

## Usage

```bash theme={null}
cassian run <command>
cassian run "python train.py --epochs 50"
cassian run --keep "python eval.py"
```

Provisions an instance (if not already running), syncs your files, runs the command, then tears down the instance. Exit code is passed through.

## Options

| Flag     | Description                                  | Default |
| -------- | -------------------------------------------- | ------- |
| `--keep` | Keep instance running after command finishes | false   |

## Behavior

```
cassian run "python train.py"
  → cassian up (if needed)
  → sync files to /workspace
  → run command
  → cassian down (always, even on failure)
```

If an instance is already running (from a previous `cassian up`), it reuses it and does NOT tear it down afterward.

## Use cases

```bash theme={null}
# Overnight training auto-stops when done
cassian run "python train.py --epochs 500"

# CI/CD pipeline
cassian run "pytest tests/"

# Quick one-off
cassian run "python -c 'import torch; print(torch.cuda.get_device_name())'"

# Keep instance for debugging after run
cassian run --keep "python train.py"
```

## Exit codes

The exit code from your command is passed through. If your script exits with code 1, `cassian run` exits with code 1.
