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

# Streaming sessions

> Managed streaming sessions.

Managed streaming sessions. No reconnect, replay, or unbounded application queues.

### StreamingSession

```python theme={null}
class tazo.streaming.StreamingSession(url, credential, state)
```

Synchronous session; use as a context manager and iterate events in one thread.

Send audio from another thread while iterating to receive provisional updates. `commit` and `update` send control messages; consume the corresponding acknowledgement before sending the next turn. `finish` requests a graceful end; keep iterating until `session.closed`. Context exit always closes the socket.

* Parameters:

  * **url** (*str*)

  * **credential** (*str*)

  * **state** (*\_State*)

#### ready

```python theme={null}
property ready: SessionReady
```

Negotiated limits, available after entering the context.

#### send\_audio()

```python theme={null}
send_audio(audio)
```

Send one raw PCM16 message, applying the server-advertised limits.

* Parameters:

  **audio** (*bytes*)

* Return type:

  None

#### commit()

```python theme={null}
commit()
```

Complete the turn; consume decision.finalized before sending more audio.

* Return type:

  None

#### update()

```python theme={null}
update(*, state, questions)
```

Replace context and question between turns; consume session.updated.

* Parameters:

  * **state** (*str*  *|**dict**\[**str**,* *Any*\*]\* *|* *list*\*\[**str**]\*)

  * **questions** (*Mapping*\*\[**str**,\* [*ChoiceQuestion*](<> "tazo.types.ChoiceQuestion")  *|*[*NoulQuestion*](<> "tazo.types.NoulQuestion")  *|*[*ChoiceQuestionParam*](<> "tazo.types.ChoiceQuestionParam")  *|*[*NoulQuestionParam*](<> "tazo.types.NoulQuestionParam")*]*)

* Return type:

  None

#### finish()

```python theme={null}
finish()
```

Request finalization and graceful closure; continue consuming events.

* Return type:

  None

#### \_\_next\_\_()

```python theme={null}
__next__()
```

Return the next item from the iterator. When exhausted, raise StopIteration

* Return type:

  [*SessionUpdated*](<> "tazo.types.SessionUpdated") | [*DecisionEvent*](<> "tazo.types.DecisionEvent") | [*SessionClosed*](<> "tazo.types.SessionClosed") | [*ErrorEvent*](<> "tazo.types.ErrorEvent") | [*UnknownEvent*](<> "tazo.types.UnknownEvent")

#### close()

```python theme={null}
close()
```

Close immediately without replaying or cancelling accepted durable work.

* Return type:

  None

### AsyncStreamingSession

```python theme={null}
class tazo.streaming.AsyncStreamingSession(url, credential, state)
```

Async context manager and event iterator. Use a concurrent audio-sending task.

No background reader is created. The websocket’s bounded receive queue supplies backpressure. One task may receive while another sends. Cancelled operations close the socket; accepted durable evaluations may still finish.

* Parameters:

  * **url** (*str*)

  * **credential** (*str*)

  * **state** (*\_State*)

#### ready

```python theme={null}
property ready: SessionReady
```

Negotiated limits, available after entering the context.

#### send\_audio()

```python theme={null}
async send_audio(audio)
```

Send one PCM16 message; the send applies transport backpressure.

* Parameters:

  **audio** (*bytes*)

* Return type:

  None

#### commit()

```python theme={null}
async commit()
```

Complete the turn; await decision.finalized through the iterator.

* Return type:

  None

#### update()

```python theme={null}
async update(*, state, questions)
```

Replace state and questions; await session.updated through the iterator.

* Parameters:

  * **state** (*str*  *|**dict**\[**str**,* *Any*\*]\* *|* *list*\*\[**str**]\*)

  * **questions** (*Mapping*\*\[**str**,\* [*ChoiceQuestion*](<> "tazo.types.ChoiceQuestion")  *|*[*NoulQuestion*](<> "tazo.types.NoulQuestion")  *|*[*ChoiceQuestionParam*](<> "tazo.types.ChoiceQuestionParam")  *|*[*NoulQuestionParam*](<> "tazo.types.NoulQuestionParam")*]*)

* Return type:

  None

#### finish()

```python theme={null}
async finish()
```

Request a graceful end; continue iterating until session.closed.

* Return type:

  None

#### \_\_anext\_\_()

```python theme={null}
async __anext__()
```

Return the next item or raise StopAsyncIteration when exhausted.

* Return type:

  [*SessionUpdated*](<> "tazo.types.SessionUpdated") | [*DecisionEvent*](<> "tazo.types.DecisionEvent") | [*SessionClosed*](<> "tazo.types.SessionClosed") | [*ErrorEvent*](<> "tazo.types.ErrorEvent") | [*UnknownEvent*](<> "tazo.types.UnknownEvent")

#### close()

```python theme={null}
async close()
```

Close immediately. It does not cancel already accepted evaluations.

* Return type:

  None


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