> ## 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** is a Windows machine running the host agent, paired to your account.
Your API key can reach any rig 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) |

Wake a sleeping rig with `gw.wake_rig(rig.id)` if Wake-on-LAN is configured.

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