Skip to main content
Mastra v1 is coming in January 2026. Get ahead by starting new projects with the beta or upgrade your existing project today.

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 exampleDirect link to 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);
}

ReturnsDirect link to Returns

ReadableStream<ChunkType>

Stream EventsDirect link to 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 begins
  • step-start: A step begins execution
  • tool-call: A tool call is initiated
  • tool-call-streaming-start: Tool call streaming begins
  • tool-call-delta: Incremental tool output updates
  • step-result: A step completes with results
  • step-finish: A step finishes execution
  • finish: Workflow execution completes

On this page