# state_to_events

> **Function** in `langchain_azure_ai`

📖 [View in docs](https://reference.langchain.com/python/langchain-azure-ai/agents/hosting/_converters/_final/state_to_events)

Yield the Responses API events that summarise a final graph state.

Walks every message appended after the last :class:`HumanMessage` so
intermediate tool calls and tool results are surfaced to the client
(not just the final assistant text).

## Signature

```python
state_to_events(
    state: dict[str, Any] | Any,
    stream: ResponseEventStream,
) -> AsyncIterator[Any]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `state` | `dict[str, Any] \| Any` | Yes | The value returned by ``CompiledStateGraph.ainvoke``. Expected shape is a mapping with a ``"messages"`` channel. |
| `stream` | `ResponseEventStream` | Yes | The :class:`ResponseEventStream` to emit events through. |

---

[View source on GitHub](https://github.com/langchain-ai/langchain-azure/blob/7a6a664d617264df8dcb12fcfb1bacc09f21d504/libs/azure-ai/langchain_azure_ai/agents/hosting/_converters/_final.py#L36)