The agent's state type
Type configuration bag
OptionalapiThe API key to use.
OptionalapiThe URL of the API to use.
The ID of the assistant to use.
OptionalcallerCustom call options, such as custom fetch implementation.
OptionalclientClient used to send requests.
OptionaldefaultDefault headers to send with requests.
OptionalfetchWhether 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.
OptionalfilterWhether to filter out messages from subagent namespaces.
When true, only messages from the main agent are included in
the messages array. Subagent messages are still accessible via
the subagents map and individual subagent streams.
This is useful when you want to display subagent progress separately from the main conversation, or when subagent messages would be too verbose in the main message list.
OptionalinitialInitial 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.
OptionalmessagesSpecify the key within the state that contains messages. Defaults to "messages".
OptionalonCallback that is called when a checkpoints event is received.
OptionalonCallback that is called when a new stream is created.
OptionalonCallback that is called when a custom event is received.
OptionalonCallback that is called when an error occurs.
OptionalonCallback that is called when the stream is finished.
OptionalonCallback that is called when a LangChain event is received.
OptionalonCallback that is called when a metadata event is received.
OptionalonCallback 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.
OptionalonCallback that is called when a tasks event is received.
OptionalonCallback that is called when the thread ID is updated (ie when a new thread is created).
OptionalonCallback that is called when an update event is received.
OptionalreconnectWill reconnect the stream on mount
OptionalsubagentTool names that indicate subagent invocation.
When an AI message contains tool calls with these names, they are
automatically tracked as subagent executions. This enables the
subagents, activeSubagents, getSubagent(), getSubagentsByType(), and getSubagentsByMessage()
properties on the stream.
OptionalthreadManage the thread state externally.
OptionalthreadThe ID of the thread to fetch history and current values from.
OptionalthrottleThrottle 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.
Options for configuring a deep agent stream.
Use this options interface when calling
useStreamwith a DeepAgent created viacreateDeepAgent. Includes all agent options plus subagent-specific configuration.Example