Typed Workflow Agent with Mastra
Build a typed approval workflow, then preserve and resume real Mastra suspension through a local SQLite store.
A scratch HTML/JSON workflow review and a real Mastra run stored in SQLite with a plan-bound approval document.
- A scratch HTML/JSON workflow review and a real Mastra run stored in SQLite with a plan-bound approval document.
- TypeScript object types, unions and async functions.
- Runtime validation of unknown JSON input.
- An explicit approval decision and a local database file.
Typed Workflow Agent with Mastra in 4 stages
Build a typed approval workflow, then preserve and resume real Mastra suspension through a local SQLite store.
Validate typed step inputs at runtime
Find the workshop policy produces read intent. Update the workshop label produces write intent. A blank ID fails before a tool is chosen. The word change inside unchanged does not match the mutation-verb word boundary.
starter · ~2 hours · TypeScript
runtime contractsintent baselinetyped outputsMake the approval invariant explicit in the plan
An update action with requiresApproval=false fails. A lookup-only plan with requiresApproval=true also violates the stated representation. One through ten actions are allowed, and every action has a supported tool and nonempty query.
core · ~2 hours · TypeScript
plan validationcapability selectionapproval invariantSuspend before effects and count failed attempts
A lookup returning a result completes in one call. A tool returning empty text twice fails after two calls. A write without approval returns a checkpoint and zero calls; resuming that checkpoint with approved=true executes the original query.
core · ~2 hours · TypeScript
retry limitscall budgetscheckpoint resultsPersist real Mastra approval state and resume it
Start the authored workshop update and observe status=suspended with zero tool calls. Close the local LibSQL store, create a fresh workflow over the same SQLite file and resume by runId. Matching approval produces success and exactly one observed local tool call in the recovery test; a wrong hash fails with zero calls.
core · ~2 hours · TypeScript
Mastra suspensionplan-bound approvalSQLite recovery