hashbrown

UseCompletionResult

The result of the useCompletion hook.

UseCompletionResult
@typeState
error
Error | undefined

The error encountered during chat operations, if any.

exhaustedRetries
boolean

Whether the current request has exhausted retries.

generatingError
Error | undefined

Error emitted during generation events.

isGenerating
boolean

Whether the chat is currently generating.

isLoading
boolean

Aggregate loading flag across transport, generation, and tool calls.

isReceiving
boolean

Whether the chat is receiving a response.

isResuming
boolean

Whether the whole resumed interaction is executing.

isRunningToolCalls
boolean

Whether the chat is running tool calls.

isSending
boolean

Whether the chat is sending a response.

lastRunFinishReason
FinishReason | undefined

Why the model stopped in the last run that completed, such as length when the answer was cut off by a token limit, or undefined when the server did not say. Cleared when the next run starts.

lastRunResult
JsonValue | undefined

The return value the agent attached to the last run that completed (AG-UI's RUN_FINISHED.result), or undefined when it attached none. Cleared when the next run starts. Interrupted, cancelled, and failed runs never set it.

lastRunUsage
readonly TokenUsage[] | undefined

The token usage of the last run that completed (AG-UI's RUN_FINISHED.usage), one entry per provider and model, or undefined when the server reported none. Cleared when the next run starts, so a turn that calls tools reports only its final run.

output
string | null

The output from the model.

pendingConversationRecovery
PendingConversationRecovery | undefined

The inert browser recovery batch awaiting explicit settlement.

pendingInterrupts
PendingInterruptBatch | undefined

The current interrupt batch, retained until resume is acknowledged.

recovery
ConversationRecoveryState

The local recovery revision and whether an explicit restore is required.

reload
() => void

Reload the chat, useful for retrying when an error occurs.

sendingError
Error | undefined

Transport/request failure before generation events arrive.

state
State | undefined

The currently visible shared agent state.