@mastra/mcp-docs-server 0.13.37 → 0.13.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +2 -0
- package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +2 -0
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +8 -8
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +69 -69
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Freact.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +23 -23
- package/.docs/organized/changelogs/create-mastra.md +5 -5
- package/.docs/organized/changelogs/mastra.md +17 -17
- package/.docs/raw/agents/adding-voice.mdx +20 -9
- package/.docs/raw/agents/agent-memory.mdx +55 -39
- package/.docs/raw/agents/guardrails.mdx +68 -61
- package/.docs/raw/agents/networks.mdx +50 -46
- package/.docs/raw/agents/overview.mdx +125 -88
- package/.docs/raw/agents/using-tools.mdx +14 -15
- package/.docs/raw/auth/auth0.mdx +28 -27
- package/.docs/raw/auth/clerk.mdx +22 -20
- package/.docs/raw/auth/firebase.mdx +42 -39
- package/.docs/raw/auth/index.mdx +1 -1
- package/.docs/raw/auth/jwt.mdx +18 -16
- package/.docs/raw/auth/supabase.mdx +20 -18
- package/.docs/raw/auth/workos.mdx +32 -26
- package/.docs/raw/community/contributing-templates.mdx +7 -7
- package/.docs/raw/community/discord.mdx +2 -2
- package/.docs/raw/community/licensing.mdx +1 -1
- package/.docs/raw/course/03-agent-memory/26-updating-mastra-export-comprehensive.md +0 -32
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +41 -22
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +48 -29
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +52 -24
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +86 -55
- package/.docs/raw/deployment/cloud-providers/index.mdx +16 -13
- package/.docs/raw/deployment/monorepo.mdx +32 -42
- package/.docs/raw/deployment/overview.mdx +15 -15
- package/.docs/raw/deployment/server-deployment.mdx +18 -23
- package/.docs/raw/deployment/serverless-platforms/cloudflare-deployer.mdx +16 -17
- package/.docs/raw/deployment/serverless-platforms/index.mdx +15 -12
- package/.docs/raw/deployment/serverless-platforms/netlify-deployer.mdx +14 -23
- package/.docs/raw/deployment/serverless-platforms/vercel-deployer.mdx +16 -23
- package/.docs/raw/deployment/web-framework.mdx +14 -14
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +138 -145
- package/.docs/raw/frameworks/agentic-uis/assistant-ui.mdx +54 -43
- package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +51 -36
- package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +161 -120
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +59 -48
- package/.docs/raw/frameworks/servers/express.mdx +45 -44
- package/.docs/raw/frameworks/web-frameworks/astro.mdx +245 -162
- package/.docs/raw/frameworks/web-frameworks/next-js.mdx +112 -69
- package/.docs/raw/frameworks/web-frameworks/sveltekit.mdx +189 -164
- package/.docs/raw/frameworks/web-frameworks/vite-react.mdx +94 -81
- package/.docs/raw/getting-started/installation.mdx +164 -133
- package/.docs/raw/getting-started/mcp-docs-server.mdx +36 -39
- package/.docs/raw/getting-started/project-structure.mdx +34 -42
- package/.docs/raw/getting-started/studio.mdx +40 -58
- package/.docs/raw/getting-started/templates.mdx +22 -27
- package/.docs/raw/index.mdx +9 -9
- package/.docs/raw/mastra-cloud/dashboard.mdx +10 -10
- package/.docs/raw/mastra-cloud/observability.mdx +7 -8
- package/.docs/raw/mastra-cloud/overview.mdx +16 -22
- package/.docs/raw/mastra-cloud/setting-up.mdx +33 -20
- package/.docs/raw/memory/conversation-history.mdx +2 -2
- package/.docs/raw/memory/overview.mdx +21 -23
- package/.docs/raw/memory/semantic-recall.mdx +14 -13
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +27 -28
- package/.docs/raw/memory/storage/memory-with-pg.mdx +26 -26
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +26 -27
- package/.docs/raw/memory/threads-and-resources.mdx +23 -20
- package/.docs/raw/memory/working-memory.mdx +27 -38
- package/.docs/raw/observability/ai-tracing/exporters/arize.mdx +30 -29
- package/.docs/raw/observability/ai-tracing/exporters/braintrust.mdx +8 -9
- package/.docs/raw/observability/ai-tracing/exporters/cloud.mdx +17 -16
- package/.docs/raw/observability/ai-tracing/exporters/default.mdx +31 -32
- package/.docs/raw/observability/ai-tracing/exporters/langfuse.mdx +18 -17
- package/.docs/raw/observability/ai-tracing/exporters/langsmith.mdx +14 -14
- package/.docs/raw/observability/ai-tracing/exporters/otel.mdx +56 -46
- package/.docs/raw/observability/ai-tracing/overview.mdx +145 -122
- package/.docs/raw/observability/ai-tracing/processors/sensitive-data-filter.mdx +57 -36
- package/.docs/raw/observability/logging.mdx +14 -17
- package/.docs/raw/observability/nextjs-tracing.mdx +5 -5
- package/.docs/raw/observability/otel-tracing.mdx +17 -18
- package/.docs/raw/observability/overview.mdx +14 -10
- package/.docs/raw/rag/chunking-and-embedding.mdx +10 -8
- package/.docs/raw/rag/overview.mdx +5 -5
- package/.docs/raw/rag/retrieval.mdx +125 -107
- package/.docs/raw/rag/vector-databases.mdx +232 -223
- package/.docs/raw/reference/agents/agent.mdx +54 -41
- package/.docs/raw/reference/agents/generate.mdx +367 -261
- package/.docs/raw/reference/agents/generateLegacy.mdx +260 -178
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +7 -5
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +7 -5
- package/.docs/raw/reference/agents/getDescription.mdx +3 -2
- package/.docs/raw/reference/agents/getInstructions.mdx +7 -5
- package/.docs/raw/reference/agents/getLLM.mdx +11 -7
- package/.docs/raw/reference/agents/getMemory.mdx +7 -5
- package/.docs/raw/reference/agents/getModel.mdx +7 -5
- package/.docs/raw/reference/agents/getScorers.mdx +7 -5
- package/.docs/raw/reference/agents/getTools.mdx +7 -5
- package/.docs/raw/reference/agents/getVoice.mdx +7 -5
- package/.docs/raw/reference/agents/getWorkflows.mdx +7 -5
- package/.docs/raw/reference/agents/listAgents.mdx +6 -4
- package/.docs/raw/reference/agents/network.mdx +171 -116
- package/.docs/raw/reference/auth/auth0.mdx +18 -14
- package/.docs/raw/reference/auth/clerk.mdx +15 -12
- package/.docs/raw/reference/auth/firebase.mdx +23 -16
- package/.docs/raw/reference/auth/jwt.mdx +7 -6
- package/.docs/raw/reference/auth/supabase.mdx +13 -10
- package/.docs/raw/reference/auth/workos.mdx +17 -13
- package/.docs/raw/reference/cli/create-mastra.mdx +61 -44
- package/.docs/raw/reference/cli/mastra.mdx +11 -11
- package/.docs/raw/reference/client-js/agents.mdx +40 -43
- package/.docs/raw/reference/client-js/error-handling.mdx +1 -1
- package/.docs/raw/reference/client-js/logs.mdx +1 -1
- package/.docs/raw/reference/client-js/mastra-client.mdx +21 -13
- package/.docs/raw/reference/client-js/memory.mdx +6 -2
- package/.docs/raw/reference/client-js/observability.mdx +10 -9
- package/.docs/raw/reference/client-js/telemetry.mdx +1 -1
- package/.docs/raw/reference/client-js/tools.mdx +1 -1
- package/.docs/raw/reference/client-js/vectors.mdx +1 -1
- package/.docs/raw/reference/client-js/workflows-legacy.mdx +1 -1
- package/.docs/raw/reference/client-js/workflows.mdx +7 -7
- package/.docs/raw/reference/core/getAgent.mdx +6 -5
- package/.docs/raw/reference/core/getAgentById.mdx +5 -4
- package/.docs/raw/reference/core/getAgents.mdx +3 -3
- package/.docs/raw/reference/core/getDeployer.mdx +4 -3
- package/.docs/raw/reference/core/getLogger.mdx +4 -3
- package/.docs/raw/reference/core/getLogs.mdx +10 -6
- package/.docs/raw/reference/core/getLogsByRunId.mdx +8 -5
- package/.docs/raw/reference/core/getMCPServer.mdx +8 -5
- package/.docs/raw/reference/core/getMCPServers.mdx +4 -3
- package/.docs/raw/reference/core/getMemory.mdx +4 -3
- package/.docs/raw/reference/core/getScorer.mdx +15 -12
- package/.docs/raw/reference/core/getScorerByName.mdx +12 -9
- package/.docs/raw/reference/core/getScorers.mdx +3 -2
- package/.docs/raw/reference/core/getServer.mdx +4 -3
- package/.docs/raw/reference/core/getStorage.mdx +4 -3
- package/.docs/raw/reference/core/getTelemetry.mdx +4 -3
- package/.docs/raw/reference/core/getVector.mdx +6 -4
- package/.docs/raw/reference/core/getVectors.mdx +4 -3
- package/.docs/raw/reference/core/getWorkflow.mdx +7 -4
- package/.docs/raw/reference/core/getWorkflows.mdx +5 -3
- package/.docs/raw/reference/core/mastra-class.mdx +16 -16
- package/.docs/raw/reference/core/setLogger.mdx +6 -4
- package/.docs/raw/reference/core/setStorage.mdx +4 -4
- package/.docs/raw/reference/core/setTelemetry.mdx +4 -3
- package/.docs/raw/reference/deployer/cloudflare.mdx +11 -7
- package/.docs/raw/reference/deployer/deployer.mdx +2 -1
- package/.docs/raw/reference/deployer/netlify.mdx +4 -4
- package/.docs/raw/reference/deployer/vercel.mdx +6 -6
- package/.docs/raw/reference/evals/answer-relevancy.mdx +4 -5
- package/.docs/raw/reference/evals/bias.mdx +4 -5
- package/.docs/raw/reference/evals/completeness.mdx +4 -5
- package/.docs/raw/reference/evals/content-similarity.mdx +4 -5
- package/.docs/raw/reference/evals/context-position.mdx +4 -5
- package/.docs/raw/reference/evals/context-precision.mdx +4 -5
- package/.docs/raw/reference/evals/context-relevancy.mdx +4 -5
- package/.docs/raw/reference/evals/contextual-recall.mdx +4 -5
- package/.docs/raw/reference/evals/faithfulness.mdx +4 -5
- package/.docs/raw/reference/evals/hallucination.mdx +4 -6
- package/.docs/raw/reference/evals/keyword-coverage.mdx +4 -5
- package/.docs/raw/reference/evals/prompt-alignment.mdx +4 -6
- package/.docs/raw/reference/evals/summarization.mdx +4 -6
- package/.docs/raw/reference/evals/textual-difference.mdx +4 -5
- package/.docs/raw/reference/evals/tone-consistency.mdx +4 -7
- package/.docs/raw/reference/evals/toxicity.mdx +4 -5
- package/.docs/raw/reference/index.mdx +3 -3
- package/.docs/raw/reference/legacyWorkflows/after.mdx +5 -5
- package/.docs/raw/reference/legacyWorkflows/afterEvent.mdx +5 -5
- package/.docs/raw/reference/legacyWorkflows/commit.mdx +5 -5
- package/.docs/raw/reference/legacyWorkflows/createRun.mdx +4 -4
- package/.docs/raw/reference/legacyWorkflows/else.mdx +5 -5
- package/.docs/raw/reference/legacyWorkflows/events.mdx +7 -7
- package/.docs/raw/reference/legacyWorkflows/execute.mdx +4 -4
- package/.docs/raw/reference/legacyWorkflows/if.mdx +5 -5
- package/.docs/raw/reference/legacyWorkflows/resume.mdx +5 -5
- package/.docs/raw/reference/legacyWorkflows/resumeWithEvent.mdx +6 -6
- package/.docs/raw/reference/legacyWorkflows/snapshots.mdx +6 -6
- package/.docs/raw/reference/legacyWorkflows/start.mdx +6 -6
- package/.docs/raw/reference/legacyWorkflows/step-class.mdx +4 -4
- package/.docs/raw/reference/legacyWorkflows/step-condition.mdx +4 -4
- package/.docs/raw/reference/legacyWorkflows/step-function.mdx +5 -5
- package/.docs/raw/reference/legacyWorkflows/step-options.mdx +6 -6
- package/.docs/raw/reference/legacyWorkflows/step-retries.mdx +4 -4
- package/.docs/raw/reference/legacyWorkflows/suspend.mdx +4 -4
- package/.docs/raw/reference/legacyWorkflows/then.mdx +5 -5
- package/.docs/raw/reference/legacyWorkflows/until.mdx +4 -4
- package/.docs/raw/reference/legacyWorkflows/watch.mdx +3 -3
- package/.docs/raw/reference/legacyWorkflows/while.mdx +4 -4
- package/.docs/raw/reference/legacyWorkflows/workflow.mdx +7 -7
- package/.docs/raw/reference/memory/createThread.mdx +10 -10
- package/.docs/raw/reference/memory/deleteMessages.mdx +7 -5
- package/.docs/raw/reference/memory/getThreadById.mdx +6 -5
- package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +11 -10
- package/.docs/raw/reference/memory/getThreadsByResourceIdPaginated.mdx +10 -9
- package/.docs/raw/reference/memory/{Memory.mdx → memory-class.mdx} +53 -46
- package/.docs/raw/reference/memory/query.mdx +39 -25
- package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +9 -5
- package/.docs/raw/reference/observability/ai-tracing/configuration.mdx +26 -22
- package/.docs/raw/reference/observability/ai-tracing/exporters/arize.mdx +16 -12
- package/.docs/raw/reference/observability/ai-tracing/exporters/braintrust.mdx +14 -14
- package/.docs/raw/reference/observability/ai-tracing/exporters/cloud-exporter.mdx +16 -11
- package/.docs/raw/reference/observability/ai-tracing/exporters/console-exporter.mdx +10 -6
- package/.docs/raw/reference/observability/ai-tracing/exporters/default-exporter.mdx +23 -15
- package/.docs/raw/reference/observability/ai-tracing/exporters/langfuse.mdx +6 -6
- package/.docs/raw/reference/observability/ai-tracing/exporters/langsmith.mdx +13 -13
- package/.docs/raw/reference/observability/ai-tracing/exporters/otel.mdx +44 -36
- package/.docs/raw/reference/observability/ai-tracing/interfaces.mdx +115 -106
- package/.docs/raw/reference/observability/ai-tracing/processors/sensitive-data-filter.mdx +37 -32
- package/.docs/raw/reference/observability/ai-tracing/span.mdx +29 -26
- package/.docs/raw/reference/observability/logging/pino-logger.mdx +13 -15
- package/.docs/raw/reference/observability/otel-tracing/otel-config.mdx +2 -2
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-ax.mdx +3 -3
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-phoenix.mdx +2 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/dash0.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/index.mdx +12 -14
- package/.docs/raw/reference/observability/otel-tracing/providers/keywordsai.mdx +3 -3
- package/.docs/raw/reference/observability/otel-tracing/providers/laminar.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/langfuse.mdx +4 -4
- package/.docs/raw/reference/observability/otel-tracing/providers/langsmith.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/langwatch.mdx +2 -2
- package/.docs/raw/reference/observability/otel-tracing/providers/new-relic.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/signoz.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/traceloop.mdx +1 -1
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +13 -10
- package/.docs/raw/reference/processors/language-detector.mdx +27 -17
- package/.docs/raw/reference/processors/moderation-processor.mdx +26 -17
- package/.docs/raw/reference/processors/pii-detector.mdx +28 -18
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +25 -17
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +26 -17
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +22 -15
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +13 -12
- package/.docs/raw/reference/rag/chunk.mdx +41 -23
- package/.docs/raw/reference/rag/database-config.mdx +56 -38
- package/.docs/raw/reference/rag/document.mdx +1 -1
- package/.docs/raw/reference/rag/embeddings.mdx +1 -1
- package/.docs/raw/reference/rag/extract-params.mdx +1 -1
- package/.docs/raw/reference/rag/graph-rag.mdx +1 -1
- package/.docs/raw/reference/rag/metadata-filters.mdx +23 -26
- package/.docs/raw/reference/rag/rerank.mdx +1 -1
- package/.docs/raw/reference/rag/rerankWithScorer.mdx +2 -2
- package/.docs/raw/reference/scorers/answer-relevancy.mdx +35 -17
- package/.docs/raw/reference/scorers/answer-similarity.mdx +84 -68
- package/.docs/raw/reference/scorers/bias.mdx +22 -19
- package/.docs/raw/reference/scorers/completeness.mdx +21 -16
- package/.docs/raw/reference/scorers/content-similarity.mdx +12 -10
- package/.docs/raw/reference/scorers/context-precision.mdx +73 -64
- package/.docs/raw/reference/scorers/context-relevance.mdx +142 -126
- package/.docs/raw/reference/scorers/create-scorer.mdx +93 -61
- package/.docs/raw/reference/scorers/faithfulness.mdx +21 -13
- package/.docs/raw/reference/scorers/hallucination.mdx +17 -12
- package/.docs/raw/reference/scorers/keyword-coverage.mdx +32 -27
- package/.docs/raw/reference/scorers/mastra-scorer.mdx +39 -33
- package/.docs/raw/reference/scorers/noise-sensitivity.mdx +203 -152
- package/.docs/raw/reference/scorers/prompt-alignment.mdx +186 -132
- package/.docs/raw/reference/scorers/run-experiment.mdx +40 -31
- package/.docs/raw/reference/scorers/textual-difference.mdx +25 -26
- package/.docs/raw/reference/scorers/tone-consistency.mdx +29 -26
- package/.docs/raw/reference/scorers/tool-call-accuracy.mdx +180 -176
- package/.docs/raw/reference/scorers/toxicity.mdx +35 -31
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +1 -1
- package/.docs/raw/reference/storage/cloudflare.mdx +1 -1
- package/.docs/raw/reference/storage/dynamodb.mdx +1 -1
- package/.docs/raw/reference/storage/lance.mdx +1 -1
- package/.docs/raw/reference/storage/libsql.mdx +2 -2
- package/.docs/raw/reference/storage/mongodb.mdx +4 -5
- package/.docs/raw/reference/storage/mssql.mdx +5 -4
- package/.docs/raw/reference/storage/postgresql.mdx +35 -33
- package/.docs/raw/reference/storage/upstash.mdx +6 -5
- package/.docs/raw/reference/streaming/ChunkType.mdx +788 -314
- package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +265 -109
- package/.docs/raw/reference/streaming/agents/stream.mdx +375 -266
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +233 -162
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +4 -4
- package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +5 -5
- package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +24 -20
- package/.docs/raw/reference/streaming/workflows/stream.mdx +35 -26
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +36 -27
- package/.docs/raw/reference/templates/overview.mdx +16 -39
- package/.docs/raw/reference/tools/client.mdx +1 -1
- package/.docs/raw/reference/tools/create-tool.mdx +45 -35
- package/.docs/raw/reference/tools/document-chunker-tool.mdx +2 -2
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +12 -12
- package/.docs/raw/reference/tools/mcp-client.mdx +70 -64
- package/.docs/raw/reference/tools/mcp-server.mdx +91 -78
- package/.docs/raw/reference/tools/vector-query-tool.mdx +48 -38
- package/.docs/raw/reference/vectors/astra.mdx +1 -1
- package/.docs/raw/reference/vectors/chroma.mdx +25 -19
- package/.docs/raw/reference/vectors/couchbase.mdx +4 -4
- package/.docs/raw/reference/vectors/lance.mdx +5 -6
- package/.docs/raw/reference/vectors/libsql.mdx +1 -1
- package/.docs/raw/reference/vectors/mongodb.mdx +1 -1
- package/.docs/raw/reference/vectors/opensearch.mdx +1 -1
- package/.docs/raw/reference/vectors/pg.mdx +8 -4
- package/.docs/raw/reference/vectors/pinecone.mdx +1 -1
- package/.docs/raw/reference/vectors/qdrant.mdx +1 -1
- package/.docs/raw/reference/vectors/s3vectors.mdx +35 -27
- package/.docs/raw/reference/vectors/turbopuffer.mdx +1 -1
- package/.docs/raw/reference/vectors/upstash.mdx +33 -25
- package/.docs/raw/reference/vectors/vectorize.mdx +1 -1
- package/.docs/raw/reference/voice/azure.mdx +1 -1
- package/.docs/raw/reference/voice/cloudflare.mdx +1 -1
- package/.docs/raw/reference/voice/composite-voice.mdx +1 -1
- package/.docs/raw/reference/voice/deepgram.mdx +1 -1
- package/.docs/raw/reference/voice/elevenlabs.mdx +1 -1
- package/.docs/raw/reference/voice/google-gemini-live.mdx +6 -4
- package/.docs/raw/reference/voice/google.mdx +1 -1
- package/.docs/raw/reference/voice/mastra-voice.mdx +1 -1
- package/.docs/raw/reference/voice/murf.mdx +1 -1
- package/.docs/raw/reference/voice/openai-realtime.mdx +1 -1
- package/.docs/raw/reference/voice/openai.mdx +1 -1
- package/.docs/raw/reference/voice/playai.mdx +1 -1
- package/.docs/raw/reference/voice/sarvam.mdx +1 -1
- package/.docs/raw/reference/voice/speechify.mdx +1 -1
- package/.docs/raw/reference/voice/voice.addInstructions.mdx +1 -1
- package/.docs/raw/reference/voice/voice.addTools.mdx +1 -1
- package/.docs/raw/reference/voice/voice.answer.mdx +1 -1
- package/.docs/raw/reference/voice/voice.close.mdx +1 -1
- package/.docs/raw/reference/voice/voice.connect.mdx +1 -1
- package/.docs/raw/reference/voice/voice.events.mdx +1 -1
- package/.docs/raw/reference/voice/voice.getSpeakers.mdx +23 -30
- package/.docs/raw/reference/voice/voice.listen.mdx +1 -1
- package/.docs/raw/reference/voice/voice.off.mdx +1 -1
- package/.docs/raw/reference/voice/voice.on.mdx +1 -1
- package/.docs/raw/reference/voice/voice.send.mdx +1 -1
- package/.docs/raw/reference/voice/voice.speak.mdx +1 -1
- package/.docs/raw/reference/voice/voice.updateConfig.mdx +1 -1
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +4 -3
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +49 -34
- package/.docs/raw/reference/workflows/run-methods/start.mdx +43 -31
- package/.docs/raw/reference/workflows/run-methods/watch.mdx +7 -8
- package/.docs/raw/reference/workflows/run.mdx +7 -10
- package/.docs/raw/reference/workflows/step.mdx +15 -12
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +7 -7
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +3 -2
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +5 -5
- package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +3 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +3 -2
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +3 -3
- package/.docs/raw/reference/workflows/workflow.mdx +13 -10
- package/.docs/raw/scorers/custom-scorers.mdx +58 -48
- package/.docs/raw/scorers/evals-old-api/custom-eval.mdx +6 -8
- package/.docs/raw/scorers/evals-old-api/overview.mdx +8 -8
- package/.docs/raw/scorers/evals-old-api/running-in-ci.mdx +9 -9
- package/.docs/raw/scorers/evals-old-api/textual-evals.mdx +5 -5
- package/.docs/raw/scorers/off-the-shelf-scorers.mdx +3 -1
- package/.docs/raw/scorers/overview.mdx +20 -19
- package/.docs/raw/server-db/custom-api-routes.mdx +8 -8
- package/.docs/raw/server-db/mastra-client.mdx +56 -54
- package/.docs/raw/server-db/middleware.mdx +11 -7
- package/.docs/raw/server-db/production-server.mdx +5 -7
- package/.docs/raw/server-db/runtime-context.mdx +41 -38
- package/.docs/raw/server-db/storage.mdx +82 -87
- package/.docs/raw/streaming/events.mdx +24 -16
- package/.docs/raw/streaming/overview.mdx +17 -18
- package/.docs/raw/streaming/tool-streaming.mdx +9 -10
- package/.docs/raw/streaming/workflow-streaming.mdx +14 -12
- package/.docs/raw/tools-mcp/advanced-usage.mdx +2 -2
- package/.docs/raw/tools-mcp/mcp-overview.mdx +92 -102
- package/.docs/raw/tools-mcp/overview.mdx +9 -14
- package/.docs/raw/voice/overview.mdx +273 -250
- package/.docs/raw/voice/speech-to-speech.mdx +14 -12
- package/.docs/raw/voice/speech-to-text.mdx +2 -2
- package/.docs/raw/voice/text-to-speech.mdx +2 -2
- package/.docs/raw/workflows/agents-and-tools.mdx +29 -28
- package/.docs/raw/workflows/control-flow.mdx +24 -24
- package/.docs/raw/workflows/error-handling.mdx +15 -17
- package/.docs/raw/workflows/human-in-the-loop.mdx +39 -39
- package/.docs/raw/workflows/inngest-workflow.mdx +33 -29
- package/.docs/raw/workflows/input-data-mapping.mdx +9 -9
- package/.docs/raw/workflows/overview.mdx +60 -60
- package/.docs/raw/workflows/snapshots.mdx +54 -36
- package/.docs/raw/workflows/suspend-and-resume.mdx +52 -57
- package/.docs/raw/workflows-legacy/control-flow.mdx +15 -17
- package/.docs/raw/workflows-legacy/dynamic-workflows.mdx +3 -1
- package/.docs/raw/workflows-legacy/error-handling.mdx +8 -6
- package/.docs/raw/workflows-legacy/nested-workflows.mdx +6 -0
- package/.docs/raw/workflows-legacy/overview.mdx +28 -26
- package/.docs/raw/workflows-legacy/runtime-variables.mdx +4 -2
- package/.docs/raw/workflows-legacy/steps.mdx +5 -3
- package/.docs/raw/workflows-legacy/suspend-and-resume.mdx +10 -8
- package/.docs/raw/workflows-legacy/variables.mdx +10 -8
- package/CHANGELOG.md +14 -0
- package/package.json +5 -5
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +0 -148
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: "MastraStorage | Server & DB | Mastra Docs"
|
|
3
3
|
description: Overview of Mastra's storage system and data persistence capabilities.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
6
|
+
import PropertiesTable from "@site/src/components/PropertiesTable";
|
|
7
|
+
import { SchemaTable } from "@site/src/components/SchemaTable";
|
|
8
|
+
import { StorageOverviewImage } from "@site/src/components/StorageOverviewImage";
|
|
9
|
+
import Tabs from "@theme/Tabs";
|
|
10
|
+
import TabItem from "@theme/TabItem";
|
|
11
11
|
|
|
12
12
|
# MastraStorage
|
|
13
13
|
|
|
@@ -47,16 +47,8 @@ configuration either on `Mastra` or directly within `new Memory()`.
|
|
|
47
47
|
|
|
48
48
|
## Data Schema
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Each tab shows the table structure and column definitions for a specific data entity (Messages, Threads, Workflows, etc.).
|
|
53
|
-
The tabs help users understand the data model and relationships between different storage entities.
|
|
54
|
-
Each tab includes detailed column information with types, constraints, and example data structures.
|
|
55
|
-
The data types include Messages, Threads, Workflows, Eval Datasets, and Traces.
|
|
56
|
-
*/}
|
|
57
|
-
|
|
58
|
-
<Tabs items={['Messages', 'Threads', 'Resources', 'Workflows', 'Eval Datasets', 'Traces']}>
|
|
59
|
-
<Tabs.Tab>
|
|
50
|
+
<Tabs>
|
|
51
|
+
<TabItem value="messages" label="Messages">
|
|
60
52
|
Stores conversation messages and their metadata. Each message belongs to a thread and contains the actual content along with metadata about the sender role and message type.
|
|
61
53
|
|
|
62
54
|
<br />
|
|
@@ -65,11 +57,9 @@ Stores conversation messages and their metadata. Each message belongs to a threa
|
|
|
65
57
|
{
|
|
66
58
|
name: "id",
|
|
67
59
|
type: "uuidv4",
|
|
68
|
-
description:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{ type: "nullable", value: false }
|
|
72
|
-
]
|
|
60
|
+
description:
|
|
61
|
+
"Unique identifier for the message (format: `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`)",
|
|
62
|
+
constraints: [{ type: "primaryKey" }, { type: "nullable", value: false }],
|
|
73
63
|
},
|
|
74
64
|
{
|
|
75
65
|
name: "thread_id",
|
|
@@ -77,35 +67,34 @@ Stores conversation messages and their metadata. Each message belongs to a threa
|
|
|
77
67
|
description: "Parent thread reference",
|
|
78
68
|
constraints: [
|
|
79
69
|
{ type: "foreignKey", value: "threads.id" },
|
|
80
|
-
{ type: "nullable", value: false }
|
|
81
|
-
]
|
|
70
|
+
{ type: "nullable", value: false },
|
|
71
|
+
],
|
|
82
72
|
},
|
|
83
73
|
{
|
|
84
74
|
name: "resourceId",
|
|
85
75
|
type: "uuidv4",
|
|
86
76
|
description: "ID of the resource that owns this message",
|
|
87
|
-
constraints: [
|
|
88
|
-
{ type: "nullable", value: true }
|
|
89
|
-
]
|
|
77
|
+
constraints: [{ type: "nullable", value: true }],
|
|
90
78
|
},
|
|
91
79
|
{
|
|
92
80
|
name: "content",
|
|
93
81
|
type: "text",
|
|
94
|
-
description:
|
|
95
|
-
|
|
82
|
+
description:
|
|
83
|
+
"JSON of the message content in V2 format. Example: `{ format: 2, parts: [...] }`",
|
|
84
|
+
constraints: [{ type: "nullable", value: false }],
|
|
96
85
|
},
|
|
97
86
|
{
|
|
98
87
|
name: "role",
|
|
99
88
|
type: "text",
|
|
100
89
|
description: "Enum of `user | assistant`",
|
|
101
|
-
constraints: [{ type: "nullable", value: false }]
|
|
90
|
+
constraints: [{ type: "nullable", value: false }],
|
|
102
91
|
},
|
|
103
92
|
{
|
|
104
93
|
name: "createdAt",
|
|
105
94
|
type: "timestamp",
|
|
106
95
|
description: "Used for thread message ordering",
|
|
107
|
-
constraints: [{ type: "nullable", value: false }]
|
|
108
|
-
}
|
|
96
|
+
constraints: [{ type: "nullable", value: false }],
|
|
97
|
+
},
|
|
109
98
|
]}
|
|
110
99
|
/>
|
|
111
100
|
|
|
@@ -117,52 +106,52 @@ The message `content` column contains a JSON object conforming to the `MastraMes
|
|
|
117
106
|
name: "format",
|
|
118
107
|
type: "integer",
|
|
119
108
|
description: "Message format version (currently 2)",
|
|
120
|
-
constraints: [{ type: "nullable", value: false }]
|
|
109
|
+
constraints: [{ type: "nullable", value: false }],
|
|
121
110
|
},
|
|
122
111
|
{
|
|
123
112
|
name: "parts",
|
|
124
113
|
type: "array (JSON)",
|
|
125
|
-
description:
|
|
126
|
-
|
|
114
|
+
description:
|
|
115
|
+
"Array of message parts (text, tool-invocation, file, reasoning, etc.). The structure of items in this array varies by `type`.",
|
|
116
|
+
constraints: [{ type: "nullable", value: false }],
|
|
127
117
|
},
|
|
128
118
|
{
|
|
129
119
|
name: "experimental_attachments",
|
|
130
120
|
type: "array (JSON)",
|
|
131
121
|
description: "Optional array of file attachments",
|
|
132
|
-
constraints: [{ type: "nullable", value: true }]
|
|
122
|
+
constraints: [{ type: "nullable", value: true }],
|
|
133
123
|
},
|
|
134
124
|
{
|
|
135
125
|
name: "content",
|
|
136
126
|
type: "text",
|
|
137
127
|
description: "Optional main text content of the message",
|
|
138
|
-
constraints: [{ type: "nullable", value: true }]
|
|
128
|
+
constraints: [{ type: "nullable", value: true }],
|
|
139
129
|
},
|
|
140
130
|
{
|
|
141
131
|
name: "toolInvocations",
|
|
142
132
|
type: "array (JSON)",
|
|
143
133
|
description: "Optional array summarizing tool calls and results",
|
|
144
|
-
constraints: [{ type: "nullable", value: true }]
|
|
134
|
+
constraints: [{ type: "nullable", value: true }],
|
|
145
135
|
},
|
|
146
136
|
{
|
|
147
137
|
name: "reasoning",
|
|
148
138
|
type: "object (JSON)",
|
|
149
|
-
description:
|
|
150
|
-
|
|
139
|
+
description:
|
|
140
|
+
"Optional information about the reasoning process behind the assistant's response",
|
|
141
|
+
constraints: [{ type: "nullable", value: true }],
|
|
151
142
|
},
|
|
152
143
|
{
|
|
153
144
|
name: "annotations",
|
|
154
145
|
type: "object (JSON)",
|
|
155
146
|
description: "Optional additional metadata or annotations",
|
|
156
|
-
constraints: [{ type: "nullable", value: true }]
|
|
157
|
-
}
|
|
147
|
+
constraints: [{ type: "nullable", value: true }],
|
|
148
|
+
},
|
|
158
149
|
]}
|
|
159
150
|
/>
|
|
160
151
|
|
|
152
|
+
</TabItem>
|
|
161
153
|
|
|
162
|
-
|
|
163
|
-
</Tabs.Tab>
|
|
164
|
-
|
|
165
|
-
<Tabs.Tab>
|
|
154
|
+
<TabItem value="threads" label="Threads">
|
|
166
155
|
Groups related messages together and associates them with a resource. Contains metadata about the conversation.
|
|
167
156
|
|
|
168
157
|
<br />
|
|
@@ -171,23 +160,22 @@ Groups related messages together and associates them with a resource. Contains m
|
|
|
171
160
|
{
|
|
172
161
|
name: "id",
|
|
173
162
|
type: "uuidv4",
|
|
174
|
-
description:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
{ type: "nullable", value: false }
|
|
178
|
-
]
|
|
163
|
+
description:
|
|
164
|
+
"Unique identifier for the thread (format: `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`)",
|
|
165
|
+
constraints: [{ type: "primaryKey" }, { type: "nullable", value: false }],
|
|
179
166
|
},
|
|
180
167
|
{
|
|
181
168
|
name: "resourceId",
|
|
182
169
|
type: "text",
|
|
183
|
-
description:
|
|
184
|
-
|
|
170
|
+
description:
|
|
171
|
+
"Primary identifier of the external resource this thread is associated with. Used to group and retrieve related threads.",
|
|
172
|
+
constraints: [{ type: "nullable", value: false }],
|
|
185
173
|
},
|
|
186
174
|
{
|
|
187
175
|
name: "title",
|
|
188
176
|
type: "text",
|
|
189
177
|
description: "Title of the conversation thread",
|
|
190
|
-
constraints: [{ type: "nullable", value: false }]
|
|
178
|
+
constraints: [{ type: "nullable", value: false }],
|
|
191
179
|
},
|
|
192
180
|
{
|
|
193
181
|
name: "metadata",
|
|
@@ -195,25 +183,25 @@ Groups related messages together and associates them with a resource. Contains m
|
|
|
195
183
|
description: "Custom thread metadata as stringified JSON. Example:",
|
|
196
184
|
example: {
|
|
197
185
|
category: "support",
|
|
198
|
-
priority: 1
|
|
199
|
-
}
|
|
186
|
+
priority: 1,
|
|
187
|
+
},
|
|
200
188
|
},
|
|
201
189
|
{
|
|
202
190
|
name: "createdAt",
|
|
203
191
|
type: "timestamp",
|
|
204
|
-
constraints: [{ type: "nullable", value: false }]
|
|
192
|
+
constraints: [{ type: "nullable", value: false }],
|
|
205
193
|
},
|
|
206
194
|
{
|
|
207
195
|
name: "updatedAt",
|
|
208
196
|
type: "timestamp",
|
|
209
197
|
description: "Used for thread ordering history",
|
|
210
|
-
constraints: [{ type: "nullable", value: false }]
|
|
211
|
-
}
|
|
198
|
+
constraints: [{ type: "nullable", value: false }],
|
|
199
|
+
},
|
|
212
200
|
]}
|
|
213
201
|
/>
|
|
214
202
|
|
|
215
|
-
</
|
|
216
|
-
<
|
|
203
|
+
</TabItem>
|
|
204
|
+
<TabItem value="resources" label="Resources">
|
|
217
205
|
Stores user-specific data for resource-scoped working memory. Each resource represents a user or entity, allowing working memory to persist across all conversation threads for that user.
|
|
218
206
|
|
|
219
207
|
<br />
|
|
@@ -222,17 +210,16 @@ Stores user-specific data for resource-scoped working memory. Each resource repr
|
|
|
222
210
|
{
|
|
223
211
|
name: "id",
|
|
224
212
|
type: "text",
|
|
225
|
-
description:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
{ type: "nullable", value: false }
|
|
229
|
-
]
|
|
213
|
+
description:
|
|
214
|
+
"Resource identifier (user or entity ID) - same as resourceId used in threads and agent calls",
|
|
215
|
+
constraints: [{ type: "primaryKey" }, { type: "nullable", value: false }],
|
|
230
216
|
},
|
|
231
217
|
{
|
|
232
218
|
name: "workingMemory",
|
|
233
219
|
type: "text",
|
|
234
|
-
description:
|
|
235
|
-
|
|
220
|
+
description:
|
|
221
|
+
"Persistent working memory data as Markdown text. Contains user profile, preferences, and contextual information that persists across conversation threads.",
|
|
222
|
+
constraints: [{ type: "nullable", value: true }],
|
|
236
223
|
},
|
|
237
224
|
{
|
|
238
225
|
name: "metadata",
|
|
@@ -240,29 +227,29 @@ Stores user-specific data for resource-scoped working memory. Each resource repr
|
|
|
240
227
|
description: "Additional resource metadata as JSON. Example:",
|
|
241
228
|
example: {
|
|
242
229
|
preferences: { language: "en", timezone: "UTC" },
|
|
243
|
-
tags: ["premium", "beta-user"]
|
|
230
|
+
tags: ["premium", "beta-user"],
|
|
244
231
|
},
|
|
245
|
-
constraints: [{ type: "nullable", value: true }]
|
|
232
|
+
constraints: [{ type: "nullable", value: true }],
|
|
246
233
|
},
|
|
247
234
|
{
|
|
248
235
|
name: "createdAt",
|
|
249
236
|
type: "timestamp",
|
|
250
237
|
description: "When the resource record was first created",
|
|
251
|
-
constraints: [{ type: "nullable", value: false }]
|
|
238
|
+
constraints: [{ type: "nullable", value: false }],
|
|
252
239
|
},
|
|
253
240
|
{
|
|
254
241
|
name: "updatedAt",
|
|
255
242
|
type: "timestamp",
|
|
256
243
|
description: "When the working memory was last updated",
|
|
257
|
-
constraints: [{ type: "nullable", value: false }]
|
|
258
|
-
}
|
|
244
|
+
constraints: [{ type: "nullable", value: false }],
|
|
245
|
+
},
|
|
259
246
|
]}
|
|
260
247
|
/>
|
|
261
248
|
|
|
262
249
|
**Note**: This table is only created and used by storage adapters that support resource-scoped working memory (LibSQL, PostgreSQL, Upstash). Other storage adapters will provide helpful error messages if resource-scoped memory is attempted.
|
|
263
250
|
|
|
264
|
-
</
|
|
265
|
-
<
|
|
251
|
+
</TabItem>
|
|
252
|
+
<TabItem value="workflows" label="Workflows">
|
|
266
253
|
When `suspend` is called on a workflow, its state is saved in the following format. When `resume` is called, that state is rehydrated.
|
|
267
254
|
|
|
268
255
|
<br />
|
|
@@ -310,8 +297,8 @@ When `suspend` is called on a workflow, its state is saved in the following form
|
|
|
310
297
|
}
|
|
311
298
|
]}
|
|
312
299
|
/>
|
|
313
|
-
</
|
|
314
|
-
<
|
|
300
|
+
</TabItem>
|
|
301
|
+
<TabItem value="evals" label="Evals">
|
|
315
302
|
Stores eval results from running metrics against agent outputs.
|
|
316
303
|
|
|
317
304
|
<br />
|
|
@@ -384,8 +371,8 @@ Stores eval results from running metrics against agent outputs.
|
|
|
384
371
|
}
|
|
385
372
|
]}
|
|
386
373
|
/>
|
|
387
|
-
</
|
|
388
|
-
<
|
|
374
|
+
</TabItem>
|
|
375
|
+
<TabItem value="traces" label="Traces">
|
|
389
376
|
Captures OpenTelemetry traces for monitoring and debugging.
|
|
390
377
|
|
|
391
378
|
<br />
|
|
@@ -482,7 +469,7 @@ Captures OpenTelemetry traces for monitoring and debugging.
|
|
|
482
469
|
}
|
|
483
470
|
]}
|
|
484
471
|
/>
|
|
485
|
-
</
|
|
472
|
+
</TabItem>
|
|
486
473
|
</Tabs>
|
|
487
474
|
|
|
488
475
|
### Querying Messages
|
|
@@ -491,25 +478,33 @@ Messages are stored in a V2 format internally, which is roughly equivalent to th
|
|
|
491
478
|
|
|
492
479
|
```typescript copy
|
|
493
480
|
// Get messages in the default V1 format (roughly equivalent to AI SDK's CoreMessage format)
|
|
494
|
-
const messagesV1 = await mastra
|
|
481
|
+
const messagesV1 = await mastra
|
|
482
|
+
.getStorage()
|
|
483
|
+
.getMessages({ threadId: "your-thread-id" });
|
|
495
484
|
|
|
496
485
|
// Get messages in the V2 format (roughly equivalent to AI SDK's UIMessage format)
|
|
497
|
-
const messagesV2 = await mastra
|
|
486
|
+
const messagesV2 = await mastra
|
|
487
|
+
.getStorage()
|
|
488
|
+
.getMessages({ threadId: "your-thread-id", format: "v2" });
|
|
498
489
|
```
|
|
499
490
|
|
|
500
491
|
You can also retrieve messages using an array of message IDs. Note that unlike `getMessages`, this defaults to the V2 format:
|
|
501
492
|
|
|
502
493
|
```typescript copy
|
|
503
|
-
const messagesV1 = await mastra
|
|
494
|
+
const messagesV1 = await mastra
|
|
495
|
+
.getStorage()
|
|
496
|
+
.getMessagesById({ messageIds: messageIdArr, format: "v1" });
|
|
504
497
|
|
|
505
|
-
const messagesV2 = await mastra
|
|
498
|
+
const messagesV2 = await mastra
|
|
499
|
+
.getStorage()
|
|
500
|
+
.getMessagesById({ messageIds: messageIdArr });
|
|
506
501
|
```
|
|
507
502
|
|
|
508
503
|
## Storage Providers
|
|
509
504
|
|
|
510
505
|
Mastra supports the following providers:
|
|
511
506
|
|
|
512
|
-
- For local development, check out [LibSQL Storage](
|
|
513
|
-
- For production, check out [PostgreSQL Storage](
|
|
514
|
-
- For serverless deployments, check out [Upstash Storage](
|
|
515
|
-
- For document-based storage, check out [MongoDB Storage](
|
|
507
|
+
- For local development, check out [LibSQL Storage](/reference/storage/libsql)
|
|
508
|
+
- For production, check out [PostgreSQL Storage](/reference/storage/postgresql)
|
|
509
|
+
- For serverless deployments, check out [Upstash Storage](/reference/storage/upstash)
|
|
510
|
+
- For document-based storage, check out [MongoDB Storage](/reference/storage/mongodb)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Streaming Events | Streaming | Mastra"
|
|
2
|
+
title: "Streaming Events | Streaming | Mastra Docs"
|
|
3
3
|
description: "Learn about the different types of streaming events in Mastra, including text deltas, tool calls, step events, and how to handle them in your applications."
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -56,7 +56,7 @@ for await (const chunk of stream) {
|
|
|
56
56
|
}
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
> See [Agent.stream()](
|
|
59
|
+
> See [Agent.stream()](/reference/streaming/agents/stream) for more information.
|
|
60
60
|
|
|
61
61
|
### Example agent output
|
|
62
62
|
|
|
@@ -98,8 +98,8 @@ const run = await testWorkflow.createRunAsync();
|
|
|
98
98
|
|
|
99
99
|
const stream = await run.stream({
|
|
100
100
|
inputData: {
|
|
101
|
-
value: "initial data"
|
|
102
|
-
}
|
|
101
|
+
value: "initial data",
|
|
102
|
+
},
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
for await (const chunk of stream) {
|
|
@@ -139,14 +139,16 @@ When using multi-agent collaboration with `agent.network()`, iterate over the st
|
|
|
139
139
|
```typescript {3,5} showLineNumbers copy
|
|
140
140
|
const networkAgent = mastra.getAgent("networkAgent");
|
|
141
141
|
|
|
142
|
-
const networkStream = await networkAgent.network(
|
|
142
|
+
const networkStream = await networkAgent.network(
|
|
143
|
+
"Research dolphins then write a report",
|
|
144
|
+
);
|
|
143
145
|
|
|
144
146
|
for await (const chunk of networkStream) {
|
|
145
147
|
console.log(chunk);
|
|
146
148
|
}
|
|
147
149
|
```
|
|
148
150
|
|
|
149
|
-
> See [Agent.network()](
|
|
151
|
+
> See [Agent.network()](/reference/agents/network) for more information.
|
|
150
152
|
|
|
151
153
|
### Example network output
|
|
152
154
|
|
|
@@ -201,23 +203,29 @@ Network streams emit events that track the orchestration flow. Each iteration be
|
|
|
201
203
|
You can filter events by type to track specific aspects of the network execution:
|
|
202
204
|
|
|
203
205
|
```typescript {5-8,11-13,16-18} showLineNumbers copy
|
|
204
|
-
const networkStream = await networkAgent.network(
|
|
206
|
+
const networkStream = await networkAgent.network(
|
|
207
|
+
"Analyze data and create visualization",
|
|
208
|
+
);
|
|
205
209
|
|
|
206
210
|
for await (const chunk of networkStream) {
|
|
207
211
|
// Track routing decisions
|
|
208
|
-
if (chunk.type ===
|
|
209
|
-
console.log(
|
|
210
|
-
|
|
212
|
+
if (chunk.type === "routing-agent-end") {
|
|
213
|
+
console.log(
|
|
214
|
+
"Selected:",
|
|
215
|
+
chunk.payload.resourceType,
|
|
216
|
+
chunk.payload.resourceId,
|
|
217
|
+
);
|
|
218
|
+
console.log("Reason:", chunk.payload.selectionReason);
|
|
211
219
|
}
|
|
212
|
-
|
|
220
|
+
|
|
213
221
|
// Track agent delegations
|
|
214
|
-
if (chunk.type ===
|
|
215
|
-
console.log(
|
|
222
|
+
if (chunk.type === "agent-execution-start") {
|
|
223
|
+
console.log("Delegating to agent:", chunk.payload.agentId);
|
|
216
224
|
}
|
|
217
|
-
|
|
225
|
+
|
|
218
226
|
// Track workflow delegations
|
|
219
|
-
if (chunk.type ===
|
|
220
|
-
console.log(
|
|
227
|
+
if (chunk.type === "workflow-execution-start") {
|
|
228
|
+
console.log("Executing workflow:", chunk.payload.name);
|
|
221
229
|
}
|
|
222
230
|
}
|
|
223
231
|
```
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Streaming Overview | Streaming | Mastra"
|
|
2
|
+
title: "Streaming Overview | Streaming | Mastra Docs"
|
|
3
3
|
description: "Streaming in Mastra enables real-time, incremental responses from both agents and workflows, providing immediate feedback as AI-generated content is produced."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
# Streaming Overview
|
|
8
7
|
|
|
9
|
-
|
|
10
8
|
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.
|
|
11
9
|
|
|
12
10
|
## Getting started
|
|
@@ -22,7 +20,7 @@ You can pass a single string for simple prompts, an array of strings when provid
|
|
|
22
20
|
|
|
23
21
|
### Using `Agent.stream()`
|
|
24
22
|
|
|
25
|
-
A `textStream` breaks the response into chunks as it's generated, allowing output to stream progressively instead of arriving all at once.
|
|
23
|
+
A `textStream` breaks the response into chunks as it's generated, allowing output to stream progressively instead of arriving all at once. Iterate over the `textStream` using a `for await` loop to inspect each stream chunk.
|
|
26
24
|
|
|
27
25
|
```typescript {3,7} showLineNumbers copy
|
|
28
26
|
const testAgent = mastra.getAgent("testAgent");
|
|
@@ -36,7 +34,7 @@ for await (const chunk of stream.textStream) {
|
|
|
36
34
|
}
|
|
37
35
|
```
|
|
38
36
|
|
|
39
|
-
> See [Agent.stream()](
|
|
37
|
+
> See [Agent.stream()](/reference/streaming/agents/stream) for more information.
|
|
40
38
|
|
|
41
39
|
### Output from `Agent.stream()`
|
|
42
40
|
|
|
@@ -58,7 +56,6 @@ An agent stream provides access to various response properties:
|
|
|
58
56
|
- **`stream.finishReason`**: The reason the agent stopped streaming.
|
|
59
57
|
- **`stream.usage`**: Token usage information.
|
|
60
58
|
|
|
61
|
-
|
|
62
59
|
### AI SDK v5 Compatibility
|
|
63
60
|
|
|
64
61
|
AI SDK v5 uses `LanguageModelV2` for the model providers. If you are getting an error that you are using an AI SDK v4 model you will need to upgrade your model package to the next major version.
|
|
@@ -70,7 +67,7 @@ const testAgent = mastra.getAgent("testAgent");
|
|
|
70
67
|
|
|
71
68
|
const stream = await testAgent.stream(
|
|
72
69
|
[{ role: "user", content: "Help me organize my day" }],
|
|
73
|
-
{ format: "aisdk" }
|
|
70
|
+
{ format: "aisdk" },
|
|
74
71
|
);
|
|
75
72
|
|
|
76
73
|
for await (const chunk of stream.textStream) {
|
|
@@ -94,7 +91,7 @@ for await (const chunk of networkStream) {
|
|
|
94
91
|
}
|
|
95
92
|
```
|
|
96
93
|
|
|
97
|
-
> See [Agent.network()](
|
|
94
|
+
> See [Agent.network()](/reference/agents/network) for more information.
|
|
98
95
|
|
|
99
96
|
#### Network stream properties
|
|
100
97
|
|
|
@@ -107,15 +104,17 @@ The network stream provides access to execution information:
|
|
|
107
104
|
```typescript {9-11} showLineNumbers copy
|
|
108
105
|
const testAgent = mastra.getAgent("testAgent");
|
|
109
106
|
|
|
110
|
-
const networkStream = await testAgent.network(
|
|
107
|
+
const networkStream = await testAgent.network(
|
|
108
|
+
"Research dolphins then write a report",
|
|
109
|
+
);
|
|
111
110
|
|
|
112
111
|
for await (const chunk of networkStream) {
|
|
113
112
|
console.log(chunk);
|
|
114
113
|
}
|
|
115
114
|
|
|
116
|
-
console.log(
|
|
117
|
-
console.log(
|
|
118
|
-
console.log(
|
|
115
|
+
console.log("Final status:", await networkStream.status);
|
|
116
|
+
console.log("Final result:", await networkStream.result);
|
|
117
|
+
console.log("Token usage:", await networkStream.usage);
|
|
119
118
|
```
|
|
120
119
|
|
|
121
120
|
## Streaming with workflows
|
|
@@ -131,8 +130,8 @@ const run = await testWorkflow.createRunAsync();
|
|
|
131
130
|
|
|
132
131
|
const stream = await run.streamVNext({
|
|
133
132
|
inputData: {
|
|
134
|
-
value: "initial data"
|
|
135
|
-
}
|
|
133
|
+
value: "initial data",
|
|
134
|
+
},
|
|
136
135
|
});
|
|
137
136
|
|
|
138
137
|
for await (const chunk of stream) {
|
|
@@ -140,7 +139,7 @@ for await (const chunk of stream) {
|
|
|
140
139
|
}
|
|
141
140
|
```
|
|
142
141
|
|
|
143
|
-
> See
|
|
142
|
+
> See Run.streamVNext() method documentation for more information.
|
|
144
143
|
|
|
145
144
|
### Output from `Run.stream()`
|
|
146
145
|
|
|
@@ -172,6 +171,6 @@ A workflow stream provides access to various response properties:
|
|
|
172
171
|
|
|
173
172
|
## Related
|
|
174
173
|
|
|
175
|
-
- [Streaming events](./events
|
|
176
|
-
- [Using Agents](
|
|
177
|
-
- [Workflows overview](../workflows/overview
|
|
174
|
+
- [Streaming events](./events)
|
|
175
|
+
- [Using Agents](/docs/agents/overview)
|
|
176
|
+
- [Workflows overview](../workflows/overview)
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Tool
|
|
2
|
+
title: "Tool streaming | Streaming | Mastra Docs"
|
|
3
3
|
description: "Learn how to use tool streaming in Mastra, including handling tool calls, tool results, and tool execution events during streaming."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { Callout } from "nextra/components";
|
|
7
|
-
|
|
8
6
|
# Tool streaming
|
|
9
7
|
|
|
10
8
|
Tool streaming in Mastra enables tools to send incremental results while they run, rather than waiting until execution finishes. This allows you to surface partial progress, intermediate states, or progressive data directly to users or upstream agents and workflows.
|
|
@@ -30,7 +28,7 @@ export const testAgent = new Agent({
|
|
|
30
28
|
name: "test-agent",
|
|
31
29
|
instructions: "You are a weather agent.",
|
|
32
30
|
model: openai("gpt-4o-mini"),
|
|
33
|
-
tools: { testTool }
|
|
31
|
+
tools: { testTool },
|
|
34
32
|
});
|
|
35
33
|
```
|
|
36
34
|
|
|
@@ -38,9 +36,11 @@ export const testAgent = new Agent({
|
|
|
38
36
|
|
|
39
37
|
The `writer` argument is passed to a tool’s `execute` function and can be used to emit custom events, data, or values into the active stream. This enables tools to provide intermediate results or status updates while execution is still in progress.
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
:::warning
|
|
40
|
+
|
|
42
41
|
You must `await` the call to `writer.write(...)` or else you will lock the stream and get a `WritableStream is locked` error.
|
|
43
|
-
|
|
42
|
+
|
|
43
|
+
:::
|
|
44
44
|
|
|
45
45
|
```typescript {5,8,15} showLineNumbers copy
|
|
46
46
|
import { createTool } from "@mastra/core/tools";
|
|
@@ -106,7 +106,7 @@ Events written to the stream are included in the emitted chunks. These chunks ca
|
|
|
106
106
|
```typescript showLineNumbers copy
|
|
107
107
|
const stream = await testAgent.stream([
|
|
108
108
|
"What is the weather in London?",
|
|
109
|
-
"Use the testTool"
|
|
109
|
+
"Use the testTool",
|
|
110
110
|
]);
|
|
111
111
|
|
|
112
112
|
for await (const chunk of stream) {
|
|
@@ -135,9 +135,8 @@ export const testTool = createTool({
|
|
|
135
135
|
await stream!.textStream.pipeTo(writer!);
|
|
136
136
|
|
|
137
137
|
return {
|
|
138
|
-
value: await stream!.text
|
|
138
|
+
value: await stream!.text,
|
|
139
139
|
};
|
|
140
|
-
}
|
|
140
|
+
},
|
|
141
141
|
});
|
|
142
142
|
```
|
|
143
|
-
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Workflow
|
|
2
|
+
title: "Workflow streaming | Streaming | Mastra Docs"
|
|
3
3
|
description: "Learn how to use workflow streaming in Mastra, including handling workflow execution events, step streaming, and workflow integration with agents and tools."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { Callout } from "nextra/components";
|
|
7
|
-
|
|
8
6
|
# Workflow streaming
|
|
9
7
|
|
|
10
8
|
Workflow streaming in Mastra enables workflows to send incremental results while they execute, rather than waiting until completion. This allows you to surface partial progress, intermediate states, or progressive data directly to users or upstream agents and workflows.
|
|
@@ -18,15 +16,19 @@ By combining writable workflow streams with agent streaming, you gain fine-grain
|
|
|
18
16
|
|
|
19
17
|
### Using the `writer` argument
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
:::warning
|
|
20
|
+
|
|
22
21
|
The writer is only available when using `streamVNext`.
|
|
23
|
-
|
|
22
|
+
|
|
23
|
+
:::
|
|
24
24
|
|
|
25
25
|
The `writer` argument is passed to a workflow step's `execute` function and can be used to emit custom events, data, or values into the active stream. This enables workflow steps to provide intermediate results or status updates while execution is still in progress.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
:::warning
|
|
28
|
+
|
|
28
29
|
You must `await` the call to `writer.write(...)` or else you will lock the stream and get a `WritableStream is locked` error.
|
|
29
|
-
|
|
30
|
+
|
|
31
|
+
:::
|
|
30
32
|
|
|
31
33
|
```typescript {5,8,15} showLineNumbers copy
|
|
32
34
|
import { createStep } from "@mastra/core/workflows";
|
|
@@ -66,8 +68,8 @@ const run = await testWorkflow.createRunAsync();
|
|
|
66
68
|
|
|
67
69
|
const stream = await run.streamVNext({
|
|
68
70
|
inputData: {
|
|
69
|
-
value: "initial data"
|
|
70
|
-
}
|
|
71
|
+
value: "initial data",
|
|
72
|
+
},
|
|
71
73
|
});
|
|
72
74
|
|
|
73
75
|
for await (const chunk of stream) {
|
|
@@ -77,7 +79,7 @@ for await (const chunk of stream) {
|
|
|
77
79
|
if (result!.status === "suspended") {
|
|
78
80
|
// if the workflow is suspended, we can resume it with the resumeStreamVNext method
|
|
79
81
|
const resumedStream = await run.resumeStreamVNext({
|
|
80
|
-
resumeData: { value: "resume data" }
|
|
82
|
+
resumeData: { value: "resume data" },
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
for await (const chunk of resumedStream) {
|
|
@@ -108,8 +110,8 @@ import { z } from "zod";
|
|
|
108
110
|
|
|
109
111
|
export const testStep = createStep({
|
|
110
112
|
// ...
|
|
111
|
-
execute: async ({ inputData, mastra, writer
|
|
112
|
-
const { city } = inputData
|
|
113
|
+
execute: async ({ inputData, mastra, writer }) => {
|
|
114
|
+
const { city } = inputData;
|
|
113
115
|
|
|
114
116
|
const testAgent = mastra?.getAgent("testAgent");
|
|
115
117
|
const stream = await testAgent?.stream(`What is the weather in ${city}$?`);
|