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

# Architecture

> How the Pastures extension, engine, and AI model layer fit together.

Pastures follows a three-layer architecture. The extension is a pure UI client — it contains no backend logic, no data processing, and no proprietary algorithms.

## Three layers

```
┌──────────────────────────────────────────────┐
│           Rancher Manager (Browser)          │
│  ┌────────────────────────────────────────┐  │
│  │        Pastures Extension (Vue 3)      │  │
│  │  Sidebar pages · AI drawer · Charts    │  │
│  └──────────────┬─────────────────────────┘  │
│                 │ REST calls (engineFetch)    │
└─────────────────┼────────────────────────────┘
                  │
                  ▼
┌──────────────────────────────────────────────┐
│            Pastures Engine (API)             │
│  Data aggregation · AI routing · Caching    │
│  /api/diagnose · /api/advisories · ...      │
└──────────────┬───────────────────────────────┘
               │
               ▼
┌──────────────────────────────────────────────┐
│            AI Model Layer                    │
│  ┌──────────────┐  ┌─────────────────────┐  │
│  │ Rancher Oracle│  │  BYO Model          │  │
│  │ (Hosted RAG) │  │  OpenAI / Anthropic  │  │
│  │ 48K+ fixes   │  │  Ollama / Azure      │  │
│  └──────────────┘  └─────────────────────┘  │
└──────────────────────────────────────────────┘
```

### 1. Pastures Extension

The Vue 3 extension runs inside Rancher Manager's browser session. Built on `@rancher/shell`, it registers sidebar items, pages, and components. It makes REST calls to the Pastures Engine via `engineFetch` (a wrapper around `fetch` that handles auth headers and base URL resolution).

The extension has **zero** runtime dependencies beyond what Rancher provides — no databases, no background workers, no secrets.

### 2. Pastures Engine

The backend REST API handles:

* Data aggregation from Kubernetes clusters
* AI request routing (Oracle vs BYO)
* Response caching and rate limiting
* Advisory generation and scoring

The extension communicates with the Engine over HTTPS. In demo mode, `engineFetch` short-circuits and returns synthetic data from `demoResponses.ts` — no network calls are made.

### 3. AI Model Layer

Two options:

* **Rancher Oracle** — A hosted RAG service that searches a curated corpus of 48,000+ real issue resolutions from 13 SUSE/Rancher repositories. Returns grounded fixes with GitHub source citations.
* **BYO Model** — Any OpenAI-compatible endpoint. The Engine forwards prompts to your chosen provider. No corpus search or source citations in this mode.

## Key API endpoints

| Endpoint                  | Purpose                              |
| ------------------------- | ------------------------------------ |
| `/api/diagnose`           | AI diagnostic requests               |
| `/api/advisories`         | Security and operational advisories  |
| `/api/clusters`           | Cluster intelligence and health data |
| `/api/gpu/nodes`          | GPU node inventory and utilization   |
| `/api/monitoring/alerts`  | Active monitoring alerts             |
| `/api/monitoring/metrics` | Prometheus metric correlation        |
| `/api/cis/scan`           | CIS benchmark scan results           |
| `/api/etcd/snapshots`     | etcd backup snapshot listing         |
| `/api/etcd/schedule`      | etcd backup schedule management      |
| `/api/audit/events`       | Audit log event stream               |

## Demo mode

When demo mode is enabled in Settings, `engineFetch` bypasses all network calls and returns synthetic responses from `demoResponses.ts`. This provides realistic data for every feature:

* Advisories with severity ratings
* Cluster health scores and version data
* GPU node telemetry
* CIS scan findings
* Monitoring alerts and metrics
* etcd snapshots and schedules
* Harvester VM and infrastructure data
* AI diagnostic responses with mock source citations

Demo mode requires no Engine deployment, no API keys, and no cluster connectivity beyond what Rancher itself provides.

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Get running in 5 minutes
  </Card>

  <Card title="AI Model Config" icon="microchip" href="/configuration/ai-model">
    Choose Oracle vs BYO
  </Card>
</CardGroup>
