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

# Rigs and sessions

> The two core objects: the machine and the connection to it.

## Rigs

A **rig** (console: **PC**) is a Windows machine running the host agent, paired
to your account. The UI says PC; the API still uses `list_rigs` / `rig_id`.
The person at the machine installs without a Glasswarp login; you pair the
tray code. Your API key can reach any PC you own that has API access enabled.

```python theme={null}
rigs = gw.list_rigs()
for rig in rigs:
    print(rig.id, rig.online, rig.api_access_enabled)
```

| Field | Meaning |
| - | - |
| `id` | Stable rig identifier |
| `online` | Host agent currently connected |
| `api_access_enabled` | Owner turned on API access (per-rig consent) |

To keep a rig reachable for agents, enable **Keep rig awake** in the rig's
settings. Windows stays awake and connected while the physical display can rest.
See [Keep a rig awake](/guides/keep-rig-awake).

API sessions also manage **Windows HDR** for capture quality: Live View is SDR,
so the host temporarily turns HDR off for the session and restores it afterward.
See [Live View → Color / HDR](/guides/live-view#color--hdr).

## Sessions

A **session** is an active, metered connection to a rig. It owns the host's
capture/encode/input pipeline for its lifetime.

```python theme={null}
session = gw.create_session(rig_id=rig.id, mode="desktop")
sid = session.session_id

status = gw.get_session(sid)   # current status
active = gw.list_sessions()    # all active sessions

gw.end_session(sid)            # end + safety_restore
```

### Modes

| Mode | Use |
| - | - |
| `desktop` | The full Windows desktop — the default for agents and QA |
| Game Mode | A frozen demo at `/play`; not a general API surface |

### Lifecycle and cleanup

<Warning>
  Sessions meter usage. Always end them in a `finally` block. The host also runs
  `safety_restore` automatically on disconnect, launch failure, `EXIT_GAME`,
  `FORCE_QUIT`, and API `END_SESSION`.
</Warning>

```python theme={null}
session = gw.create_session(rig_id=rig.id, mode="desktop")
try:
    ...  # your loop
finally:
    gw.end_session(session.session_id)
```

Continue to [Vision](/concepts/vision).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.