Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 41 additions & 7 deletions .agents/skills/brev-cli/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: brev-cli
description: Manage GPU cloud instances with the Brev CLI. Use when users want to create GPU instances, search for GPUs, SSH into instances, open editors, copy files, port forward, manage organizations, or work with cloud compute. Trigger keywords - brev, gpu, instance, create instance, ssh, vram, A100, H100, cloud gpu, remote machine.
description: Manage GPU and CPU cloud instances with the Brev CLI. Use when users want to create instances, search for GPUs or CPUs, SSH into instances, open editors, copy files, port forward, manage organizations, or work with cloud compute. Trigger keywords - brev, gpu, cpu, instance, create instance, ssh, vram, vcpu, A100, H100, cloud gpu, cloud cpu, remote machine.
allowed-tools: Bash, Read, AskUserQuestion
argument-hint: [create|search|shell|exec|open|ls|delete] [instance-name]
---
Expand All @@ -13,31 +13,35 @@ Token Budget:

# Brev CLI

Manage GPU cloud instances from the command line. Create, search, connect, and manage remote GPU machines.
Manage GPU and CPU cloud instances from the command line. Create, search, connect, and manage remote machines.

## When to Use

Use this skill when users want to:
- Create GPU instances (with smart defaults or specific types)
- Create GPU or CPU instances (with smart defaults or specific types)
- Search for available GPU types (A100, H100, L40S, etc.)
- Search for CPU-only instance types (no GPU)
- SSH into instances or run commands remotely
- Open editors (VS Code, Cursor, Windsurf) on remote instances
- Copy files to/from instances
- Port forward from remote to local
- Manage organizations and instances

**Trigger Keywords:** brev, gpu, instance, create instance, ssh, vram, A100, H100, cloud gpu, remote machine, shell
**Trigger Keywords:** brev, gpu, cpu, instance, create instance, ssh, vram, vcpu, A100, H100, cloud gpu, cloud cpu, remote machine, shell

## Quick Start

```bash
# Search for GPUs (sorted by price)
brev search

# Search for CPU-only instances
brev search cpu

# Create an instance with smart defaults
brev create my-instance

# Create with specific GPU
# Create with specific type
brev create my-instance --type g5.xlarge

# List your instances
Expand All @@ -58,8 +62,12 @@ brev open my-instance cursor

### Search GPUs
```bash
# All available GPUs
# All available GPUs (default)
brev search
brev search gpu

# GPU search with wide mode (shows RAM and ARCH columns)
brev search gpu --wide

# Filter by GPU name
brev search --gpu-name A100
Expand All @@ -75,6 +83,32 @@ brev search --max-boot-time 5 --sort price
brev search --stoppable --min-total-vram 40 --sort price
```

### Search CPUs
```bash
# All available CPU-only instances
brev search cpu

# Filter by provider
brev search cpu --provider aws

# Filter by minimum RAM
brev search cpu --min-ram 64

# Filter by architecture
brev search cpu --arch arm64

# Filter by vCPUs
brev search cpu --min-vcpu 16

# Sort by price
brev search cpu --sort price

# JSON output
brev search cpu --json
```

CPU search shows: TYPE, PROVIDER, VCPUs, RAM, ARCH, DISK, $/GB/MO, BOOT, FEATURES, $/HR

### Create Instances
```bash
# Smart defaults (cheapest matching GPU)
Expand Down Expand Up @@ -234,6 +268,6 @@ brev invite
## References

- **[reference/commands.md](reference/commands.md)** - Full command reference
- **[reference/search-filters.md](reference/search-filters.md)** - GPU search options
- **[reference/search-filters.md](reference/search-filters.md)** - GPU and CPU search options
- **[prompts/](prompts/)** - Workflow guides
- **[examples/](examples/)** - Common patterns
38 changes: 38 additions & 0 deletions .agents/skills/brev-cli/examples/common-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,44 @@ git config --global user.name "Your Name"
git config --global user.email "you@example.com"
```

## CPU Instance Patterns

### Find CPU Instances
```bash
# All CPU instances sorted by price
brev search cpu --sort price

# Cheapest ARM CPU instances
brev search cpu --arch arm64 --sort price

# High-memory CPU for data processing
brev search cpu --min-ram 128 --sort price

# Many-core for parallel workloads
brev search cpu --min-vcpu 32 --sort price
```

### Create CPU Instance
```bash
# Create from CPU search
brev search cpu --min-ram 64 | brev create my-cpu-box

