> ## 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.

# Station Lattice

> Multi-station mesh networking for distributed agent execution

# Station Lattice

Station Lattice enables multiple Station instances to form a mesh network, allowing agents to discover and invoke each other across stations. This creates a powerful distributed system where specialized agents can collaborate on complex tasks.

<Info>
  Station Lattice is designed for teams that need to distribute agent workloads across multiple machines, environments, or security boundaries.
</Info>

## Key Features

<CardGroup cols={2}>
  <Card title="Agent Discovery" icon="magnifying-glass">
    Agents automatically register and discover each other across the mesh
  </Card>

  <Card title="Capability Routing" icon="route">
    Route requests to agents based on their declared capabilities
  </Card>

  <Card title="Remote Invocation" icon="bolt">
    Invoke agents on remote stations with request-reply semantics
  </Card>

  <Card title="Async Work Queue" icon="list-check">
    Assign long-running tasks with JetStream-backed tracking
  </Card>
</CardGroup>

## Architecture Overview

```
┌─────────────────────────────────────────────────────────────────┐
│                    Orchestrator Station                          │
│                    (embedded NATS on :4222)                      │
│                    JetStream KV: stations, agents, work          │
└─────────────────────────────────────────────────────────────────┘
                               │
         ┌─────────────────────┼─────────────────────┐
         │                     │                     │
         ▼                     ▼                     ▼
┌───────────────┐     ┌───────────────┐     ┌───────────────┐
│  SRE Station  │     │   Security    │     │    DevOps     │
│  K8sHealth    │     │  VulnScanner  │     │  Deployer     │
│  LogAnalyzer  │     │  ThreatAnalyz │     │  CICDRunner   │
└───────────────┘     └───────────────┘     └───────────────┘
```

## Operating Modes

| Mode             | Flag                                   | Description                                     |
| ---------------- | -------------------------------------- | ----------------------------------------------- |
| **Standalone**   | `stn serve`                            | Traditional single-station mode (no lattice)    |
| **Orchestrator** | `stn serve --orchestration`            | Runs embedded NATS server, coordinates the mesh |
| **Member**       | `stn serve --lattice nats://host:4222` | Connects to an orchestrator's NATS server       |

## Quick Start

### 1. Start an Orchestrator Station

```bash theme={null}
# Start with embedded NATS server
stn serve --orchestration --workspace ./orchestrator

# The orchestrator will:
# - Start embedded NATS on port 4222
# - Create JetStream KV buckets for registry
# - Begin accepting member connections
```

### 2. Start Member Stations

```bash theme={null}
# On another machine or terminal
stn serve --lattice nats://orchestrator-host:4222 --workspace ./member

# The member will:
# - Connect to orchestrator's NATS
# - Register its station and agents
# - Begin heartbeat presence
```

### 3. Verify the Mesh

```bash theme={null}
# List all connected stations
stn lattice stations list

# List all available agents across the mesh
stn lattice agents list

# Check mesh health
stn lattice status
```

## Use Cases

### Distributed SRE Team

Deploy specialized agents across your infrastructure:

* **Orchestrator** in your central management cluster
* **SRE Station** in production with K8s access
* **Security Station** in isolated security zone
* **DevOps Station** with CI/CD credentials

### Multi-Cloud Deployment

Connect stations across cloud providers:

```bash theme={null}
# AWS orchestrator
stn serve --orchestration --workspace ./aws-station

# GCP member
stn serve --lattice nats://aws-orchestrator:4222 --workspace ./gcp-station

# Azure member  
stn serve --lattice nats://aws-orchestrator:4222 --workspace ./azure-station
```

### Development & Production Separation

Keep development agents separate from production:

```bash theme={null}
# Production orchestrator (locked down)
stn serve --orchestration --workspace ./prod --port 8080

# Dev member (connects for read-only monitoring)
stn serve --lattice nats://prod:4222 --workspace ./dev
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Setup & Configuration" icon="gear" href="/station/lattice-setup">
    Detailed configuration options for lattice networking
  </Card>

  <Card title="CLI Reference" icon="terminal" href="/station/lattice-cli">
    Complete reference for lattice CLI commands
  </Card>

  <Card title="Architecture Deep Dive" icon="sitemap" href="/station/lattice-architecture">
    Technical details on NATS subjects, message flows, and internals
  </Card>
</CardGroup>
