How to stream custom events from workflows using the AI SDK
Hi everyone!
I send custom events using
I stream the agent using the AI SDK as stated in the documentation :
My custom events are not sent in the response.
By analysing the stream chunks, i can see that they are available in the
In the
Is it the expected behaviour? I would kind of expect custom events to not be wrapped, as it's the case when streaming custom events from a tool.
How can I work around this issue?
Thanks for your help!
I send custom events using
writer.custom in a workflow used by an agent.I stream the agent using the AI SDK as stated in the documentation :
My custom events are not sent in the response.
By analysing the stream chunks, i can see that they are available in the
stream.fullStream stream but not in the parts created by the toAISdkFormat function.In the
stream.fullStream stream, I see that they are wrapped in a tool-output part, that's probably why they are not caught by the toAISdkFormat function :Is it the expected behaviour? I would kind of expect custom events to not be wrapped, as it's the case when streaming custom events from a tool.
How can I work around this issue?
Thanks for your help!