@mastra/mcp-docs-server 1.1.8 → 1.1.9-alpha.1
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 +4 -4
- package/.docs/docs/agents/agent-approval.md +3 -3
- package/.docs/docs/agents/agent-memory.md +3 -3
- package/.docs/docs/agents/guardrails.md +3 -3
- package/.docs/docs/agents/network-approval.md +5 -2
- package/.docs/docs/agents/networks.md +2 -2
- package/.docs/docs/agents/overview.md +2 -2
- package/.docs/docs/agents/processors.md +42 -24
- package/.docs/docs/agents/structured-output.md +2 -2
- package/.docs/docs/agents/supervisor-agents.md +3 -3
- package/.docs/docs/agents/using-tools.md +3 -3
- package/.docs/docs/build-with-ai/mcp-docs-server.md +5 -5
- package/.docs/docs/build-with-ai/skills.md +2 -2
- package/.docs/docs/community/contributing-templates.md +1 -1
- package/.docs/docs/community/discord.md +3 -3
- package/.docs/docs/community/licensing.md +2 -2
- package/.docs/docs/deployment/cloud-providers.md +2 -2
- package/.docs/docs/deployment/mastra-server.md +2 -2
- package/.docs/docs/deployment/monorepo.md +1 -1
- package/.docs/docs/deployment/overview.md +3 -3
- package/.docs/docs/deployment/studio.md +3 -3
- package/.docs/docs/deployment/web-framework.md +2 -2
- package/.docs/docs/deployment/workflow-runners.md +1 -1
- package/.docs/docs/evals/built-in-scorers.md +1 -1
- package/.docs/docs/evals/custom-scorers.md +6 -6
- package/.docs/docs/evals/overview.md +2 -2
- package/.docs/docs/evals/running-in-ci.md +6 -6
- package/.docs/docs/getting-started/build-with-ai.md +3 -3
- package/.docs/docs/getting-started/manual-install.md +1 -1
- package/.docs/docs/getting-started/project-structure.md +2 -2
- package/.docs/docs/index.md +63 -17
- package/.docs/docs/mastra-cloud/deployment.md +1 -1
- package/.docs/docs/mastra-cloud/studio.md +1 -1
- package/.docs/docs/mcp/overview.md +1 -1
- package/.docs/docs/mcp/publishing-mcp-server.md +4 -4
- package/.docs/docs/memory/memory-processors.md +9 -9
- package/.docs/docs/memory/message-history.md +4 -4
- package/.docs/docs/memory/observational-memory.md +11 -7
- package/.docs/docs/memory/semantic-recall.md +9 -9
- package/.docs/docs/memory/storage.md +1 -1
- package/.docs/docs/memory/working-memory.md +20 -20
- package/.docs/docs/observability/datasets/overview.md +1 -1
- package/.docs/docs/observability/datasets/running-experiments.md +1 -1
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/overview.md +5 -5
- package/.docs/docs/observability/tracing/bridges/otel.md +9 -9
- package/.docs/docs/observability/tracing/exporters/arize.md +3 -3
- package/.docs/docs/observability/tracing/exporters/braintrust.md +1 -1
- package/.docs/docs/observability/tracing/exporters/cloud.md +2 -2
- package/.docs/docs/observability/tracing/exporters/datadog.md +3 -3
- package/.docs/docs/observability/tracing/exporters/default.md +8 -8
- package/.docs/docs/observability/tracing/exporters/laminar.md +1 -1
- package/.docs/docs/observability/tracing/exporters/langfuse.md +3 -3
- package/.docs/docs/observability/tracing/exporters/langsmith.md +4 -4
- package/.docs/docs/observability/tracing/exporters/otel.md +8 -8
- package/.docs/docs/observability/tracing/exporters/posthog.md +2 -2
- package/.docs/docs/observability/tracing/exporters/sentry.md +4 -4
- package/.docs/docs/observability/tracing/overview.md +24 -24
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +13 -13
- package/.docs/docs/rag/chunking-and-embedding.md +5 -5
- package/.docs/docs/rag/overview.md +2 -2
- package/.docs/docs/rag/retrieval.md +4 -4
- package/.docs/docs/rag/vector-databases.md +13 -13
- package/.docs/docs/server/auth/auth0.md +2 -2
- package/.docs/docs/server/auth/clerk.md +1 -1
- package/.docs/docs/server/auth/composite-auth.md +9 -9
- package/.docs/docs/server/auth/custom-auth-provider.md +12 -12
- package/.docs/docs/server/auth/firebase.md +3 -3
- package/.docs/docs/server/auth/jwt.md +1 -1
- package/.docs/docs/server/auth/simple-auth.md +9 -9
- package/.docs/docs/server/auth/supabase.md +1 -1
- package/.docs/docs/server/auth/workos.md +1 -1
- package/.docs/docs/server/auth.md +2 -2
- package/.docs/docs/server/custom-adapters.md +7 -7
- package/.docs/docs/server/custom-api-routes.md +2 -2
- package/.docs/docs/server/mastra-client.md +2 -2
- package/.docs/docs/server/mastra-server.md +2 -2
- package/.docs/docs/server/request-context.md +2 -2
- package/.docs/docs/server/server-adapters.md +3 -3
- package/.docs/docs/streaming/events.md +2 -2
- package/.docs/docs/streaming/overview.md +2 -2
- package/.docs/docs/streaming/tool-streaming.md +46 -32
- package/.docs/docs/streaming/workflow-streaming.md +1 -1
- package/.docs/docs/voice/overview.md +3 -3
- package/.docs/docs/voice/speech-to-speech.md +1 -1
- package/.docs/docs/voice/speech-to-text.md +2 -2
- package/.docs/docs/voice/text-to-speech.md +2 -2
- package/.docs/docs/workflows/agents-and-tools.md +1 -1
- package/.docs/docs/workflows/control-flow.md +45 -3
- package/.docs/docs/workflows/error-handling.md +4 -4
- package/.docs/docs/workflows/overview.md +3 -3
- package/.docs/docs/workflows/snapshots.md +1 -1
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workflows/time-travel.md +3 -3
- package/.docs/docs/workflows/workflow-state.md +1 -1
- package/.docs/docs/workspace/filesystem.md +3 -3
- package/.docs/docs/workspace/overview.md +53 -8
- package/.docs/docs/workspace/sandbox.md +72 -13
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/docs/workspace/skills.md +4 -4
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +2 -2
- package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
- package/.docs/guides/build-your-ui/copilotkit.md +2 -2
- package/.docs/guides/deployment/digital-ocean.md +1 -1
- package/.docs/guides/deployment/inngest.md +4 -4
- package/.docs/guides/getting-started/astro.md +1 -1
- package/.docs/guides/getting-started/electron.md +1 -1
- package/.docs/guides/getting-started/next-js.md +1 -1
- package/.docs/guides/getting-started/vite-react.md +1 -1
- package/.docs/guides/guide/ai-recruiter.md +4 -4
- package/.docs/guides/guide/chef-michel.md +4 -4
- package/.docs/guides/guide/code-review-bot.md +3 -3
- package/.docs/guides/guide/dev-assistant.md +5 -5
- package/.docs/guides/guide/docs-manager.md +3 -3
- package/.docs/guides/guide/github-actions-pr-description.md +4 -4
- package/.docs/guides/guide/notes-mcp-server.md +4 -4
- package/.docs/guides/guide/research-assistant.md +4 -4
- package/.docs/guides/guide/research-coordinator.md +1 -1
- package/.docs/guides/guide/stock-agent.md +6 -6
- package/.docs/guides/guide/web-search.md +2 -2
- package/.docs/guides/guide/whatsapp-chat-bot.md +1 -1
- package/.docs/guides/migrations/agentnetwork.md +1 -1
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +3 -3
- package/.docs/guides/migrations/network-to-supervisor.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/client.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/deployment.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/mastra.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +4 -4
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/vectors.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +6 -6
- package/.docs/guides/migrations/vnext-to-standard-apis.md +3 -3
- package/.docs/models/embeddings.md +4 -4
- package/.docs/models/gateways/custom-gateways.md +4 -4
- package/.docs/models/gateways/netlify.md +2 -3
- package/.docs/models/gateways/openrouter.md +9 -2
- package/.docs/models/gateways/vercel.md +11 -2
- package/.docs/models/gateways.md +2 -2
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/302ai.md +3 -3
- package/.docs/models/providers/abacus.md +24 -14
- package/.docs/models/providers/aihubmix.md +10 -5
- package/.docs/models/providers/alibaba-cn.md +83 -74
- package/.docs/models/providers/alibaba-coding-plan-cn.md +78 -0
- package/.docs/models/providers/alibaba-coding-plan.md +78 -0
- package/.docs/models/providers/alibaba.md +3 -3
- package/.docs/models/providers/anthropic.md +4 -4
- package/.docs/models/providers/bailing.md +3 -3
- package/.docs/models/providers/baseten.md +3 -3
- package/.docs/models/providers/berget.md +3 -3
- package/.docs/models/providers/cerebras.md +4 -4
- package/.docs/models/providers/chutes.md +7 -6
- package/.docs/models/providers/clarifai.md +81 -0
- package/.docs/models/providers/cloudferro-sherlock.md +8 -7
- package/.docs/models/providers/cloudflare-workers-ai.md +6 -5
- package/.docs/models/providers/cortecs.md +10 -8
- package/.docs/models/providers/deepinfra.md +11 -6
- package/.docs/models/providers/deepseek.md +4 -4
- package/.docs/models/providers/drun.md +73 -0
- package/.docs/models/providers/evroc.md +3 -3
- package/.docs/models/providers/fastrouter.md +3 -3
- package/.docs/models/providers/fireworks-ai.md +3 -3
- package/.docs/models/providers/firmware.md +31 -23
- package/.docs/models/providers/friendli.md +3 -3
- package/.docs/models/providers/github-models.md +3 -3
- package/.docs/models/providers/google.md +7 -5
- package/.docs/models/providers/groq.md +4 -4
- package/.docs/models/providers/helicone.md +3 -3
- package/.docs/models/providers/huggingface.md +3 -3
- package/.docs/models/providers/iflowcn.md +3 -3
- package/.docs/models/providers/inception.md +7 -5
- package/.docs/models/providers/inference.md +3 -3
- package/.docs/models/providers/io-net.md +3 -3
- package/.docs/models/providers/jiekou.md +3 -3
- package/.docs/models/providers/kilo.md +6 -4
- package/.docs/models/providers/kimi-for-coding.md +4 -4
- package/.docs/models/providers/kuae-cloud-coding-plan.md +3 -3
- package/.docs/models/providers/llama.md +3 -3
- package/.docs/models/providers/lmstudio.md +3 -3
- package/.docs/models/providers/lucidquery.md +3 -3
- package/.docs/models/providers/meganova.md +3 -3
- package/.docs/models/providers/minimax-cn-coding-plan.md +4 -4
- package/.docs/models/providers/minimax-cn.md +4 -4
- package/.docs/models/providers/minimax-coding-plan.md +4 -4
- package/.docs/models/providers/minimax.md +4 -4
- package/.docs/models/providers/mistral.md +4 -4
- package/.docs/models/providers/moark.md +3 -3
- package/.docs/models/providers/modelscope.md +3 -3
- package/.docs/models/providers/moonshotai-cn.md +3 -3
- package/.docs/models/providers/moonshotai.md +3 -3
- package/.docs/models/providers/morph.md +3 -3
- package/.docs/models/providers/nano-gpt.md +523 -42
- package/.docs/models/providers/nebius.md +37 -37
- package/.docs/models/providers/nova.md +3 -3
- package/.docs/models/providers/novita-ai.md +3 -3
- package/.docs/models/providers/nvidia.md +7 -5
- package/.docs/models/providers/ollama-cloud.md +4 -5
- package/.docs/models/providers/openai.md +7 -5
- package/.docs/models/providers/opencode-go.md +3 -3
- package/.docs/models/providers/opencode.md +39 -36
- package/.docs/models/providers/ovhcloud.md +3 -3
- package/.docs/models/providers/perplexity-agent.md +4 -4
- package/.docs/models/providers/perplexity.md +4 -4
- package/.docs/models/providers/poe.md +11 -5
- package/.docs/models/providers/privatemode-ai.md +3 -3
- package/.docs/models/providers/qihang-ai.md +3 -3
- package/.docs/models/providers/qiniu-ai.md +23 -8
- package/.docs/models/providers/requesty.md +20 -4
- package/.docs/models/providers/scaleway.md +3 -3
- package/.docs/models/providers/siliconflow-cn.md +10 -4
- package/.docs/models/providers/siliconflow.md +3 -3
- package/.docs/models/providers/stackit.md +3 -3
- package/.docs/models/providers/stepfun.md +3 -3
- package/.docs/models/providers/submodel.md +3 -3
- package/.docs/models/providers/synthetic.md +3 -3
- package/.docs/models/providers/togetherai.md +5 -7
- package/.docs/models/providers/upstage.md +3 -3
- package/.docs/models/providers/vivgrid.md +4 -4
- package/.docs/models/providers/vultr.md +3 -3
- package/.docs/models/providers/wandb.md +3 -3
- package/.docs/models/providers/xai.md +34 -31
- package/.docs/models/providers/xiaomi.md +4 -4
- package/.docs/models/providers/zai-coding-plan.md +3 -3
- package/.docs/models/providers/zai.md +3 -3
- package/.docs/models/providers/zenmux.md +7 -5
- package/.docs/models/providers/zhipuai-coding-plan.md +3 -3
- package/.docs/models/providers/zhipuai.md +3 -3
- package/.docs/models/providers.md +4 -0
- package/.docs/reference/agents/agent.md +3 -3
- package/.docs/reference/agents/generateLegacy.md +1 -1
- package/.docs/reference/agents/getDefaultGenerateOptions.md +1 -1
- package/.docs/reference/agents/getDefaultOptions.md +1 -1
- package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
- package/.docs/reference/agents/getDescription.md +1 -1
- package/.docs/reference/agents/network.md +5 -3
- package/.docs/reference/ai-sdk/handle-chat-stream.md +2 -0
- package/.docs/reference/ai-sdk/handle-network-stream.md +2 -0
- package/.docs/reference/ai-sdk/network-route.md +2 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +1 -1
- package/.docs/reference/auth/auth0.md +7 -7
- package/.docs/reference/auth/better-auth.md +2 -2
- package/.docs/reference/auth/clerk.md +1 -1
- package/.docs/reference/auth/firebase.md +5 -5
- package/.docs/reference/auth/jwt.md +1 -1
- package/.docs/reference/auth/supabase.md +1 -1
- package/.docs/reference/auth/workos.md +6 -6
- package/.docs/reference/cli/mastra.md +5 -5
- package/.docs/reference/client-js/agents.md +22 -22
- package/.docs/reference/client-js/error-handling.md +2 -2
- package/.docs/reference/client-js/logs.md +2 -2
- package/.docs/reference/client-js/mastra-client.md +2 -2
- package/.docs/reference/client-js/memory.md +6 -6
- package/.docs/reference/client-js/observability.md +4 -4
- package/.docs/reference/client-js/telemetry.md +1 -1
- package/.docs/reference/client-js/tools.md +3 -3
- package/.docs/reference/client-js/vectors.md +2 -2
- package/.docs/reference/client-js/workflows.md +12 -12
- package/.docs/reference/configuration.md +62 -6
- package/.docs/reference/core/getDeployer.md +1 -1
- package/.docs/reference/core/getGatewayById.md +1 -1
- package/.docs/reference/core/getLogger.md +1 -1
- package/.docs/reference/core/getMCPServer.md +2 -2
- package/.docs/reference/core/getMCPServerById.md +2 -2
- package/.docs/reference/core/getMemory.md +1 -1
- package/.docs/reference/core/getScorer.md +4 -4
- package/.docs/reference/core/getScorerById.md +2 -2
- package/.docs/reference/core/getServer.md +1 -1
- package/.docs/reference/core/getStorage.md +1 -1
- package/.docs/reference/core/getStoredAgentById.md +3 -3
- package/.docs/reference/core/getTelemetry.md +1 -1
- package/.docs/reference/core/getWorkflow.md +1 -1
- package/.docs/reference/core/listAgents.md +1 -1
- package/.docs/reference/core/listMCPServers.md +3 -3
- package/.docs/reference/core/listMemory.md +1 -1
- package/.docs/reference/core/listScorers.md +1 -1
- package/.docs/reference/core/listStoredAgents.md +3 -3
- package/.docs/reference/core/listVectors.md +1 -1
- package/.docs/reference/core/mastra-class.md +2 -2
- package/.docs/reference/core/mastra-model-gateway.md +11 -11
- package/.docs/reference/core/setLogger.md +1 -1
- package/.docs/reference/core/setStorage.md +1 -1
- package/.docs/reference/datasets/dataset.md +2 -2
- package/.docs/reference/datasets/datasets-manager.md +1 -1
- package/.docs/reference/datasets/get.md +2 -2
- package/.docs/reference/datasets/getDetails.md +1 -1
- package/.docs/reference/datasets/listItems.md +1 -1
- package/.docs/reference/deployer/vercel.md +1 -1
- package/.docs/reference/deployer.md +4 -4
- package/.docs/reference/evals/answer-relevancy.md +4 -4
- package/.docs/reference/evals/answer-similarity.md +3 -3
- package/.docs/reference/evals/bias.md +4 -4
- package/.docs/reference/evals/completeness.md +6 -6
- package/.docs/reference/evals/content-similarity.md +3 -3
- package/.docs/reference/evals/context-precision.md +9 -9
- package/.docs/reference/evals/context-relevance.md +7 -7
- package/.docs/reference/evals/create-scorer.md +7 -7
- package/.docs/reference/evals/faithfulness.md +3 -3
- package/.docs/reference/evals/hallucination.md +8 -14
- package/.docs/reference/evals/keyword-coverage.md +4 -4
- package/.docs/reference/evals/mastra-scorer.md +7 -7
- package/.docs/reference/evals/noise-sensitivity.md +11 -11
- package/.docs/reference/evals/prompt-alignment.md +5 -5
- package/.docs/reference/evals/run-evals.md +5 -5
- package/.docs/reference/evals/scorer-utils.md +17 -17
- package/.docs/reference/evals/textual-difference.md +4 -4
- package/.docs/reference/evals/tone-consistency.md +5 -5
- package/.docs/reference/evals/tool-call-accuracy.md +10 -10
- package/.docs/reference/evals/toxicity.md +3 -3
- package/.docs/reference/harness/harness-class.md +5 -3
- package/.docs/reference/index.md +2 -0
- package/.docs/reference/memory/clone-utilities.md +7 -7
- package/.docs/reference/memory/cloneThread.md +5 -5
- package/.docs/reference/memory/createThread.md +1 -1
- package/.docs/reference/memory/deleteMessages.md +1 -1
- package/.docs/reference/memory/getThreadById.md +1 -1
- package/.docs/reference/memory/listThreads.md +3 -3
- package/.docs/reference/memory/memory-class.md +1 -1
- package/.docs/reference/memory/observational-memory.md +8 -6
- package/.docs/reference/memory/recall.md +1 -1
- package/.docs/reference/observability/tracing/bridges/otel.md +6 -6
- package/.docs/reference/observability/tracing/configuration.md +17 -17
- package/.docs/reference/observability/tracing/exporters/arize.md +4 -4
- package/.docs/reference/observability/tracing/exporters/braintrust.md +3 -3
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +6 -6
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +4 -4
- package/.docs/reference/observability/tracing/exporters/datadog.md +4 -4
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +6 -6
- package/.docs/reference/observability/tracing/exporters/laminar.md +2 -2
- package/.docs/reference/observability/tracing/exporters/langfuse.md +4 -4
- package/.docs/reference/observability/tracing/exporters/langsmith.md +6 -6
- package/.docs/reference/observability/tracing/exporters/otel.md +12 -12
- package/.docs/reference/observability/tracing/exporters/posthog.md +3 -3
- package/.docs/reference/observability/tracing/exporters/sentry.md +5 -5
- package/.docs/reference/observability/tracing/instances.md +9 -9
- package/.docs/reference/observability/tracing/interfaces.md +39 -39
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +6 -6
- package/.docs/reference/observability/tracing/spans.md +15 -13
- package/.docs/reference/processors/message-history-processor.md +1 -1
- package/.docs/reference/processors/processor-interface.md +21 -17
- package/.docs/reference/processors/token-limiter-processor.md +2 -2
- package/.docs/reference/rag/chunk.md +2 -2
- package/.docs/reference/rag/database-config.md +8 -8
- package/.docs/reference/rag/document.md +11 -11
- package/.docs/reference/rag/embeddings.md +5 -5
- package/.docs/reference/rag/extract-params.md +8 -8
- package/.docs/reference/rag/graph-rag.md +4 -4
- package/.docs/reference/rag/metadata-filters.md +15 -15
- package/.docs/reference/rag/rerank.md +2 -2
- package/.docs/reference/rag/rerankWithScorer.md +2 -2
- package/.docs/reference/server/create-route.md +2 -0
- package/.docs/reference/server/express-adapter.md +1 -1
- package/.docs/reference/server/fastify-adapter.md +1 -1
- package/.docs/reference/server/hono-adapter.md +1 -1
- package/.docs/reference/server/koa-adapter.md +2 -2
- package/.docs/reference/server/mastra-server.md +16 -16
- package/.docs/reference/server/register-api-route.md +7 -7
- package/.docs/reference/server/routes.md +1 -1
- package/.docs/reference/storage/cloudflare-d1.md +5 -5
- package/.docs/reference/storage/cloudflare.md +3 -3
- package/.docs/reference/storage/composite.md +1 -1
- package/.docs/reference/storage/convex.md +6 -6
- package/.docs/reference/storage/dynamodb.md +7 -7
- package/.docs/reference/storage/lance.md +5 -5
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/mongodb.md +6 -6
- package/.docs/reference/storage/mssql.md +4 -4
- package/.docs/reference/storage/overview.md +2 -2
- package/.docs/reference/storage/postgresql.md +7 -7
- package/.docs/reference/storage/upstash.md +4 -4
- package/.docs/reference/streaming/ChunkType.md +13 -13
- package/.docs/reference/streaming/agents/MastraModelOutput.md +6 -6
- package/.docs/reference/streaming/agents/stream.md +2 -2
- package/.docs/reference/streaming/agents/streamLegacy.md +1 -1
- package/.docs/reference/streaming/workflows/observeStream.md +2 -2
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/streaming/workflows/stream.md +1 -1
- package/.docs/reference/templates/overview.md +4 -4
- package/.docs/reference/tools/create-tool.md +10 -10
- package/.docs/reference/tools/document-chunker-tool.md +4 -4
- package/.docs/reference/tools/graph-rag-tool.md +7 -7
- package/.docs/reference/tools/mcp-client.md +13 -13
- package/.docs/reference/tools/mcp-server.md +27 -27
- package/.docs/reference/tools/vector-query-tool.md +12 -12
- package/.docs/reference/vectors/astra.md +13 -13
- package/.docs/reference/vectors/chroma.md +18 -18
- package/.docs/reference/vectors/convex.md +15 -15
- package/.docs/reference/vectors/couchbase.md +21 -21
- package/.docs/reference/vectors/duckdb.md +17 -17
- package/.docs/reference/vectors/elasticsearch.md +14 -14
- package/.docs/reference/vectors/lance.md +22 -22
- package/.docs/reference/vectors/libsql.md +15 -15
- package/.docs/reference/vectors/mongodb.md +18 -18
- package/.docs/reference/vectors/opensearch.md +11 -11
- package/.docs/reference/vectors/pg.md +23 -21
- package/.docs/reference/vectors/pinecone.md +15 -15
- package/.docs/reference/vectors/qdrant.md +15 -15
- package/.docs/reference/vectors/s3vectors.md +22 -22
- package/.docs/reference/vectors/turbopuffer.md +14 -14
- package/.docs/reference/vectors/upstash.md +15 -15
- package/.docs/reference/vectors/vectorize.md +16 -16
- package/.docs/reference/voice/azure.md +12 -10
- package/.docs/reference/voice/cloudflare.md +9 -7
- package/.docs/reference/voice/composite-voice.md +5 -5
- package/.docs/reference/voice/deepgram.md +5 -5
- package/.docs/reference/voice/elevenlabs.md +7 -7
- package/.docs/reference/voice/google-gemini-live.md +22 -22
- package/.docs/reference/voice/google.md +12 -12
- package/.docs/reference/voice/mastra-voice.md +18 -18
- package/.docs/reference/voice/murf.md +8 -8
- package/.docs/reference/voice/openai-realtime.md +19 -17
- package/.docs/reference/voice/openai.md +12 -8
- package/.docs/reference/voice/playai.md +9 -7
- package/.docs/reference/voice/sarvam.md +8 -6
- package/.docs/reference/voice/speechify.md +11 -9
- package/.docs/reference/voice/voice.addInstructions.md +4 -4
- package/.docs/reference/voice/voice.addTools.md +3 -3
- package/.docs/reference/voice/voice.answer.md +2 -2
- package/.docs/reference/voice/voice.close.md +4 -4
- package/.docs/reference/voice/voice.connect.md +9 -7
- package/.docs/reference/voice/voice.events.md +4 -4
- package/.docs/reference/voice/voice.getSpeakers.md +4 -4
- package/.docs/reference/voice/voice.listen.md +17 -11
- package/.docs/reference/voice/voice.off.md +4 -4
- package/.docs/reference/voice/voice.on.md +5 -5
- package/.docs/reference/voice/voice.send.md +2 -2
- package/.docs/reference/voice/voice.speak.md +19 -9
- package/.docs/reference/voice/voice.updateConfig.md +4 -4
- package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workflows/run.md +3 -3
- package/.docs/reference/workflows/step.md +2 -2
- package/.docs/reference/workflows/workflow-methods/create-run.md +1 -1
- package/.docs/reference/workflows/workflow.md +1 -1
- package/.docs/reference/workspace/blaxel-sandbox.md +164 -0
- package/.docs/reference/workspace/daytona-sandbox.md +50 -141
- package/.docs/reference/workspace/e2b-sandbox.md +41 -77
- package/.docs/reference/workspace/filesystem.md +25 -11
- package/.docs/reference/workspace/gcs-filesystem.md +21 -1
- package/.docs/reference/workspace/local-filesystem.md +24 -10
- package/.docs/reference/workspace/local-sandbox.md +27 -102
- package/.docs/reference/workspace/process-manager.md +296 -0
- package/.docs/reference/workspace/s3-filesystem.md +21 -1
- package/.docs/reference/workspace/sandbox.md +9 -1
- package/.docs/reference/workspace/workspace-class.md +95 -27
- package/CHANGELOG.md +15 -0
- package/dist/tools/course.d.ts +7 -27
- package/dist/tools/course.d.ts.map +1 -1
- package/dist/tools/docs.d.ts +6 -18
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/embedded-docs.d.ts +12 -112
- package/dist/tools/embedded-docs.d.ts.map +1 -1
- package/dist/tools/migration.d.ts +6 -26
- package/dist/tools/migration.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# MastraJwtAuth
|
|
1
|
+
# MastraJwtAuth class
|
|
2
2
|
|
|
3
3
|
The `MastraJwtAuth` class provides a lightweight authentication mechanism for Mastra using JSON Web Tokens (JWTs). It verifies incoming requests based on a shared secret and integrates with the Mastra server using the `auth` option.
|
|
4
4
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# SimpleAuth
|
|
1
|
+
# SimpleAuth class
|
|
2
2
|
|
|
3
|
-
The `SimpleAuth` class provides token-based authentication using a
|
|
3
|
+
The `SimpleAuth` class provides token-based authentication using a basic token-to-user mapping. It's included in `@mastra/core/server` and is useful for development, testing, and basic API key authentication scenarios.
|
|
4
4
|
|
|
5
|
-
## Use
|
|
5
|
+
## Use cases
|
|
6
6
|
|
|
7
7
|
- Local development and testing
|
|
8
8
|
- Simple API key authentication
|
|
@@ -17,7 +17,7 @@ SimpleAuth is included in `@mastra/core`, no additional packages required.
|
|
|
17
17
|
import { SimpleAuth } from '@mastra/core/server'
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
## Usage
|
|
20
|
+
## Usage example
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
import { Mastra } from '@mastra/core'
|
|
@@ -50,7 +50,7 @@ export const mastra = new Mastra({
|
|
|
50
50
|
})
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
## Configuration
|
|
53
|
+
## Configuration options
|
|
54
54
|
|
|
55
55
|
| Option | Type | Required | Description |
|
|
56
56
|
| --------------- | ---------------------------- | -------- | -------------------------------------- |
|
|
@@ -79,7 +79,7 @@ new SimpleAuth({
|
|
|
79
79
|
})
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
## Making
|
|
82
|
+
## Making authenticated requests
|
|
83
83
|
|
|
84
84
|
Include your token in the `Authorization` header:
|
|
85
85
|
|
|
@@ -99,7 +99,7 @@ curl -X POST http://localhost:4111/api/agents/myAgent/generate \
|
|
|
99
99
|
-d '{"messages": "Hello"}'
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
## Custom
|
|
102
|
+
## Custom authorization
|
|
103
103
|
|
|
104
104
|
Add role-based or custom authorization logic:
|
|
105
105
|
|
|
@@ -119,7 +119,7 @@ new SimpleAuth<User>({
|
|
|
119
119
|
})
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
## Environment
|
|
122
|
+
## Environment variables
|
|
123
123
|
|
|
124
124
|
For production-like setups, load tokens from environment variables:
|
|
125
125
|
|
|
@@ -144,7 +144,7 @@ export const mastra = new Mastra({
|
|
|
144
144
|
})
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
## With MastraClient
|
|
147
|
+
## With `MastraClient`
|
|
148
148
|
|
|
149
149
|
Configure the client with your token:
|
|
150
150
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# MastraAuthSupabase
|
|
1
|
+
# MastraAuthSupabase class
|
|
2
2
|
|
|
3
3
|
The `MastraAuthSupabase` class provides authentication for Mastra using Supabase Auth. It verifies incoming requests using Supabase's authentication system and integrates with the Mastra server using the `auth` option.
|
|
4
4
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Auth
|
|
1
|
+
# Auth overview
|
|
2
2
|
|
|
3
3
|
Mastra lets you choose how you handle authentication, so you can secure access to your application's endpoints using the identity system that fits your stack.
|
|
4
4
|
|
|
5
|
-
You can start with
|
|
5
|
+
You can start with basic shared secret JWT authentication and switch to providers like Supabase, Firebase Auth, Auth0, Clerk, or WorkOS when you need more advanced identity features.
|
|
6
6
|
|
|
7
7
|
## Default behavior
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Custom
|
|
1
|
+
# Custom adapters
|
|
2
2
|
|
|
3
3
|
Create a custom adapter when you need to run Mastra with a framework other than Hono or Express. This might be necessary if you have specific request/response handling requirements that `@mastra/hono` and `@mastra/express` don't support.
|
|
4
4
|
|
|
@@ -38,7 +38,7 @@ These type parameters ensure type safety throughout your adapter implementation
|
|
|
38
38
|
|
|
39
39
|
You must implement these six abstract methods. Each handles a specific part of the request lifecycle, from attaching context to sending responses.
|
|
40
40
|
|
|
41
|
-
### registerContextMiddleware()
|
|
41
|
+
### `registerContextMiddleware()`
|
|
42
42
|
|
|
43
43
|
This method runs first and attaches Mastra context to every incoming request. Route handlers need access to the Mastra instance, tools, and other context to function. How you attach this context depends on your framework — Express uses `res.locals`, Hono uses `c.set()`, and other frameworks have their own patterns.
|
|
44
44
|
|
|
@@ -65,7 +65,7 @@ Context to attach:
|
|
|
65
65
|
| `abortSignal` | `AbortSignal` | Request cancellation signal |
|
|
66
66
|
| `taskStore` | `InMemoryTaskStore` | A2A task storage (if configured) |
|
|
67
67
|
|
|
68
|
-
### registerAuthMiddleware()
|
|
68
|
+
### `registerAuthMiddleware()`
|
|
69
69
|
|
|
70
70
|
Register authentication and authorization middleware. This method should check if authentication is configured on the Mastra instance and skip registration entirely if not. When auth is configured, you'll typically register two middleware functions: one for authentication (validating tokens and setting the user) and one for authorization (checking if the user can access the requested resource).
|
|
71
71
|
|
|
@@ -101,7 +101,7 @@ registerAuthMiddleware(): void {
|
|
|
101
101
|
}
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
### registerRoute()
|
|
104
|
+
### `registerRoute()`
|
|
105
105
|
|
|
106
106
|
Register a single route with your framework. This method is called once for each Mastra route during initialization. It receives a `ServerRoute` object containing the path, HTTP method, handler function, and Zod schemas for validation. Your implementation should wire this up to your framework's routing system.
|
|
107
107
|
|
|
@@ -148,7 +148,7 @@ async registerRoute(
|
|
|
148
148
|
}
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
### getParams()
|
|
151
|
+
### `getParams()`
|
|
152
152
|
|
|
153
153
|
Extract URL parameters, query parameters, and request body from the incoming request. Different frameworks expose these values in different ways—Express uses `req.params`, `req.query`, and `req.body`, while other frameworks may use different property names or require method calls. This method normalizes the extraction for your framework.
|
|
154
154
|
|
|
@@ -172,7 +172,7 @@ async getParams(
|
|
|
172
172
|
}
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
### sendResponse()
|
|
175
|
+
### `sendResponse()`
|
|
176
176
|
|
|
177
177
|
Send the response back to the client based on the route's response type. Mastra routes can return different response types: JSON for most API responses, streams for agent generation, and special types for MCP transports. Your implementation should handle each type appropriately for your framework.
|
|
178
178
|
|
|
@@ -207,7 +207,7 @@ async sendResponse(
|
|
|
207
207
|
}
|
|
208
208
|
```
|
|
209
209
|
|
|
210
|
-
### stream()
|
|
210
|
+
### `stream()`
|
|
211
211
|
|
|
212
212
|
Handle streaming responses for agent generation. When an agent generates a response, it produces a stream of chunks that should be sent to the client as they become available. This method reads from the stream, optionally applies redaction to hide sensitive data, and writes chunks to the response in the appropriate format (SSE or newline-delimited JSON).
|
|
213
213
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Custom API
|
|
1
|
+
# Custom API routes
|
|
2
2
|
|
|
3
3
|
By default, Mastra automatically exposes registered agents and workflows via its server. For additional behavior you can define your own HTTP routes.
|
|
4
4
|
|
|
@@ -61,7 +61,7 @@ export const mastra = new Mastra({
|
|
|
61
61
|
})
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
## OpenAPI
|
|
64
|
+
## OpenAPI documentation
|
|
65
65
|
|
|
66
66
|
Custom routes can include OpenAPI metadata to appear in the Swagger UI alongside Mastra server routes. Pass an `openapi` option with standard OpenAPI operation fields.
|
|
67
67
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Mastra
|
|
1
|
+
# Mastra client SDK
|
|
2
2
|
|
|
3
|
-
The Mastra Client SDK provides a
|
|
3
|
+
The Mastra Client SDK provides a concise and type-safe interface for interacting with your [Mastra Server](https://mastra.ai/docs/server/mastra-server) from your client environment.
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Server
|
|
1
|
+
# Server overview
|
|
2
2
|
|
|
3
3
|
Mastra runs as an HTTP server that exposes your agents, workflows, and other functionality as API endpoints. The server handles request routing, middleware execution, authentication, and streaming responses.
|
|
4
4
|
|
|
@@ -51,7 +51,7 @@ This behavior is only configurable by using [server adapters](https://mastra.ai/
|
|
|
51
51
|
|
|
52
52
|
## TypeScript configuration
|
|
53
53
|
|
|
54
|
-
Mastra requires `module` and `moduleResolution` settings compatible with modern Node.js. Legacy options like `CommonJS` or `node`
|
|
54
|
+
Mastra requires `module` and `moduleResolution` settings compatible with modern Node.js. Legacy options like `CommonJS` or `node` aren't supported.
|
|
55
55
|
|
|
56
56
|
```json
|
|
57
57
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Request
|
|
1
|
+
# Request context
|
|
2
2
|
|
|
3
3
|
Agents, tools, and workflows can all accept `RequestContext` as a parameter, making request-specific values available to the underlying primitives.
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ Agents, tools, and workflows can all accept `RequestContext` as a parameter, mak
|
|
|
6
6
|
|
|
7
7
|
Use `RequestContext` when a primitive's behavior should change based on runtime conditions. For example, you might switch models or storage backends based on user attributes, or adjust instructions and tool selection based on language.
|
|
8
8
|
|
|
9
|
-
> **Note:**
|
|
9
|
+
> **Note:** `RequestContext` is primarily used for passing data into specific requests. It's distinct from agent memory, which handles conversation history and state persistence across multiple calls.
|
|
10
10
|
|
|
11
11
|
## Setting values
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Server
|
|
1
|
+
# Server adapters
|
|
2
2
|
|
|
3
3
|
Server adapters let you run Mastra with your own HTTP server instead of the Hono server generated by `mastra build`. They provide more control over the server setup, including custom middleware ordering, authentication, logging, and deployment configuration. You can still integrate Mastra into any Node.js application without changing how agents or workflows execute.
|
|
4
4
|
|
|
@@ -389,7 +389,7 @@ const server = new MastraServer({
|
|
|
389
389
|
})
|
|
390
390
|
```
|
|
391
391
|
|
|
392
|
-
With this prefix, Mastra routes become `/api/v2/agents`, `/api/v2/workflows`, etc. Custom routes you add directly to the app
|
|
392
|
+
With this prefix, Mastra routes become `/api/v2/agents`, `/api/v2/workflows`, etc. Custom routes you add directly to the app aren't affected by this prefix.
|
|
393
393
|
|
|
394
394
|
## OpenAPI spec
|
|
395
395
|
|
|
@@ -487,7 +487,7 @@ The adapter reads these settings from `mastra.getServer()`:
|
|
|
487
487
|
|
|
488
488
|
### Adapter constructor only
|
|
489
489
|
|
|
490
|
-
These options are passed directly to the adapter constructor and
|
|
490
|
+
These options are passed directly to the adapter constructor and aren't read from the Mastra config:
|
|
491
491
|
|
|
492
492
|
| Option | Description |
|
|
493
493
|
| ----------------------- | --------------------------------------------------------------------------- |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Streaming
|
|
1
|
+
# Streaming events
|
|
2
2
|
|
|
3
3
|
Streaming from agents or workflows provides real-time visibility into either the LLM’s output or the status of a workflow run. This feedback can be passed directly to the user, or used within applications to handle workflow status more effectively, creating a smoother and more responsive experience.
|
|
4
4
|
|
|
@@ -143,7 +143,7 @@ Each progress event includes:
|
|
|
143
143
|
- **`id`**: The step ID of the foreach step
|
|
144
144
|
- **`completedCount`**: Number of iterations completed so far
|
|
145
145
|
- **`totalCount`**: Total number of iterations
|
|
146
|
-
- **`currentIndex`**: Index of the iteration that
|
|
146
|
+
- **`currentIndex`**: Index of the iteration that completed
|
|
147
147
|
- **`iterationStatus`**: Status of the iteration (`success`, `failed`, or `suspended`)
|
|
148
148
|
- **`iterationOutput`**: Output of the iteration (when successful)
|
|
149
149
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Streaming
|
|
1
|
+
# Streaming overview
|
|
2
2
|
|
|
3
3
|
Mastra supports real-time, incremental responses from agents and workflows, allowing users to see output as it’s generated instead of waiting for completion. This is useful for chat, long-form content, multi-step workflows, or any scenario where immediate feedback matters.
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ Mastra's streaming API adapts based on your model version:
|
|
|
11
11
|
|
|
12
12
|
## Streaming with agents
|
|
13
13
|
|
|
14
|
-
You can pass a single string for
|
|
14
|
+
You can pass a single string for basic prompts, an array of strings when providing multiple pieces of context, or an array of message objects with `role` and `content` for precise control over roles and conversational flows.
|
|
15
15
|
|
|
16
16
|
### Using `Agent.stream()`
|
|
17
17
|
|
|
@@ -5,7 +5,7 @@ Tool streaming in Mastra enables tools to send incremental results while they ru
|
|
|
5
5
|
Streams can be written to in two main ways:
|
|
6
6
|
|
|
7
7
|
- **From within a tool**: every tool receives a `context.writer` object, which is a writable stream you can use to push updates as execution progresses.
|
|
8
|
-
- **From an agent stream**: you can also pipe an agent's `stream` output directly into a tool's writer, making it
|
|
8
|
+
- **From an agent stream**: you can also pipe an agent's `stream` output directly into a tool's writer, making it convenient to chain agent responses into tool results without extra glue code.
|
|
9
9
|
|
|
10
10
|
By combining writable tool streams with agent streaming, you gain fine grained control over how intermediate results flow through your system and into the user experience.
|
|
11
11
|
|
|
@@ -33,59 +33,73 @@ The `context.writer` object is available in a tool's `execute()` function and ca
|
|
|
33
33
|
> **Warning:** You must `await` the call to `writer.write()` or else you will lock the stream and get a `WritableStream is locked` error.
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
import { createTool } from
|
|
36
|
+
import { createTool } from '@mastra/core/tools'
|
|
37
37
|
|
|
38
38
|
export const testTool = createTool({
|
|
39
39
|
execute: async (inputData, context) => {
|
|
40
|
-
const { value } = inputData
|
|
40
|
+
const { value } = inputData
|
|
41
41
|
|
|
42
42
|
await context?.writer?.write({
|
|
43
|
-
type:
|
|
44
|
-
status:
|
|
45
|
-
})
|
|
43
|
+
type: 'custom-event',
|
|
44
|
+
status: 'pending',
|
|
45
|
+
})
|
|
46
46
|
|
|
47
|
-
const response = await fetch(
|
|
47
|
+
const response = await fetch()
|
|
48
48
|
|
|
49
49
|
await context?.writer?.write({
|
|
50
|
-
type:
|
|
51
|
-
status:
|
|
52
|
-
})
|
|
50
|
+
type: 'custom-event',
|
|
51
|
+
status: 'success',
|
|
52
|
+
})
|
|
53
53
|
|
|
54
54
|
return {
|
|
55
|
-
value:
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
})
|
|
55
|
+
value: '',
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
You can also use `writer.custom()`
|
|
61
|
+
You can also use `writer.custom()` to emit top-level stream chunks. This is useful when integrating with UI frameworks.
|
|
62
62
|
|
|
63
63
|
```typescript
|
|
64
|
-
import { createTool } from
|
|
64
|
+
import { createTool } from '@mastra/core/tools'
|
|
65
65
|
|
|
66
66
|
export const testTool = createTool({
|
|
67
67
|
execute: async (inputData, context) => {
|
|
68
|
-
const { value } = inputData
|
|
68
|
+
const { value } = inputData
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
type:
|
|
72
|
-
status:
|
|
73
|
-
})
|
|
70
|
+
await context?.writer?.custom({
|
|
71
|
+
type: 'data-tool-progress',
|
|
72
|
+
status: 'pending',
|
|
73
|
+
})
|
|
74
74
|
|
|
75
|
-
const response = await fetch(
|
|
75
|
+
const response = await fetch()
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
type:
|
|
79
|
-
status:
|
|
80
|
-
})
|
|
77
|
+
await context?.writer?.custom({
|
|
78
|
+
type: 'data-tool-progress',
|
|
79
|
+
status: 'success',
|
|
80
|
+
})
|
|
81
81
|
|
|
82
82
|
return {
|
|
83
|
-
value:
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
})
|
|
83
|
+
value: '',
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
})
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Transient data chunks
|
|
90
|
+
|
|
91
|
+
By default, `data-*` chunks emitted with `writer.custom()` are persisted to storage as part of the message history. For chunks that are only needed during live streaming — such as progress updates or verbose log output — set `transient: true` to skip storage persistence. Transient chunks are still streamed to the client in real time but aren't saved to the database.
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
await context?.writer?.custom({
|
|
95
|
+
type: 'data-build-log',
|
|
96
|
+
data: { line: 'Compiling module 3 of 12...' },
|
|
97
|
+
transient: true,
|
|
98
|
+
})
|
|
87
99
|
```
|
|
88
100
|
|
|
101
|
+
Use transient chunks when the data is large or high-frequency and only relevant during the live session. After a page refresh, transient chunks are no longer available — only the tool's return value and any non-transient chunks are loaded from storage.
|
|
102
|
+
|
|
89
103
|
### Inspecting stream payloads
|
|
90
104
|
|
|
91
105
|
Events written to the stream are included in the emitted chunks. These chunks can be inspected to access any custom fields, such as event types, intermediate values, or tool-specific data.
|
|
@@ -100,11 +114,11 @@ for await (const chunk of stream) {
|
|
|
100
114
|
}
|
|
101
115
|
```
|
|
102
116
|
|
|
103
|
-
## Tool
|
|
117
|
+
## Tool lifecycle hooks
|
|
104
118
|
|
|
105
119
|
Tools support lifecycle hooks that allow you to monitor different stages of tool execution during streaming. These hooks are particularly useful for logging or analytics.
|
|
106
120
|
|
|
107
|
-
### Example: Using onInputAvailable and onOutput
|
|
121
|
+
### Example: Using `onInputAvailable` and `onOutput`
|
|
108
122
|
|
|
109
123
|
```typescript
|
|
110
124
|
import { createTool } from '@mastra/core/tools'
|
|
@@ -5,7 +5,7 @@ Workflow streaming in Mastra enables workflows to send incremental results while
|
|
|
5
5
|
Streams can be written to in two main ways:
|
|
6
6
|
|
|
7
7
|
- **From within a workflow step**: every workflow step receives a `writer` argument, which is a writable stream you can use to push updates as execution progresses.
|
|
8
|
-
- **From an agent stream**: you can also pipe an agent's `stream` output directly into a workflow step's writer, making it
|
|
8
|
+
- **From an agent stream**: you can also pipe an agent's `stream` output directly into a workflow step's writer, making it convenient to chain agent responses into workflow results without extra glue code.
|
|
9
9
|
|
|
10
10
|
By combining writable workflow streams with agent streaming, you gain fine-grained control over how intermediate results flow through your system and into the user experience.
|
|
11
11
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Mastra's Voice system provides a unified interface for voice interactions, enabling text-to-speech (TTS), speech-to-text (STT), and real-time speech-to-speech (STS) capabilities in your applications.
|
|
4
4
|
|
|
5
|
-
## Adding
|
|
5
|
+
## Adding voice to agents
|
|
6
6
|
|
|
7
7
|
To learn how to integrate voice capabilities into your agents, check out the [Adding Voice to Agents](https://mastra.ai/docs/agents/adding-voice) documentation. This section covers how to use both single and multiple voice providers, as well as real-time interactions.
|
|
8
8
|
|
|
@@ -588,7 +588,7 @@ await voiceAgent.voice.send(micStream)
|
|
|
588
588
|
|
|
589
589
|
Visit the [Google Gemini Live Reference](https://mastra.ai/reference/voice/google-gemini-live) for more information on the Google Gemini Live voice provider.
|
|
590
590
|
|
|
591
|
-
## Voice
|
|
591
|
+
## Voice configuration
|
|
592
592
|
|
|
593
593
|
Each voice provider can be configured with different models and options. Below are the detailed configuration options for all supported providers:
|
|
594
594
|
|
|
@@ -945,7 +945,7 @@ const voice = new CompositeVoice({
|
|
|
945
945
|
|
|
946
946
|
For more information on the CompositeVoice, refer to the [CompositeVoice Reference](https://mastra.ai/reference/voice/composite-voice).
|
|
947
947
|
|
|
948
|
-
## More
|
|
948
|
+
## More resources
|
|
949
949
|
|
|
950
950
|
- [CompositeVoice](https://mastra.ai/reference/voice/composite-voice)
|
|
951
951
|
- [MastraVoice](https://mastra.ai/reference/voice/mastra-voice)
|
|
@@ -24,7 +24,7 @@ const voice = new OpenAIVoice({
|
|
|
24
24
|
const voice = new OpenAIVoice()
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
## Available
|
|
27
|
+
## Available providers
|
|
28
28
|
|
|
29
29
|
Mastra supports several Speech-to-Text providers, each with their own capabilities and strengths:
|
|
30
30
|
|
|
@@ -42,7 +42,7 @@ Each provider is implemented as a separate package that you can install as neede
|
|
|
42
42
|
pnpm add @mastra/voice-openai@latest # Example for OpenAI
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
## Using the
|
|
45
|
+
## Using the listen method
|
|
46
46
|
|
|
47
47
|
The primary method for STT is the `listen()` method, which converts spoken audio into text. Here's how to use it:
|
|
48
48
|
|
|
@@ -29,7 +29,7 @@ const voice = new OpenAIVoice({
|
|
|
29
29
|
const voice = new OpenAIVoice()
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
## Available
|
|
32
|
+
## Available providers
|
|
33
33
|
|
|
34
34
|
Mastra supports a wide range of Text-to-Speech providers, each with their own unique capabilities and voice options. You can choose the provider that best suits your application's needs:
|
|
35
35
|
|
|
@@ -50,7 +50,7 @@ Each provider is implemented as a separate package that you can install as neede
|
|
|
50
50
|
pnpm add @mastra/voice-openai@latest # Example for OpenAI
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
## Using the
|
|
53
|
+
## Using the speak method
|
|
54
54
|
|
|
55
55
|
The primary method for TTS is the `speak()` method, which converts text to speech. This method can accept options that allows you to specify the speaker and other provider-specific options. Here's how to use it:
|
|
56
56
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Control
|
|
1
|
+
# Control flow
|
|
2
2
|
|
|
3
3
|
Workflows run a sequence of predefined tasks, and you can control how that flow is executed. Tasks are divided into **steps**, which can be executed in different ways depending on your requirements. They can run sequentially, in parallel, or follow different paths based on conditions.
|
|
4
4
|
|
|
@@ -166,6 +166,48 @@ export const testWorkflow = createWorkflow({
|
|
|
166
166
|
- The next step receives an object containing all parallel step outputs
|
|
167
167
|
- You must define the `inputSchema` of the following step to match this structure
|
|
168
168
|
|
|
169
|
+
### Handling step failures
|
|
170
|
+
|
|
171
|
+
If any parallel step throws an error, the entire parallel block fails. To build resilient parallel workflows where some steps may fail — for example, multiple research agents where one might have an expired auth token — handle errors inside the step itself using try/catch:
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
const resilientStep = createStep({
|
|
175
|
+
id: 'researcher',
|
|
176
|
+
inputSchema: z.object({ query: z.string() }),
|
|
177
|
+
outputSchema: z.object({
|
|
178
|
+
brief: z.string().nullable(),
|
|
179
|
+
failed: z.boolean(),
|
|
180
|
+
}),
|
|
181
|
+
execute: async ({ inputData }) => {
|
|
182
|
+
try {
|
|
183
|
+
const result = await fetchExternalData(inputData.query)
|
|
184
|
+
return { brief: result, failed: false }
|
|
185
|
+
} catch {
|
|
186
|
+
return { brief: null, failed: true }
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
})
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
This way the step always succeeds with a typed result, and the downstream step can filter out failed results:
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
const writerStep = createStep({
|
|
196
|
+
id: 'writer',
|
|
197
|
+
inputSchema: z.object({
|
|
198
|
+
'researcher-a': z.object({ brief: z.string().nullable(), failed: z.boolean() }),
|
|
199
|
+
'researcher-b': z.object({ brief: z.string().nullable(), failed: z.boolean() }),
|
|
200
|
+
}),
|
|
201
|
+
outputSchema: z.object({ synthesis: z.string() }),
|
|
202
|
+
execute: async ({ inputData }) => {
|
|
203
|
+
const briefs = Object.values(inputData)
|
|
204
|
+
.filter(v => !v.failed && v.brief)
|
|
205
|
+
.map(v => v.brief)
|
|
206
|
+
return { synthesis: briefs.join('; ') }
|
|
207
|
+
},
|
|
208
|
+
})
|
|
209
|
+
```
|
|
210
|
+
|
|
169
211
|
> **Info:** Visit [Choosing the right pattern](#choosing-the-right-pattern) to understand when to use `.parallel()` vs `.foreach()`.
|
|
170
212
|
|
|
171
213
|
## Conditional logic with `.branch()`
|
|
@@ -292,7 +334,7 @@ export const testWorkflow = createWorkflow({
|
|
|
292
334
|
|
|
293
335
|
## Input data mapping
|
|
294
336
|
|
|
295
|
-
When using `.then()`, `.parallel()`, or `.branch()`, it
|
|
337
|
+
When using `.then()`, `.parallel()`, or `.branch()`, it's sometimes necessary to transform the output of a previous step to match the input of the next. In these cases you can use `.map()` to access the `inputData` and transform it to create a suitable data shape for the next step.
|
|
296
338
|
|
|
297
339
|

|
|
298
340
|
|
|
@@ -777,7 +819,7 @@ This means:
|
|
|
777
819
|
|
|
778
820
|
- `.parallel()` collects all branch outputs into an object, then passes it to the next step
|
|
779
821
|
- `.foreach()` collects all iteration outputs into an array, then passes it to the next step
|
|
780
|
-
-
|
|
822
|
+
- Results can't be "streamed" to the next step as they complete
|
|
781
823
|
|
|
782
824
|
### Concurrency behavior
|
|
783
825
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Error
|
|
1
|
+
# Error handling
|
|
2
2
|
|
|
3
3
|
Mastra workflows support error handling through result status checks after execution, retry policies for transient failures, and lifecycle callbacks for centralized error logging or alerting.
|
|
4
4
|
|
|
@@ -58,7 +58,7 @@ if (result.status === 'failed') {
|
|
|
58
58
|
|
|
59
59
|
For scenarios where you need to handle workflow completion without awaiting the result—such as background jobs, fire-and-forget workflows, or centralized logging—you can use lifecycle callbacks.
|
|
60
60
|
|
|
61
|
-
### onFinish
|
|
61
|
+
### `onFinish`
|
|
62
62
|
|
|
63
63
|
Called when a workflow completes with any status (success, failed, suspended, or tripwire):
|
|
64
64
|
|
|
@@ -100,7 +100,7 @@ The `onFinish` callback receives:
|
|
|
100
100
|
- `logger` - The workflow's logger instance
|
|
101
101
|
- `state` - The workflow's current state object
|
|
102
102
|
|
|
103
|
-
### onError
|
|
103
|
+
### `onError`
|
|
104
104
|
|
|
105
105
|
Called only when a workflow fails (status is `'failed'` or `'tripwire'`):
|
|
106
106
|
|
|
@@ -166,7 +166,7 @@ const pipelineWorkflow = createWorkflow({
|
|
|
166
166
|
|
|
167
167
|
### Error handling in callbacks
|
|
168
168
|
|
|
169
|
-
Errors thrown inside callbacks are caught and logged—they
|
|
169
|
+
Errors thrown inside callbacks are caught and logged—they won't affect the workflow result or cause it to fail. This ensures that callback issues don't break your workflows in production.
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
172
|
options: {
|
|
@@ -140,7 +140,7 @@ export const testWorkflow = createWorkflow({
|
|
|
140
140
|
|
|
141
141
|
### Cloning a workflow
|
|
142
142
|
|
|
143
|
-
Clone a workflow using `cloneWorkflow()` when you want to reuse its logic but track it separately under a new ID. Each clone runs independently and
|
|
143
|
+
Clone a workflow using `cloneWorkflow()` when you want to reuse its logic but track it separately under a new ID. Each clone runs independently and shows up as a distinct workflow in logs and observability tools.
|
|
144
144
|
|
|
145
145
|
```typescript
|
|
146
146
|
import { cloneWorkflow } from "@mastra/core/workflows";
|
|
@@ -182,7 +182,7 @@ const testWorkflow = mastra.getWorkflow('testWorkflow')
|
|
|
182
182
|
> 1. It provides access to the Mastra instance configuration (logger, telemetry, storage, registered agents, and vector stores)
|
|
183
183
|
> 2. It provides full TypeScript type inference for workflow input and output schemas
|
|
184
184
|
>
|
|
185
|
-
> **Note:** Use `getWorkflow()` with the workflow's **registration key** (the key used when adding it to Mastra). While `getWorkflowById()` is available for retrieving workflows by their `id` property, it
|
|
185
|
+
> **Note:** Use `getWorkflow()` with the workflow's **registration key** (the key used when adding it to Mastra). While `getWorkflowById()` is available for retrieving workflows by their `id` property, it doesn't provide the same level of type inference.
|
|
186
186
|
|
|
187
187
|
## Running workflows
|
|
188
188
|
|
|
@@ -358,7 +358,7 @@ const step1 = createStep({
|
|
|
358
358
|
|
|
359
359
|
## Testing with Studio
|
|
360
360
|
|
|
361
|
-
Use [Studio](https://mastra.ai/docs/getting-started/studio) to
|
|
361
|
+
Use [Studio](https://mastra.ai/docs/getting-started/studio) to run workflows with different inputs, visualize the execution lifecycle, see the inputs and outputs for each step, and inspect each part of the workflow in more detail.
|
|
362
362
|
|
|
363
363
|
## Related
|
|
364
364
|
|
|
@@ -150,7 +150,7 @@ export const mastra = new Mastra({
|
|
|
150
150
|
1. **Ensure Serializability**: Any data that needs to be included in the snapshot must be serializable (convertible to JSON).
|
|
151
151
|
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.
|
|
152
152
|
3. **Handle Resume Context Carefully**: When resuming a workflow, carefully consider what context to provide. This will be merged with the existing snapshot data.
|
|
153
|
-
4. **Set Up Proper Monitoring**: Implement monitoring for suspended workflows, especially long-running ones, to ensure they
|
|
153
|
+
4. **Set Up Proper Monitoring**: Implement monitoring for suspended workflows, especially long-running ones, to ensure they're properly resumed.
|
|
154
154
|
5. **Consider Storage Scaling**: For applications with many suspended workflows, ensure your storage solution is appropriately scaled.
|
|
155
155
|
|
|
156
156
|
## Custom snapshot metadata
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Suspend
|
|
1
|
+
# Suspend and resume
|
|
2
2
|
|
|
3
3
|
Workflows can be paused at any step to collect additional data, wait for API callbacks, throttle costly operations, or request [human-in-the-loop](https://mastra.ai/docs/workflows/human-in-the-loop) input. When a workflow is suspended, its current execution state is saved as a snapshot. You can later resume the workflow from a [specific step ID](https://mastra.ai/docs/workflows/snapshots), restoring the exact state captured in that snapshot. [Snapshots](https://mastra.ai/docs/workflows/snapshots) are stored in your configured storage provider and persist across deployments and application restarts.
|
|
4
4
|
|