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

# MonitorClient

> High-level single-session monitor over the low-level Rust monitor feed

```python theme={null}
from grid_nexus_client import MonitorClient
```

High-level single-session monitor over the low-level Rust monitor feed.

## Constructor

```python Signature theme={null}
MonitorClient(
    handle,
    *,
    session_id: str | None = None,
    deployment_id: str | None = None,
    deployment_prefix: str | None = None,
    environment: str = 'unknown',
)
```

## Properties

<ResponseField name="scope" type="MonitorScope" />

<ResponseField name="ws_endpoint" type="tuple[str, int] | None" />

## Methods

### `close()`

```python Signature theme={null}
close() -> None
```

### `get_session()`

```python Signature theme={null}
get_session() -> SessionState
```

### `list_graph_nodes()`

```python Signature theme={null}
list_graph_nodes() -> list[GraphNodeStatus]
```

### `list_parties()`

```python Signature theme={null}
list_parties() -> list[PartyInstance]
```

### `recent_errors()`

```python Signature theme={null}
recent_errors(limit: int = 50) -> list[MonitorEvent]
```

### `recent_trace_refs()`

```python Signature theme={null}
recent_trace_refs(
    snapshot: MonitorSnapshot | None = None,
    *,
    limit: int = 20,
) -> list[TraceReference]
```

### `serve_ws()`

```python Signature theme={null}
serve_ws(
    *,
    host: str = '127.0.0.1',
    port: int = 0,
    interval_secs: float = 1.5,
    error_limit: int = 50,
    allow_remote: bool = False,
) -> int
```

Start a background websocket broadcaster for MonitorSnapshot JSON.

`port=0` asks the OS for a free port; the actual bound port is
returned so callers can tell viewers where to connect. Idempotent
in the sense that a second call while the server is running raises.

The snapshot includes full session/party/trace topology with no
authentication, so binding a non-loopback host requires the caller
to opt in with `allow_remote=True`.

### `session_parties()`

```python Signature theme={null}
session_parties(snapshot: MonitorSnapshot | None = None) -> list[PartyInstance]
```

### `snapshot()`

```python Signature theme={null}
snapshot(*, error_limit: int = 50) -> MonitorSnapshot
```

### `stop()`

```python Signature theme={null}
stop() -> None
```

### `stop_ws()`

```python Signature theme={null}
stop_ws() -> None
```


## Related topics

- [Your first skill](/get-started/first-skill.md)
- [GRID Cortex Client](/models/cortex.md)
- [grid-cortex-client](/python-api/grid-cortex-client/overview.md)
- [CortexClient](/python-api/grid-cortex-client/cortexclient.md)
- [AsyncCortexClient](/python-api/grid-cortex-client/asynccortexclient.md)
