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

# Minesweeper: agent loop + grounding

> An agent plays Google Minesweeper on a real Windows PC — observe → think → act → verify.

A fast demo on a browser game. Glasswarp is eyes and hands; the solver or
LLM is the brain (example code).

```
observe → think (CV+solver or Gemini) → click_target → verify → repeat
```

<Note>
  **Platform vs agent:** `observe` / `click_target` are Glasswarp. Board CV,
  `solve()`, and LLM prompts live under `sdk/python/examples/**`. Prefer
  [Notepad](/examples/notepad) or [Mona Lisa](/examples/mona-lisa) when you need
  the strongest “VNC can’t do this” story (native Win32 / UIA).
</Note>

## Prerequisites

<Steps>
  <Step title="Online, API-enabled rig">
    [Install the host](/get-started/install-host) → Console → Rigs → API access on.
  </Step>

  <Step title="SDK">
    ```bash theme={null}
    pip install "glasswarp[grounding]"
    export GLASSWARP_API_KEY=gw_live_sk_...
    ```
  </Step>
</Steps>

## Run (deterministic think — fastest)

```bash theme={null}
python sdk/python/examples/minesweeper_solver_demo.py
```

Launches Chrome → Google Minesweeper (Medium) → plays to a win. Watch
**Console → Sessions → Eye**.

## Run (LLM think — Gemini + SoM)

```bash theme={null}
export GEMINI_API_KEY=...
python sdk/python/examples/gemini_agent_loop.py
```

Same eyes/hands; Gemini picks a Set-of-Mark cell id each step.

## Platform vs agent

| Step                          | Owner                     |
| ----------------------------- | ------------------------- |
| Observe (`observe`)           | Platform                  |
| Think (CV + solver, or model) | Your agent / example code |
| Act (`click_target`)          | Platform                  |
| Verify (re-observe)           | Your loop + platform eyes |

Canonical shape: [Build an agent loop](/guides/agent-loop). Skeleton:
`sdk/python/templates/observe_think_act/`.

## Tuning

| Env var                 | Default | Purpose                         |
| ----------------------- | ------- | ------------------------------- |
| `DEMO_BOOTSTRAP_CHROME` | `1`     | `0` if the game is already open |
| `TOTAL_MINES`           | `40`    | Google Medium                   |
| `CLICK_PAUSE_S`         | `0.12`  | Delay between clicks            |

<CardGroup cols={2}>
  <Card title="Templates" icon="copy" href="/examples/templates">
    Outcome-named starters.
  </Card>

  <Card title="Grounding" icon="bullseye" href="/examples/grounding">
    SoM + click\_target.
  </Card>
</CardGroup>
