@mastra/mcp-docs-server 1.0.0-beta.11 → 1.0.0-beta.14
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/%40mastra%2Fagent-builder.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +51 -51
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +180 -180
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +68 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +331 -331
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +31 -31
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Flance.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +96 -96
- package/.docs/organized/changelogs/%40mastra%2Frag.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Freact.md +49 -2
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +122 -122
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +39 -39
- package/.docs/organized/changelogs/create-mastra.md +31 -31
- package/.docs/organized/changelogs/mastra.md +51 -51
- package/.docs/organized/code-examples/agent-v6.md +151 -0
- package/.docs/organized/code-examples/ai-elements.md +1 -1
- package/.docs/organized/code-examples/quick-start.md +0 -4
- package/.docs/organized/code-examples/stock-price-tool.md +21 -2
- package/.docs/raw/agents/adding-voice.mdx +2 -3
- package/.docs/raw/agents/agent-approval.mdx +139 -6
- package/.docs/raw/agents/agent-memory.mdx +24 -32
- package/.docs/raw/agents/guardrails.mdx +61 -51
- package/.docs/raw/agents/networks.mdx +9 -13
- package/.docs/raw/agents/overview.mdx +40 -24
- package/.docs/raw/agents/processors.mdx +20 -19
- package/.docs/raw/agents/structured-output.mdx +11 -7
- package/.docs/raw/agents/using-tools.mdx +5 -6
- package/.docs/raw/course/01-first-agent/07-creating-your-agent.md +1 -2
- package/.docs/raw/course/01-first-agent/12-connecting-tool-to-agent.md +1 -1
- package/.docs/raw/course/01-first-agent/16-adding-memory-to-agent.md +1 -2
- package/.docs/raw/course/02-agent-tools-mcp/05-updating-your-agent.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/10-updating-agent-instructions-zapier.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/16-updating-agent-instructions-github.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/21-updating-agent-instructions-hackernews.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/27-updating-agent-instructions-filesystem.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +2 -2
- package/.docs/raw/course/03-agent-memory/04-creating-basic-memory-agent.md +1 -2
- package/.docs/raw/course/03-agent-memory/08-configuring-conversation-history.md +1 -2
- package/.docs/raw/course/03-agent-memory/16-configuring-semantic-recall.md +3 -4
- package/.docs/raw/course/03-agent-memory/21-configuring-working-memory.md +2 -3
- package/.docs/raw/course/03-agent-memory/22-custom-working-memory-templates.md +2 -3
- package/.docs/raw/course/03-agent-memory/25-combining-memory-features.md +1 -2
- package/.docs/raw/course/03-agent-memory/27-creating-learning-assistant.md +2 -3
- package/.docs/raw/course/04-workflows/11-creating-an-ai-agent.md +2 -3
- package/.docs/raw/deployment/cloud-providers.mdx +20 -0
- package/.docs/raw/deployment/{building-mastra.mdx → mastra-server.mdx} +5 -5
- package/.docs/raw/deployment/monorepo.mdx +23 -44
- package/.docs/raw/deployment/overview.mdx +32 -50
- package/.docs/raw/deployment/web-framework.mdx +15 -19
- package/.docs/raw/evals/custom-scorers.mdx +9 -6
- package/.docs/raw/evals/overview.mdx +3 -6
- package/.docs/raw/evals/running-in-ci.mdx +2 -2
- package/.docs/raw/getting-started/manual-install.mdx +20 -20
- package/.docs/raw/getting-started/mcp-docs-server.mdx +2 -2
- package/.docs/raw/getting-started/start.mdx +10 -1
- package/.docs/raw/getting-started/studio.mdx +1 -1
- package/.docs/raw/guides/agent-frameworks/ai-sdk.mdx +4 -4
- package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +1033 -79
- package/.docs/raw/guides/build-your-ui/assistant-ui.mdx +8 -8
- package/.docs/raw/guides/build-your-ui/copilotkit.mdx +11 -11
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/amazon-ec2.mdx +9 -9
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/aws-lambda.mdx +13 -16
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/azure-app-services.mdx +5 -7
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/cloudflare-deployer.mdx +8 -5
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/digital-ocean.mdx +12 -15
- package/.docs/raw/guides/deployment/index.mdx +32 -0
- package/.docs/raw/guides/deployment/inngest.mdx +386 -0
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/netlify-deployer.mdx +7 -3
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/vercel-deployer.mdx +8 -5
- package/.docs/raw/guides/getting-started/astro.mdx +292 -451
- package/.docs/raw/guides/getting-started/express.mdx +72 -153
- package/.docs/raw/guides/getting-started/hono.mdx +227 -0
- package/.docs/raw/guides/getting-started/next-js.mdx +170 -61
- package/.docs/raw/guides/getting-started/quickstart.mdx +4 -4
- package/.docs/raw/guides/getting-started/sveltekit.mdx +238 -409
- package/.docs/raw/guides/getting-started/vite-react.mdx +317 -147
- package/.docs/raw/guides/guide/ai-recruiter.mdx +10 -10
- package/.docs/raw/guides/guide/chef-michel.mdx +9 -11
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +15 -15
- package/.docs/raw/guides/guide/research-assistant.mdx +17 -17
- package/.docs/raw/guides/guide/stock-agent.mdx +5 -5
- package/.docs/raw/guides/guide/web-search.mdx +8 -8
- package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +7 -7
- package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +2 -2
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +1 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/client.mdx +17 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/overview.mdx +6 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +0 -2
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +21 -23
- package/.docs/raw/index.mdx +2 -2
- package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/dashboard.mdx +2 -6
- package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/observability.mdx +1 -5
- package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/overview.mdx +2 -6
- package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/setting-up.mdx +8 -7
- package/.docs/raw/mcp/overview.mdx +31 -13
- package/.docs/raw/mcp/publishing-mcp-server.mdx +2 -2
- package/.docs/raw/memory/memory-processors.mdx +9 -9
- package/.docs/raw/memory/message-history.mdx +69 -0
- package/.docs/raw/memory/overview.mdx +34 -76
- package/.docs/raw/memory/semantic-recall.mdx +58 -49
- package/.docs/raw/memory/storage.mdx +188 -0
- package/.docs/raw/memory/working-memory.mdx +7 -7
- package/.docs/raw/observability/logging.mdx +10 -11
- package/.docs/raw/observability/overview.mdx +0 -1
- package/.docs/raw/observability/tracing/bridges/otel.mdx +2 -2
- package/.docs/raw/observability/tracing/exporters/cloud.mdx +1 -1
- package/.docs/raw/observability/tracing/exporters/default.mdx +3 -3
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +1 -2
- package/.docs/raw/observability/tracing/overview.mdx +23 -25
- package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +3 -3
- package/.docs/raw/rag/chunking-and-embedding.mdx +18 -31
- package/.docs/raw/rag/graph-rag.mdx +220 -0
- package/.docs/raw/rag/overview.mdx +2 -3
- package/.docs/raw/rag/retrieval.mdx +34 -51
- package/.docs/raw/rag/vector-databases.mdx +29 -25
- package/.docs/raw/reference/agents/agent.mdx +3 -3
- package/.docs/raw/reference/agents/generate.mdx +1 -1
- package/.docs/raw/reference/agents/generateLegacy.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +3 -3
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +3 -3
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +3 -3
- package/.docs/raw/reference/agents/getDescription.mdx +1 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +3 -3
- package/.docs/raw/reference/agents/getLLM.mdx +3 -3
- package/.docs/raw/reference/agents/getMemory.mdx +3 -3
- package/.docs/raw/reference/agents/getModel.mdx +3 -3
- package/.docs/raw/reference/agents/getTools.mdx +2 -2
- package/.docs/raw/reference/agents/getVoice.mdx +2 -2
- package/.docs/raw/reference/agents/listAgents.mdx +2 -2
- package/.docs/raw/reference/agents/listScorers.mdx +3 -3
- package/.docs/raw/reference/agents/listTools.mdx +2 -2
- package/.docs/raw/reference/agents/listWorkflows.mdx +2 -2
- package/.docs/raw/reference/agents/network.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/chat-route.mdx +3 -3
- package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/network-route.mdx +3 -3
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-stream.mdx +6 -6
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v4-messages.mdx +127 -0
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v5-messages.mdx +107 -0
- package/.docs/raw/reference/ai-sdk/with-mastra.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/workflow-route.mdx +3 -3
- package/.docs/raw/reference/auth/auth0.mdx +2 -3
- package/.docs/raw/reference/auth/clerk.mdx +2 -3
- package/.docs/raw/reference/auth/firebase.mdx +3 -5
- package/.docs/raw/reference/auth/jwt.mdx +2 -3
- package/.docs/raw/reference/auth/supabase.mdx +2 -3
- package/.docs/raw/reference/auth/workos.mdx +2 -3
- package/.docs/raw/reference/cli/create-mastra.mdx +10 -10
- package/.docs/raw/reference/cli/mastra.mdx +10 -10
- package/.docs/raw/reference/client-js/agents.mdx +1 -2
- package/.docs/raw/reference/client-js/mastra-client.mdx +2 -2
- package/.docs/raw/reference/client-js/workflows.mdx +20 -0
- package/.docs/raw/reference/core/getAgent.mdx +1 -1
- package/.docs/raw/reference/core/getAgentById.mdx +1 -1
- package/.docs/raw/reference/core/getDeployer.mdx +1 -1
- package/.docs/raw/reference/core/getLogger.mdx +1 -1
- package/.docs/raw/reference/core/getMCPServer.mdx +1 -1
- package/.docs/raw/reference/core/getMCPServerById.mdx +1 -1
- package/.docs/raw/reference/core/getMemory.mdx +2 -2
- package/.docs/raw/reference/core/getServer.mdx +3 -3
- package/.docs/raw/reference/core/getStorage.mdx +2 -2
- package/.docs/raw/reference/core/getStoredAgentById.mdx +3 -3
- package/.docs/raw/reference/core/getTelemetry.mdx +1 -1
- package/.docs/raw/reference/core/getVector.mdx +1 -1
- package/.docs/raw/reference/core/getWorkflow.mdx +1 -1
- package/.docs/raw/reference/core/listAgents.mdx +1 -1
- package/.docs/raw/reference/core/listLogs.mdx +1 -1
- package/.docs/raw/reference/core/listLogsByRunId.mdx +1 -1
- package/.docs/raw/reference/core/listMCPServers.mdx +1 -1
- package/.docs/raw/reference/core/listMemory.mdx +2 -2
- package/.docs/raw/reference/core/listStoredAgents.mdx +4 -4
- package/.docs/raw/reference/core/listVectors.mdx +1 -1
- package/.docs/raw/reference/core/listWorkflows.mdx +1 -1
- package/.docs/raw/reference/core/setLogger.mdx +1 -1
- package/.docs/raw/reference/core/setStorage.mdx +2 -2
- package/.docs/raw/reference/core/setTelemetry.mdx +1 -1
- package/.docs/raw/reference/deployer/cloudflare.mdx +1 -2
- package/.docs/raw/reference/deployer/deployer.mdx +0 -1
- package/.docs/raw/reference/deployer/netlify.mdx +1 -1
- package/.docs/raw/reference/deployer/vercel.mdx +2 -4
- package/.docs/raw/reference/evals/answer-relevancy.mdx +1 -1
- package/.docs/raw/reference/evals/answer-similarity.mdx +1 -1
- package/.docs/raw/reference/evals/bias.mdx +1 -1
- package/.docs/raw/reference/evals/completeness.mdx +1 -1
- package/.docs/raw/reference/evals/content-similarity.mdx +1 -1
- package/.docs/raw/reference/evals/context-precision.mdx +1 -1
- package/.docs/raw/reference/evals/faithfulness.mdx +1 -1
- package/.docs/raw/reference/evals/hallucination.mdx +1 -1
- package/.docs/raw/reference/evals/keyword-coverage.mdx +1 -1
- package/.docs/raw/reference/evals/prompt-alignment.mdx +7 -7
- package/.docs/raw/reference/evals/textual-difference.mdx +1 -1
- package/.docs/raw/reference/evals/tone-consistency.mdx +1 -1
- package/.docs/raw/reference/evals/tool-call-accuracy.mdx +10 -10
- package/.docs/raw/reference/evals/toxicity.mdx +1 -1
- package/.docs/raw/reference/logging/pino-logger.mdx +7 -8
- package/.docs/raw/reference/memory/createThread.mdx +2 -2
- package/.docs/raw/reference/memory/deleteMessages.mdx +2 -2
- package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +2 -2
- package/.docs/raw/reference/memory/memory-class.mdx +3 -3
- package/.docs/raw/reference/memory/query.mdx +2 -2
- package/.docs/raw/reference/memory/recall.mdx +2 -2
- package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +1 -1
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +2 -2
- package/.docs/raw/reference/processors/language-detector.mdx +2 -2
- package/.docs/raw/reference/processors/message-history-processor.mdx +2 -2
- package/.docs/raw/reference/processors/moderation-processor.mdx +3 -3
- package/.docs/raw/reference/processors/pii-detector.mdx +3 -3
- package/.docs/raw/reference/processors/processor-interface.mdx +13 -13
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +2 -2
- package/.docs/raw/reference/processors/semantic-recall-processor.mdx +2 -2
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +2 -2
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +2 -2
- package/.docs/raw/reference/processors/tool-call-filter.mdx +3 -3
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +2 -2
- package/.docs/raw/reference/processors/working-memory-processor.mdx +3 -3
- package/.docs/raw/reference/rag/chunk.mdx +1 -1
- package/.docs/raw/reference/rag/database-config.mdx +1 -1
- package/.docs/raw/reference/rag/extract-params.mdx +2 -2
- package/.docs/raw/reference/rag/metadata-filters.mdx +7 -7
- package/.docs/raw/reference/server/create-route.mdx +14 -14
- package/.docs/raw/reference/server/express-adapter.mdx +10 -11
- package/.docs/raw/reference/server/hono-adapter.mdx +10 -11
- package/.docs/raw/reference/server/mastra-server.mdx +22 -22
- package/.docs/raw/reference/server/routes.mdx +28 -1
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +3 -3
- package/.docs/raw/reference/storage/cloudflare.mdx +2 -2
- package/.docs/raw/reference/storage/convex.mdx +6 -6
- package/.docs/raw/reference/storage/dynamodb.mdx +4 -4
- package/.docs/raw/reference/storage/lance.mdx +3 -3
- package/.docs/raw/reference/storage/libsql.mdx +69 -54
- package/.docs/raw/reference/storage/mongodb.mdx +80 -7
- package/.docs/raw/reference/storage/mssql.mdx +4 -4
- package/.docs/raw/{server-db/storage.mdx → reference/storage/overview.mdx} +13 -111
- package/.docs/raw/reference/storage/postgresql.mdx +78 -7
- package/.docs/raw/reference/storage/upstash.mdx +74 -2
- package/.docs/raw/reference/streaming/agents/stream.mdx +27 -5
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +2 -2
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/resumeStream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/stream.mdx +35 -22
- package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +4 -4
- package/.docs/raw/reference/templates/overview.mdx +1 -2
- package/.docs/raw/reference/tools/create-tool.mdx +24 -5
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +3 -3
- package/.docs/raw/reference/tools/vector-query-tool.mdx +4 -4
- package/.docs/raw/reference/vectors/astra.mdx +3 -3
- package/.docs/raw/reference/vectors/chroma.mdx +3 -3
- package/.docs/raw/reference/vectors/convex.mdx +12 -12
- package/.docs/raw/reference/vectors/couchbase.mdx +5 -5
- package/.docs/raw/reference/vectors/duckdb.mdx +10 -10
- package/.docs/raw/reference/vectors/elasticsearch.mdx +4 -4
- package/.docs/raw/reference/vectors/lance.mdx +4 -4
- package/.docs/raw/reference/vectors/libsql.mdx +61 -11
- package/.docs/raw/reference/vectors/mongodb.mdx +58 -5
- package/.docs/raw/reference/vectors/pg.mdx +53 -6
- package/.docs/raw/reference/vectors/pinecone.mdx +3 -3
- package/.docs/raw/reference/vectors/qdrant.mdx +3 -3
- package/.docs/raw/reference/vectors/s3vectors.mdx +6 -6
- package/.docs/raw/reference/vectors/turbopuffer.mdx +4 -4
- package/.docs/raw/reference/vectors/upstash.mdx +55 -6
- package/.docs/raw/reference/vectors/vectorize.mdx +3 -3
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/restart.mdx +1 -3
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/start.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/startAsync.mdx +143 -0
- package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +5 -5
- package/.docs/raw/reference/workflows/run.mdx +1 -1
- package/.docs/raw/reference/workflows/step.mdx +3 -3
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +37 -2
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +6 -6
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +7 -7
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow.mdx +17 -3
- package/.docs/raw/{auth → server/auth}/auth0.mdx +20 -14
- package/.docs/raw/{auth → server/auth}/clerk.mdx +16 -9
- package/.docs/raw/{auth → server/auth}/firebase.mdx +21 -15
- package/.docs/raw/{auth → server/auth}/index.mdx +6 -6
- package/.docs/raw/{auth → server/auth}/jwt.mdx +14 -7
- package/.docs/raw/{auth → server/auth}/supabase.mdx +16 -9
- package/.docs/raw/{auth → server/auth}/workos.mdx +19 -13
- package/.docs/raw/{server-db → server}/custom-adapters.mdx +13 -13
- package/.docs/raw/{server-db → server}/custom-api-routes.mdx +3 -5
- package/.docs/raw/{server-db → server}/mastra-client.mdx +26 -15
- package/.docs/raw/{server-db → server}/mastra-server.mdx +8 -8
- package/.docs/raw/{server-db → server}/middleware.mdx +9 -9
- package/.docs/raw/{server-db → server}/request-context.mdx +33 -32
- package/.docs/raw/{server-db → server}/server-adapters.mdx +12 -12
- package/.docs/raw/streaming/events.mdx +14 -7
- package/.docs/raw/streaming/overview.mdx +21 -10
- package/.docs/raw/streaming/tool-streaming.mdx +6 -6
- package/.docs/raw/streaming/workflow-streaming.mdx +6 -8
- package/.docs/raw/tools-mcp/advanced-usage.mdx +2 -2
- package/.docs/raw/tools-mcp/mcp-overview.mdx +31 -12
- package/.docs/raw/tools-mcp/overview.mdx +10 -11
- package/.docs/raw/voice/overview.mdx +1 -1
- package/.docs/raw/workflows/agents-and-tools.mdx +28 -19
- package/.docs/raw/workflows/control-flow.mdx +27 -40
- package/.docs/raw/workflows/error-handling.mdx +172 -18
- package/.docs/raw/workflows/human-in-the-loop.mdx +6 -7
- package/.docs/raw/workflows/inngest-workflow.mdx +8 -9
- package/.docs/raw/workflows/input-data-mapping.mdx +7 -7
- package/.docs/raw/workflows/overview.mdx +34 -23
- package/.docs/raw/workflows/snapshots.mdx +14 -44
- package/.docs/raw/workflows/suspend-and-resume.mdx +7 -7
- package/.docs/raw/workflows/time-travel.mdx +16 -16
- package/.docs/raw/workflows/workflow-state.mdx +5 -8
- package/CHANGELOG.md +23 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/stdio.js +53 -0
- package/package.json +4 -4
- package/.docs/organized/changelogs/%40internal%2Fai-sdk-v4.md +0 -1
- package/.docs/raw/deployment/cloud-providers/index.mdx +0 -55
- package/.docs/raw/memory/conversation-history.mdx +0 -24
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +0 -140
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +0 -150
- package/.docs/raw/memory/storage/memory-with-pg.mdx +0 -138
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +0 -146
- package/.docs/raw/memory/threads-and-resources.mdx +0 -95
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Monorepo
|
|
2
|
+
title: "Deploy in a Monorepo | Deployment"
|
|
3
3
|
description: Learn how to deploy Mastra applications that are part of a monorepo setup
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Monorepo
|
|
6
|
+
# Deploy in a Monorepo
|
|
7
7
|
|
|
8
|
-
Deploying Mastra in a monorepo follows the same approach as deploying a standalone application. While some [Cloud](
|
|
8
|
+
Deploying Mastra in a monorepo follows the same approach as deploying a standalone application. While some [Cloud](/guides/v1/deployment) or [Serverless Platform](/guides/v1/deployment) providers may introduce extra requirements, the core setup is the same.
|
|
9
|
+
|
|
10
|
+
## Supported monorepos
|
|
11
|
+
|
|
12
|
+
Mastra works with:
|
|
13
|
+
|
|
14
|
+
- npm workspaces
|
|
15
|
+
- pnpm workspaces
|
|
16
|
+
- Yarn workspaces
|
|
17
|
+
- Turborepo
|
|
18
|
+
|
|
19
|
+
Known limitations:
|
|
20
|
+
|
|
21
|
+
- Bun workspaces - partial support; known issues
|
|
22
|
+
- Nx - You can use Nx's [supported dependency strategies](https://nx.dev/concepts/decisions/dependency-management) but you need to have `package.json` files inside your workspace packages
|
|
9
23
|
|
|
10
24
|
## Example monorepo
|
|
11
25
|
|
|
@@ -44,10 +58,15 @@ api/
|
|
|
44
58
|
|
|
45
59
|
## Deployment configuration
|
|
46
60
|
|
|
47
|
-
The image below shows how to select `apps/api` as the project root when deploying to [Mastra Cloud](
|
|
61
|
+
The image below shows how to select `apps/api` as the project root when deploying to [Mastra Cloud](/docs/v1/mastra-cloud/overview). While the interface may differ between providers, the configuration remains the same.
|
|
48
62
|
|
|
49
63
|

|
|
50
64
|
|
|
65
|
+
|
|
66
|
+
:::info
|
|
67
|
+
Make sure the correct package (e.g. `apps/api`) is selected as the deploy target. Selecting the wrong project root is a common deployment issue in monorepos.
|
|
68
|
+
:::
|
|
69
|
+
|
|
51
70
|
## Dependency management
|
|
52
71
|
|
|
53
72
|
In a monorepo, keep dependencies consistent to avoid version conflicts and build errors.
|
|
@@ -55,43 +74,3 @@ In a monorepo, keep dependencies consistent to avoid version conflicts and build
|
|
|
55
74
|
- Use a **single lockfile** at the project root so all packages resolve the same versions.
|
|
56
75
|
- Align versions of **shared libraries** (like Mastra or frameworks) to prevent duplicates.
|
|
57
76
|
|
|
58
|
-
## Deployment pitfalls
|
|
59
|
-
|
|
60
|
-
Common issues to watch for when deploying Mastra in a monorepo:
|
|
61
|
-
|
|
62
|
-
- **Wrong project root**: make sure the correct package (e.g. `apps/api`) is selected as the deploy target.
|
|
63
|
-
|
|
64
|
-
## Bundler options
|
|
65
|
-
|
|
66
|
-
Use `transpilePackages` to compile TypeScript workspace packages or libraries. List package names exactly as they appear in each `package.json`. Use `externals` to exclude dependencies resolved at runtime, and `sourcemap` to emit readable stack traces.
|
|
67
|
-
|
|
68
|
-
```typescript title="src/mastra/index.ts" showLineNumbers copy
|
|
69
|
-
import { Mastra } from "@mastra/core";
|
|
70
|
-
|
|
71
|
-
export const mastra = new Mastra({
|
|
72
|
-
// ...
|
|
73
|
-
bundler: {
|
|
74
|
-
transpilePackages: ["utils"],
|
|
75
|
-
externals: ["ui"],
|
|
76
|
-
sourcemap: true,
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
> See [Mastra Class](/reference/v1/core/mastra-class) for more configuration options.
|
|
82
|
-
|
|
83
|
-
## Supported monorepos
|
|
84
|
-
|
|
85
|
-
Mastra works with:
|
|
86
|
-
|
|
87
|
-
- npm workspaces
|
|
88
|
-
- pnpm workspaces
|
|
89
|
-
- Yarn workspaces
|
|
90
|
-
- Turborepo
|
|
91
|
-
|
|
92
|
-
Known limitations:
|
|
93
|
-
|
|
94
|
-
- Bun workspaces — partial support; known issues
|
|
95
|
-
- Nx — You can use Nx's [supported dependency strategies](https://nx.dev/concepts/decisions/dependency-management) but you need to have `package.json` files inside your workspace packages
|
|
96
|
-
|
|
97
|
-
> If you are experiencing issues with monorepos see our: [Monorepos Support mega issue](https://github.com/mastra-ai/mastra/issues/6852).
|
|
@@ -5,78 +5,60 @@ description: Learn about different deployment options for your Mastra applicatio
|
|
|
5
5
|
|
|
6
6
|
# Deployment Overview
|
|
7
7
|
|
|
8
|
-
Mastra
|
|
8
|
+
Mastra applications can be deployed to any Node.js-compatible environment. You can deploy a Mastra server, integrate with an existing web framework, deploy to cloud providers, or use Mastra Cloud for managed hosting.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Runtime support
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
| ------------------------ | ------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
14
|
-
| **Mastra Cloud** | Teams wanting to ship quickly without infrastructure concerns | Fully-managed, automatic scaling, built-in observability |
|
|
15
|
-
| **Framework Deployment** | Teams already using Next.js, Astro etc | Simplify deployment with a unified codebase for frontend and backend |
|
|
16
|
-
| **Server Deployment** | Teams needing maximum control and customization | Full control, custom middleware, integrate with existing apps |
|
|
17
|
-
| **Serverless Platforms** | Teams already using Vercel, Netlify, or Cloudflare | Platform integration, simplified deployment, automatic scaling |
|
|
18
|
-
|
|
19
|
-
## Deployment Options
|
|
20
|
-
|
|
21
|
-
### Runtime support
|
|
12
|
+
Mastra can run against any of these runtime environments:
|
|
22
13
|
|
|
23
14
|
- Node.js `v22.13.0` or later
|
|
24
15
|
- Bun
|
|
25
16
|
- Deno
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
### Mastra Cloud
|
|
29
|
-
|
|
30
|
-
Mastra Cloud is a deployment platform that connects to your GitHub repository, automatically deploys on code changes, and provides monitoring tools. It includes:
|
|
17
|
+
- Cloudflare
|
|
31
18
|
|
|
32
|
-
|
|
33
|
-
- Deployment on git push
|
|
34
|
-
- Agent testing interface
|
|
35
|
-
- Comprehensive logs and traces
|
|
36
|
-
- Custom domains for each project
|
|
19
|
+
## Deployment Options
|
|
37
20
|
|
|
38
|
-
|
|
21
|
+
### Mastra Server
|
|
39
22
|
|
|
40
|
-
|
|
23
|
+
Mastra provides a [server](/docs/v1/server/mastra-server) powered by Hono that can be deployed independently. Use the `mastra build` command to build your application and deploy the output to your preferred VM, container, or PaaS platform.
|
|
41
24
|
|
|
42
|
-
|
|
25
|
+
See the [Mastra server deployment guide](/docs/v1/deployment/mastra-server).
|
|
43
26
|
|
|
44
|
-
|
|
45
|
-
- [With Astro](/guides/v1/getting-started/astro)
|
|
27
|
+
### Monorepo
|
|
46
28
|
|
|
47
|
-
|
|
29
|
+
Deploy a Mastra server as part of a monorepo setup, following the same approach as standalone deployment.
|
|
48
30
|
|
|
49
|
-
|
|
31
|
+
Read about [monorepo deployment](/docs/v1/deployment/monorepo).
|
|
50
32
|
|
|
51
|
-
###
|
|
33
|
+
### Cloud Providers
|
|
52
34
|
|
|
53
|
-
|
|
35
|
+
Mastra applications can be deployed to cloud providers and serverless platforms. Mastra includes optional built-in deployers for Vercel, Netlify, and Cloudflare to automate the build and deployment process.
|
|
54
36
|
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
37
|
+
- [Amazon EC2](/guides/v1/deployment/amazon-ec2)
|
|
38
|
+
- [AWS Lambda](/guides/v1/deployment/aws-lambda)
|
|
39
|
+
- [Azure App Services](/guides/v1/deployment/azure-app-services)
|
|
40
|
+
- [Cloudflare](/guides/v1/deployment/cloudflare-deployer)
|
|
41
|
+
- [Digital Ocean](/guides/v1/deployment/digital-ocean)
|
|
42
|
+
- [Netlify](/guides/v1/deployment/netlify-deployer)
|
|
43
|
+
- [Vercel](/guides/v1/deployment/vercel-deployer)
|
|
59
44
|
|
|
60
|
-
|
|
45
|
+
### Web Framework
|
|
61
46
|
|
|
62
|
-
|
|
47
|
+
When Mastra is integrated with a web framework, it deploys alongside your application using the framework's standard deployment process. The guides below cover framework-specific configuration requirements for deployment:
|
|
63
48
|
|
|
64
|
-
|
|
49
|
+
- [With Next.js on Vercel](/docs/v1/deployment/web-framework#with-nextjs-on-vercel)
|
|
50
|
+
- [With Astro on Vercel](/docs/v1/deployment/web-framework#with-astro-on-vercel)
|
|
51
|
+
- [With Astro on Netlify](/docs/v1/deployment/web-framework#with-astro-on-netlify)
|
|
65
52
|
|
|
66
|
-
|
|
67
|
-
- Platform-specific optimizations
|
|
68
|
-
- Simplified deployment process
|
|
69
|
-
- Automatic scaling through the platform
|
|
53
|
+
### Mastra Cloud
|
|
70
54
|
|
|
71
|
-
|
|
55
|
+
We're building Mastra Cloud to be the easiest place to deploy and observe your Mastra agents. It's currently in beta.
|
|
72
56
|
|
|
73
|
-
|
|
57
|
+
Learn more in the [Mastra Cloud docs](/docs/v1/mastra-cloud/overview).
|
|
74
58
|
|
|
75
|
-
|
|
59
|
+
## Workflow Runners
|
|
76
60
|
|
|
77
|
-
|
|
78
|
-
- Authentication and request handling
|
|
79
|
-
- Retries and error handling
|
|
80
|
-
- Support for streaming responses
|
|
61
|
+
Mastra supports deploying workflows to specialized workflow execution platforms that handle orchestration, monitoring, and reliability. [Inngest](https://www.inngest.com) is a developer platform for running background workflows without managing infrastructure. Mastra workflows can be deployed to Inngest, which provides step memoization, automatic retries, real-time monitoring, and suspend/resume capabilities.
|
|
81
62
|
|
|
82
|
-
[
|
|
63
|
+
- [Inngest deployment guide](/guides/v1/deployment/inngest)
|
|
64
|
+
- [Inngest workflow example](https://github.com/mastra-ai/mastra/tree/main/examples/inngest)
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Web Framework
|
|
2
|
+
title: "Deploy with a Web Framework | Deployment"
|
|
3
3
|
description: "Learn how Mastra can be deployed when integrated with a Web Framework"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Web Framework
|
|
6
|
+
# Deploy with a Web Framework
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
When Mastra is integrated with a web framework, it deploys alongside your application using the framework's standard deployment process. Follow the instructions below to ensure your Mastra integration deploys correctly.
|
|
9
|
+
|
|
10
|
+
:::warning
|
|
11
|
+
If you're deploying to a cloud provider, remove any usage of [LibSQLStore](/reference/v1/storage/libsql) from your Mastra configuration. LibSQLStore requires filesystem access and is not compatible with serverless platforms.
|
|
12
|
+
:::
|
|
13
|
+
|
|
14
|
+
Integration guides:
|
|
9
15
|
|
|
10
16
|
- [With Next.js](/guides/v1/getting-started/next-js)
|
|
11
17
|
- [With Astro](/guides/v1/getting-started/astro)
|
|
12
18
|
|
|
13
|
-
When integrated with a framework, Mastra typically requires no additional configuration for deployment.
|
|
14
|
-
|
|
15
19
|
## With Next.js on Vercel
|
|
16
20
|
|
|
17
|
-
If you've integrated Mastra with Next.js [by following our guide](/guides/v1/getting-started/next-js) and plan to deploy to Vercel,
|
|
21
|
+
If you've integrated Mastra with Next.js [by following our guide](/guides/v1/getting-started/next-js) and plan to deploy to Vercel, add `serverExternalPackages: ["@mastra/*"]` to your `next.config.ts`:
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
```typescript {4} title="next.config.ts" showLineNumbers copy
|
|
23
|
+
```typescript {4} title="next.config.ts"
|
|
22
24
|
import type { NextConfig } from "next";
|
|
23
25
|
|
|
24
26
|
const nextConfig: NextConfig = {
|
|
@@ -30,16 +32,13 @@ export default nextConfig;
|
|
|
30
32
|
|
|
31
33
|
## With Astro on Vercel
|
|
32
34
|
|
|
33
|
-
If you've integrated Mastra with Astro [by following our guide](/guides/v1/getting-started/astro) and plan to deploy to Vercel,
|
|
34
|
-
|
|
35
|
-
The only thing to verify is that you've added the following to your `astro.config.mjs` and removed any usage of [LibSQLStore](/docs/v1/deployment/overview), which is not supported in serverless environments:
|
|
35
|
+
If you've integrated Mastra with Astro [by following our guide](/guides/v1/getting-started/astro) and plan to deploy to Vercel, add the Vercel adapter and server output to your `astro.config.mjs`:
|
|
36
36
|
|
|
37
|
-
```javascript {2,6
|
|
37
|
+
```javascript {2,5-6} title="astro.config.mjs"
|
|
38
38
|
import { defineConfig } from "astro/config";
|
|
39
39
|
import vercel from "@astrojs/vercel";
|
|
40
40
|
|
|
41
41
|
export default defineConfig({
|
|
42
|
-
// ...
|
|
43
42
|
adapter: vercel(),
|
|
44
43
|
output: "server",
|
|
45
44
|
});
|
|
@@ -47,16 +46,13 @@ export default defineConfig({
|
|
|
47
46
|
|
|
48
47
|
## With Astro on Netlify
|
|
49
48
|
|
|
50
|
-
If you've integrated Mastra with Astro [by following our guide](/guides/v1/getting-started/astro) and plan to deploy to Netlify,
|
|
51
|
-
|
|
52
|
-
The only thing to verify is that you've added the following to your `astro.config.mjs` and removed any usage of [LibSQLStore](/docs/v1/deployment/overview), which is not supported in serverless environments:
|
|
49
|
+
If you've integrated Mastra with Astro [by following our guide](/guides/v1/getting-started/astro) and plan to deploy to Netlify, add the Netlify adapter and server output to your `astro.config.mjs`:
|
|
53
50
|
|
|
54
|
-
```javascript {2,6
|
|
51
|
+
```javascript {2,5-6} title="astro.config.mjs"
|
|
55
52
|
import { defineConfig } from "astro/config";
|
|
56
53
|
import netlify from "@astrojs/netlify";
|
|
57
54
|
|
|
58
55
|
export default defineConfig({
|
|
59
|
-
// ...
|
|
60
56
|
adapter: netlify(),
|
|
61
57
|
output: "server",
|
|
62
58
|
});
|
|
@@ -65,7 +65,6 @@ For type safety and compatibility with both live agent scoring and trace scoring
|
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
67
|
const myScorer = createScorer({
|
|
68
|
-
// ...
|
|
69
68
|
type: "agent", // Automatically handles agent input/output types
|
|
70
69
|
}).generateScore(({ run, results }) => {
|
|
71
70
|
// run.output is automatically typed as ScorerRunOutputForAgent
|
|
@@ -241,9 +240,13 @@ A custom scorer in Mastra uses `createScorer` with four core components:
|
|
|
241
240
|
|
|
242
241
|
Together, these components allow you to define custom evaluation logic using LLMs as judges.
|
|
243
242
|
|
|
244
|
-
|
|
243
|
+
:::info
|
|
245
244
|
|
|
246
|
-
|
|
245
|
+
Visit [createScorer](/reference/v1/evals/create-scorer) for the full API and configuration options.
|
|
246
|
+
|
|
247
|
+
:::
|
|
248
|
+
|
|
249
|
+
```typescript title="src/mastra/scorers/gluten-checker.ts"
|
|
247
250
|
import { createScorer } from "@mastra/core/evals";
|
|
248
251
|
import { z } from "zod";
|
|
249
252
|
|
|
@@ -399,7 +402,7 @@ The reason generation step creates explanations that help users understand why a
|
|
|
399
402
|
|
|
400
403
|
## High gluten-free example
|
|
401
404
|
|
|
402
|
-
```typescript title="src/example-high-gluten-free.ts"
|
|
405
|
+
```typescript title="src/example-high-gluten-free.ts"
|
|
403
406
|
const result = await glutenCheckerScorer.run({
|
|
404
407
|
input: [{ role: 'user', content: 'Mix rice, beans, and vegetables' }],
|
|
405
408
|
output: { text: 'Mix rice, beans, and vegetables' },
|
|
@@ -425,7 +428,7 @@ console.log('Reason:', result.reason);
|
|
|
425
428
|
|
|
426
429
|
## Partial gluten example
|
|
427
430
|
|
|
428
|
-
```typescript title="src/example-partial-gluten.ts"
|
|
431
|
+
```typescript title="src/example-partial-gluten.ts"
|
|
429
432
|
const result = await glutenCheckerScorer.run({
|
|
430
433
|
input: [{ role: "user", content: "Mix flour and water to make dough" }],
|
|
431
434
|
output: { text: "Mix flour and water to make dough" },
|
|
@@ -451,7 +454,7 @@ console.log("Reason:", result.reason);
|
|
|
451
454
|
|
|
452
455
|
## Low gluten-free example
|
|
453
456
|
|
|
454
|
-
```typescript title="src/example-low-gluten-free.ts"
|
|
457
|
+
```typescript title="src/example-low-gluten-free.ts"
|
|
455
458
|
const result = await glutenCheckerScorer.run({
|
|
456
459
|
input: [{ role: "user", content: "Add soy sauce and noodles" }],
|
|
457
460
|
output: { text: "Add soy sauce and noodles" },
|
|
@@ -23,7 +23,7 @@ There are different kinds of scorers, each serving a specific purpose. Here are
|
|
|
23
23
|
|
|
24
24
|
To access Mastra's scorers feature install the `@mastra/evals` package.
|
|
25
25
|
|
|
26
|
-
```bash
|
|
26
|
+
```bash
|
|
27
27
|
npm install @mastra/evals@beta
|
|
28
28
|
```
|
|
29
29
|
|
|
@@ -35,7 +35,7 @@ npm install @mastra/evals@beta
|
|
|
35
35
|
|
|
36
36
|
You can add built-in scorers to your agents to automatically evaluate their outputs. See the [full list of built-in scorers](/docs/v1/evals/built-in-scorers) for all available options.
|
|
37
37
|
|
|
38
|
-
```typescript title="src/mastra/agents/evaluated-agent.ts"
|
|
38
|
+
```typescript title="src/mastra/agents/evaluated-agent.ts"
|
|
39
39
|
import { Agent } from "@mastra/core/agent";
|
|
40
40
|
import {
|
|
41
41
|
createAnswerRelevancyScorer,
|
|
@@ -43,7 +43,6 @@ import {
|
|
|
43
43
|
} from "@mastra/evals/scorers/prebuilt";
|
|
44
44
|
|
|
45
45
|
export const evaluatedAgent = new Agent({
|
|
46
|
-
// ...
|
|
47
46
|
scorers: {
|
|
48
47
|
relevancy: {
|
|
49
48
|
scorer: createAnswerRelevancyScorer({ model: "openai/gpt-4.1-nano" }),
|
|
@@ -61,13 +60,12 @@ export const evaluatedAgent = new Agent({
|
|
|
61
60
|
|
|
62
61
|
You can also add scorers to individual workflow steps to evaluate outputs at specific points in your process:
|
|
63
62
|
|
|
64
|
-
```typescript title="src/mastra/workflows/content-generation.ts"
|
|
63
|
+
```typescript title="src/mastra/workflows/content-generation.ts"
|
|
65
64
|
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
66
65
|
import { z } from "zod";
|
|
67
66
|
import { customStepScorer } from "../scorers/custom-step-scorer";
|
|
68
67
|
|
|
69
68
|
const contentStep = createStep({
|
|
70
|
-
// ...
|
|
71
69
|
scorers: {
|
|
72
70
|
customStepScorer: {
|
|
73
71
|
scorer: customStepScorer(),
|
|
@@ -115,7 +113,6 @@ To score traces, you first need to register your scorers with your Mastra instan
|
|
|
115
113
|
|
|
116
114
|
```typescript
|
|
117
115
|
const mastra = new Mastra({
|
|
118
|
-
// ...
|
|
119
116
|
scorers: {
|
|
120
117
|
answerRelevancy: myAnswerRelevancyScorer,
|
|
121
118
|
responseQuality: myResponseQualityScorer,
|
|
@@ -15,7 +15,7 @@ You can use any testing framework that supports ESM modules, such as [Vitest](ht
|
|
|
15
15
|
|
|
16
16
|
Use `runEvals` to evaluate your agent against multiple test cases. The function accepts an array of data items, each containing an `input` and optional `groundTruth` for scorer validation.
|
|
17
17
|
|
|
18
|
-
```typescript
|
|
18
|
+
```typescript title="src/mastra/agents/weather-agent.test.ts"
|
|
19
19
|
import { describe, it, expect } from 'vitest';
|
|
20
20
|
import { createScorer, runEvals } from "@mastra/core/evals";
|
|
21
21
|
import { weatherAgent } from "./weather-agent";
|
|
@@ -72,7 +72,7 @@ The `runEvals` function returns an object with:
|
|
|
72
72
|
|
|
73
73
|
Create separate test cases for different evaluation scenarios:
|
|
74
74
|
|
|
75
|
-
```typescript
|
|
75
|
+
```typescript title="src/mastra/agents/weather-agent.test.ts"
|
|
76
76
|
describe('Weather Agent Tests', () => {
|
|
77
77
|
const locationScorer = createScorer({ /* ... */ });
|
|
78
78
|
|
|
@@ -22,7 +22,7 @@ If you prefer not to use our automatic CLI tool, you can set up your project you
|
|
|
22
22
|
|
|
23
23
|
Create a new project and change directory:
|
|
24
24
|
|
|
25
|
-
```bash
|
|
25
|
+
```bash
|
|
26
26
|
mkdir my-first-agent && cd my-first-agent
|
|
27
27
|
```
|
|
28
28
|
|
|
@@ -31,7 +31,7 @@ Initialize a TypeScript project and install the following dependencies:
|
|
|
31
31
|
<Tabs>
|
|
32
32
|
<TabItem value="npm" label="npm">
|
|
33
33
|
|
|
34
|
-
```bash
|
|
34
|
+
```bash
|
|
35
35
|
npm init -y
|
|
36
36
|
npm install -D typescript @types/node mastra@beta
|
|
37
37
|
npm install @mastra/core@beta zod@^4
|
|
@@ -40,7 +40,7 @@ npm install @mastra/core@beta zod@^4
|
|
|
40
40
|
</TabItem>
|
|
41
41
|
<TabItem value="pnpm" label="pnpm">
|
|
42
42
|
|
|
43
|
-
```bash
|
|
43
|
+
```bash
|
|
44
44
|
pnpm init
|
|
45
45
|
pnpm add -D typescript @types/node mastra@beta
|
|
46
46
|
pnpm add @mastra/core@beta zod@^4
|
|
@@ -49,7 +49,7 @@ pnpm add @mastra/core@beta zod@^4
|
|
|
49
49
|
</TabItem>
|
|
50
50
|
<TabItem value="yarn" label="yarn">
|
|
51
51
|
|
|
52
|
-
```bash
|
|
52
|
+
```bash
|
|
53
53
|
yarn init -y
|
|
54
54
|
yarn add -D typescript @types/node mastra@beta
|
|
55
55
|
yarn add @mastra/core@beta zod@^4
|
|
@@ -58,7 +58,7 @@ yarn add @mastra/core@beta zod@^4
|
|
|
58
58
|
</TabItem>
|
|
59
59
|
<TabItem value="bun" label="bun">
|
|
60
60
|
|
|
61
|
-
```bash
|
|
61
|
+
```bash
|
|
62
62
|
bun init -y
|
|
63
63
|
bun add -d typescript @types/node mastra@beta
|
|
64
64
|
bun add @mastra/core@beta zod@^4
|
|
@@ -69,7 +69,7 @@ bun add @mastra/core@beta zod@^4
|
|
|
69
69
|
|
|
70
70
|
Add `dev` and `build` scripts to your `package.json` file:
|
|
71
71
|
|
|
72
|
-
```json title="package.json"
|
|
72
|
+
```json title="package.json" /,/ /"dev": "mastra dev",/ /"build": "mastra build"/
|
|
73
73
|
{
|
|
74
74
|
"scripts": {
|
|
75
75
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -85,13 +85,13 @@ Add `dev` and `build` scripts to your `package.json` file:
|
|
|
85
85
|
|
|
86
86
|
Create a `tsconfig.json` file:
|
|
87
87
|
|
|
88
|
-
```bash
|
|
88
|
+
```bash
|
|
89
89
|
touch tsconfig.json
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
Add the following configuration:
|
|
93
93
|
|
|
94
|
-
```json title="tsconfig.json"
|
|
94
|
+
```json title="tsconfig.json"
|
|
95
95
|
{
|
|
96
96
|
"compilerOptions": {
|
|
97
97
|
"target": "ES2022",
|
|
@@ -120,13 +120,13 @@ Mastra requires modern `module` and `moduleResolution` settings. Using `CommonJS
|
|
|
120
120
|
|
|
121
121
|
Create an `.env` file:
|
|
122
122
|
|
|
123
|
-
```bash
|
|
123
|
+
```bash
|
|
124
124
|
touch .env
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
Add your API key:
|
|
128
128
|
|
|
129
|
-
```bash title=".env"
|
|
129
|
+
```bash title=".env"
|
|
130
130
|
GOOGLE_GENERATIVE_AI_API_KEY=<your-api-key>
|
|
131
131
|
```
|
|
132
132
|
|
|
@@ -142,13 +142,13 @@ This guide uses Google Gemini, but you can use any supported [model provider](/m
|
|
|
142
142
|
|
|
143
143
|
Create a `weather-tool.ts` file:
|
|
144
144
|
|
|
145
|
-
```bash
|
|
145
|
+
```bash
|
|
146
146
|
mkdir -p src/mastra/tools && touch src/mastra/tools/weather-tool.ts
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
Add the following code:
|
|
150
150
|
|
|
151
|
-
```ts title="src/mastra/tools/weather-tool.ts"
|
|
151
|
+
```ts title="src/mastra/tools/weather-tool.ts"
|
|
152
152
|
import { createTool } from "@mastra/core/tools";
|
|
153
153
|
import { z } from "zod";
|
|
154
154
|
|
|
@@ -181,13 +181,13 @@ We've shortened and simplified the `weatherTool` example here. You can see the c
|
|
|
181
181
|
|
|
182
182
|
Create a `weather-agent.ts` file:
|
|
183
183
|
|
|
184
|
-
```bash
|
|
184
|
+
```bash
|
|
185
185
|
mkdir -p src/mastra/agents && touch src/mastra/agents/weather-agent.ts
|
|
186
186
|
```
|
|
187
187
|
|
|
188
188
|
Add the following code:
|
|
189
189
|
|
|
190
|
-
```ts title="src/mastra/agents/weather-agent.ts"
|
|
190
|
+
```ts title="src/mastra/agents/weather-agent.ts"
|
|
191
191
|
import { Agent } from "@mastra/core/agent";
|
|
192
192
|
import { weatherTool } from "../tools/weather-tool";
|
|
193
193
|
|
|
@@ -217,13 +217,13 @@ export const weatherAgent = new Agent({
|
|
|
217
217
|
|
|
218
218
|
Create the Mastra entry point and register your agent:
|
|
219
219
|
|
|
220
|
-
```bash
|
|
220
|
+
```bash
|
|
221
221
|
touch src/mastra/index.ts
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
Add the following code:
|
|
225
225
|
|
|
226
|
-
```ts title="src/mastra/index.ts"
|
|
226
|
+
```ts title="src/mastra/index.ts"
|
|
227
227
|
import { Mastra } from "@mastra/core";
|
|
228
228
|
import { weatherAgent } from "./agents/weather-agent";
|
|
229
229
|
|
|
@@ -241,28 +241,28 @@ You can now launch [Studio](/docs/v1/getting-started/studio) and test your agent
|
|
|
241
241
|
<Tabs>
|
|
242
242
|
<TabItem value="npm" label="npm">
|
|
243
243
|
|
|
244
|
-
```bash
|
|
244
|
+
```bash
|
|
245
245
|
npm run dev
|
|
246
246
|
```
|
|
247
247
|
|
|
248
248
|
</TabItem>
|
|
249
249
|
<TabItem value="pnpm" label="pnpm">
|
|
250
250
|
|
|
251
|
-
```bash
|
|
251
|
+
```bash
|
|
252
252
|
pnpm run dev
|
|
253
253
|
```
|
|
254
254
|
|
|
255
255
|
</TabItem>
|
|
256
256
|
<TabItem value="yarn" label="yarn">
|
|
257
257
|
|
|
258
|
-
```bash
|
|
258
|
+
```bash
|
|
259
259
|
yarn run dev
|
|
260
260
|
```
|
|
261
261
|
|
|
262
262
|
</TabItem>
|
|
263
263
|
<TabItem value="bun" label="bun">
|
|
264
264
|
|
|
265
|
-
```bash
|
|
265
|
+
```bash
|
|
266
266
|
bun run dev
|
|
267
267
|
```
|
|
268
268
|
|
|
@@ -25,7 +25,7 @@ During the interactive [create-mastra](/reference/v1/cli/create-mastra) wizard,
|
|
|
25
25
|
|
|
26
26
|
If there are no specific instructions for your tool below, you may be able to add the MCP server with this common JSON configuration anyways.
|
|
27
27
|
|
|
28
|
-
```json
|
|
28
|
+
```json
|
|
29
29
|
{
|
|
30
30
|
"mcpServers": {
|
|
31
31
|
"mastra": {
|
|
@@ -41,7 +41,7 @@ If there are no specific instructions for your tool below, you may be able to ad
|
|
|
41
41
|
|
|
42
42
|
Install using the terminal command:
|
|
43
43
|
|
|
44
|
-
```bash
|
|
44
|
+
```bash
|
|
45
45
|
claude mcp add mastra -- npx -y @mastra/mcp-docs-server@beta
|
|
46
46
|
```
|
|
47
47
|
|
|
@@ -6,6 +6,7 @@ description: Choose how to get started with Mastra - quickstart, framework integ
|
|
|
6
6
|
import { CardGrid, CardGridItem } from "@site/src/components/cards/card-grid";
|
|
7
7
|
|
|
8
8
|
# Start
|
|
9
|
+
|
|
9
10
|
Create a new Mastra project, or integrate Mastra with your preferred framework to start building.
|
|
10
11
|
|
|
11
12
|
## New project
|
|
@@ -62,11 +63,19 @@ Integrate Mastra with SvelteKit
|
|
|
62
63
|
href="/guides/v1/getting-started/express"
|
|
63
64
|
logo={<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 861.6297 500" width="32" height="32"><path d="M822.05434 464.78529c-23.57102 8.91305-50.08664-1.16881-61.78139-23.49073l-112.4692-155.53981-16.30803-21.72701-130.51543 177.49688c-11.00437 21.35391-36.14786 31.22309-58.7396 23.05618l168.14149-225.57746L453.94772 35.178469c23.20955-8.38407 49.07747.715704 61.98587 21.727011l116.55901 157.4569L749.74175 57.518928c11.0937-21.002063 36.16603-30.356097 58.30506-21.752557l-60.70782 80.543289-82.23033 107.02469c-9.6735 8.63851-9.6735 23.77308 0 32.41158l156.61338 209.03936ZM39.626477 236.19163l13.700796-67.66046C90.953337 34.743916 244.32044-20.928337 349.83703 61.941017 411.61839 110.45615 427.0318 179.1902 424.01558 256.64057H75.94892C70.325459 394.9777 170.14188 478.51165 297.82 435.87559c42.0737-15.33669 73.74401-50.3044 84.17297-93.75842 6.74816-21.72701 17.89283-25.45896 38.29067-19.1709-6.89256 53.65922-37.9963 101.20027-84.40304 129.00732-77.62638 42.45286-173.75024 30.1679-238.204672-30.44338-31.082401-34.94215-49.844311-79.11186-53.49956-125.76104 0-7.66837-2.556118-14.82549-4.345401-21.727-.170408-12.89987-.255612-25.51006-.255612-37.83054zm36.756986-9.35539H391.14389c-1.96821-100.27654-65.2577-171.413323-149.66074-172.077907C147.52023 53.480264 80.294322 123.05782 76.153409 226.40169Z" fill="currentColor"/></svg>}
|
|
64
65
|
>
|
|
65
|
-
|
|
66
|
+
Integrate Mastra with the Express server adapter
|
|
67
|
+
</CardGridItem>
|
|
68
|
+
<CardGridItem
|
|
69
|
+
title="Hono"
|
|
70
|
+
href="/guides/v1/getting-started/hono"
|
|
71
|
+
logo={<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 98" width="32" height="32"><path fill="url(#a)" d="m11 25 7 9s9-18 22-34c17 20 36 48 36 64 0 20-19 34-37 34C17 98 0 81 0 61c0-6 3-24 11-36Z"/><path fill="#F95" d="M39 21c47 51 14 66 0 66-11 0-51-11 0-66Z"/><defs><linearGradient id="a" x2="0%" y2="100%"><stop stop-color="#F84"/><stop offset="100%" stop-color="#F30"/></linearGradient></defs></svg>}
|
|
72
|
+
>
|
|
73
|
+
Integrate Mastra with the Hono server adapter
|
|
66
74
|
</CardGridItem>
|
|
67
75
|
</CardGrid>
|
|
68
76
|
|
|
69
77
|
Mastra works great with agentic UI frameworks like [AI SDK UI](/guides/v1/build-your-ui/ai-sdk-ui), [CopilotKit](/guides/v1/build-your-ui/copilotkit), and [Assistant UI](/guides/v1/build-your-ui/assistant-ui). Use them with any of the frontend frameworks above to stream agent responses, render tools, and build chat interfaces.
|
|
70
78
|
|
|
71
79
|
## Start from a template
|
|
80
|
+
|
|
72
81
|
Have a use case in mind? Start with a pre-built [template](https://mastra.ai/templates) from Mastra or our community.
|
|
@@ -101,7 +101,7 @@ The Scorers tab displays the results of your agent's scorers as they run. When m
|
|
|
101
101
|
|
|
102
102
|
## REST API
|
|
103
103
|
|
|
104
|
-
The local development server exposes a complete set of REST API routes, allowing you to programmatically interact with your agents, workflows, and tools during development. This is particularly helpful if you plan to deploy the Mastra server, since the local development server uses the exact same API routes as the [Mastra Server](/docs/v1/server
|
|
104
|
+
The local development server exposes a complete set of REST API routes, allowing you to programmatically interact with your agents, workflows, and tools during development. This is particularly helpful if you plan to deploy the Mastra server, since the local development server uses the exact same API routes as the [Mastra Server](/docs/v1/server/mastra-server), allowing you to develop and test against it with full parity.
|
|
105
105
|
|
|
106
106
|
You can explore all available endpoints in the OpenAPI specification at http://localhost:4111/openapi.json, which details every endpoint and its request and response schemas.
|
|
107
107
|
|
|
@@ -49,7 +49,7 @@ Install `@mastra/ai-sdk` to begin using the `withMastra()` function.
|
|
|
49
49
|
|
|
50
50
|
Processors let you transform messages before they're sent to the model (`processInput`) and after responses are received (`processOutputResult`). This example creates a logging processor that logs message counts at each stage, then wraps an OpenAI model with it.
|
|
51
51
|
|
|
52
|
-
```typescript title="src/example.ts"
|
|
52
|
+
```typescript title="src/example.ts"
|
|
53
53
|
import { openai } from '@ai-sdk/openai';
|
|
54
54
|
import { generateText } from 'ai';
|
|
55
55
|
import { withMastra } from '@mastra/ai-sdk';
|
|
@@ -80,9 +80,9 @@ const { text } = await generateText({
|
|
|
80
80
|
|
|
81
81
|
### With Memory
|
|
82
82
|
|
|
83
|
-
Memory automatically loads previous messages from storage before the LLM call and saves new messages after. This example configures a
|
|
83
|
+
Memory automatically loads previous messages from storage before the LLM call and saves new messages after. This example configures a libSQL storage backend to persist conversation history, loading the last 10 messages for context.
|
|
84
84
|
|
|
85
|
-
```typescript title="src/memory-example.ts"
|
|
85
|
+
```typescript title="src/memory-example.ts"
|
|
86
86
|
import { openai } from '@ai-sdk/openai';
|
|
87
87
|
import { generateText } from 'ai';
|
|
88
88
|
import { withMastra } from '@mastra/ai-sdk';
|
|
@@ -113,7 +113,7 @@ const { text } = await generateText({
|
|
|
113
113
|
|
|
114
114
|
You can combine processors and memory together. Input processors run after memory loads historical messages, and output processors run before memory saves the response.
|
|
115
115
|
|
|
116
|
-
```typescript title="src/combined-example.ts"
|
|
116
|
+
```typescript title="src/combined-example.ts"
|
|
117
117
|
import { openai } from '@ai-sdk/openai';
|
|
118
118
|
import { generateText } from 'ai';
|
|
119
119
|
import { withMastra } from '@mastra/ai-sdk';
|