# Create CPU instance and run setup
brev search cpu --sort price | brev create data-proc | brev exec @setup.sh
```

### CPU Use Cases
```bash
# Data preprocessing box
brev search cpu --min-ram 64 --min-disk 500 | brev create etl-box

# CI/CD runner
brev search cpu --min-vcpu 8 --max-boot-time 3 | brev create ci-runner

# Web server / API host
brev search cpu --stoppable --sort price | brev create api-server
```

## Quick Start Patterns

### Create and Connect (One-Liner)
Expand Down
50 changes: 46 additions & 4 deletions .agents/skills/brev-cli/reference/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,22 @@ brev create my-instance --dry-run
```

### brev search
Search and filter available GPU instance types.
Search and filter available instance types. Has two subcommands: `gpu` (default) and `cpu`.

```bash
brev search [flags]
brev search [gpu|cpu] [flags]
```

**Aliases:** `gpu-search`, `gpu`, `gpus`, `gpu-list`

**Flags:**
#### GPU Search (default)
```bash
brev search [flags]
brev search gpu [flags]
brev search gpu --wide # shows RAM and ARCH columns
```

**GPU Flags:**
| Flag | Short | Description |
|------|-------|-------------|
| `--gpu-name` | `-g` | Filter by GPU name (partial match) |
Expand All @@ -155,16 +162,51 @@ brev search [flags]
| `--sort` | `-s` | Sort by: price, gpu-count, vram, total-vram, vcpu, disk, boot-time |
| `--desc` | `-d` | Sort descending |
| `--json` | | Output as JSON |
| `--wide` | `-w` | Show extra columns (RAM, ARCH) — gpu subcommand only |

**Examples:**
**GPU Examples:**
```bash
brev search
brev search gpu --wide
brev search --gpu-name A100
brev search --min-vram 40 --sort price
brev search --gpu-name H100 --max-boot-time 3
brev search --stoppable --min-total-vram 40 --sort price
```

#### CPU Search
```bash
brev search cpu [flags]
```

Search for CPU-only instance types (no GPU). Uses shared flags only.

**CPU Flags:**
| Flag | Short | Description |
|------|-------|-------------|
| `--provider` | `-p` | Filter by cloud provider |
| `--arch` | | Filter by architecture (x86_64, arm64) |
| `--min-ram` | | Minimum RAM in GB |
| `--min-disk` | | Minimum disk size (GB) |
| `--min-vcpu` | | Minimum number of vCPUs |
| `--max-boot-time` | | Maximum boot time (minutes) |
| `--stoppable` | | Only stoppable instances |
| `--rebootable` | | Only rebootable instances |
| `--flex-ports` | | Only instances with configurable firewall |
| `--sort` | `-s` | Sort by: price, vcpu, type, provider, disk, boot-time |
| `--desc` | `-d` | Sort descending |
| `--json` | | Output as JSON |

**CPU Examples:**
```bash
brev search cpu
brev search cpu --provider aws
brev search cpu --min-ram 64 --sort price
brev search cpu --arch arm64
brev search cpu --min-vcpu 16 --sort price
brev search cpu | brev create my-cpu-box
```

### brev ls
List instances in active org.

Expand Down
72 changes: 70 additions & 2 deletions .agents/skills/brev-cli/reference/search-filters.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# GPU Search Filters Reference
# Search Filters Reference

Detailed guide to filtering and sorting GPU instance types.
Detailed guide to filtering and sorting GPU and CPU instance types.

## Command Structure

`brev search` has two subcommands:
- `brev search` or `brev search gpu` — GPU instances (default, backwards compatible)
- `brev search gpu --wide` — GPU instances with extra RAM and ARCH columns
- `brev search cpu` — CPU-only instances (no GPU)

## Filter Options

Expand Down Expand Up @@ -187,3 +194,64 @@ brev search --json | jq '.[] | {type, gpu_name, price}'
| S | Stoppable - can stop/restart without data loss |
| R | Rebootable - can reboot the instance |
| P | Flex Ports - can modify firewall rules |

## CPU Search (`brev search cpu`)

CPU search shows instances without GPUs. It uses shared flags (no GPU-specific flags like `--gpu-name`, `--min-vram`, etc.).

### CPU Filter Options

