@mastra/mcp-docs-server 1.1.5 → 1.1.6-alpha.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/docs/agents/adding-voice.md +349 -0
- package/.docs/docs/agents/agent-approval.md +558 -0
- package/.docs/docs/agents/agent-memory.md +209 -0
- package/.docs/docs/agents/guardrails.md +374 -0
- package/.docs/docs/agents/network-approval.md +275 -0
- package/.docs/docs/agents/networks.md +299 -0
- package/.docs/docs/agents/overview.md +304 -0
- package/.docs/docs/agents/processors.md +622 -0
- package/.docs/docs/agents/structured-output.md +273 -0
- package/.docs/docs/agents/supervisor-agents.md +304 -0
- package/.docs/docs/agents/using-tools.md +214 -0
- package/.docs/docs/build-with-ai/mcp-docs-server.md +238 -0
- package/.docs/docs/build-with-ai/skills.md +35 -0
- package/.docs/docs/community/contributing-templates.md +3 -0
- package/.docs/docs/community/discord.md +9 -0
- package/.docs/docs/community/licensing.md +66 -0
- package/.docs/docs/deployment/cloud-providers.md +15 -0
- package/.docs/docs/deployment/mastra-server.md +122 -0
- package/.docs/docs/deployment/monorepo.md +142 -0
- package/.docs/docs/deployment/overview.md +62 -0
- package/.docs/docs/deployment/studio.md +239 -0
- package/.docs/docs/deployment/web-framework.md +52 -0
- package/.docs/docs/deployment/workflow-runners.md +9 -0
- package/.docs/docs/evals/built-in-scorers.md +47 -0
- package/.docs/docs/evals/custom-scorers.md +519 -0
- package/.docs/docs/evals/overview.md +141 -0
- package/.docs/docs/evals/running-in-ci.md +124 -0
- package/.docs/docs/getting-started/build-with-ai.md +68 -0
- package/.docs/docs/getting-started/manual-install.md +226 -0
- package/.docs/docs/getting-started/project-structure.md +60 -0
- package/.docs/docs/getting-started/start.md +28 -0
- package/.docs/docs/getting-started/studio.md +101 -0
- package/.docs/docs/index.md +43 -0
- package/.docs/docs/mastra-cloud/deployment.md +77 -0
- package/.docs/docs/mastra-cloud/observability.md +38 -0
- package/.docs/docs/mastra-cloud/overview.md +23 -0
- package/.docs/docs/mastra-cloud/setup.md +42 -0
- package/.docs/docs/mastra-cloud/studio.md +24 -0
- package/.docs/docs/mastra-code/configuration.md +299 -0
- package/.docs/docs/mastra-code/customization.md +228 -0
- package/.docs/docs/mastra-code/modes.md +104 -0
- package/.docs/docs/mastra-code/overview.md +135 -0
- package/.docs/docs/mastra-code/tools.md +229 -0
- package/.docs/docs/mcp/overview.md +373 -0
- package/.docs/docs/mcp/publishing-mcp-server.md +95 -0
- package/.docs/docs/memory/memory-processors.md +314 -0
- package/.docs/docs/memory/message-history.md +260 -0
- package/.docs/docs/memory/observational-memory.md +248 -0
- package/.docs/docs/memory/overview.md +45 -0
- package/.docs/docs/memory/semantic-recall.md +272 -0
- package/.docs/docs/memory/storage.md +261 -0
- package/.docs/docs/memory/working-memory.md +400 -0
- package/.docs/docs/observability/datasets/overview.md +198 -0
- package/.docs/docs/observability/datasets/running-experiments.md +274 -0
- package/.docs/docs/observability/logging.md +99 -0
- package/.docs/docs/observability/overview.md +70 -0
- package/.docs/docs/observability/tracing/bridges/otel.md +209 -0
- package/.docs/docs/observability/tracing/exporters/arize.md +272 -0
- package/.docs/docs/observability/tracing/exporters/braintrust.md +111 -0
- package/.docs/docs/observability/tracing/exporters/cloud.md +127 -0
- package/.docs/docs/observability/tracing/exporters/datadog.md +187 -0
- package/.docs/docs/observability/tracing/exporters/default.md +209 -0
- package/.docs/docs/observability/tracing/exporters/laminar.md +100 -0
- package/.docs/docs/observability/tracing/exporters/langfuse.md +213 -0
- package/.docs/docs/observability/tracing/exporters/langsmith.md +198 -0
- package/.docs/docs/observability/tracing/exporters/otel.md +476 -0
- package/.docs/docs/observability/tracing/exporters/posthog.md +148 -0
- package/.docs/docs/observability/tracing/exporters/sentry.md +208 -0
- package/.docs/docs/observability/tracing/overview.md +1112 -0
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +300 -0
- package/.docs/docs/rag/chunking-and-embedding.md +183 -0
- package/.docs/docs/rag/graph-rag.md +215 -0
- package/.docs/docs/rag/overview.md +72 -0
- package/.docs/docs/rag/retrieval.md +515 -0
- package/.docs/docs/rag/vector-databases.md +645 -0
- package/.docs/docs/server/auth/auth0.md +220 -0
- package/.docs/docs/server/auth/better-auth.md +203 -0
- package/.docs/docs/server/auth/clerk.md +132 -0
- package/.docs/docs/server/auth/composite-auth.md +234 -0
- package/.docs/docs/server/auth/custom-auth-provider.md +513 -0
- package/.docs/docs/server/auth/firebase.md +272 -0
- package/.docs/docs/server/auth/jwt.md +110 -0
- package/.docs/docs/server/auth/simple-auth.md +180 -0
- package/.docs/docs/server/auth/supabase.md +117 -0
- package/.docs/docs/server/auth/workos.md +186 -0
- package/.docs/docs/server/auth.md +38 -0
- package/.docs/docs/server/custom-adapters.md +378 -0
- package/.docs/docs/server/custom-api-routes.md +267 -0
- package/.docs/docs/server/mastra-client.md +243 -0
- package/.docs/docs/server/mastra-server.md +71 -0
- package/.docs/docs/server/middleware.md +225 -0
- package/.docs/docs/server/request-context.md +471 -0
- package/.docs/docs/server/server-adapters.md +547 -0
- package/.docs/docs/streaming/events.md +237 -0
- package/.docs/docs/streaming/overview.md +175 -0
- package/.docs/docs/streaming/tool-streaming.md +175 -0
- package/.docs/docs/streaming/workflow-streaming.md +109 -0
- package/.docs/docs/voice/overview.md +959 -0
- package/.docs/docs/voice/speech-to-speech.md +102 -0
- package/.docs/docs/voice/speech-to-text.md +79 -0
- package/.docs/docs/voice/text-to-speech.md +83 -0
- package/.docs/docs/workflows/agents-and-tools.md +166 -0
- package/.docs/docs/workflows/control-flow.md +822 -0
- package/.docs/docs/workflows/error-handling.md +360 -0
- package/.docs/docs/workflows/human-in-the-loop.md +215 -0
- package/.docs/docs/workflows/overview.md +370 -0
- package/.docs/docs/workflows/snapshots.md +238 -0
- package/.docs/docs/workflows/suspend-and-resume.md +205 -0
- package/.docs/docs/workflows/time-travel.md +309 -0
- package/.docs/docs/workflows/workflow-state.md +181 -0
- package/.docs/docs/workspace/filesystem.md +164 -0
- package/.docs/docs/workspace/overview.md +239 -0
- package/.docs/docs/workspace/sandbox.md +63 -0
- package/.docs/docs/workspace/search.md +243 -0
- package/.docs/docs/workspace/skills.md +169 -0
- package/.docs/guides/agent-frameworks/ai-sdk.md +140 -0
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +1499 -0
- package/.docs/guides/build-your-ui/assistant-ui.md +156 -0
- package/.docs/guides/build-your-ui/copilotkit.md +289 -0
- package/.docs/guides/deployment/amazon-ec2.md +130 -0
- package/.docs/guides/deployment/aws-lambda.md +248 -0
- package/.docs/guides/deployment/azure-app-services.md +114 -0
- package/.docs/guides/deployment/cloudflare.md +99 -0
- package/.docs/guides/deployment/digital-ocean.md +168 -0
- package/.docs/guides/deployment/inngest.md +682 -0
- package/.docs/guides/deployment/netlify.md +77 -0
- package/.docs/guides/deployment/vercel.md +101 -0
- package/.docs/guides/getting-started/astro.md +398 -0
- package/.docs/guides/getting-started/electron.md +504 -0
- package/.docs/guides/getting-started/express.md +251 -0
- package/.docs/guides/getting-started/hono.md +190 -0
- package/.docs/guides/getting-started/next-js.md +347 -0
- package/.docs/guides/getting-started/nuxt.md +497 -0
- package/.docs/guides/getting-started/quickstart.md +67 -0
- package/.docs/guides/getting-started/sveltekit.md +296 -0
- package/.docs/guides/getting-started/vite-react.md +425 -0
- package/.docs/guides/guide/ai-recruiter.md +226 -0
- package/.docs/guides/guide/chef-michel.md +211 -0
- package/.docs/guides/guide/code-review-bot.md +226 -0
- package/.docs/guides/guide/dev-assistant.md +307 -0
- package/.docs/guides/guide/docs-manager.md +238 -0
- package/.docs/guides/guide/github-actions-pr-description.md +236 -0
- package/.docs/guides/guide/notes-mcp-server.md +416 -0
- package/.docs/guides/guide/research-assistant.md +348 -0
- package/.docs/guides/guide/research-coordinator.md +416 -0
- package/.docs/guides/guide/stock-agent.md +132 -0
- package/.docs/guides/guide/web-search.md +320 -0
- package/.docs/guides/guide/whatsapp-chat-bot.md +405 -0
- package/.docs/guides/index.md +3 -0
- package/.docs/guides/migrations/agentnetwork.md +97 -0
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +112 -0
- package/.docs/guides/migrations/network-to-supervisor.md +261 -0
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +404 -0
- package/.docs/guides/migrations/upgrade-to-v1/cli.md +57 -0
- package/.docs/guides/migrations/upgrade-to-v1/client.md +337 -0
- package/.docs/guides/migrations/upgrade-to-v1/deployment.md +37 -0
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +239 -0
- package/.docs/guides/migrations/upgrade-to-v1/mastra.md +143 -0
- package/.docs/guides/migrations/upgrade-to-v1/mcp.md +97 -0
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +285 -0
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +119 -0
- package/.docs/guides/migrations/upgrade-to-v1/processors.md +68 -0
- package/.docs/guides/migrations/upgrade-to-v1/rag.md +42 -0
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +553 -0
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +180 -0
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +412 -0
- package/.docs/guides/migrations/upgrade-to-v1/vectors.md +87 -0
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +30 -0
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +341 -0
- package/.docs/guides/migrations/vnext-to-standard-apis.md +362 -0
- package/.docs/models/embeddings.md +161 -0
- package/.docs/models/gateways/azure-openai.md +128 -0
- package/.docs/models/gateways/custom-gateways.md +545 -0
- package/.docs/models/gateways/netlify.md +88 -0
- package/.docs/models/gateways/openrouter.md +219 -0
- package/.docs/models/gateways/vercel.md +225 -0
- package/.docs/models/gateways.md +14 -0
- package/.docs/models/index.md +286 -0
- package/.docs/models/providers/302ai.md +134 -0
- package/.docs/models/providers/abacus.md +125 -0
- package/.docs/models/providers/agentrouter.md +90 -0
- package/.docs/models/providers/aihubmix.md +107 -0
- package/.docs/models/providers/alibaba-cn.md +135 -0
- package/.docs/models/providers/alibaba.md +111 -0
- package/.docs/models/providers/amazon-bedrock.md +33 -0
- package/.docs/models/providers/anthropic.md +153 -0
- package/.docs/models/providers/azure.md +33 -0
- package/.docs/models/providers/bailing.md +72 -0
- package/.docs/models/providers/baseten.md +77 -0
- package/.docs/models/providers/berget.md +78 -0
- package/.docs/models/providers/cerebras.md +101 -0
- package/.docs/models/providers/chutes.md +136 -0
- package/.docs/models/providers/cloudflare-ai-gateway.md +33 -0
- package/.docs/models/providers/cloudflare-workers-ai.md +109 -0
- package/.docs/models/providers/cohere.md +33 -0
- package/.docs/models/providers/cortecs.md +91 -0
- package/.docs/models/providers/deepinfra.md +112 -0
- package/.docs/models/providers/deepseek.md +88 -0
- package/.docs/models/providers/fastrouter.md +84 -0
- package/.docs/models/providers/fireworks-ai.md +89 -0
- package/.docs/models/providers/firmware.md +85 -0
- package/.docs/models/providers/friendli.md +78 -0
- package/.docs/models/providers/github-models.md +125 -0
- package/.docs/models/providers/google-vertex.md +33 -0
- package/.docs/models/providers/google.md +159 -0
- package/.docs/models/providers/groq.md +107 -0
- package/.docs/models/providers/helicone.md +161 -0
- package/.docs/models/providers/huggingface.md +90 -0
- package/.docs/models/providers/iflowcn.md +84 -0
- package/.docs/models/providers/inception.md +72 -0
- package/.docs/models/providers/inference.md +79 -0
- package/.docs/models/providers/io-intelligence.md +87 -0
- package/.docs/models/providers/io-net.md +87 -0
- package/.docs/models/providers/jiekou.md +131 -0
- package/.docs/models/providers/kilo.md +333 -0
- package/.docs/models/providers/kimi-for-coding.md +100 -0
- package/.docs/models/providers/kuae-cloud-coding-plan.md +71 -0
- package/.docs/models/providers/llama.md +77 -0
- package/.docs/models/providers/lmstudio.md +73 -0
- package/.docs/models/providers/lucidquery.md +72 -0
- package/.docs/models/providers/minimax-cn-coding-plan.md +102 -0
- package/.docs/models/providers/minimax-cn.md +102 -0
- package/.docs/models/providers/minimax-coding-plan.md +102 -0
- package/.docs/models/providers/minimax.md +104 -0
- package/.docs/models/providers/mistral.md +124 -0
- package/.docs/models/providers/moark.md +72 -0
- package/.docs/models/providers/modelscope.md +77 -0
- package/.docs/models/providers/moonshotai-cn.md +76 -0
- package/.docs/models/providers/moonshotai.md +76 -0
- package/.docs/models/providers/morph.md +73 -0
- package/.docs/models/providers/nano-gpt.md +103 -0
- package/.docs/models/providers/nebius.md +116 -0
- package/.docs/models/providers/nova.md +72 -0
- package/.docs/models/providers/novita-ai.md +154 -0
- package/.docs/models/providers/nvidia.md +141 -0
- package/.docs/models/providers/ollama-cloud.md +103 -0
- package/.docs/models/providers/ollama.md +33 -0
- package/.docs/models/providers/openai.md +193 -0
- package/.docs/models/providers/opencode.md +100 -0
- package/.docs/models/providers/ovhcloud.md +83 -0
- package/.docs/models/providers/perplexity.md +100 -0
- package/.docs/models/providers/poe.md +183 -0
- package/.docs/models/providers/privatemode-ai.md +75 -0
- package/.docs/models/providers/requesty.md +90 -0
- package/.docs/models/providers/scaleway.md +84 -0
- package/.docs/models/providers/siliconflow-cn.md +138 -0
- package/.docs/models/providers/siliconflow.md +140 -0
- package/.docs/models/providers/stackit.md +78 -0
- package/.docs/models/providers/stepfun.md +73 -0
- package/.docs/models/providers/submodel.md +79 -0
- package/.docs/models/providers/synthetic.md +96 -0
- package/.docs/models/providers/togetherai.md +115 -0
- package/.docs/models/providers/upstage.md +73 -0
- package/.docs/models/providers/venice.md +95 -0
- package/.docs/models/providers/vivgrid.md +106 -0
- package/.docs/models/providers/vultr.md +75 -0
- package/.docs/models/providers/wandb.md +80 -0
- package/.docs/models/providers/xai.md +141 -0
- package/.docs/models/providers/xiaomi.md +71 -0
- package/.docs/models/providers/zai-coding-plan.md +80 -0
- package/.docs/models/providers/zai.md +79 -0
- package/.docs/models/providers/zenmux.md +161 -0
- package/.docs/models/providers/zhipuai-coding-plan.md +79 -0
- package/.docs/models/providers/zhipuai.md +79 -0
- package/.docs/models/providers.md +81 -0
- package/.docs/reference/agents/agent.md +141 -0
- package/.docs/reference/agents/generate.md +186 -0
- package/.docs/reference/agents/generateLegacy.md +173 -0
- package/.docs/reference/agents/getDefaultGenerateOptions.md +36 -0
- package/.docs/reference/agents/getDefaultOptions.md +34 -0
- package/.docs/reference/agents/getDefaultStreamOptions.md +36 -0
- package/.docs/reference/agents/getDescription.md +21 -0
- package/.docs/reference/agents/getInstructions.md +34 -0
- package/.docs/reference/agents/getLLM.md +37 -0
- package/.docs/reference/agents/getMemory.md +34 -0
- package/.docs/reference/agents/getModel.md +34 -0
- package/.docs/reference/agents/getTools.md +29 -0
- package/.docs/reference/agents/getVoice.md +34 -0
- package/.docs/reference/agents/listAgents.md +35 -0
- package/.docs/reference/agents/listScorers.md +34 -0
- package/.docs/reference/agents/listTools.md +34 -0
- package/.docs/reference/agents/listWorkflows.md +34 -0
- package/.docs/reference/agents/network.md +133 -0
- package/.docs/reference/ai-sdk/chat-route.md +82 -0
- package/.docs/reference/ai-sdk/handle-chat-stream.md +53 -0
- package/.docs/reference/ai-sdk/handle-network-stream.md +37 -0
- package/.docs/reference/ai-sdk/handle-workflow-stream.md +55 -0
- package/.docs/reference/ai-sdk/network-route.md +74 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +231 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +79 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +76 -0
- package/.docs/reference/ai-sdk/with-mastra.md +59 -0
- package/.docs/reference/ai-sdk/workflow-route.md +79 -0
- package/.docs/reference/auth/auth0.md +73 -0
- package/.docs/reference/auth/better-auth.md +71 -0
- package/.docs/reference/auth/clerk.md +36 -0
- package/.docs/reference/auth/firebase.md +80 -0
- package/.docs/reference/auth/jwt.md +26 -0
- package/.docs/reference/auth/supabase.md +33 -0
- package/.docs/reference/auth/workos.md +84 -0
- package/.docs/reference/cli/create-mastra.md +137 -0
- package/.docs/reference/cli/mastra.md +336 -0
- package/.docs/reference/client-js/agents.md +437 -0
- package/.docs/reference/client-js/error-handling.md +16 -0
- package/.docs/reference/client-js/logs.md +24 -0
- package/.docs/reference/client-js/mastra-client.md +63 -0
- package/.docs/reference/client-js/memory.md +221 -0
- package/.docs/reference/client-js/observability.md +72 -0
- package/.docs/reference/client-js/telemetry.md +20 -0
- package/.docs/reference/client-js/tools.md +44 -0
- package/.docs/reference/client-js/vectors.md +79 -0
- package/.docs/reference/client-js/workflows.md +199 -0
- package/.docs/reference/configuration.md +752 -0
- package/.docs/reference/core/addGateway.md +42 -0
- package/.docs/reference/core/getAgent.md +21 -0
- package/.docs/reference/core/getAgentById.md +21 -0
- package/.docs/reference/core/getDeployer.md +22 -0
- package/.docs/reference/core/getGateway.md +38 -0
- package/.docs/reference/core/getGatewayById.md +41 -0
- package/.docs/reference/core/getLogger.md +22 -0
- package/.docs/reference/core/getMCPServer.md +47 -0
- package/.docs/reference/core/getMCPServerById.md +55 -0
- package/.docs/reference/core/getMemory.md +50 -0
- package/.docs/reference/core/getScorer.md +54 -0
- package/.docs/reference/core/getScorerById.md +54 -0
- package/.docs/reference/core/getServer.md +22 -0
- package/.docs/reference/core/getStorage.md +22 -0
- package/.docs/reference/core/getStoredAgentById.md +89 -0
- package/.docs/reference/core/getTelemetry.md +22 -0
- package/.docs/reference/core/getVector.md +22 -0
- package/.docs/reference/core/getWorkflow.md +42 -0
- package/.docs/reference/core/listAgents.md +21 -0
- package/.docs/reference/core/listGateways.md +40 -0
- package/.docs/reference/core/listLogs.md +38 -0
- package/.docs/reference/core/listLogsByRunId.md +36 -0
- package/.docs/reference/core/listMCPServers.md +55 -0
- package/.docs/reference/core/listMemory.md +56 -0
- package/.docs/reference/core/listScorers.md +29 -0
- package/.docs/reference/core/listStoredAgents.md +93 -0
- package/.docs/reference/core/listVectors.md +22 -0
- package/.docs/reference/core/listWorkflows.md +21 -0
- package/.docs/reference/core/mastra-class.md +66 -0
- package/.docs/reference/core/mastra-model-gateway.md +153 -0
- package/.docs/reference/core/setLogger.md +26 -0
- package/.docs/reference/core/setStorage.md +27 -0
- package/.docs/reference/datasets/addItem.md +37 -0
- package/.docs/reference/datasets/addItems.md +35 -0
- package/.docs/reference/datasets/compareExperiments.md +52 -0
- package/.docs/reference/datasets/create.md +51 -0
- package/.docs/reference/datasets/dataset.md +82 -0
- package/.docs/reference/datasets/datasets-manager.md +94 -0
- package/.docs/reference/datasets/delete.md +25 -0
- package/.docs/reference/datasets/deleteExperiment.md +27 -0
- package/.docs/reference/datasets/deleteItem.md +27 -0
- package/.docs/reference/datasets/deleteItems.md +29 -0
- package/.docs/reference/datasets/get.md +31 -0
- package/.docs/reference/datasets/getDetails.md +47 -0
- package/.docs/reference/datasets/getExperiment.md +30 -0
- package/.docs/reference/datasets/getItem.md +33 -0
- package/.docs/reference/datasets/getItemHistory.md +31 -0
- package/.docs/reference/datasets/list.md +31 -0
- package/.docs/reference/datasets/listExperimentResults.md +39 -0
- package/.docs/reference/datasets/listExperiments.md +33 -0
- package/.docs/reference/datasets/listItems.md +46 -0
- package/.docs/reference/datasets/listVersions.md +33 -0
- package/.docs/reference/datasets/startExperiment.md +62 -0
- package/.docs/reference/datasets/startExperimentAsync.md +43 -0
- package/.docs/reference/datasets/update.md +48 -0
- package/.docs/reference/datasets/updateItem.md +38 -0
- package/.docs/reference/deployer/cloudflare.md +79 -0
- package/.docs/reference/deployer/netlify.md +80 -0
- package/.docs/reference/deployer/vercel.md +91 -0
- package/.docs/reference/deployer.md +100 -0
- package/.docs/reference/evals/answer-relevancy.md +105 -0
- package/.docs/reference/evals/answer-similarity.md +99 -0
- package/.docs/reference/evals/bias.md +120 -0
- package/.docs/reference/evals/completeness.md +136 -0
- package/.docs/reference/evals/content-similarity.md +101 -0
- package/.docs/reference/evals/context-precision.md +196 -0
- package/.docs/reference/evals/context-relevance.md +531 -0
- package/.docs/reference/evals/create-scorer.md +270 -0
- package/.docs/reference/evals/faithfulness.md +114 -0
- package/.docs/reference/evals/hallucination.md +213 -0
- package/.docs/reference/evals/keyword-coverage.md +128 -0
- package/.docs/reference/evals/mastra-scorer.md +123 -0
- package/.docs/reference/evals/noise-sensitivity.md +675 -0
- package/.docs/reference/evals/prompt-alignment.md +614 -0
- package/.docs/reference/evals/run-evals.md +179 -0
- package/.docs/reference/evals/scorer-utils.md +326 -0
- package/.docs/reference/evals/textual-difference.md +113 -0
- package/.docs/reference/evals/tone-consistency.md +119 -0
- package/.docs/reference/evals/tool-call-accuracy.md +533 -0
- package/.docs/reference/evals/toxicity.md +123 -0
- package/.docs/reference/harness/harness-class.md +708 -0
- package/.docs/reference/index.md +277 -0
- package/.docs/reference/logging/pino-logger.md +117 -0
- package/.docs/reference/mastra-code/createMastraCode.md +108 -0
- package/.docs/reference/memory/clone-utilities.md +199 -0
- package/.docs/reference/memory/cloneThread.md +130 -0
- package/.docs/reference/memory/createThread.md +68 -0
- package/.docs/reference/memory/deleteMessages.md +38 -0
- package/.docs/reference/memory/getThreadById.md +24 -0
- package/.docs/reference/memory/listThreads.md +145 -0
- package/.docs/reference/memory/memory-class.md +147 -0
- package/.docs/reference/memory/observational-memory.md +565 -0
- package/.docs/reference/memory/recall.md +91 -0
- package/.docs/reference/observability/tracing/bridges/otel.md +131 -0
- package/.docs/reference/observability/tracing/configuration.md +178 -0
- package/.docs/reference/observability/tracing/exporters/arize.md +141 -0
- package/.docs/reference/observability/tracing/exporters/braintrust.md +93 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +163 -0
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +138 -0
- package/.docs/reference/observability/tracing/exporters/datadog.md +116 -0
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +174 -0
- package/.docs/reference/observability/tracing/exporters/laminar.md +78 -0
- package/.docs/reference/observability/tracing/exporters/langfuse.md +134 -0
- package/.docs/reference/observability/tracing/exporters/langsmith.md +108 -0
- package/.docs/reference/observability/tracing/exporters/otel.md +199 -0
- package/.docs/reference/observability/tracing/exporters/posthog.md +92 -0
- package/.docs/reference/observability/tracing/exporters/sentry.md +184 -0
- package/.docs/reference/observability/tracing/instances.md +107 -0
- package/.docs/reference/observability/tracing/interfaces.md +743 -0
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +144 -0
- package/.docs/reference/observability/tracing/spans.md +224 -0
- package/.docs/reference/processors/batch-parts-processor.md +61 -0
- package/.docs/reference/processors/language-detector.md +82 -0
- package/.docs/reference/processors/message-history-processor.md +85 -0
- package/.docs/reference/processors/moderation-processor.md +104 -0
- package/.docs/reference/processors/pii-detector.md +108 -0
- package/.docs/reference/processors/processor-interface.md +521 -0
- package/.docs/reference/processors/prompt-injection-detector.md +72 -0
- package/.docs/reference/processors/semantic-recall-processor.md +117 -0
- package/.docs/reference/processors/system-prompt-scrubber.md +80 -0
- package/.docs/reference/processors/token-limiter-processor.md +115 -0
- package/.docs/reference/processors/tool-call-filter.md +85 -0
- package/.docs/reference/processors/tool-search-processor.md +111 -0
- package/.docs/reference/processors/unicode-normalizer.md +62 -0
- package/.docs/reference/processors/working-memory-processor.md +152 -0
- package/.docs/reference/rag/chunk.md +221 -0
- package/.docs/reference/rag/database-config.md +261 -0
- package/.docs/reference/rag/document.md +114 -0
- package/.docs/reference/rag/embeddings.md +92 -0
- package/.docs/reference/rag/extract-params.md +168 -0
- package/.docs/reference/rag/graph-rag.md +111 -0
- package/.docs/reference/rag/metadata-filters.md +216 -0
- package/.docs/reference/rag/rerank.md +75 -0
- package/.docs/reference/rag/rerankWithScorer.md +80 -0
- package/.docs/reference/server/create-route.md +262 -0
- package/.docs/reference/server/express-adapter.md +176 -0
- package/.docs/reference/server/fastify-adapter.md +90 -0
- package/.docs/reference/server/hono-adapter.md +162 -0
- package/.docs/reference/server/koa-adapter.md +127 -0
- package/.docs/reference/server/mastra-server.md +298 -0
- package/.docs/reference/server/register-api-route.md +249 -0
- package/.docs/reference/server/routes.md +306 -0
- package/.docs/reference/storage/cloudflare-d1.md +218 -0
- package/.docs/reference/storage/cloudflare.md +88 -0
- package/.docs/reference/storage/composite.md +235 -0
- package/.docs/reference/storage/convex.md +161 -0
- package/.docs/reference/storage/dynamodb.md +282 -0
- package/.docs/reference/storage/lance.md +131 -0
- package/.docs/reference/storage/libsql.md +135 -0
- package/.docs/reference/storage/mongodb.md +262 -0
- package/.docs/reference/storage/mssql.md +157 -0
- package/.docs/reference/storage/overview.md +121 -0
- package/.docs/reference/storage/postgresql.md +526 -0
- package/.docs/reference/storage/upstash.md +160 -0
- package/.docs/reference/streaming/ChunkType.md +292 -0
- package/.docs/reference/streaming/agents/MastraModelOutput.md +182 -0
- package/.docs/reference/streaming/agents/stream.md +221 -0
- package/.docs/reference/streaming/agents/streamLegacy.md +142 -0
- package/.docs/reference/streaming/workflows/observeStream.md +42 -0
- package/.docs/reference/streaming/workflows/resumeStream.md +61 -0
- package/.docs/reference/streaming/workflows/stream.md +88 -0
- package/.docs/reference/streaming/workflows/timeTravelStream.md +142 -0
- package/.docs/reference/templates/overview.md +194 -0
- package/.docs/reference/tools/create-tool.md +237 -0
- package/.docs/reference/tools/document-chunker-tool.md +89 -0
- package/.docs/reference/tools/graph-rag-tool.md +182 -0
- package/.docs/reference/tools/mcp-client.md +954 -0
- package/.docs/reference/tools/mcp-server.md +1271 -0
- package/.docs/reference/tools/vector-query-tool.md +459 -0
- package/.docs/reference/vectors/astra.md +121 -0
- package/.docs/reference/vectors/chroma.md +264 -0
- package/.docs/reference/vectors/convex.md +300 -0
- package/.docs/reference/vectors/couchbase.md +226 -0
- package/.docs/reference/vectors/duckdb.md +318 -0
- package/.docs/reference/vectors/elasticsearch.md +189 -0
- package/.docs/reference/vectors/lance.md +220 -0
- package/.docs/reference/vectors/libsql.md +305 -0
- package/.docs/reference/vectors/mongodb.md +295 -0
- package/.docs/reference/vectors/opensearch.md +99 -0
- package/.docs/reference/vectors/pg.md +408 -0
- package/.docs/reference/vectors/pinecone.md +168 -0
- package/.docs/reference/vectors/qdrant.md +222 -0
- package/.docs/reference/vectors/s3vectors.md +277 -0
- package/.docs/reference/vectors/turbopuffer.md +157 -0
- package/.docs/reference/vectors/upstash.md +294 -0
- package/.docs/reference/vectors/vectorize.md +147 -0
- package/.docs/reference/voice/azure.md +148 -0
- package/.docs/reference/voice/cloudflare.md +83 -0
- package/.docs/reference/voice/composite-voice.md +121 -0
- package/.docs/reference/voice/deepgram.md +79 -0
- package/.docs/reference/voice/elevenlabs.md +98 -0
- package/.docs/reference/voice/google-gemini-live.md +378 -0
- package/.docs/reference/voice/google.md +228 -0
- package/.docs/reference/voice/mastra-voice.md +311 -0
- package/.docs/reference/voice/murf.md +122 -0
- package/.docs/reference/voice/openai-realtime.md +203 -0
- package/.docs/reference/voice/openai.md +88 -0
- package/.docs/reference/voice/playai.md +80 -0
- package/.docs/reference/voice/sarvam.md +126 -0
- package/.docs/reference/voice/speechify.md +75 -0
- package/.docs/reference/voice/voice.addInstructions.md +55 -0
- package/.docs/reference/voice/voice.addTools.md +67 -0
- package/.docs/reference/voice/voice.answer.md +54 -0
- package/.docs/reference/voice/voice.close.md +51 -0
- package/.docs/reference/voice/voice.connect.md +94 -0
- package/.docs/reference/voice/voice.events.md +37 -0
- package/.docs/reference/voice/voice.getSpeakers.md +129 -0
- package/.docs/reference/voice/voice.listen.md +164 -0
- package/.docs/reference/voice/voice.off.md +54 -0
- package/.docs/reference/voice/voice.on.md +111 -0
- package/.docs/reference/voice/voice.send.md +65 -0
- package/.docs/reference/voice/voice.speak.md +157 -0
- package/.docs/reference/voice/voice.updateConfig.md +60 -0
- package/.docs/reference/workflows/run-methods/cancel.md +86 -0
- package/.docs/reference/workflows/run-methods/restart.md +33 -0
- package/.docs/reference/workflows/run-methods/resume.md +59 -0
- package/.docs/reference/workflows/run-methods/start.md +58 -0
- package/.docs/reference/workflows/run-methods/startAsync.md +67 -0
- package/.docs/reference/workflows/run-methods/timeTravel.md +142 -0
- package/.docs/reference/workflows/run.md +59 -0
- package/.docs/reference/workflows/step.md +119 -0
- package/.docs/reference/workflows/workflow-methods/branch.md +25 -0
- package/.docs/reference/workflows/workflow-methods/commit.md +17 -0
- package/.docs/reference/workflows/workflow-methods/create-run.md +63 -0
- package/.docs/reference/workflows/workflow-methods/dountil.md +25 -0
- package/.docs/reference/workflows/workflow-methods/dowhile.md +25 -0
- package/.docs/reference/workflows/workflow-methods/foreach.md +118 -0
- package/.docs/reference/workflows/workflow-methods/map.md +93 -0
- package/.docs/reference/workflows/workflow-methods/parallel.md +21 -0
- package/.docs/reference/workflows/workflow-methods/sleep.md +35 -0
- package/.docs/reference/workflows/workflow-methods/sleepUntil.md +35 -0
- package/.docs/reference/workflows/workflow-methods/then.md +21 -0
- package/.docs/reference/workflows/workflow.md +157 -0
- package/.docs/reference/workspace/e2b-sandbox.md +289 -0
- package/.docs/reference/workspace/filesystem.md +255 -0
- package/.docs/reference/workspace/gcs-filesystem.md +174 -0
- package/.docs/reference/workspace/local-filesystem.md +343 -0
- package/.docs/reference/workspace/local-sandbox.md +301 -0
- package/.docs/reference/workspace/s3-filesystem.md +175 -0
- package/.docs/reference/workspace/sandbox.md +87 -0
- package/.docs/reference/workspace/workspace-class.md +244 -0
- package/CHANGELOG.md +8 -0
- package/package.json +5 -5
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# Workflows
|
|
2
|
+
|
|
3
|
+
Legacy workflow features have been removed.
|
|
4
|
+
|
|
5
|
+
## Changed
|
|
6
|
+
|
|
7
|
+
### `getWorkflows` to `listWorkflows`
|
|
8
|
+
|
|
9
|
+
The `mastra.getWorkflows()` method has been renamed to `mastra.listWorkflows()`. This change aligns with the naming convention used across the API where plural getter methods use the `list` prefix.
|
|
10
|
+
|
|
11
|
+
To migrate, replace all calls to `mastra.getWorkflows()` with `mastra.listWorkflows()`.
|
|
12
|
+
|
|
13
|
+
```diff
|
|
14
|
+
- const workflows = mastra.getWorkflows();
|
|
15
|
+
+ const workflows = mastra.listWorkflows();
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
> **Codemod:** You can use Mastra's codemod CLI to update your imports automatically:
|
|
19
|
+
>
|
|
20
|
+
> ```bash
|
|
21
|
+
> npx @mastra/codemod@latest v1/mastra-plural-apis .
|
|
22
|
+
> ```
|
|
23
|
+
|
|
24
|
+
### `RuntimeContext` to `RequestContext` in step context
|
|
25
|
+
|
|
26
|
+
The parameter name `runtimeContext` has been changed to `requestContext` in workflow step execution context. This change aligns with the global rename for clarity.
|
|
27
|
+
|
|
28
|
+
To migrate, update references from `runtimeContext` to `requestContext` in step execution functions.
|
|
29
|
+
|
|
30
|
+
```diff
|
|
31
|
+
createStep({
|
|
32
|
+
- execute: async ({ runtimeContext } ) => {
|
|
33
|
+
- const userTier = context.runtimeContext.get('userTier');
|
|
34
|
+
+ execute: async ({ requestContext } ) => {
|
|
35
|
+
+ const userTier = requestContext.get('userTier');
|
|
36
|
+
return { result: userTier };
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
> **Codemod:** You can use Mastra's codemod CLI to update your imports automatically:
|
|
42
|
+
>
|
|
43
|
+
> ```bash
|
|
44
|
+
> npx @mastra/codemod@latest v1/runtime-context .
|
|
45
|
+
> ```
|
|
46
|
+
|
|
47
|
+
### `createRunAsync` to `createRun`
|
|
48
|
+
|
|
49
|
+
The `createRunAsync()` method has been renamed to `createRun()`. This change simplifies the API by removing the redundant "Async" suffix since all run creation is asynchronous.
|
|
50
|
+
|
|
51
|
+
To migrate, rename method calls from `createRunAsync` to `createRun`.
|
|
52
|
+
|
|
53
|
+
```diff
|
|
54
|
+
- await workflow.createRunAsync({ input: { ... } });
|
|
55
|
+
+ await workflow.createRun({ input: { ... } });
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
> **Codemod:** You can use Mastra's codemod CLI to update your code automatically:
|
|
59
|
+
>
|
|
60
|
+
> ```bash
|
|
61
|
+
> npx @mastra/codemod@latest v1/workflow-create-run-async .
|
|
62
|
+
> ```
|
|
63
|
+
|
|
64
|
+
### `runCount` to `retryCount` (deprecated)
|
|
65
|
+
|
|
66
|
+
The `runCount` parameter has been deprecated in favor of `retryCount` in workflow step execution. This change provides clearer naming that better describes retry behavior. The old `runCount` still works but shows deprecation warnings.
|
|
67
|
+
|
|
68
|
+
To migrate, rename `runCount` to `retryCount` in step execution functions.
|
|
69
|
+
|
|
70
|
+
```diff
|
|
71
|
+
createStep({
|
|
72
|
+
execute: async (inputData, context) => {
|
|
73
|
+
- console.log(`Step run ${context.runCount} times`);
|
|
74
|
+
+ console.log(`Step retry count: ${context.retryCount}`);
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
> **Codemod:** You can use Mastra's codemod CLI to update your code automatically:
|
|
80
|
+
>
|
|
81
|
+
> ```bash
|
|
82
|
+
> npx @mastra/codemod@latest v1/workflow-run-count .
|
|
83
|
+
> ```
|
|
84
|
+
|
|
85
|
+
### `getInitData` returns unknown
|
|
86
|
+
|
|
87
|
+
The `getInitData` function in the execute function now returns unknown instead of any. You'll need to type it yourself. To simply migrate, change `getInitData()` into `getInitData<any>()`
|
|
88
|
+
|
|
89
|
+
```diff
|
|
90
|
+
createStep({
|
|
91
|
+
execute: async ({ getInitData }) => {
|
|
92
|
+
- const initData = getInitData();
|
|
93
|
+
- if (initData.key === 'value') {}
|
|
94
|
+
+ const initData = getInitData<any>();
|
|
95
|
+
+ if (initData.key === 'value') {}
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
> **Codemod:** You can use Mastra's codemod CLI to update your code automatically:
|
|
101
|
+
>
|
|
102
|
+
> ```bash
|
|
103
|
+
> npx @mastra/codemod@latest v1/workflow-get-init-data .
|
|
104
|
+
> ```
|
|
105
|
+
|
|
106
|
+
### `getWorkflowRuns` to `listWorkflowRuns`
|
|
107
|
+
|
|
108
|
+
The `getWorkflowRuns()` method has been renamed to `listWorkflowRuns()`. This change aligns with the convention that `list*` methods return collections.
|
|
109
|
+
|
|
110
|
+
To migrate, rename method calls from `getWorkflowRuns` to `listWorkflowRuns`.
|
|
111
|
+
|
|
112
|
+
```diff
|
|
113
|
+
- const runs = await workflow.getWorkflowRuns({ fromDate, toDate });
|
|
114
|
+
+ const runs = await workflow.listWorkflowRuns({ fromDate, toDate });
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
> **Codemod:** You can use Mastra's codemod CLI to update your code automatically:
|
|
118
|
+
>
|
|
119
|
+
> ```bash
|
|
120
|
+
> npx @mastra/codemod@latest v1/workflow-list-runs .
|
|
121
|
+
> ```
|
|
122
|
+
|
|
123
|
+
### Inputs are validated by default
|
|
124
|
+
|
|
125
|
+
Previously, inputs weren't validated by default. The [`validateInputs`](https://mastra.ai/reference/workflows/workflow) flag determines whether to validate the workflow inputs or not. This boolean has been flipped to `true`. If you want the old behavior or have workflows whose schemas don't need to be validated, set `validateInputs: false`.
|
|
126
|
+
|
|
127
|
+
```diff
|
|
128
|
+
createWorkflow({
|
|
129
|
+
+ options: {
|
|
130
|
+
+ validateInputs: false
|
|
131
|
+
+ }
|
|
132
|
+
})
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Step `suspendPayload` validation
|
|
136
|
+
|
|
137
|
+
Step `suspendPayload` is now validated for steps that have a `suspendSchema` defined. This also uses the `validateInputs` flag to determine whether to validate the `suspendPayload` or not.
|
|
138
|
+
|
|
139
|
+
```diff
|
|
140
|
+
createStep({
|
|
141
|
+
id: "suspend-resume-step",
|
|
142
|
+
// ... other step properties
|
|
143
|
+
suspendSchema: z.object({
|
|
144
|
+
reason: z.string(),
|
|
145
|
+
otherReason: z.string()
|
|
146
|
+
}),
|
|
147
|
+
execute: async ({ suspend, resumeData}) => {
|
|
148
|
+
if (!resumeData) {
|
|
149
|
+
- return suspend({ reason: "Suspension reason" }); // Missing otherReason
|
|
150
|
+
+ return suspend({ reason: "Suspension reason", otherReason: "Other reason" });
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Branch result fields are now optional
|
|
157
|
+
|
|
158
|
+
The `.branch()` method now returns a schema where all branch output fields are optional. This reflects the runtime behavior where each branch only executes if its condition is truthy, so outputs from any branch may be undefined.
|
|
159
|
+
|
|
160
|
+
To migrate, update any code that consumes branch outputs to handle optional values.
|
|
161
|
+
|
|
162
|
+
```diff
|
|
163
|
+
const workflow = createWorkflow({...})
|
|
164
|
+
.branch([
|
|
165
|
+
[condition1, stepA], // outputSchema: { result: z.string() }
|
|
166
|
+
[condition2, stepB], // outputSchema: { data: z.number() }
|
|
167
|
+
])
|
|
168
|
+
- // Previously: stepA.result typed as string, stepB.data typed as number
|
|
169
|
+
+ // Now: stepA.result typed as string | undefined, stepB.data typed as number | undefined
|
|
170
|
+
.then(nextStep);
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
If your code depends on non-optional types, add runtime checks or provide default values when accessing branch outputs.
|
|
174
|
+
|
|
175
|
+
### `writableStream` to `outputWriter` in `Run.start()` & `Run.timeTravel()`
|
|
176
|
+
|
|
177
|
+
The `writableStream` parameter in `Run.start()` and `Run.timeTravel()` has been replaced with `outputWriter`. Instead of passing a `WritableStream`, you now pass an async callback function that receives each workflow event chunk directly.
|
|
178
|
+
|
|
179
|
+
This change simplifies the API - rather than creating a `WritableStream` wrapper, you handle chunks directly in the callback.
|
|
180
|
+
|
|
181
|
+
**Example:** Streaming workflow events to an HTTP response (SSE):
|
|
182
|
+
|
|
183
|
+
```diff
|
|
184
|
+
const run = await workflow.createRun();
|
|
185
|
+
|
|
186
|
+
- const stream = new WritableStream({
|
|
187
|
+
- write(chunk) {
|
|
188
|
+
- response.write(`data: ${JSON.stringify(chunk)}\n\n`);
|
|
189
|
+
- }
|
|
190
|
+
- });
|
|
191
|
+
- await run.start({ inputData, writableStream: stream });
|
|
192
|
+
|
|
193
|
+
+ await run.start({
|
|
194
|
+
+ inputData,
|
|
195
|
+
+ outputWriter: async (chunk) => {
|
|
196
|
+
+ response.write(`data: ${JSON.stringify(chunk)}\n\n`);
|
|
197
|
+
+ },
|
|
198
|
+
+ });
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
> **Note:** The `writer` parameter passed to step `execute` functions is not affected by this change. It remains a `ToolStream` that extends `WritableStream<unknown>` and provides `.write()` and `.custom()` methods:
|
|
202
|
+
>
|
|
203
|
+
> ```ts
|
|
204
|
+
> createStep({
|
|
205
|
+
> id: 'my-step',
|
|
206
|
+
> execute: async ({ writer }) => {
|
|
207
|
+
> // This API is unchanged
|
|
208
|
+
> await writer.write({ data: 'some output' })
|
|
209
|
+
> await writer.custom({ type: 'custom-event', payload: {} })
|
|
210
|
+
> },
|
|
211
|
+
> })
|
|
212
|
+
> ```
|
|
213
|
+
|
|
214
|
+
### `setState()` is now async and the data passed is validated
|
|
215
|
+
|
|
216
|
+
The `setState()` function is now async. The data passed is now validated against the `stateSchema` defined in the step. The state data validation also uses the `validateInputs` flag to determine whether to validate the state data or not. Also, when calling `setState()`, you can now pass only the state data being updated, instead of adding the previous state spread `(...state)`.
|
|
217
|
+
|
|
218
|
+
To migrate, update the `setState()` function to be async.
|
|
219
|
+
|
|
220
|
+
```diff
|
|
221
|
+
- setState({ ...state, sharedCounter: state.sharedCounter + 1 });
|
|
222
|
+
+ await setState({ sharedCounter: state.sharedCounter + 1 });
|
|
223
|
+
+ // await setState({ ...state, sharedCounter: state.sharedCounter + 1 });
|
|
224
|
+
+ // this also works, as the previous state spread remains supported
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Removed
|
|
228
|
+
|
|
229
|
+
### `streamVNext`, `resumeStreamVNext`, and `observeStreamVNext` methods
|
|
230
|
+
|
|
231
|
+
The experimental `streamVNext()`, `resumeStreamVNext()`, and `observeStreamVNext()` methods have been removed. These methods are now the standard implementation with updated event structures and return types.
|
|
232
|
+
|
|
233
|
+
To migrate, use the standard `stream()`, `resumeStream()`, and `observeStream()` methods. Update event type checks to use workflow-prefixed names and access stream properties directly.
|
|
234
|
+
|
|
235
|
+
See [`Run.stream()`](https://mastra.ai/reference/streaming/workflows/stream), [`Run.resumeStream()`](https://mastra.ai/reference/streaming/workflows/resumeStream), and [`Run.observeStream()`](https://mastra.ai/reference/streaming/workflows/observeStream) for details.
|
|
236
|
+
|
|
237
|
+
> **Codemod:** You can use Mastra's codemod CLI to update your code automatically:
|
|
238
|
+
>
|
|
239
|
+
> ```bash
|
|
240
|
+
> npx @mastra/codemod@latest v1/workflow-stream-vnext .
|
|
241
|
+
> ```
|
|
242
|
+
|
|
243
|
+
### `suspend` and `setState` are not available in step condition functions parameters
|
|
244
|
+
|
|
245
|
+
The `suspend` and `setState` functions are not available in step condition functions parameters.
|
|
246
|
+
|
|
247
|
+
To migrate, use the `suspend` function in the step execute function instead.
|
|
248
|
+
|
|
249
|
+
```diff
|
|
250
|
+
.dowhile(step, async ({ suspend, state, setState }) => {
|
|
251
|
+
- setState({...state, updatedState: "updated state"})
|
|
252
|
+
- await suspend({ reason: "Suspension reason" });
|
|
253
|
+
+ // Use the suspend/setState in the step execute function instead
|
|
254
|
+
});
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
This is the same for `dountil` and `branch` condition functions parameters.
|
|
258
|
+
|
|
259
|
+
### Legacy workflows export
|
|
260
|
+
|
|
261
|
+
The `./workflows/legacy` export path has been removed from `@mastra/core`. Legacy workflows are no longer supported.
|
|
262
|
+
|
|
263
|
+
To migrate, use the new workflow API. There is no direct migration path from legacy workflows.
|
|
264
|
+
|
|
265
|
+
```diff
|
|
266
|
+
- import { LegacyWorkflow } from '@mastra/core/workflows/legacy';
|
|
267
|
+
+ // Legacy workflows are no longer supported
|
|
268
|
+
+ // Migrate to the new workflow API
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### `pipeThrough` and `pipeTo` methods from WorkflowRunOutput
|
|
272
|
+
|
|
273
|
+
The `pipeThrough()` and `pipeTo()` methods on `WorkflowRunOutput` are deprecated. These methods still work but show console warnings.
|
|
274
|
+
|
|
275
|
+
To migrate, use the `fullStream` property instead of calling methods directly on the run output.
|
|
276
|
+
|
|
277
|
+
```diff
|
|
278
|
+
const run = await workflow.createRun({ input: { ... } });
|
|
279
|
+
- await run.pipeTo(writableStream);
|
|
280
|
+
- const transformed = run.pipeThrough(transformStream);
|
|
281
|
+
+ await run.fullStream.pipeTo(writableStream);
|
|
282
|
+
+ const transformed = run.fullStream.pipeThrough(transformStream);
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Watch events API
|
|
286
|
+
|
|
287
|
+
Legacy watch events have been removed and consolidated on the v2 events API. The `watch()` method and related watch endpoints are no longer available.
|
|
288
|
+
|
|
289
|
+
To migrate, use the workflow events API or streaming instead of watch events.
|
|
290
|
+
|
|
291
|
+
```diff
|
|
292
|
+
- const workflow = mastraClient.getWorkflow('my-workflow');
|
|
293
|
+
- const run = await workflow.createRun();
|
|
294
|
+
- await run.watch((event) => {
|
|
295
|
+
- console.log('Step completed:', event);
|
|
296
|
+
- });
|
|
297
|
+
|
|
298
|
+
+ const workflow = mastraClient.getWorkflow('my-workflow');
|
|
299
|
+
+ const run = await workflow.createRun();
|
|
300
|
+
+ const stream = await run.stream({ inputData: { ... } });
|
|
301
|
+
+ for await (const chunk of stream) {
|
|
302
|
+
+ console.log('Step completed:', chunk);
|
|
303
|
+
+ }
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### `waitForEvent` API
|
|
307
|
+
|
|
308
|
+
The `waitForEvent` API has been removed from workflows. Use the suspend/resume API instead.
|
|
309
|
+
|
|
310
|
+
To migrate, use suspend/resume API for waiting on workflow execution milestones.
|
|
311
|
+
|
|
312
|
+
```diff
|
|
313
|
+
- workflow.waitForEvent('step-complete', step1).commit();
|
|
314
|
+
+ workflow.then(step1).commit();
|
|
315
|
+
+ // Use suspend/resume API instead, in step1 execute function
|
|
316
|
+
createStep({
|
|
317
|
+
- execute: async (inputData, context) => {
|
|
318
|
+
- // ... execution logic
|
|
319
|
+
- }
|
|
320
|
+
+ execute: async (inputData, context) => {
|
|
321
|
+
+ if (!context.resumeData) {
|
|
322
|
+
+ return context.suspend({})
|
|
323
|
+
+ }
|
|
324
|
+
+ }
|
|
325
|
+
});
|
|
326
|
+
+
|
|
327
|
+
+ // after workflow is suspended, you can resume it
|
|
328
|
+
+ const result = await run.start({ inputData: { ... } });
|
|
329
|
+
+ if (result.status === 'suspended') {
|
|
330
|
+
+ const resumedResult = await run.resume({
|
|
331
|
+
+ resumeData: {
|
|
332
|
+
+ event: 'step-complete',
|
|
333
|
+
+ },
|
|
334
|
+
+ step: 'step1',
|
|
335
|
+
+ });
|
|
336
|
+
+ }
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### `sendEvent` API
|
|
340
|
+
|
|
341
|
+
The `sendEvent` API has been removed from workflows. Use the suspend/resume API instead.
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
# Migrate from VNext to Standard APIs
|
|
2
|
+
|
|
3
|
+
As of `v0.20.0` for `@mastra/core`, the following changes apply.
|
|
4
|
+
|
|
5
|
+
## Legacy APIs (AI SDK v4)
|
|
6
|
+
|
|
7
|
+
The original methods have been renamed and maintain backward compatibility with **AI SDK v4** and `v1` models.
|
|
8
|
+
|
|
9
|
+
- `.stream()` → `.streamLegacy()`
|
|
10
|
+
- `.generate()` → `.generateLegacy()`
|
|
11
|
+
|
|
12
|
+
## Standard APIs (AI SDK v5)
|
|
13
|
+
|
|
14
|
+
These are now the current APIs with full **AI SDK v5** and `v2` model compatibility.
|
|
15
|
+
|
|
16
|
+
- `.streamVNext()` → `.stream()`
|
|
17
|
+
- `.generateVNext()` → `.generate()`
|
|
18
|
+
|
|
19
|
+
## Migration paths
|
|
20
|
+
|
|
21
|
+
If you're already using `.streamVNext()` and `.generateVNext()` use find/replace to change methods to `.stream()` and `.generate()` respectively.
|
|
22
|
+
|
|
23
|
+
If you're using the old `.stream()` and `.generate()`, decide whether you want to upgrade or not. If you don't, use find/replace to change to `.streamLegacy()` and `.generateLegacy()`.
|
|
24
|
+
|
|
25
|
+
Choose the migration path that fits your needs:
|
|
26
|
+
|
|
27
|
+
### Keep using AI SDK v4 models
|
|
28
|
+
|
|
29
|
+
- Rename all your `.stream()` and `.generate()` calls to `.streamLegacy()` and `.generateLegacy()` respectively.
|
|
30
|
+
|
|
31
|
+
> No further changes required.
|
|
32
|
+
|
|
33
|
+
### Keep using AI SDK v5 models
|
|
34
|
+
|
|
35
|
+
- Rename all your `.streamVNext()` and `.generateVNext()` calls to `.stream()` and `.generate()` respectively.
|
|
36
|
+
|
|
37
|
+
> No further changes required.
|
|
38
|
+
|
|
39
|
+
### Upgrade from AI SDK v4 to v5
|
|
40
|
+
|
|
41
|
+
- Bump all your model provider packages by a major version.
|
|
42
|
+
|
|
43
|
+
> This will ensure that they are all v5 models now. Follow the guide below to understand the key differences and update your code accordingly.
|
|
44
|
+
|
|
45
|
+
## Key differences
|
|
46
|
+
|
|
47
|
+
The updated `.stream()` and `.generate()` methods differ from their legacy counterparts in behavior, compatibility, return types, and available options. This section highlights the most important changes you need to understand when migrating.
|
|
48
|
+
|
|
49
|
+
### Model version support
|
|
50
|
+
|
|
51
|
+
**Legacy APIs**
|
|
52
|
+
|
|
53
|
+
- `.generateLegacy()`
|
|
54
|
+
- `.streamLegacy()`
|
|
55
|
+
|
|
56
|
+
Only support **AI SDK v4** models (`specificationVersion: 'v1'`)
|
|
57
|
+
|
|
58
|
+
**Standard APIs**
|
|
59
|
+
|
|
60
|
+
- `.generate()`
|
|
61
|
+
- `.stream()`
|
|
62
|
+
|
|
63
|
+
Only support **AI SDK v5** models (`specificationVersion: 'v2'`)
|
|
64
|
+
|
|
65
|
+
> This is enforced at runtime with clear error messages.
|
|
66
|
+
|
|
67
|
+
### Return types
|
|
68
|
+
|
|
69
|
+
**Legacy APIs**
|
|
70
|
+
|
|
71
|
+
- `.generateLegacy()` Returns: `GenerateTextResult` or `GenerateObjectResult`
|
|
72
|
+
|
|
73
|
+
- `.streamLegacy()` Returns: `StreamTextResult` or `StreamObjectResult`
|
|
74
|
+
|
|
75
|
+
See the following API references for more information:
|
|
76
|
+
|
|
77
|
+
- [Agent.generateLegacy()](https://mastra.ai/reference/agents/generateLegacy)
|
|
78
|
+
- [Agent.streamLegacy()](https://mastra.ai/reference/streaming/agents/streamLegacy)
|
|
79
|
+
|
|
80
|
+
**Standard APIs**
|
|
81
|
+
|
|
82
|
+
- `.generate()`
|
|
83
|
+
|
|
84
|
+
- `format: 'mastra'` (default): Returns `MastraModelOutput.getFullOutput()`
|
|
85
|
+
- `format: 'aisdk'`: Returns `AISDKV5OutputStream.getFullOutput()`
|
|
86
|
+
- Internally calls `.stream()` and awaits `.getFullOutput()`
|
|
87
|
+
|
|
88
|
+
- `.stream()`
|
|
89
|
+
|
|
90
|
+
- `format: 'mastra'` (default): Returns `MastraModelOutput<OUTPUT>`
|
|
91
|
+
- `format: 'aisdk'`: Returns `AISDKV5OutputStream<OUTPUT>`
|
|
92
|
+
|
|
93
|
+
See the following API references for more information:
|
|
94
|
+
|
|
95
|
+
- [Agent.generate()](https://mastra.ai/reference/agents/generate)
|
|
96
|
+
- [Agent.stream()](https://mastra.ai/reference/streaming/agents/stream)
|
|
97
|
+
|
|
98
|
+
### Format control
|
|
99
|
+
|
|
100
|
+
#### Legacy APIs
|
|
101
|
+
|
|
102
|
+
No `format` option: Always return AI SDK v4 types
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// Mastra native format (default)
|
|
106
|
+
const result = await agent.stream(messages)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### Standard APIs
|
|
110
|
+
|
|
111
|
+
Use `format` option to choose output:
|
|
112
|
+
|
|
113
|
+
- `'mastra'` (default)
|
|
114
|
+
- `'aisdk'` (AI SDK v5 compatible)
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
// AI SDK v5 compatibility
|
|
118
|
+
const result = await agent.stream(messages, {
|
|
119
|
+
format: 'aisdk',
|
|
120
|
+
})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### New options in standard APIs
|
|
124
|
+
|
|
125
|
+
The following options are available in the standard `.stream()` and `generate()`, but **NOT** in their legacy counterparts:
|
|
126
|
+
|
|
127
|
+
- `format` - Choose between 'mastra' or 'aisdk' output format:
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
const result = await agent.stream(messages, {
|
|
131
|
+
format: 'aisdk', // or 'mastra' (default)
|
|
132
|
+
})
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
- `system` - Custom system message (separate from instructions).
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
const result = await agent.stream(messages, {
|
|
139
|
+
system: 'You are a helpful assistant',
|
|
140
|
+
})
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
- `structuredOutput` - Enhanced structured output with model override and custom options.
|
|
144
|
+
|
|
145
|
+
- `jsonPromptInjection` - Used to override the default behaviour of passing response\_format to the model. This will inject context into the prompt to coerce the model into returning structured outputs.
|
|
146
|
+
|
|
147
|
+
- `model` - If a model is added this will create a sub agent to structure the response from the main agent. The main agent will call tools and return text, and the sub agent will return an object that conforms to your schema provided. This is a replacement for `experimental_output`.
|
|
148
|
+
|
|
149
|
+
- `errorStrategy` - Determines what happens when the output doesn’t match the schema:
|
|
150
|
+
|
|
151
|
+
- 'warn' - log a warning
|
|
152
|
+
- 'error' - throw an error
|
|
153
|
+
- 'fallback' - return a fallback value you provide
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
const result = await agent.generate(messages, {
|
|
157
|
+
structuredOutput: {
|
|
158
|
+
schema: z.object({
|
|
159
|
+
name: z.string(),
|
|
160
|
+
age: z.number(),
|
|
161
|
+
}),
|
|
162
|
+
model: 'openai/gpt-5.1', // Optional model override for structuring
|
|
163
|
+
errorStrategy: 'fallback',
|
|
164
|
+
fallbackValue: { name: 'unknown', age: 0 },
|
|
165
|
+
instructions: 'Extract user information', // Override default structuring instructions
|
|
166
|
+
},
|
|
167
|
+
})
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
- `stopWhen` - Flexible stop conditions (step count, token limit, etc).
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
const result = await agent.stream(messages, {
|
|
174
|
+
stopWhen: ({ steps, totalTokens }) => steps >= 5 || totalTokens >= 10000,
|
|
175
|
+
})
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
- `providerOptions` - Provider-specific options (e.g., OpenAI-specific settings)
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
const result = await agent.stream(messages, {
|
|
182
|
+
providerOptions: {
|
|
183
|
+
openai: {
|
|
184
|
+
store: true,
|
|
185
|
+
metadata: { userId: '123' },
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
})
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
- `onChunk` - Callback for each streaming chunk.
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
const result = await agent.stream(messages, {
|
|
195
|
+
onChunk: chunk => {
|
|
196
|
+
console.log('Received chunk:', chunk)
|
|
197
|
+
},
|
|
198
|
+
})
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
- `onError` - Error callback.
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
const result = await agent.stream(messages, {
|
|
205
|
+
onError: error => {
|
|
206
|
+
console.error('Stream error:', error)
|
|
207
|
+
},
|
|
208
|
+
})
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
- `onAbort` - Abort callback.
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
const result = await agent.stream(messages, {
|
|
215
|
+
onAbort: () => {
|
|
216
|
+
console.log('Stream aborted')
|
|
217
|
+
},
|
|
218
|
+
})
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
- `activeTools` - Specify which tools are active for this execution.
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
const result = await agent.stream(messages, {
|
|
225
|
+
activeTools: ['search', 'calculator'], // Only these tools will be available
|
|
226
|
+
})
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
- `abortSignal` - AbortSignal for cancellation.
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
const controller = new AbortController()
|
|
233
|
+
const result = await agent.stream(messages, {
|
|
234
|
+
abortSignal: controller.signal,
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
// Later: controller.abort();
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
- `prepareStep` - Callback before each step in multi-step execution.
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
const result = await agent.stream(messages, {
|
|
244
|
+
prepareStep: ({ step, state }) => {
|
|
245
|
+
console.log('About to execute step:', step)
|
|
246
|
+
return {
|
|
247
|
+
/* modified state */
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
})
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
- `requireToolApproval` - Require approval for all tool calls.
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
const result = await agent.stream(messages, {
|
|
257
|
+
requireToolApproval: true,
|
|
258
|
+
})
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Legacy options that moved
|
|
262
|
+
|
|
263
|
+
- `temperature` and other `modelSettings`.
|
|
264
|
+
|
|
265
|
+
Unified in `modelSettings`
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
const result = await agent.stream(messages, {
|
|
269
|
+
modelSettings: {
|
|
270
|
+
temperature: 0.7,
|
|
271
|
+
maxTokens: 1000,
|
|
272
|
+
topP: 0.9,
|
|
273
|
+
},
|
|
274
|
+
})
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
- `resourceId` and `threadId`.
|
|
278
|
+
|
|
279
|
+
Moved to memory object.
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
const result = await agent.stream(messages, {
|
|
283
|
+
memory: {
|
|
284
|
+
resource: 'user-123',
|
|
285
|
+
thread: 'thread-456',
|
|
286
|
+
},
|
|
287
|
+
})
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Deprecated or removed options
|
|
291
|
+
|
|
292
|
+
- `experimental_output`
|
|
293
|
+
|
|
294
|
+
Use `structuredOutput` instead to allow for tool calls and an object return.
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
const result = await agent.generate(messages, {
|
|
298
|
+
structuredOutput: {
|
|
299
|
+
schema: z.object({
|
|
300
|
+
summary: z.string(),
|
|
301
|
+
}),
|
|
302
|
+
model: 'openai/gpt-5.1',
|
|
303
|
+
},
|
|
304
|
+
})
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
- `output`
|
|
308
|
+
|
|
309
|
+
The `output` property is deprecated in favor of `structuredOutput`, to achieve the same results, omit the model and only pass `structuredOutput.schema`, optionally add `jsonPromptInjection: true` if your model does not natively support `response_format`.
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
const result = await agent.generate(messages, {
|
|
313
|
+
structuredOutput: {
|
|
314
|
+
schema: z.object({
|
|
315
|
+
name: z.string(),
|
|
316
|
+
}),
|
|
317
|
+
},
|
|
318
|
+
})
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
- `memoryOptions`
|
|
322
|
+
|
|
323
|
+
Use `memory` instead.
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
const result = await agent.generate(messages, {
|
|
327
|
+
memory: {},
|
|
328
|
+
})
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Type changes
|
|
332
|
+
|
|
333
|
+
**Legacy APIs**
|
|
334
|
+
|
|
335
|
+
- `CoreMessage[]`
|
|
336
|
+
|
|
337
|
+
See the following API references for more information:
|
|
338
|
+
|
|
339
|
+
- [Agent.generateLegacy()](https://mastra.ai/reference/agents/generateLegacy)
|
|
340
|
+
- [Agent.streamLegacy()](https://mastra.ai/reference/streaming/agents/streamLegacy)
|
|
341
|
+
|
|
342
|
+
**Standard APIs**
|
|
343
|
+
|
|
344
|
+
- `ModelMessage[]`
|
|
345
|
+
|
|
346
|
+
`toolChoice` uses the AI SDK v5 `ToolChoice` type.
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
type ToolChoice<TOOLS extends Record<string, unknown>> =
|
|
350
|
+
| 'auto'
|
|
351
|
+
| 'none'
|
|
352
|
+
| 'required'
|
|
353
|
+
| {
|
|
354
|
+
type: 'tool'
|
|
355
|
+
toolName: Extract<keyof TOOLS, string>
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
See the following API references for more information:
|
|
360
|
+
|
|
361
|
+
- [Agent.generate()](https://mastra.ai/reference/agents/generate)
|
|
362
|
+
- [Agent.stream()](https://mastra.ai/reference/streaming/agents/stream)
|