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

# How Momentic works

> The agent loop, step cache, auto-heal, and how Momentic tests flow from prompt to result.

Momentic runs an **AI agent that controls a real browser or emulator**. You
describe steps in natural language, the agent translates them into low-level
actions, and Momentic records everything so future runs are fast and reliable.

## The lifecycle of a step

1. **Prompt**: You write a step like `Click the Sign in button`.
2. **Context**: The agent reads the page (DOM, accessibility tree, screenshot)
   to understand what's in front of it.
3. **Action**: The agent picks an element and issues the action (click, type,
   scroll, etc.).
4. **Verification**: Built-in stability checks wait for the network and DOM to
   settle before declaring the step done.
5. **Cache**: The resolved locator and context are written to the
   [step cache](/reliability/step-cache).
6. **Replay**: On the next run, Momentic replays from cache, no LLM call, until
   something changes.
7. **Heal**: When the cached locator misses, [auto-heal](/reliability/auto-heal)
   uses the AI agent to find the element again and updates the cache.

This loop is why Momentic tests stay stable across UI changes: the agent is only
invoked when it's needed.

## Anatomy of a test

Tests live in your repo as YAML. Each test file is a series of steps; steps can
be [modules](/core-concepts/modules) (reusable),
[variables](/core-concepts/variables) (environment-aware), or primitive
commands. Common step types include **AI action**, **AI check**, **Page check**,
**Element check**, **Tap**, **Type**, **Click**, and **Scroll to**.

<Note>
  The YAML is generated and maintained through the editor, IDs and nested fields
  are bookkeeping you don't write by hand. See a real example in
  [momentic-ai/examples](https://github.com/momentic-ai/examples/blob/main/android/android-google-maps.test.yaml).
</Note>

## Where things run

* **Local**: The CLI drives a browser or emulator on your machine. Fastest
  iteration loop.
* **CI**: The same CLI runs in your CI pipeline. Results upload to the dashboard
  at [app.momentic.ai](https://app.momentic.ai).
* **Dashboard**: View runs, triage failures, manage
  [quarantine](/reliability/quarantine), configure alerts, and manage API keys,
  integrations, and team. Tests are no longer authored or executed in the
  dashboard (see [Cloud deprecation](/get-started/cloud-deprecation)).

## Step-based vs. agentic

* **Step-based** is deterministic and fast. Use it for critical paths.
* **[Agentic](/core-concepts/agentic-testing)** uses **AI action** to let the
  agent determine a flow on its own. Use it for dynamic or high-level scenarios.

Most tests mix both.
