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

# Core Concepts

> Loops, actors, guards, and gateway primitives — concepts that apply across the Better Data platform.

## Better Data platform concepts

### Layered ecosystem model (canonical)

Better Data is described as **five layers** — not as a flat list of products:

| Layer              | Surface                                    |
| ------------------ | ------------------------------------------ |
| **Infrastructure** | Gateway Console, Hosted Gateway MCP        |
| **Protocol**       | Commerce Gateway, Registry MCP             |
| **Reference**      | Gateway Demo, Commerce Demo, Agent Starter |
| **Control**        | Loop Engine                                |
| **Platform**       | Better Data                                |

* **Infrastructure** is where operators configure and host gateway/MCP surfaces.
* **Protocol** is what agents and integrations speak (gateway execution, registry discovery).
* **Reference** is implementation demos and accelerators — illustrative, not control planes.
* **Control** is governed automation (loops, policy, audit).
* **Platform** is the workspace shell that composes the layers after onboarding.

→ [MCP surfaces](/reference/mcp-surfaces) · [Platform architecture](/getting-started/platform-architecture)

### Agent flow (C04 / C12)

Agents **reuse the layered stack** — they do not replace it or sit “beside” the gateway as a separate product. Canonical wording: **agents use Registry to discover, Gateway to act, and Loop Engine to govern.**

```
Agent
  ↓
Registry MCP
  ↓
Commerce Gateway
  ↓
Loop Engine
  ↓
Demo / UI
```

Experience (demos, product UI) sits at the bottom; developers start from [Build an agent](/guides/build-an-agent). See [Commerce Agent pattern](/reference/commerce-agent-pattern).

### Loops, actors, guards, and evidence

The core concepts in Better Data apply across **all four platform layers** (loop / gateway / SCM·DCM / Signal Tags — see [Platform architecture](/getting-started/platform-architecture)):

* **Loops** — governed workflows. Every operation is a loop.
* **Actors** — human, automation, or AI agent. Every action is attributed.
* **Guards** — policies enforced at runtime. Not in prompts.
* **Evidence** — structured context attached to every decision.
* **Audit trail** — immutable record of every loop transition.

The Commerce Gateway, SCM/DCM modules, and Signal Tags all participate in loops. The **loop model** is the unifying concept.

→ [Platform Architecture](/getting-started/platform-architecture)\
→ [Loops](/platform/loops)

***

## Commerce Gateway concepts: Backends, Tools, and Sessions

The Commerce Gateway is built on three main pillars: **Backends**, **Tools**, and **Sessions**. Understanding these concepts will help you design flexible and robust conversational commerce experiences.

## 1. Backends

Backends are where your data lives. They provide the gateway with access to your product catalog, shopping carts, and order management systems.

* **ProductBackend**: Handles searching and retrieving product information.
* **CartBackend**: Manages the lifecycle of a shopping cart.
* **OrderBackend**: Facilitates order creation and status tracking.

[Learn more about Backends ->](/getting-started/backends)

## 2. Tools (Capabilities)

Tools (often referred to as Capabilities in the marketing docs) are the specific actions an AI can perform. The gateway takes your backend logic and "adapts" it into a format the LLM can understand (like MCP for Claude or Function Calling for OpenAI).

Common tools include:

* `search_products`
* `get_product_details`
* `add_to_cart`
* `check_inventory`

[Learn more about Tools ->](/getting-started/tools)

## 3. Sessions

Sessions maintain the state of a conversation across multiple turns. They store things like the current `cartId` and user context.

* **Persistent**: Sessions can be stored in Redis to survive server restarts.
* **Cross-Platform**: A session started in Claude can be transferred to a web checkout or even another AI assistant.

[Learn more about Sessions ->](/getting-started/sessions)

## Architecture Overview

The Commerce Gateway acts as the orchestration layer between various LLM providers and your commerce infrastructure.

<Note>
  This diagram is **LLM ↔ gateway ↔ backends** plumbing only. The **canonical platform / layered ecosystem** diagram for C8 is the [layered ecosystem model](#layered-ecosystem-model-canonical) above and [Platform architecture](/getting-started/platform-architecture).
</Note>

```mermaid theme={null}
graph LR
    A[Claude / OpenAI] --> B[Commerce Gateway]
    B --> C[Universal Tools]
    C --> D[Backends]
    D --> E[Shopify / Square / Custom]
```

## Getting Started

If you're ready to start building, head over to the [Quickstart](/getting-started/quickstart) guide.
