Documentation Index
Fetch the complete documentation index at: https://docs.cloudshipai.com/llms.txt
Use this file to discover all available pages before exploring further.
Lattice CLI Reference
Complete reference for all stn lattice commands.
Overview
The stn lattice command group provides tools for managing and interacting with Station Lattice mesh networks.
stn lattice [command] [flags]
CLI Client Mode
You can interact with a running lattice from the CLI without starting a server using the --nats flag:
# Connect to a lattice from CLI
stn lattice --nats nats://localhost:4222 status
stn lattice --nats nats://localhost:4222 agents
# With authentication token
stn lattice --nats "nats://my-token@orchestrator.example.com:4222" agents
# Execute an agent remotely
stn lattice --nats "nats://token@host:4222" agent exec my-agent "Task description"
This is useful for:
- Querying lattice status from scripts
- Executing agents from CI/CD pipelines
- Debugging without running a full station
Commands
stn lattice status
Display the current lattice connection status.
stn lattice status [flags]
Flags:
| Flag | Description | Default |
|---|
--json | Output in JSON format | false |
--watch | Continuously watch status | false |
--interval | Watch refresh interval | 2s |
Examples:
# Basic status
stn lattice status
# Output:
# Lattice Status: Connected
# Mode: member
# Station ID: sre-station-prod
# Orchestrator: nats://orchestrator.example.com:4222
# Connected Since: 2024-01-15 10:30:00 UTC
# Heartbeat: OK (last: 2s ago)
# Registered Agents: 5
# JSON output
stn lattice status --json
# Watch mode
stn lattice status --watch --interval 5s
stn lattice stations
Manage stations in the lattice mesh.
stn lattice stations list
List all stations connected to the mesh.
stn lattice stations list [flags]
Flags:
| Flag | Description | Default |
|---|
--json | Output in JSON format | false |
--all | Include offline stations | false |
Examples:
# List online stations
stn lattice stations list
# Output:
# STATION ID NAME STATUS AGENTS LAST SEEN
# orchestrator-main Main Orchestrator online 3 now
# sre-station-prod SRE Production online 5 2s ago
# security-station Security Scanner online 2 1s ago
# devops-ci DevOps CI/CD offline 4 5m ago
# Include offline stations
stn lattice stations list --all
# JSON output
stn lattice stations list --json
stn lattice stations info
Get detailed information about a specific station.
stn lattice stations info <station-id> [flags]
Examples:
stn lattice stations info sre-station-prod
# Output:
# Station: sre-station-prod
# Name: SRE Production
# Status: online
# Connected Since: 2024-01-15 10:30:00 UTC
# Last Heartbeat: 2s ago
#
# Agents (5):
# - k8s-health-checker (capabilities: kubernetes, health-check)
# - log-analyzer (capabilities: logs, analysis)
# - incident-responder (capabilities: incidents, pagerduty)
# - metrics-collector (capabilities: prometheus, metrics)
# - alert-manager (capabilities: alerts, notifications)
#
# Metadata:
# environment: production
# region: us-east-1
# version: 1.2.3
stn lattice agents
List all agents available in the mesh.
stn lattice agents [flags]
Flags:
| Flag | Description | Default |
|---|
--discover | Show detailed agent info with schema | false |
--capability | Filter agents by capability | - |
--schema | Show full schema for a specific agent | - |
Examples:
# List all agents
stn lattice agents
# Output:
# Agents in Lattice (5 total)
# ============================================
# AGENT STATION LOCAL
# --------------------------------------------
# k8s-health-checker sre-station-prod
# log-analyzer sre-station-prod
# vuln-scanner security-station
# threat-analyzer security-station
# ci-runner devops-ci
# With CLI client mode
stn lattice --nats nats://host:4222 agents
# Filter by capability
stn lattice agents --capability kubernetes
# Show detailed info
stn lattice agents --discover
# Show full schema for an agent
stn lattice agents --schema k8s-health-checker
stn lattice agents info
Get detailed information about a specific agent.
stn lattice agents info <agent-name> [flags]
Flags:
| Flag | Description | Default |
|---|
--station | Specify station if agent name is ambiguous | - |
Examples:
stn lattice agents info k8s-health-checker
# Output:
# Agent: k8s-health-checker
# Station: sre-station-prod
# Status: available
#
# Description:
# Checks Kubernetes cluster health and reports issues
#
# Capabilities:
# - kubernetes
# - health-check
# - monitoring
#
# Tags:
# environment: production
# cluster: prod-east-1
#
# Recent Invocations:
# 2024-01-15 10:45:00 - success (1.2s)
# 2024-01-15 10:30:00 - success (0.8s)
# 2024-01-15 10:15:00 - success (1.1s)
stn lattice agent exec
Execute an agent on a remote station.
stn lattice agent exec <agent-name> <task> [flags]
Flags:
| Flag | Description | Default |
|---|
--station | Target specific station | auto-route |
Examples:
# Simple execution
stn lattice agent exec k8s-health-checker "Check pod health in production"
# Output:
# [routing to sre-station-prod]
#
# All 42 pods healthy in namespace production
# - web-frontend: 3/3 replicas ready
# - api-backend: 5/5 replicas ready
# - worker: 2/2 replicas ready
#
# Execution completed in 1.23s (via abc123-def456)
# With CLI client mode (no server required)
stn lattice --nats "nats://token@host:4222" agent exec echo-agent "Hello!"
# Target specific station
stn lattice agent exec log-analyzer "Analyze errors" --station sre-station-staging
# From a script
NATS_URL="nats://token@orchestrator:4222"
stn lattice --nats "$NATS_URL" agent exec math-agent "Calculate 25 * 17"
stn lattice route
Find agents by capability (for debugging routing).
stn lattice route <capability> [flags]
Flags:
| Flag | Description | Default |
|---|
--json | Output in JSON format | false |
--all | Show all matches | false |
Examples:
# Find agents with kubernetes capability
stn lattice route kubernetes
# Output:
# Best match: k8s-health-checker (sre-station-prod)
#
# All matches:
# 1. k8s-health-checker (sre-station-prod) - score: 0.95
# 2. k8s-deployer (devops-ci) - score: 0.82
# 3. k8s-monitor (monitoring-station) - score: 0.78
# Show all matches
stn lattice route security --all
stn lattice work
Manage async work items. Async work allows you to submit long-running tasks that execute in the background.
stn lattice work assign
Assign work to an agent asynchronously.
stn lattice work assign <agent-name> <task> [flags]
Flags:
| Flag | Description | Default |
|---|
--station | Assign to specific station | auto-route |
--timeout | Work timeout | 5m |
Examples:
# Assign work
stn lattice work assign vuln-scanner "Full security scan"
# Output:
# Work assigned: work_abc123
# Agent: vuln-scanner
#
# Use 'stn lattice work await work_abc123' to wait for results
# With timeout
stn lattice work assign log-analyzer "Analyze last 24h logs" --timeout 30m
stn lattice work await
Wait for work to complete and return the result.
stn lattice work await <work-id> [flags]
Examples:
stn lattice work await work_abc123
# Output:
# Waiting for work work_abc123...
#
# Status: completed
# Result: Scan complete. Found 3 vulnerabilities...
# Station: security-station
# Duration: 45.23s
stn lattice work check
Check work status without blocking.
stn lattice work check <work-id> [flags]
Examples:
stn lattice work check work_abc123
# Output:
# Work ID: work_abc123
# Status: running
stn lattice dashboard
Launch the interactive TUI dashboard.
stn lattice dashboard [flags]
Flags:
| Flag | Description | Default |
|---|
--refresh | Dashboard refresh interval | 2s |
Examples:
# Launch dashboard
stn lattice dashboard
# The dashboard shows:
# - Connected stations with health status
# - Available agents across the mesh
# - Active work items with progress
# - Recent invocations and their results
Global Flags
These flags apply to all stn lattice commands:
| Flag | Description | Default |
|---|
--nats | NATS URL for CLI client mode (e.g., nats://token@host:4222) | - |
--config | Config file path | ~/.config/station/config.yaml |
--enable-telemetry | Enable OpenTelemetry tracing | false |
--otel-endpoint | OpenTelemetry OTLP endpoint | http://localhost:4318 |
The --nats flag enables CLI client mode, allowing you to interact with a lattice without running a station server.
Authentication tokens can be included in the URL: nats://my-token@host:4222
Environment Variables
| Variable | Description |
|---|
NATS_AUTH_TOKEN | Authentication token for NATS (can be used in URL) |
STN_LATTICE_STATION_NAME | Station name in the mesh |
STN_LATTICE_TLS_CERT | TLS certificate path |
STN_LATTICE_TLS_KEY | TLS key path |
Exit Codes
| Code | Meaning |
|---|
0 | Success |
1 | General error |
2 | Connection failed |
3 | Agent not found |
4 | Invocation timeout |
5 | Work item not found |