useAgentRun
Render a run from createWebSocketRuns: its value so far and its status. Re-renders on every event.
Usage
Parameters
Returns
The run's AgentRun<T>: runId, status ('streaming', 'done', 'error' or 'aborted'), value and error. undefined for a null id, for a run the manager doesn't know yet, and on the server.
Behavior
- Attaching. A run the manager doesn't know, such as one from a chat history, is attached once mounted and followed from its first event, so
valuebuilds up from the beginning. - Connection. The manager holds the connection while runs are streaming; the hook itself doesn't.
- Re-renders. Once per event. For very fast streams, reduce several tokens per event on the server, or render the value with
useDeferredValue.