You can suspend/resume workflows in playground

Mastra workflows now support suspend and resume in Playground. You can also use the new resumeStream API to close streams on suspend and resume them later.

Sam BhagwatSam Bhagwat·

Oct 22, 2025

·

2 min read

Mastra workflows have suspend/resume functionality enabling to wait for humans in the loop. That works in playground now!

Here’s a demo:

We also shipped an API for automatically closing streams when a workflow suspends, allowing them to be resumed later

resumeStream

The default behavior of suspend() is to leave the stream open. We shipped a closeOnSuspend option to close a stream automatically when a workflow suspends.

Now, when you’re ready to resume, use resumeStream to pick up your stream exactly where the workflow left off.

As an example:

 1// 1. Initial execution with closeOnSuspend enabled
 2const run = await workflow.createRunAsync();
 3const output = run.stream({
 4  inputData: { task: "approval_needed" },
 5  closeOnSuspend: true, // 🔑 Stream will close when workflow suspends
 6});
 7
 8// Stream events until suspension
 9for await (const chunk of stream.fullStream) {
10  console.log(chunk.type, chunk.payload);
11  // Stream automatically closes when workflow suspends
12}
13
14const result = await stream.result;
15console.log(result.status); // 'suspended'
16
17// --- Time passes, user provides input ---
18
19// 2. Resume and get a NEW stream for the continuation
20const resumedOutput = await run.resumeStream({
21  resumeData: { userInput: "approved" },
22  step: "approval-step", // Optional - auto-detected if omitted
23});
24
25// Stream remaining events from the new stream
26for await (const chunk of resumedStream.fullStream) {
27  console.log("Resumed:", chunk.type, chunk.payload);
28}
29
30const finalResult = await resumedStream.result;
31console.log(finalResult.status); // 'success' or 'failed'

We hope this helps you build more human-in-the-loop workflows in Mastra. Happy building! 🚀

Share:
Sam Bhagwat

Sam Bhagwat is the founder and CEO of Mastra. He co-founded Gatsby, which was used by hundreds of thousands of developers. A Stanford graduate and veteran of web development, he authored 'Principles of Building AI Agents' (2025).

All articles by Sam Bhagwat