createAgentUIStream / communicate a timeout abort to the UI

Hi,

We’ve implemented createAgentUIStream and are using the timeout parameter to proactively set a timeout before a Vercel run times out in the backend (so we can adjust a job/chat status to “timeout”) before everything fails.

Problem

The last part is to communicate a timeout to the client / UI. Only I can’t seem to figure out how to communicate this to the UI / user?

Current Behavior

In the raw message stream to the browser, I see this:

data: {"type":"tool-output-available","toolCallId":"toolu_vrtx_012NzYgnvT59Qkfka5mcW113","output":"Transferred to agent-database-query"}

data: {"type":"finish-step"}

data: {"type":"abort","reason":"The operation was aborted due to timeout"}

data: [DONE]

But is there any way to capture this within the useChat function?