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

# autogen.agentchat.realtime.experimental.AudioObserver

<h2 id="autogen.agentchat.realtime.experimental.AudioObserver" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

  <span class="doc doc-object-name doc-class-name">AudioObserver</span>
</h2>

```python theme={null}
AudioObserver(*, logger: ForwardRef('Logger') | None = None)
```

Observer for user voice input

Observer for user voice input

<b>Parameters:</b>

| Name     | Description                                                         |
| -------- | ------------------------------------------------------------------- |
| `logger` | **Type:** ForwardRef('Logger') \| None<br /><br />**Default:** None |

### Instance Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### initialize\_session

```python theme={null}
initialize_session(self) -> None
```

No need to initialize session from this observer

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### on\_close

```python theme={null}
on_close(self) -> None
```

Handle close of RealtimeClient.

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### on\_event

```python theme={null}
on_event(self, event: RealtimeEvent) -> None
```

Observe voice input events from the Realtime.<br />

<b>Parameters:</b>

| Name    | Description                                                                                                                                                             |
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `event` | The event from the OpenAI Realtime API.<br /><br />**Type:** [RealtimeEvent](/docs/api-reference/autogen/agentchat/realtime/experimental/realtime_events/RealtimeEvent) |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### run

```python theme={null}
run(self, agent: RealtimeAgent) -> 
```

Run the observer with the agent.<br />When implementing, be sure to call `self._ready_event.set()` when the observer is ready to process events.<br />

<b>Parameters:</b>

| Name    | Description                                                                     |
| ------- | ------------------------------------------------------------------------------- |
| `agent` | The realtime agent attached to the observer.<br /><br />**Type:** RealtimeAgent |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### run\_loop

```python theme={null}
run_loop(self) -> None
```

Run the observer loop.

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### wait\_for\_ready

```python theme={null}
wait_for_ready(self) -> None
```

Get the event that is set when the observer is ready.

<br />
