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

# Your first session

> Start a session, observe UIA targets, click by name, and clean up.

With an [installed host](/get-started/install-host) and an
[eligible PC](/get-started/pair-rig), you're ready to run a full session.

## Full example

```python theme={null}
import os
from glasswarp import GlasswarpClient

gw = GlasswarpClient(api_key=os.environ["GLASSWARP_API_KEY"])

rig = next(
    (r for r in gw.list_rigs() if r.online and r.api_access_enabled),
    None,
)
if rig is None:
    raise RuntimeError("No online PC with API access enabled")

session = gw.create_session(rig_id=rig.id, mode="desktop")
sid = session.session_id
print("session:", sid)

try:
    obs = gw.observe(sid)
    save = next((t for t in obs.targets if (t.name or "") == "Save"), None)
    if save is None:
        print("No target named Save — first few:", [
            (t.role, t.name) for t in obs.targets[:8]
        ])
    else:
        gw.click_target(sid, save)
finally:
    gw.end_session(sid)
```

## What happens

<Steps>
  <Step title="create_session">
    The gateway checks ownership and consent, then the host starts a desktop
    session and shows the on-screen "API session active" indicator.
  </Step>

  <Step title="observe">
    One round-trip: JPEG plus UIA targets (names, roles, bounds).
  </Step>

  <Step title="click_target">
    Native Win32 click at the named control's center — not a guessed pixel.
  </Step>

  <Step title="end_session">
    The host runs `safety_restore` and tears the session down. Always end
    sessions — they meter usage.
  </Step>
</Steps>

<Warning>
  Wrap actions in `try/finally` and always call `end_session`. Sessions meter
  usage and hold the host's pipeline. `safety_restore` also runs automatically
  on disconnect, launch failure, and `END_SESSION`.
</Warning>

## Watch it live

Open **Console → Sessions → Eye** to watch at 60fps while your code runs. See
[Live View](/guides/live-view).

Next: [ground your clicks](/concepts/grounding), [build an agent
loop](/guides/agent-loop), and [safe agent
sessions](/guides/safe-agent-sessions).


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