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

# flow_runs_watching

# `prefect.cli.flow_runs_watching`

Utilities for following flow runs with interleaved events and logs

## Functions

### `watch_flow_run` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow\_runs\_watching.py#L38](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow_runs_watching.py#L38)</sup>

```python theme={null}
watch_flow_run(flow_run_id: UUID, console: Console, timeout: int | None = None) -> FlowRun
```

Watch a flow run, displaying interleaved events and logs until completion.

**Args:**

* `flow_run_id`: The ID of the flow run to watch
* `console`: Rich console for output
* `timeout`: Maximum time to wait for flow run completion in seconds.
  If None, waits indefinitely.

**Returns:**

* The finished flow run

**Raises:**

* `FlowRunWaitTimeout`: If the flow run exceeds the timeout
* `FlowRunWatchError`: If the events/logs stream closes before the flow run
  reaches a terminal state

## Classes

### `FlowRunFormatter` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow\_runs\_watching.py#L115](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow_runs_watching.py#L115)</sup>

Handles formatting of logs and events for CLI display

**Methods:**

#### `format` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow\_runs\_watching.py#L160](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow_runs_watching.py#L160)</sup>

```python theme={null}
format(self, item: Log | Event) -> str
```

Format a log or event for display

#### `format_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow\_runs\_watching.py#L188](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow_runs_watching.py#L188)</sup>

```python theme={null}
format_event(self, event: Event) -> str
```

Format an event

#### `format_log` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow\_runs\_watching.py#L167](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow_runs_watching.py#L167)</sup>

```python theme={null}
format_log(self, log: Log) -> str
```

Format a log entry

#### `format_run_id` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow\_runs\_watching.py#L156](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow_runs_watching.py#L156)</sup>

```python theme={null}
format_run_id(self, run_id_short: str) -> str
```

Format run ID

#### `format_timestamp` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow\_runs\_watching.py#L122](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/cli/flow_runs_watching.py#L122)</sup>

```python theme={null}
format_timestamp(self, dt: datetime) -> str
```

Format timestamp with incremental display
