> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# Interface: UseOpenUIStateOptions

Inputs used to parse OpenUI text and build renderer state.

## Properties

### initialQueryResults?

> `optional` **initialQueryResults?**: `Readonly`\<`Record`\<`string`, `unknown`>>

Prefetched Query results keyed by the Query assignment name (statement ID).
They are available during the initial render and act as fallbacks while an
optional tool provider revalidates them after commit.

***

### initialState?

> `optional` **initialState?**: `Record`\<`string`, `unknown`>

***

### isStreaming

> **isStreaming**: `boolean`

***

### library

> **library**: [`Library`](/next/api/genui/openui/core/type-aliases/Library.md)

***

### onAction?

> `optional` **onAction?**: (`event`: [`ActionEvent`](/next/api/genui/openui/core/interfaces/ActionEvent.md)) => `void`

#### Parameters

| Parameter | Type                                                                   |
| --------- | ---------------------------------------------------------------------- |
| `event`   | [`ActionEvent`](/next/api/genui/openui/core/interfaces/ActionEvent.md) |

#### Returns

`void`

***

### onError?

> `optional` **onError?**: (`errors`: [`OpenUIError`](/next/api/genui/openui/core/interfaces/OpenUIError.md)\[]) => `void`

Callback for structured, LLM-friendly errors. See OpenUIError type.

#### Parameters

| Parameter | Type                                                                      |
| --------- | ------------------------------------------------------------------------- |
| `errors`  | [`OpenUIError`](/next/api/genui/openui/core/interfaces/OpenUIError.md)\[] |

#### Returns

`void`

***

### onStateUpdate?

> `optional` **onStateUpdate?**: (`state`: `Record`\<`string`, `unknown`>) => `void`

#### Parameters

| Parameter | Type                           |
| --------- | ------------------------------ |
| `state`   | `Record`\<`string`, `unknown`> |

#### Returns

`void`

***

### response

> **response**: `string` | `null`

***

### toolProvider?

> `optional` **toolProvider?**: [`ToolProvider`](/next/api/genui/openui/core/interfaces/ToolProvider.md) | `null`

ToolProvider for Query data fetching — MCP, REST, GraphQL, or any backend.
