Run.observeStream()
The .observeStream() method opens a new ReadableStream to a workflow run that is currently running, allowing you to observe the stream of events if the original stream is no longer available.
Usage example
const run = await workflow.createRunAsync();
run.stream({
inputData: {
value: "initial data",
},
});
const { stream } = await run.observeStream();
for await (const chunk of stream) {
console.log(chunk);
}
Returns
ReadableStream<ChunkType>
Stream Events
The stream emits various event types during workflow execution. Each event has a type field and a payload containing relevant data:
start: Workflow execution beginsstep-start: A step begins executiontool-call: A tool call is initiatedtool-call-streaming-start: Tool call streaming beginstool-call-delta: Incremental tool output updatesstep-result: A step completes with resultsstep-finish: A step finishes executionfinish: Workflow execution completes