@mastra/mcp-docs-server 0.13.39 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/changelogs/%40internal%2Fai-sdk-v4.md +1 -0
- package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +0 -10
- package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +0 -10
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +36 -36
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +0 -10
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +70 -70
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +40 -40
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fauth.md +4 -14
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +199 -199
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +223 -223
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +190 -190
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +199 -199
- package/.docs/organized/changelogs/%40mastra%2Fcodemod.md +7 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +214 -214
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +74 -74
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +67 -67
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +70 -70
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +67 -67
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +209 -209
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +191 -191
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +5 -13
- package/.docs/organized/changelogs/%40mastra%2Flance.md +182 -182
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +199 -199
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +58 -58
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +65 -65
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +228 -228
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +199 -199
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +206 -206
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +197 -197
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +217 -217
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Frag.md +61 -61
- package/.docs/organized/changelogs/%40mastra%2Freact.md +70 -70
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -17
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -30
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +206 -206
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +190 -190
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +56 -56
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +56 -56
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +20 -20
- package/.docs/organized/changelogs/create-mastra.md +33 -33
- package/.docs/organized/changelogs/mastra.md +86 -86
- package/.docs/organized/code-examples/a2a.md +4 -2
- package/.docs/organized/code-examples/agui.md +12 -9
- package/.docs/organized/code-examples/ai-sdk-useChat.md +12 -18
- package/.docs/organized/code-examples/ai-sdk-v5.md +4 -2
- package/.docs/organized/code-examples/bird-checker-with-express.md +5 -4
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +4 -3
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +4 -3
- package/.docs/organized/code-examples/client-side-tools.md +1 -0
- package/.docs/organized/code-examples/crypto-chatbot.md +1 -1
- package/.docs/organized/code-examples/experimental-auth-weather-agent.md +8 -177
- package/.docs/organized/code-examples/fireworks-r1.md +2 -2
- package/.docs/organized/code-examples/heads-up-game.md +10 -7
- package/.docs/organized/code-examples/mcp-configuration.md +5 -3
- package/.docs/organized/code-examples/mcp-registry-registry.md +3 -2
- package/.docs/organized/code-examples/memory-per-resource-example.md +4 -2
- package/.docs/organized/code-examples/memory-todo-agent.md +1 -0
- package/.docs/organized/code-examples/memory-with-context.md +2 -1
- package/.docs/organized/code-examples/memory-with-libsql.md +4 -2
- package/.docs/organized/code-examples/memory-with-mongodb.md +4 -2
- package/.docs/organized/code-examples/memory-with-pg.md +4 -2
- package/.docs/organized/code-examples/memory-with-processors.md +13 -8
- package/.docs/organized/code-examples/memory-with-upstash.md +5 -3
- package/.docs/organized/code-examples/openapi-spec-writer.md +32 -41
- package/.docs/organized/code-examples/quick-start.md +5 -32
- package/.docs/organized/code-examples/stock-price-tool.md +6 -5
- package/.docs/organized/code-examples/weather-agent.md +21 -16
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +3 -2
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +9 -12
- package/.docs/organized/code-examples/workflow-with-memory.md +16 -15
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +2 -2
- package/.docs/organized/code-examples/workflow-with-suspend-resume.md +3 -2
- package/.docs/raw/agents/adding-voice.mdx +27 -22
- package/.docs/raw/agents/agent-memory.mdx +23 -15
- package/.docs/raw/agents/guardrails.mdx +33 -12
- package/.docs/raw/agents/networks.mdx +8 -4
- package/.docs/raw/agents/overview.mdx +21 -15
- package/.docs/raw/agents/using-tools.mdx +11 -8
- package/.docs/raw/auth/auth0.mdx +8 -8
- package/.docs/raw/auth/clerk.mdx +6 -6
- package/.docs/raw/auth/firebase.mdx +8 -8
- package/.docs/raw/auth/index.mdx +6 -6
- package/.docs/raw/auth/jwt.mdx +6 -6
- package/.docs/raw/auth/supabase.mdx +7 -7
- package/.docs/raw/auth/workos.mdx +8 -8
- package/.docs/raw/community/contributing-templates.mdx +3 -3
- package/.docs/raw/community/discord.mdx +1 -1
- package/.docs/raw/course/01-first-agent/08-exporting-your-agent.md +2 -1
- package/.docs/raw/course/01-first-agent/16-adding-memory-to-agent.md +2 -1
- package/.docs/raw/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +2 -0
- package/.docs/raw/course/03-agent-memory/04-creating-basic-memory-agent.md +1 -0
- package/.docs/raw/course/03-agent-memory/10-storage-configuration.md +2 -3
- package/.docs/raw/course/03-agent-memory/13-vector-store-configuration.md +2 -0
- package/.docs/raw/course/03-agent-memory/16-configuring-semantic-recall.md +2 -0
- package/.docs/raw/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +1 -0
- package/.docs/raw/course/03-agent-memory/21-configuring-working-memory.md +2 -0
- package/.docs/raw/course/03-agent-memory/22-custom-working-memory-templates.md +1 -0
- package/.docs/raw/course/03-agent-memory/25-combining-memory-features.md +1 -0
- package/.docs/raw/course/03-agent-memory/27-creating-learning-assistant.md +1 -0
- package/.docs/raw/course/04-workflows/08-running-workflows-programmatically.md +2 -2
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +5 -5
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +7 -5
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +3 -3
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +4 -4
- package/.docs/raw/deployment/cloud-providers/index.mdx +11 -8
- package/.docs/raw/deployment/monorepo.mdx +2 -2
- package/.docs/raw/deployment/overview.mdx +2 -2
- package/.docs/raw/deployment/server-deployment.mdx +2 -10
- package/.docs/raw/deployment/serverless-platforms/cloudflare-deployer.mdx +4 -4
- package/.docs/raw/deployment/serverless-platforms/index.mdx +10 -7
- package/.docs/raw/deployment/serverless-platforms/netlify-deployer.mdx +4 -4
- package/.docs/raw/deployment/serverless-platforms/vercel-deployer.mdx +4 -4
- package/.docs/raw/deployment/web-framework.mdx +8 -8
- package/.docs/raw/{scorers → evals}/custom-scorers.mdx +6 -6
- package/.docs/raw/evals/off-the-shelf-scorers.mdx +50 -0
- package/.docs/raw/{scorers → evals}/overview.mdx +8 -8
- package/.docs/raw/evals/running-in-ci.mdx +113 -0
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +22 -21
- package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +8 -8
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +3 -0
- package/.docs/raw/frameworks/servers/express.mdx +10 -9
- package/.docs/raw/frameworks/web-frameworks/astro.mdx +6 -6
- package/.docs/raw/frameworks/web-frameworks/next-js.mdx +3 -3
- package/.docs/raw/frameworks/web-frameworks/sveltekit.mdx +4 -4
- package/.docs/raw/frameworks/web-frameworks/vite-react.mdx +2 -2
- package/.docs/raw/getting-started/installation.mdx +13 -12
- package/.docs/raw/getting-started/mcp-docs-server.mdx +1 -1
- package/.docs/raw/getting-started/project-structure.mdx +4 -4
- package/.docs/raw/getting-started/studio.mdx +8 -8
- package/.docs/raw/getting-started/templates.mdx +1 -1
- package/.docs/raw/guides/guide/ai-recruiter.mdx +264 -0
- package/.docs/raw/guides/guide/chef-michel.mdx +271 -0
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +450 -0
- package/.docs/raw/guides/guide/research-assistant.mdx +389 -0
- package/.docs/raw/guides/guide/stock-agent.mdx +185 -0
- package/.docs/raw/guides/guide/web-search.mdx +291 -0
- package/.docs/raw/guides/index.mdx +43 -0
- package/.docs/raw/guides/migrations/agentnetwork.mdx +114 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/_template.mdx +50 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +265 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/cli.mdx +48 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/client.mdx +153 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/evals.mdx +230 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/mastra.mdx +171 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/mcp.mdx +114 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/memory.mdx +241 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/overview.mdx +83 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/processors.mdx +62 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +270 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +115 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tracing.mdx +280 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/vectors.mdx +23 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/voice.mdx +39 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +178 -0
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +367 -0
- package/.docs/raw/index.mdx +9 -9
- package/.docs/raw/{observability/logging.mdx → logging.mdx} +4 -4
- package/.docs/raw/mastra-cloud/dashboard.mdx +2 -2
- package/.docs/raw/mastra-cloud/observability.mdx +6 -6
- package/.docs/raw/mastra-cloud/overview.mdx +2 -2
- package/.docs/raw/mastra-cloud/setting-up.mdx +4 -4
- package/.docs/raw/memory/conversation-history.mdx +1 -0
- package/.docs/raw/memory/memory-processors.mdx +4 -3
- package/.docs/raw/memory/overview.mdx +9 -5
- package/.docs/raw/memory/semantic-recall.mdx +12 -7
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +10 -5
- package/.docs/raw/memory/storage/memory-with-pg.mdx +9 -4
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +9 -4
- package/.docs/raw/memory/threads-and-resources.mdx +11 -13
- package/.docs/raw/memory/working-memory.mdx +30 -14
- package/.docs/raw/observability/overview.mdx +13 -30
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/arize.mdx +10 -18
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/braintrust.mdx +7 -16
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/cloud.mdx +11 -17
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/default.mdx +16 -20
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/langfuse.mdx +7 -16
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/langsmith.mdx +7 -16
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/otel.mdx +9 -18
- package/.docs/raw/observability/{ai-tracing → tracing}/overview.mdx +107 -142
- package/.docs/raw/observability/{ai-tracing → tracing}/processors/sensitive-data-filter.mdx +14 -13
- package/.docs/raw/rag/chunking-and-embedding.mdx +5 -5
- package/.docs/raw/rag/overview.mdx +3 -13
- package/.docs/raw/rag/retrieval.mdx +24 -12
- package/.docs/raw/rag/vector-databases.mdx +7 -1
- package/.docs/raw/reference/agents/agent.mdx +33 -28
- package/.docs/raw/reference/agents/generate.mdx +10 -10
- package/.docs/raw/reference/agents/generateLegacy.mdx +8 -8
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +21 -15
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +69 -0
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +22 -16
- package/.docs/raw/reference/agents/getDescription.mdx +1 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +8 -8
- package/.docs/raw/reference/agents/getLLM.mdx +9 -9
- package/.docs/raw/reference/agents/getMemory.mdx +9 -9
- package/.docs/raw/reference/agents/getModel.mdx +10 -10
- package/.docs/raw/reference/agents/getVoice.mdx +8 -8
- package/.docs/raw/reference/agents/listAgents.mdx +9 -9
- package/.docs/raw/reference/agents/listScorers.mdx +7 -7
- package/.docs/raw/reference/agents/listTools.mdx +7 -7
- package/.docs/raw/reference/agents/listWorkflows.mdx +7 -7
- package/.docs/raw/reference/agents/network.mdx +11 -10
- package/.docs/raw/reference/auth/auth0.mdx +4 -4
- package/.docs/raw/reference/auth/clerk.mdx +4 -4
- package/.docs/raw/reference/auth/firebase.mdx +6 -6
- package/.docs/raw/reference/auth/jwt.mdx +4 -4
- package/.docs/raw/reference/auth/supabase.mdx +4 -4
- package/.docs/raw/reference/auth/workos.mdx +4 -4
- package/.docs/raw/reference/cli/mastra.mdx +7 -7
- package/.docs/raw/reference/client-js/agents.mdx +6 -2
- package/.docs/raw/reference/client-js/mastra-client.mdx +7 -7
- package/.docs/raw/reference/client-js/memory.mdx +24 -16
- package/.docs/raw/reference/client-js/observability.mdx +11 -11
- package/.docs/raw/reference/client-js/workflows.mdx +6 -34
- package/.docs/raw/reference/core/getAgent.mdx +1 -1
- package/.docs/raw/reference/core/getAgentById.mdx +1 -1
- package/.docs/raw/reference/core/getDeployer.mdx +2 -2
- package/.docs/raw/reference/core/getLogger.mdx +2 -2
- package/.docs/raw/reference/core/getMCPServer.mdx +31 -15
- package/.docs/raw/reference/core/getMCPServerById.mdx +81 -0
- package/.docs/raw/reference/core/getScorer.mdx +3 -3
- package/.docs/raw/reference/core/getScorerById.mdx +79 -0
- package/.docs/raw/reference/core/getServer.mdx +2 -2
- package/.docs/raw/reference/core/getStorage.mdx +2 -2
- package/.docs/raw/reference/core/getTelemetry.mdx +2 -2
- package/.docs/raw/reference/core/getVector.mdx +2 -2
- package/.docs/raw/reference/core/getWorkflow.mdx +1 -1
- package/.docs/raw/reference/core/listAgents.mdx +1 -1
- package/.docs/raw/reference/core/listLogs.mdx +2 -2
- package/.docs/raw/reference/core/listLogsByRunId.mdx +2 -2
- package/.docs/raw/reference/core/listMCPServers.mdx +65 -0
- package/.docs/raw/reference/core/listScorers.mdx +3 -3
- package/.docs/raw/reference/core/listVectors.mdx +36 -0
- package/.docs/raw/reference/core/listWorkflows.mdx +6 -6
- package/.docs/raw/reference/core/mastra-class.mdx +3 -2
- package/.docs/raw/reference/core/setLogger.mdx +2 -2
- package/.docs/raw/reference/core/setStorage.mdx +3 -2
- package/.docs/raw/reference/core/setTelemetry.mdx +2 -2
- package/.docs/raw/reference/deployer/cloudflare.mdx +2 -2
- package/.docs/raw/reference/deployer/deployer.mdx +0 -6
- package/.docs/raw/reference/deployer/netlify.mdx +2 -2
- package/.docs/raw/reference/deployer/vercel.mdx +3 -3
- package/.docs/raw/reference/evals/answer-relevancy.mdx +164 -126
- package/.docs/raw/reference/{scorers → evals}/answer-similarity.mdx +27 -27
- package/.docs/raw/reference/evals/bias.mdx +149 -115
- package/.docs/raw/reference/evals/completeness.mdx +148 -117
- package/.docs/raw/reference/evals/content-similarity.mdx +126 -113
- package/.docs/raw/reference/evals/context-precision.mdx +290 -133
- package/.docs/raw/reference/{scorers → evals}/context-relevance.mdx +6 -6
- package/.docs/raw/reference/{scorers → evals}/create-scorer.mdx +11 -11
- package/.docs/raw/reference/evals/faithfulness.mdx +163 -121
- package/.docs/raw/reference/evals/hallucination.mdx +159 -132
- package/.docs/raw/reference/evals/keyword-coverage.mdx +169 -125
- package/.docs/raw/reference/{scorers → evals}/mastra-scorer.mdx +5 -5
- package/.docs/raw/reference/{scorers → evals}/noise-sensitivity.mdx +9 -9
- package/.docs/raw/reference/evals/prompt-alignment.mdx +604 -182
- package/.docs/raw/reference/{scorers/run-experiment.mdx → evals/run-evals.mdx} +17 -18
- package/.docs/raw/reference/evals/textual-difference.mdx +149 -117
- package/.docs/raw/reference/evals/tone-consistency.mdx +149 -125
- package/.docs/raw/reference/{scorers → evals}/tool-call-accuracy.mdx +8 -6
- package/.docs/raw/reference/evals/toxicity.mdx +152 -96
- package/.docs/raw/reference/{observability/logging → logging}/pino-logger.mdx +2 -2
- package/.docs/raw/reference/memory/createThread.mdx +5 -5
- package/.docs/raw/reference/memory/deleteMessages.mdx +7 -7
- package/.docs/raw/reference/memory/getThreadById.mdx +4 -4
- package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +110 -0
- package/.docs/raw/reference/memory/memory-class.mdx +13 -9
- package/.docs/raw/reference/memory/query.mdx +58 -57
- package/.docs/raw/reference/memory/recall.mdx +185 -0
- package/.docs/raw/reference/observability/tracing/configuration.mdx +245 -0
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/arize.mdx +13 -13
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/braintrust.mdx +11 -8
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/cloud-exporter.mdx +21 -19
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/console-exporter.mdx +49 -17
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/default-exporter.mdx +42 -41
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/langfuse.mdx +10 -7
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/langsmith.mdx +10 -7
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/otel.mdx +5 -5
- package/.docs/raw/reference/observability/tracing/instances.mdx +168 -0
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/interfaces.mdx +115 -89
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/processors/sensitive-data-filter.mdx +3 -3
- package/.docs/raw/reference/observability/{ai-tracing/span.mdx → tracing/spans.mdx} +59 -41
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +1 -1
- package/.docs/raw/reference/processors/language-detector.mdx +1 -1
- package/.docs/raw/reference/processors/moderation-processor.mdx +1 -1
- package/.docs/raw/reference/processors/pii-detector.mdx +1 -1
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +1 -1
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +1 -1
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +1 -1
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +1 -1
- package/.docs/raw/reference/rag/chunk.mdx +1 -8
- package/.docs/raw/reference/rag/database-config.mdx +7 -7
- package/.docs/raw/reference/rag/metadata-filters.mdx +14 -11
- package/.docs/raw/reference/storage/libsql.mdx +2 -0
- package/.docs/raw/reference/storage/mssql.mdx +5 -0
- package/.docs/raw/reference/storage/postgresql.mdx +6 -0
- package/.docs/raw/reference/storage/upstash.mdx +1 -0
- package/.docs/raw/reference/streaming/agents/stream.mdx +12 -12
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +8 -8
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +3 -3
- package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +3 -3
- package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +6 -6
- package/.docs/raw/reference/streaming/workflows/stream.mdx +10 -10
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +11 -11
- package/.docs/raw/reference/templates/overview.mdx +2 -2
- package/.docs/raw/reference/tools/create-tool.mdx +52 -35
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +15 -15
- package/.docs/raw/reference/tools/mcp-client.mdx +1 -1
- package/.docs/raw/reference/tools/mcp-server.mdx +119 -35
- package/.docs/raw/reference/tools/vector-query-tool.mdx +27 -26
- package/.docs/raw/reference/vectors/libsql.mdx +1 -0
- package/.docs/raw/reference/vectors/pg.mdx +3 -0
- package/.docs/raw/reference/vectors/upstash.mdx +1 -0
- package/.docs/raw/reference/voice/google-gemini-live.mdx +1 -1
- package/.docs/raw/reference/voice/voice.addTools.mdx +3 -3
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +4 -4
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +14 -14
- package/.docs/raw/reference/workflows/run-methods/start.mdx +17 -17
- package/.docs/raw/reference/workflows/run.mdx +1 -8
- package/.docs/raw/reference/workflows/step.mdx +5 -5
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +7 -13
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +5 -0
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow.mdx +1 -1
- package/.docs/raw/server-db/custom-api-routes.mdx +2 -2
- package/.docs/raw/server-db/mastra-client.mdx +19 -18
- package/.docs/raw/server-db/middleware.mdx +7 -7
- package/.docs/raw/server-db/production-server.mdx +4 -4
- package/.docs/raw/server-db/{runtime-context.mdx → request-context.mdx} +46 -45
- package/.docs/raw/server-db/storage.mdx +29 -21
- package/.docs/raw/streaming/events.mdx +3 -3
- package/.docs/raw/streaming/overview.mdx +5 -5
- package/.docs/raw/streaming/tool-streaming.mdx +18 -17
- package/.docs/raw/streaming/workflow-streaming.mdx +1 -1
- package/.docs/raw/tools-mcp/advanced-usage.mdx +5 -4
- package/.docs/raw/tools-mcp/mcp-overview.mdx +32 -19
- package/.docs/raw/tools-mcp/overview.mdx +11 -11
- package/.docs/raw/voice/overview.mdx +63 -43
- package/.docs/raw/voice/speech-to-speech.mdx +5 -3
- package/.docs/raw/voice/speech-to-text.mdx +9 -8
- package/.docs/raw/voice/text-to-speech.mdx +12 -11
- package/.docs/raw/workflows/agents-and-tools.mdx +9 -5
- package/.docs/raw/workflows/control-flow.mdx +3 -3
- package/.docs/raw/workflows/error-handling.mdx +2 -21
- package/.docs/raw/workflows/human-in-the-loop.mdx +7 -4
- package/.docs/raw/workflows/inngest-workflow.mdx +2 -2
- package/.docs/raw/workflows/input-data-mapping.mdx +107 -0
- package/.docs/raw/workflows/overview.mdx +17 -16
- package/.docs/raw/workflows/snapshots.mdx +13 -11
- package/.docs/raw/workflows/suspend-and-resume.mdx +23 -15
- package/CHANGELOG.md +52 -57
- package/README.md +11 -2
- package/dist/{chunk-TUAHUTTB.js → chunk-5NJC7NRO.js} +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
- package/dist/prepare-docs/prepare.js +1 -1
- package/dist/prompts/migration.d.ts +6 -0
- package/dist/prompts/migration.d.ts.map +1 -0
- package/dist/stdio.js +402 -30
- package/dist/tools/migration.d.ts +40 -0
- package/dist/tools/migration.d.ts.map +1 -0
- package/package.json +8 -12
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +0 -302
- package/.docs/raw/observability/nextjs-tracing.mdx +0 -109
- package/.docs/raw/observability/otel-tracing.mdx +0 -189
- package/.docs/raw/reference/agents/getScorers.mdx +0 -69
- package/.docs/raw/reference/agents/getTools.mdx +0 -69
- package/.docs/raw/reference/agents/getWorkflows.mdx +0 -69
- package/.docs/raw/reference/client-js/workflows-legacy.mdx +0 -143
- package/.docs/raw/reference/core/getAgents.mdx +0 -35
- package/.docs/raw/reference/core/getLogs.mdx +0 -96
- package/.docs/raw/reference/core/getLogsByRunId.mdx +0 -87
- package/.docs/raw/reference/core/getMCPServers.mdx +0 -36
- package/.docs/raw/reference/core/getMemory.mdx +0 -36
- package/.docs/raw/reference/core/getScorerByName.mdx +0 -78
- package/.docs/raw/reference/core/getScorers.mdx +0 -43
- package/.docs/raw/reference/core/getVectors.mdx +0 -36
- package/.docs/raw/reference/core/getWorkflows.mdx +0 -45
- package/.docs/raw/reference/evals/context-position.mdx +0 -197
- package/.docs/raw/reference/evals/context-relevancy.mdx +0 -196
- package/.docs/raw/reference/evals/contextual-recall.mdx +0 -196
- package/.docs/raw/reference/evals/summarization.mdx +0 -212
- package/.docs/raw/reference/legacyWorkflows/after.mdx +0 -89
- package/.docs/raw/reference/legacyWorkflows/afterEvent.mdx +0 -79
- package/.docs/raw/reference/legacyWorkflows/commit.mdx +0 -33
- package/.docs/raw/reference/legacyWorkflows/createRun.mdx +0 -76
- package/.docs/raw/reference/legacyWorkflows/else.mdx +0 -68
- package/.docs/raw/reference/legacyWorkflows/events.mdx +0 -305
- package/.docs/raw/reference/legacyWorkflows/execute.mdx +0 -110
- package/.docs/raw/reference/legacyWorkflows/if.mdx +0 -108
- package/.docs/raw/reference/legacyWorkflows/resume.mdx +0 -158
- package/.docs/raw/reference/legacyWorkflows/resumeWithEvent.mdx +0 -133
- package/.docs/raw/reference/legacyWorkflows/snapshots.mdx +0 -207
- package/.docs/raw/reference/legacyWorkflows/start.mdx +0 -87
- package/.docs/raw/reference/legacyWorkflows/step-class.mdx +0 -100
- package/.docs/raw/reference/legacyWorkflows/step-condition.mdx +0 -137
- package/.docs/raw/reference/legacyWorkflows/step-function.mdx +0 -93
- package/.docs/raw/reference/legacyWorkflows/step-options.mdx +0 -69
- package/.docs/raw/reference/legacyWorkflows/step-retries.mdx +0 -196
- package/.docs/raw/reference/legacyWorkflows/suspend.mdx +0 -70
- package/.docs/raw/reference/legacyWorkflows/then.mdx +0 -72
- package/.docs/raw/reference/legacyWorkflows/until.mdx +0 -168
- package/.docs/raw/reference/legacyWorkflows/watch.mdx +0 -124
- package/.docs/raw/reference/legacyWorkflows/while.mdx +0 -168
- package/.docs/raw/reference/legacyWorkflows/workflow.mdx +0 -234
- package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +0 -79
- package/.docs/raw/reference/memory/getThreadsByResourceIdPaginated.mdx +0 -110
- package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +0 -185
- package/.docs/raw/reference/observability/ai-tracing/configuration.mdx +0 -238
- package/.docs/raw/reference/observability/otel-tracing/otel-config.mdx +0 -117
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-ax.mdx +0 -81
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-phoenix.mdx +0 -121
- package/.docs/raw/reference/observability/otel-tracing/providers/braintrust.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/dash0.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/index.mdx +0 -20
- package/.docs/raw/reference/observability/otel-tracing/providers/keywordsai.mdx +0 -73
- package/.docs/raw/reference/observability/otel-tracing/providers/laminar.mdx +0 -41
- package/.docs/raw/reference/observability/otel-tracing/providers/langfuse.mdx +0 -84
- package/.docs/raw/reference/observability/otel-tracing/providers/langsmith.mdx +0 -48
- package/.docs/raw/reference/observability/otel-tracing/providers/langwatch.mdx +0 -43
- package/.docs/raw/reference/observability/otel-tracing/providers/new-relic.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/signoz.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/traceloop.mdx +0 -40
- package/.docs/raw/reference/scorers/answer-relevancy.mdx +0 -227
- package/.docs/raw/reference/scorers/bias.mdx +0 -228
- package/.docs/raw/reference/scorers/completeness.mdx +0 -214
- package/.docs/raw/reference/scorers/content-similarity.mdx +0 -197
- package/.docs/raw/reference/scorers/context-precision.mdx +0 -352
- package/.docs/raw/reference/scorers/faithfulness.mdx +0 -241
- package/.docs/raw/reference/scorers/hallucination.mdx +0 -252
- package/.docs/raw/reference/scorers/keyword-coverage.mdx +0 -229
- package/.docs/raw/reference/scorers/prompt-alignment.mdx +0 -668
- package/.docs/raw/reference/scorers/textual-difference.mdx +0 -203
- package/.docs/raw/reference/scorers/tone-consistency.mdx +0 -211
- package/.docs/raw/reference/scorers/toxicity.mdx +0 -228
- package/.docs/raw/reference/workflows/run-methods/watch.mdx +0 -73
- package/.docs/raw/scorers/evals-old-api/custom-eval.mdx +0 -24
- package/.docs/raw/scorers/evals-old-api/overview.mdx +0 -106
- package/.docs/raw/scorers/evals-old-api/running-in-ci.mdx +0 -85
- package/.docs/raw/scorers/evals-old-api/textual-evals.mdx +0 -58
- package/.docs/raw/scorers/off-the-shelf-scorers.mdx +0 -50
- package/.docs/raw/workflows-legacy/control-flow.mdx +0 -774
- package/.docs/raw/workflows-legacy/dynamic-workflows.mdx +0 -239
- package/.docs/raw/workflows-legacy/error-handling.mdx +0 -187
- package/.docs/raw/workflows-legacy/nested-workflows.mdx +0 -360
- package/.docs/raw/workflows-legacy/overview.mdx +0 -182
- package/.docs/raw/workflows-legacy/runtime-variables.mdx +0 -156
- package/.docs/raw/workflows-legacy/steps.mdx +0 -115
- package/.docs/raw/workflows-legacy/suspend-and-resume.mdx +0 -406
- package/.docs/raw/workflows-legacy/variables.mdx +0 -318
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Reference: run.resume() | Legacy Workflows | Mastra Docs"
|
|
3
|
-
description: Documentation for the `.resume()` method in workflows, which continues execution of a suspended workflow step.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# run.resume()
|
|
7
|
-
|
|
8
|
-
The `.resume()` method continues execution of a suspended workflow step, optionally providing new context data that can be accessed by the step on the inputData property.
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
```typescript copy showLineNumbers
|
|
13
|
-
await run.resume({
|
|
14
|
-
runId: "abc-123",
|
|
15
|
-
stepId: "stepTwo",
|
|
16
|
-
context: {
|
|
17
|
-
secondValue: 100,
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Parameters
|
|
23
|
-
|
|
24
|
-
<PropertiesTable
|
|
25
|
-
content={[
|
|
26
|
-
{
|
|
27
|
-
name: "config",
|
|
28
|
-
type: "object",
|
|
29
|
-
description: "Configuration for resuming the workflow",
|
|
30
|
-
isOptional: false,
|
|
31
|
-
},
|
|
32
|
-
]}
|
|
33
|
-
/>
|
|
34
|
-
|
|
35
|
-
### config
|
|
36
|
-
|
|
37
|
-
<PropertiesTable
|
|
38
|
-
content={[
|
|
39
|
-
{
|
|
40
|
-
name: "runId",
|
|
41
|
-
type: "string",
|
|
42
|
-
description: "Unique identifier of the workflow run to resume",
|
|
43
|
-
isOptional: false,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "stepId",
|
|
47
|
-
type: "string",
|
|
48
|
-
description: "ID of the suspended step to resume",
|
|
49
|
-
isOptional: false,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "context",
|
|
53
|
-
type: "Record<string, any>",
|
|
54
|
-
description:
|
|
55
|
-
"New context data to inject into the step's inputData property",
|
|
56
|
-
isOptional: true,
|
|
57
|
-
},
|
|
58
|
-
]}
|
|
59
|
-
/>
|
|
60
|
-
|
|
61
|
-
## Returns
|
|
62
|
-
|
|
63
|
-
<PropertiesTable
|
|
64
|
-
content={[
|
|
65
|
-
{
|
|
66
|
-
name: "Promise<LegacyWorkflowResult>",
|
|
67
|
-
type: "object",
|
|
68
|
-
description: "Result of the resumed workflow execution",
|
|
69
|
-
},
|
|
70
|
-
]}
|
|
71
|
-
/>
|
|
72
|
-
|
|
73
|
-
## Async/Await Flow
|
|
74
|
-
|
|
75
|
-
When a workflow is resumed, execution continues from the point immediately after the `suspend()` call in the step's execution function. This creates a natural flow in your code:
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
// Step definition with suspend point
|
|
79
|
-
const reviewStep = new LegacyStep({
|
|
80
|
-
id: "review",
|
|
81
|
-
execute: async ({ context, suspend }) => {
|
|
82
|
-
// First part of execution
|
|
83
|
-
const initialAnalysis = analyzeData(context.inputData.data);
|
|
84
|
-
|
|
85
|
-
if (initialAnalysis.needsReview) {
|
|
86
|
-
// Suspend execution here
|
|
87
|
-
await suspend({ analysis: initialAnalysis });
|
|
88
|
-
|
|
89
|
-
// This code runs after resume() is called
|
|
90
|
-
// context.inputData now contains any data provided during resume
|
|
91
|
-
return {
|
|
92
|
-
reviewedData: enhanceWithFeedback(
|
|
93
|
-
initialAnalysis,
|
|
94
|
-
context.inputData.feedback,
|
|
95
|
-
),
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return { reviewedData: initialAnalysis };
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const { runId, resume, start } = workflow.createRun();
|
|
104
|
-
|
|
105
|
-
await start({
|
|
106
|
-
inputData: {
|
|
107
|
-
data: "some data",
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
// Later, resume the workflow
|
|
112
|
-
const result = await resume({
|
|
113
|
-
runId: "workflow-123",
|
|
114
|
-
stepId: "review",
|
|
115
|
-
context: {
|
|
116
|
-
// This data will be available in `context.inputData`
|
|
117
|
-
feedback: "Looks good, but improve section 3",
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Execution Flow
|
|
123
|
-
|
|
124
|
-
1. The workflow runs until it hits `await suspend()` in the `review` step
|
|
125
|
-
2. The workflow state is persisted and execution pauses
|
|
126
|
-
3. Later, `run.resume()` is called with new context data
|
|
127
|
-
4. Execution continues from the point after `suspend()` in the `review` step
|
|
128
|
-
5. The new context data (`feedback`) is available to the step on the `inputData` property
|
|
129
|
-
6. The step completes and returns its result
|
|
130
|
-
7. The workflow continues with subsequent steps
|
|
131
|
-
|
|
132
|
-
## Error Handling
|
|
133
|
-
|
|
134
|
-
The resume function may throw several types of errors:
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
try {
|
|
138
|
-
await run.resume({
|
|
139
|
-
runId,
|
|
140
|
-
stepId: "stepTwo",
|
|
141
|
-
context: newData,
|
|
142
|
-
});
|
|
143
|
-
} catch (error) {
|
|
144
|
-
if (error.message === "No snapshot found for workflow run") {
|
|
145
|
-
// Handle missing workflow state
|
|
146
|
-
}
|
|
147
|
-
if (error.message === "Failed to parse workflow snapshot") {
|
|
148
|
-
// Handle corrupted workflow state
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
## Related
|
|
154
|
-
|
|
155
|
-
- [Suspend and Resume](/docs/workflows-legacy/suspend-and-resume)
|
|
156
|
-
- [`suspend` Reference](./suspend)
|
|
157
|
-
- [`watch` Reference](./watch)
|
|
158
|
-
- [Workflow Class Reference](./workflow)
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Reference: resumeWithEvent() | Legacy Workflows | Mastra Docs"
|
|
3
|
-
description: "Reference for the resumeWithEvent method that resumes suspended workflows using event data."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# resumeWithEvent()
|
|
7
|
-
|
|
8
|
-
The `resumeWithEvent()` method resumes workflow execution by providing data for a specific event that the workflow is waiting for.
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```typescript
|
|
13
|
-
const run = workflow.createRun();
|
|
14
|
-
|
|
15
|
-
// After the workflow has started and suspended at an event step
|
|
16
|
-
await run.resumeWithEvent(eventName: string, data: any): Promise<WorkflowRunResult>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Parameters
|
|
20
|
-
|
|
21
|
-
| Parameter | Type | Description |
|
|
22
|
-
| --------- | ------ | ------------------------------------------------------------------------------------------------------- |
|
|
23
|
-
| eventName | string | The name of the event to trigger. Must match an event defined in the workflow's `events` configuration. |
|
|
24
|
-
| data | any | The event data to provide. Must conform to the schema defined for that event. |
|
|
25
|
-
|
|
26
|
-
## Return Value
|
|
27
|
-
|
|
28
|
-
Returns a Promise that resolves to a `WorkflowRunResult` object, containing:
|
|
29
|
-
|
|
30
|
-
- `results`: The result status and output of each step in the workflow
|
|
31
|
-
- `activePaths`: A map of active workflow paths and their states
|
|
32
|
-
- `value`: The current state value of the workflow
|
|
33
|
-
- Other workflow execution metadata
|
|
34
|
-
|
|
35
|
-
## Description
|
|
36
|
-
|
|
37
|
-
The `resumeWithEvent()` method is used to resume a workflow that has been suspended at an event step created by the `afterEvent()` method. When called, this method:
|
|
38
|
-
|
|
39
|
-
1. Validates the provided event data against the schema defined for that event
|
|
40
|
-
2. Loads the workflow snapshot from storage
|
|
41
|
-
3. Updates the context with the event data in the `resumedEvent` field
|
|
42
|
-
4. Resumes execution from the event step
|
|
43
|
-
5. Continues workflow execution with the subsequent steps
|
|
44
|
-
|
|
45
|
-
This method is part of Mastra's event-driven workflow capabilities, allowing you to create workflows that can respond to external events or user interactions.
|
|
46
|
-
|
|
47
|
-
## Usage Notes
|
|
48
|
-
|
|
49
|
-
- The workflow must be in a suspended state, specifically at the event step created by `afterEvent(eventName)`
|
|
50
|
-
- The event data must conform to the schema defined for that event in the workflow configuration
|
|
51
|
-
- The workflow will continue execution from the point it was suspended
|
|
52
|
-
- If the workflow is not suspended or is suspended at a different step, this method may throw an error
|
|
53
|
-
- The event data is made available to subsequent steps via `context.inputData.resumedEvent`
|
|
54
|
-
|
|
55
|
-
## Examples
|
|
56
|
-
|
|
57
|
-
### Basic Usage
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
// Define and start a workflow
|
|
61
|
-
const workflow = mastra.legacy_getWorkflow("approval-workflow");
|
|
62
|
-
const run = workflow.createRun();
|
|
63
|
-
|
|
64
|
-
// Start the workflow
|
|
65
|
-
await run.start({ triggerData: { requestId: "req-123" } });
|
|
66
|
-
|
|
67
|
-
// Later, when the approval event occurs:
|
|
68
|
-
const result = await run.resumeWithEvent("approval", {
|
|
69
|
-
approved: true,
|
|
70
|
-
approverName: "John Doe",
|
|
71
|
-
comment: "Looks good to me!",
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
console.log(result.results);
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### With Error Handling
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
try {
|
|
81
|
-
const result = await run.resumeWithEvent("paymentReceived", {
|
|
82
|
-
amount: 100.5,
|
|
83
|
-
transactionId: "tx-456",
|
|
84
|
-
paymentMethod: "credit-card",
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
console.log("Workflow resumed successfully:", result.results);
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.error("Failed to resume workflow with event:", error);
|
|
90
|
-
// Handle error - could be invalid event data, workflow not suspended, etc.
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### Monitoring and Auto-Resuming
|
|
95
|
-
|
|
96
|
-
```typescript
|
|
97
|
-
// Start a workflow
|
|
98
|
-
const { start, watch, resumeWithEvent } = workflow.createRun();
|
|
99
|
-
|
|
100
|
-
// Watch for suspended event steps
|
|
101
|
-
watch(async ({ activePaths }) => {
|
|
102
|
-
const isApprovalEventSuspended =
|
|
103
|
-
activePaths.get("__approval_event")?.status === "suspended";
|
|
104
|
-
// Check if suspended at the approval event step
|
|
105
|
-
if (isApprovalEventSuspended) {
|
|
106
|
-
console.log("Workflow waiting for approval");
|
|
107
|
-
|
|
108
|
-
// In a real scenario, you would wait for the actual event
|
|
109
|
-
// Here we're simulating with a timeout
|
|
110
|
-
setTimeout(async () => {
|
|
111
|
-
try {
|
|
112
|
-
await resumeWithEvent("approval", {
|
|
113
|
-
approved: true,
|
|
114
|
-
approverName: "Auto Approver",
|
|
115
|
-
});
|
|
116
|
-
} catch (error) {
|
|
117
|
-
console.error("Failed to auto-resume workflow:", error);
|
|
118
|
-
}
|
|
119
|
-
}, 5000); // Wait 5 seconds before auto-approving
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// Start the workflow
|
|
124
|
-
await start({ triggerData: { requestId: "auto-123" } });
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Related
|
|
128
|
-
|
|
129
|
-
- [Event-Driven Workflows](./events)
|
|
130
|
-
- [afterEvent()](./afterEvent)
|
|
131
|
-
- [Suspend and Resume](/docs/workflows-legacy/suspend-and-resume)
|
|
132
|
-
- [resume()](./resume)
|
|
133
|
-
- [watch()](./watch)
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Reference: Snapshots | Legacy Workflows | Mastra Docs"
|
|
3
|
-
description: "Technical reference on snapshots in Mastra - the serialized workflow state that enables suspend and resume functionality"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Snapshots
|
|
7
|
-
|
|
8
|
-
In Mastra, a snapshot is a serializable representation of a workflow's complete execution state at a specific point in time. Snapshots capture all the information needed to resume a workflow from exactly where it left off, including:
|
|
9
|
-
|
|
10
|
-
- The current state of each step in the workflow
|
|
11
|
-
- The outputs of completed steps
|
|
12
|
-
- The execution path taken through the workflow
|
|
13
|
-
- Any suspended steps and their metadata
|
|
14
|
-
- The remaining retry attempts for each step
|
|
15
|
-
- Additional contextual data needed to resume execution
|
|
16
|
-
|
|
17
|
-
Snapshots are automatically created and managed by Mastra whenever a workflow is suspended, and are persisted to the configured storage system.
|
|
18
|
-
|
|
19
|
-
## The Role of Snapshots in Suspend and Resume
|
|
20
|
-
|
|
21
|
-
Snapshots are the key mechanism enabling Mastra's suspend and resume capabilities. When a workflow step calls `await suspend()`:
|
|
22
|
-
|
|
23
|
-
1. The workflow execution is paused at that exact point
|
|
24
|
-
2. The current state of the workflow is captured as a snapshot
|
|
25
|
-
3. The snapshot is persisted to storage
|
|
26
|
-
4. The workflow step is marked as "suspended" with a status of `'suspended'`
|
|
27
|
-
5. Later, when `resume()` is called on the suspended step, the snapshot is retrieved
|
|
28
|
-
6. The workflow execution resumes from exactly where it left off
|
|
29
|
-
|
|
30
|
-
This mechanism provides a powerful way to implement human-in-the-loop workflows, handle rate limiting, wait for external resources, and implement complex branching workflows that may need to pause for extended periods.
|
|
31
|
-
|
|
32
|
-
## Snapshot Anatomy
|
|
33
|
-
|
|
34
|
-
A Mastra workflow snapshot consists of several key components:
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
export interface LegacyWorkflowRunState {
|
|
38
|
-
// Core state info
|
|
39
|
-
value: Record<string, string>; // Current state machine value
|
|
40
|
-
context: {
|
|
41
|
-
// Workflow context
|
|
42
|
-
steps: Record<
|
|
43
|
-
string,
|
|
44
|
-
{
|
|
45
|
-
// Step execution results
|
|
46
|
-
status: "success" | "failed" | "suspended" | "waiting" | "skipped";
|
|
47
|
-
payload?: any; // Step-specific data
|
|
48
|
-
error?: string; // Error info if failed
|
|
49
|
-
}
|
|
50
|
-
>;
|
|
51
|
-
triggerData: Record<string, any>; // Initial trigger data
|
|
52
|
-
attempts: Record<string, number>; // Remaining retry attempts
|
|
53
|
-
inputData: Record<string, any>; // Initial input data
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
activePaths: Array<{
|
|
57
|
-
// Currently active execution paths
|
|
58
|
-
stepPath: string[];
|
|
59
|
-
stepId: string;
|
|
60
|
-
status: string;
|
|
61
|
-
}>;
|
|
62
|
-
|
|
63
|
-
// Metadata
|
|
64
|
-
runId: string; // Unique run identifier
|
|
65
|
-
timestamp: number; // Time snapshot was created
|
|
66
|
-
|
|
67
|
-
// For nested workflows and suspended steps
|
|
68
|
-
childStates?: Record<string, WorkflowRunState>; // Child workflow states
|
|
69
|
-
suspendedSteps?: Record<string, string>; // Mapping of suspended steps
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## How Snapshots Are Saved and Retrieved
|
|
74
|
-
|
|
75
|
-
Mastra persists snapshots to the configured storage system. By default, snapshots are saved to a LibSQL database, but can be configured to use other storage providers like Upstash.
|
|
76
|
-
The snapshots are stored in the `workflow_snapshots` table and identified uniquely by the `run_id` for the associated run when using libsql.
|
|
77
|
-
Utilizing a persistence layer allows for the snapshots to be persisted across workflow runs, allowing for advanced human-in-the-loop functionality.
|
|
78
|
-
|
|
79
|
-
Read more about [libsql storage](../storage/libsql) and [upstash storage](../storage/upstash) here.
|
|
80
|
-
|
|
81
|
-
### Saving Snapshots
|
|
82
|
-
|
|
83
|
-
When a workflow is suspended, Mastra automatically persists the workflow snapshot with these steps:
|
|
84
|
-
|
|
85
|
-
1. The `suspend()` function in a step execution triggers the snapshot process
|
|
86
|
-
2. The `WorkflowInstance.suspend()` method records the suspended machine
|
|
87
|
-
3. `persistWorkflowSnapshot()` is called to save the current state
|
|
88
|
-
4. The snapshot is serialized and stored in the configured database in the `workflow_snapshots` table
|
|
89
|
-
5. The storage record includes the workflow name, run ID, and the serialized snapshot
|
|
90
|
-
|
|
91
|
-
### Retrieving Snapshots
|
|
92
|
-
|
|
93
|
-
When a workflow is resumed, Mastra retrieves the persisted snapshot with these steps:
|
|
94
|
-
|
|
95
|
-
1. The `resume()` method is called with a specific step ID
|
|
96
|
-
2. The snapshot is loaded from storage using `loadWorkflowSnapshot()`
|
|
97
|
-
3. The snapshot is parsed and prepared for resumption
|
|
98
|
-
4. The workflow execution is recreated with the snapshot state
|
|
99
|
-
5. The suspended step is resumed, and execution continues
|
|
100
|
-
|
|
101
|
-
## Storage Options for Snapshots
|
|
102
|
-
|
|
103
|
-
Mastra provides multiple storage options for persisting snapshots.
|
|
104
|
-
|
|
105
|
-
A `storage` instance is configured on the `Mastra` class, and is used to setup a snapshot persistence layer for all workflows registered on the `Mastra` instance.
|
|
106
|
-
This means that storage is shared across all workflows registered with the same `Mastra` instance.
|
|
107
|
-
|
|
108
|
-
### LibSQL (Default)
|
|
109
|
-
|
|
110
|
-
The default storage option is LibSQL, a SQLite-compatible database:
|
|
111
|
-
|
|
112
|
-
```typescript
|
|
113
|
-
import { Mastra } from "@mastra/core/mastra";
|
|
114
|
-
import { DefaultStorage } from "@mastra/core/storage/libsql";
|
|
115
|
-
|
|
116
|
-
const mastra = new Mastra({
|
|
117
|
-
storage: new DefaultStorage({
|
|
118
|
-
config: {
|
|
119
|
-
url: "file:storage.db", // Local file-based database
|
|
120
|
-
// For production:
|
|
121
|
-
// url: process.env.DATABASE_URL,
|
|
122
|
-
// authToken: process.env.DATABASE_AUTH_TOKEN,
|
|
123
|
-
},
|
|
124
|
-
}),
|
|
125
|
-
legacy_workflows: {
|
|
126
|
-
weatherWorkflow,
|
|
127
|
-
travelWorkflow,
|
|
128
|
-
},
|
|
129
|
-
});
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Upstash (Redis-Compatible)
|
|
133
|
-
|
|
134
|
-
For serverless environments:
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
import { Mastra } from "@mastra/core/mastra";
|
|
138
|
-
import { UpstashStore } from "@mastra/upstash";
|
|
139
|
-
|
|
140
|
-
const mastra = new Mastra({
|
|
141
|
-
storage: new UpstashStore({
|
|
142
|
-
url: process.env.UPSTASH_URL,
|
|
143
|
-
token: process.env.UPSTASH_TOKEN,
|
|
144
|
-
}),
|
|
145
|
-
workflows: {
|
|
146
|
-
weatherWorkflow,
|
|
147
|
-
travelWorkflow,
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Best Practices for Working with Snapshots
|
|
153
|
-
|
|
154
|
-
1. **Ensure Serializability**: Any data that needs to be included in the snapshot must be serializable (convertible to JSON).
|
|
155
|
-
|
|
156
|
-
2. **Minimize Snapshot Size**: Avoid storing large data objects directly in the workflow context. Instead, store references to them (like IDs) and retrieve the data when needed.
|
|
157
|
-
|
|
158
|
-
3. **Handle Resume Context Carefully**: When resuming a workflow, carefully consider what context to provide. This will be merged with the existing snapshot data.
|
|
159
|
-
|
|
160
|
-
4. **Set Up Proper Monitoring**: Implement monitoring for suspended workflows, especially long-running ones, to ensure they are properly resumed.
|
|
161
|
-
|
|
162
|
-
5. **Consider Storage Scaling**: For applications with many suspended workflows, ensure your storage solution is appropriately scaled.
|
|
163
|
-
|
|
164
|
-
## Advanced Snapshot Patterns
|
|
165
|
-
|
|
166
|
-
### Custom Snapshot Metadata
|
|
167
|
-
|
|
168
|
-
When suspending a workflow, you can include custom metadata that can help when resuming:
|
|
169
|
-
|
|
170
|
-
```typescript
|
|
171
|
-
await suspend({
|
|
172
|
-
reason: "Waiting for customer approval",
|
|
173
|
-
requiredApprovers: ["manager", "finance"],
|
|
174
|
-
requestedBy: currentUser,
|
|
175
|
-
urgency: "high",
|
|
176
|
-
expires: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
|
|
177
|
-
});
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
This metadata is stored with the snapshot and available when resuming.
|
|
181
|
-
|
|
182
|
-
### Conditional Resumption
|
|
183
|
-
|
|
184
|
-
You can implement conditional logic based on the suspend payload when resuming:
|
|
185
|
-
|
|
186
|
-
```typescript
|
|
187
|
-
run.watch(async ({ activePaths }) => {
|
|
188
|
-
const isApprovalStepSuspended =
|
|
189
|
-
activePaths.get("approval")?.status === "suspended";
|
|
190
|
-
if (isApprovalStepSuspended) {
|
|
191
|
-
const payload = activePaths.get("approval")?.suspendPayload;
|
|
192
|
-
if (payload.urgency === "high" && currentUser.role === "manager") {
|
|
193
|
-
await resume({
|
|
194
|
-
stepId: "approval",
|
|
195
|
-
context: { approved: true, approver: currentUser.id },
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## Related
|
|
203
|
-
|
|
204
|
-
- [Suspend Function Reference](./suspend)
|
|
205
|
-
- [Resume Function Reference](./resume)
|
|
206
|
-
- [Watch Function Reference](./watch)
|
|
207
|
-
- [Suspend and Resume Guide](/docs/workflows-legacy/suspend-and-resume)
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Reference: start() | Legacy Workflows | Mastra Docs"
|
|
3
|
-
description: "Documentation for the `start()` method in workflows, which begins execution of a workflow run."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# start()
|
|
7
|
-
|
|
8
|
-
The start function begins execution of a workflow run. It processes all steps in the defined workflow order, handling parallel execution, branching logic, and step dependencies.
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
```typescript copy showLineNumbers
|
|
13
|
-
const { runId, start } = workflow.createRun();
|
|
14
|
-
const result = await start({
|
|
15
|
-
triggerData: { inputValue: 42 },
|
|
16
|
-
});
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Parameters
|
|
20
|
-
|
|
21
|
-
<PropertiesTable
|
|
22
|
-
content={[
|
|
23
|
-
{
|
|
24
|
-
name: "config",
|
|
25
|
-
type: "object",
|
|
26
|
-
description: "Configuration for starting the workflow run",
|
|
27
|
-
isOptional: true,
|
|
28
|
-
},
|
|
29
|
-
]}
|
|
30
|
-
/>
|
|
31
|
-
|
|
32
|
-
### config
|
|
33
|
-
|
|
34
|
-
<PropertiesTable
|
|
35
|
-
content={[
|
|
36
|
-
{
|
|
37
|
-
name: "triggerData",
|
|
38
|
-
type: "Record<string, any>",
|
|
39
|
-
description: "Initial data that matches the workflow's triggerSchema",
|
|
40
|
-
isOptional: false,
|
|
41
|
-
},
|
|
42
|
-
]}
|
|
43
|
-
/>
|
|
44
|
-
|
|
45
|
-
## Returns
|
|
46
|
-
|
|
47
|
-
<PropertiesTable
|
|
48
|
-
content={[
|
|
49
|
-
{
|
|
50
|
-
name: "results",
|
|
51
|
-
type: "Record<string, any>",
|
|
52
|
-
description: "Combined output from all completed workflow steps",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: "status",
|
|
56
|
-
type: "'completed' | 'error' | 'suspended'",
|
|
57
|
-
description: "Final status of the workflow run",
|
|
58
|
-
},
|
|
59
|
-
]}
|
|
60
|
-
/>
|
|
61
|
-
|
|
62
|
-
## Error Handling
|
|
63
|
-
|
|
64
|
-
The start function may throw several types of validation errors:
|
|
65
|
-
|
|
66
|
-
```typescript copy showLineNumbers
|
|
67
|
-
try {
|
|
68
|
-
const result = await start({ triggerData: data });
|
|
69
|
-
} catch (error) {
|
|
70
|
-
if (error instanceof ValidationError) {
|
|
71
|
-
console.log(error.type); // 'circular_dependency' | 'no_terminal_path' | 'unreachable_step'
|
|
72
|
-
console.log(error.details);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Related
|
|
78
|
-
|
|
79
|
-
- [Example: Creating a Workflow](/examples/workflows_legacy/creating-a-workflow)
|
|
80
|
-
- [Example: Suspend and Resume](/examples/workflows_legacy/suspend-and-resume)
|
|
81
|
-
- [createRun Reference](./createRun)
|
|
82
|
-
- [Workflow Class Reference](./workflow)
|
|
83
|
-
- [Step Class Reference](./step-class)
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
```
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Reference: Step | Legacy Workflows | Mastra Docs"
|
|
3
|
-
description: Documentation for the Step class, which defines individual units of work within a workflow.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Step
|
|
7
|
-
|
|
8
|
-
The Step class defines individual units of work within a workflow, encapsulating execution logic, data validation, and input/output handling.
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
```typescript
|
|
13
|
-
const processOrder = new LegacyStep({
|
|
14
|
-
id: "processOrder",
|
|
15
|
-
inputSchema: z.object({
|
|
16
|
-
orderId: z.string(),
|
|
17
|
-
userId: z.string(),
|
|
18
|
-
}),
|
|
19
|
-
outputSchema: z.object({
|
|
20
|
-
status: z.string(),
|
|
21
|
-
orderId: z.string(),
|
|
22
|
-
}),
|
|
23
|
-
execute: async ({ context, runId }) => {
|
|
24
|
-
return {
|
|
25
|
-
status: "processed",
|
|
26
|
-
orderId: context.orderId,
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Constructor Parameters
|
|
33
|
-
|
|
34
|
-
<PropertiesTable
|
|
35
|
-
content={[
|
|
36
|
-
{
|
|
37
|
-
name: "id",
|
|
38
|
-
type: "string",
|
|
39
|
-
description: "Unique identifier for the step",
|
|
40
|
-
required: true,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "inputSchema",
|
|
44
|
-
type: "z.ZodSchema",
|
|
45
|
-
description: "Zod schema to validate input data before execution",
|
|
46
|
-
required: false,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: "outputSchema",
|
|
50
|
-
type: "z.ZodSchema",
|
|
51
|
-
description: "Zod schema to validate step output data",
|
|
52
|
-
required: false,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: "payload",
|
|
56
|
-
type: "Record<string, any>",
|
|
57
|
-
description: "Static data to be merged with variables",
|
|
58
|
-
required: false,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "execute",
|
|
62
|
-
type: "(params: ExecuteParams) => Promise<any>",
|
|
63
|
-
description: "Async function containing step logic",
|
|
64
|
-
required: true,
|
|
65
|
-
},
|
|
66
|
-
]}
|
|
67
|
-
/>
|
|
68
|
-
|
|
69
|
-
### ExecuteParams
|
|
70
|
-
|
|
71
|
-
<PropertiesTable
|
|
72
|
-
content={[
|
|
73
|
-
{
|
|
74
|
-
name: "context",
|
|
75
|
-
type: "StepContext",
|
|
76
|
-
description: "Access to workflow context and step results",
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: "runId",
|
|
80
|
-
type: "string",
|
|
81
|
-
description: "Unique identifier for current workflow run",
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: "suspend",
|
|
85
|
-
type: "() => Promise<void>",
|
|
86
|
-
description: "Function to suspend step execution",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "mastra",
|
|
90
|
-
type: "Mastra",
|
|
91
|
-
description: "Access to Mastra instance",
|
|
92
|
-
},
|
|
93
|
-
]}
|
|
94
|
-
/>
|
|
95
|
-
|
|
96
|
-
## Related
|
|
97
|
-
|
|
98
|
-
- [Workflow Reference](./workflow)
|
|
99
|
-
- [Step Configuration Guide](/docs/workflows-legacy/steps)
|
|
100
|
-
- [Control Flow Guide](/docs/workflows-legacy/control-flow)
|