API key for authentication.
The ID of the assistant to use.
LangGraph SDK client used to send requests and receive responses.
Whether to fetch the history of the thread. If true, the history will be fetched from the server. Defaults to 10 entries. If false, only the last state will be fetched from the server.
Initial values to display immediately when loading a thread. Useful for displaying cached thread data while official history loads. These values will be replaced when official thread data is fetched.
Note: UI components from initialValues will render immediately if they're predefined in LoadExternalComponent's components prop, providing instant cached UI display without server fetches.
Specify the key within the state that contains messages. Defaults to "messages".
Callback that is called when a checkpoints event is received.
Callback that is called when a new stream is created.
Callback that is called when a custom event is received.
Callback that is called when an error occurs.
Callback that is called when the stream is finished.
Callback that is called when a LangChain event is received.
Callback that is called when a metadata event is received.
Callback that is called when the stream is stopped by the user. Provides a mutate function to update the stream state immediately without requiring a server roundtrip.
Callback that is called when a tasks event is received.
Callback that is called when the thread ID is updated (ie when a new thread is created).
Callback that is called when an update event is received.
Will reconnect the stream on mount
Manage the thread state externally.
The ID of the thread to fetch history and current values from.
Throttle the stream.
If a number is provided, the stream will be throttled to the given number of milliseconds.
If true, updates are batched in a single macrotask.
If false, updates are not throttled or batched.
onStop: ({ mutate }) => {
mutate((prev) => ({
...prev,
ui: prev.ui?.map(component =>
component.props.isLoading
? { ...component, props: { ...component.props, stopped: true, isLoading: false }}
: component
)
}));
}