assistant-ui logo/Docs/API Reference
Hooks

Model Context Hooks

React hooks for registering assistant-ui tools, data renderers, instructions, and model context providers.

API Reference

useAssistantInteractable

Registers an interactable with the AI assistant.

This hook handles registration only. To read and write the interactable's state, use useInteractableState with the returned id.

useAssistantInteractable
name : string

config : AssistantInteractableProps

description : string

stateSchema : InteractableStateSchema

initialState : unknown

id ?: string

selected ?: boolean

useAuiToolOverrides

Deprecated. Experimental, API may change.

Overrides toolkit entries for the current assistant scope.

This is intended for dynamic local-state tools whose model-facing contract is declared in a "use generative" toolkit file with execute: stubTool(), but whose actual executor must close over React state in the mounted component. Keep the override keys stable after mount; dynamic key addition/removal is not currently observed. Overrides are registered at priority 1000, above toolkit defaults. Only one mounted override provider may define a given tool name at a time.

useAuiToolOverrides
overrides : AuiToolOverrides

useInteractableState

Reads and writes the state of a registered interactable.

Pair with useAssistantInteractable which handles registration.

useInteractableState
id : string

fallback : TState