MastraM
Mastra2mo ago
Alex

Question: Suspend/Resume with Modifications

Building a workflow where generated content needs user approval. User should be able to request changes and have the step regenerate until satisfied.

Flow:
  1. Step generates content → suspends
  2. User reviews → provides feedback via agent chat
  3. If changes needed → step regenerates → suspends again
  4. Repeat until user approves → proceed to next step of the workflow.
Can a step suspend MULTIPLE times in a .dountil() loop?

Example:
.dountil(
  contentStep, // Can this suspend → regenerate → suspend → regenerate?
  async ({ inputData }) => inputData.approved === true
)


Context:
  • Agent-driven (conversational, not UI buttons)
  • User says "make it shorter" → agent calls resume({ approved: false, feedback: "make it shorter" })
  • Step regenerates and suspends again for review
Can a single step suspend multiple times within a .dountil() loop?
  • Generate → suspend → regenerate → suspend again → repeat until confirmed?
Is this pattern supported? Any examples?

Actual playground behavior: Only "Approve" button → no way to provide feedback or reject
Is there an example of this pattern anywhere? How should modification feedback be passed back to regenerate content?

Or we can resolve inside the step the modification without being needed to use .dountil() at workflow on step level?

Thanks!
Was this page helpful?