| Flag | Short | Description |
|------|-------|-------------|
| `--provider` | `-p` | Filter by cloud provider |
| `--arch` | | Filter by architecture (x86_64, arm64) |
| `--min-ram` | | Minimum RAM in GB |
| `--min-disk` | | Minimum disk size in GB |
| `--min-vcpu` | | Minimum number of vCPUs |
| `--max-boot-time` | | Maximum boot time in minutes |
| `--stoppable` | | Only stoppable instances |
| `--rebootable` | | Only rebootable instances |
| `--flex-ports` | | Only instances with configurable firewall |
| `--sort` | `-s` | Sort column (price, vcpu, type, provider, disk, boot-time) |
| `--desc` | `-d` | Sort descending |
| `--json` | | Output as JSON |

### CPU Output Columns

**Interactive (terminal):**
```
TYPE | PROVIDER | VCPUs | RAM | ARCH | DISK | $/GB/MO | BOOT | FEATURES | $/HR
```

**Piped (stdout):**
```
TYPE | TARGET_DISK | PROVIDER | VCPUs | RAM | ARCH | DISK | $/GB/MO | BOOT | FEATURES | $/HR
```

### CPU Filter Examples

```bash
# All CPU instances
brev search cpu

# Cheap ARM instances
brev search cpu --arch arm64 --sort price

# High-memory instances for data processing
brev search cpu --min-ram 128 --sort price

# Many-core instances for parallel workloads
brev search cpu --min-vcpu 32 --sort price

# Fast-booting CPU instances
brev search cpu --max-boot-time 3 --sort price

# Stoppable CPU instances (save costs)
brev search cpu --stoppable --sort price

# AWS CPU instances with large disk
brev search cpu --provider aws --min-disk 500

# Pipe CPU search into create
brev search cpu --min-ram 64 | brev create my-cpu-box
```
18 changes: 16 additions & 2 deletions pkg/analytics/posthog.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,24 @@ func getTimezone() string {
}

func getGPUInfo() string {
type result struct {
out string
}
ch := make(chan result, 1)
go func() {
ch <- result{out: getGPUInfoSync()}
}()
select {
case r := <-ch:
return r.out
case <-time.After(100 * time.Millisecond):
return ""
}
}

func getGPUInfoSync() string {
out, err := exec.Command("nvidia-smi", "--query-gpu=name,memory.total,driver_version,count", "--format=csv,noheader,nounits").Output() // #nosec G204
if err != nil {
// nvidia-smi not available or no NVIDIA GPU
if runtime.GOOS == "darwin" {
return getAppleGPUInfo()
}
Expand All @@ -335,7 +350,6 @@ func getAppleGPUInfo() string {
if err != nil {
return ""
}
// Extract just the chipset/model lines
lines := strings.Split(string(out), "\n")
var gpuLines []string
for _, line := range lines {
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/gpucreate/gpucreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func parseStartupScript(value string) (string, error) {

// searchInstances fetches and filters GPU instances using user-provided filters merged with defaults
func searchInstances(s GPUCreateStore, filters *searchFilterFlags) ([]gpusearch.GPUInstanceInfo, float64, error) {
response, err := s.GetInstanceTypes()
response, err := s.GetInstanceTypes(false)
if err != nil {
return nil, 0, breverrors.WrapAndTrace(err)
}
Expand All @@ -340,8 +340,8 @@ func searchInstances(s GPUCreateStore, filters *searchFilterFlags) ([]gpusearch.
}

instances := gpusearch.ProcessInstances(response.Items)
filtered := gpusearch.FilterInstances(instances, filters.gpuName, filters.provider, filters.minVRAM,
minTotalVRAM, minCapability, minDisk, maxBootTime, filters.stoppable, filters.rebootable, filters.flexPorts)
filtered := gpusearch.FilterInstances(instances, filters.gpuName, filters.provider, "", filters.minVRAM,
minTotalVRAM, minCapability, 0, minDisk, 0, maxBootTime, filters.stoppable, filters.rebootable, filters.flexPorts, true)
gpusearch.SortInstances(filtered, sortBy, filters.descending)

return filtered, minDisk, nil
Expand Down Expand Up @@ -375,7 +375,7 @@ func runDryRun(t *terminal.Terminal, s GPUCreateStore, filters *searchFilterFlag
}

piped := gpusearch.IsStdoutPiped()
if err := gpusearch.DisplayResults(t, filtered, false, piped); err != nil {
if err := gpusearch.DisplayGPUResults(t, filtered, false, piped, false); err != nil {
return breverrors.WrapAndTrace(err)
}
return nil
Expand Down
Loading
Loading