The outcome

Pause and resume a business process without duplicate actions, stale authorization, corrupted state, or abandoned executions.

Mastra is a Open-source TypeScript framework for AI agents, typed tools, graph workflows, memory, retrieval, evaluation, and observability. Building TypeScript agents for open-ended tasks and typed, resumable workflows for controlled multistep processes, with shared memory, tracing, and evaluation. This guide narrows that broad capability into one repeatable outcome, with checkpoints that keep the source material and your judgment in the loop.

Before you begin

Set the boundary before the tool starts.

Choose one real task, identify who will use the result, and decide what evidence or test will make the result acceptable. Gather only the source material needed for that task. If the work contains confidential, personal, regulated, or client-owned information, confirm that the platform and account are approved before sharing it.

Troiana principle

AI should make the work easier to inspect. If the workflow removes the source, the owner, or the review step, redesign the workflow.

Step by step

A workflow you can repeat.

  1. 01

    Map deterministic steps, schemas, state, owners, approval rules, deadlines, retry and compensation policy, data retention, side effects, SLO, cost, and terminal states.

  2. 02

    Implement typed steps with small state references, stable idempotency keys, bounded retries and timeouts, explicit failure paths, and no irreversible effect before its authorization gate.

  3. 03

    Suspend with minimal metadata, encrypt and restrict snapshot storage, issue an authenticated approval request, and recheck approver role, workflow version, amount, expiry, and current business state on resume.

  4. 04

    Test crash and restart, repeated resume, stale and forged payloads, denial, timeout, changed permissions, step failure, provider outage, compensation, cancellation, and snapshot deletion.

  5. 05

    Trace every transition and approver, alert on stuck runs, canary workflow revisions, preserve compatible rollback, and expire or reconcile abandoned snapshots and pending effects.

Working standard

What good use looks like.

  • Make every side effect idempotent.
  • Reauthorize when resuming.
  • Alert on suspended workflows.

Typed schemas validate structure, not truth, authorization, or safe intent. Agents can loop or misuse tools, and workflows can replay or resume with stale state. Treat prompts, memory, MCP content, tool arguments, and resume payloads as untrusted; authorize outside the model, make side effects idempotent, cap requests and cost, isolate tenants, protect snapshots and traces, and require approval for consequential actions.

Official references

Check the current product documentation.

Features, plan limits, availability, and data controls change. These official pages are the starting points used for this collection.