@mastra/mcp-docs-server 0.13.39-alpha.0 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/changelogs/%40internal%2Fai-sdk-v4.md +1 -0
- package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +0 -8
- package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +0 -8
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +29 -29
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +0 -8
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +70 -70
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fauth.md +4 -8
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +199 -199
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +223 -223
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +189 -189
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +198 -198
- package/.docs/organized/changelogs/%40mastra%2Fcodemod.md +7 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +214 -214
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +63 -63
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +57 -57
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +60 -60
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +57 -57
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +209 -209
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +191 -191
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +38 -38
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +5 -7
- package/.docs/organized/changelogs/%40mastra%2Flance.md +186 -186
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +199 -199
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +53 -53
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +69 -69
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +221 -221
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +199 -199
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +206 -206
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +197 -197
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +218 -218
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Frag.md +65 -65
- package/.docs/organized/changelogs/%40mastra%2Freact.md +61 -61
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +10 -9
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -24
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +206 -206
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +191 -191
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +58 -58
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +56 -56
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +11 -11
- package/.docs/organized/changelogs/create-mastra.md +27 -27
- package/.docs/organized/changelogs/mastra.md +87 -87
- package/.docs/organized/code-examples/a2a.md +4 -2
- package/.docs/organized/code-examples/agui.md +12 -9
- package/.docs/organized/code-examples/ai-sdk-useChat.md +12 -18
- package/.docs/organized/code-examples/ai-sdk-v5.md +4 -2
- package/.docs/organized/code-examples/bird-checker-with-express.md +5 -4
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +4 -3
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +4 -3
- package/.docs/organized/code-examples/client-side-tools.md +1 -0
- package/.docs/organized/code-examples/crypto-chatbot.md +1 -1
- package/.docs/organized/code-examples/experimental-auth-weather-agent.md +8 -177
- package/.docs/organized/code-examples/fireworks-r1.md +2 -2
- package/.docs/organized/code-examples/heads-up-game.md +10 -7
- package/.docs/organized/code-examples/mcp-configuration.md +5 -3
- package/.docs/organized/code-examples/mcp-registry-registry.md +3 -2
- package/.docs/organized/code-examples/memory-per-resource-example.md +4 -2
- package/.docs/organized/code-examples/memory-todo-agent.md +1 -0
- package/.docs/organized/code-examples/memory-with-context.md +2 -1
- package/.docs/organized/code-examples/memory-with-libsql.md +4 -2
- package/.docs/organized/code-examples/memory-with-mongodb.md +4 -2
- package/.docs/organized/code-examples/memory-with-pg.md +4 -2
- package/.docs/organized/code-examples/memory-with-processors.md +13 -8
- package/.docs/organized/code-examples/memory-with-upstash.md +5 -3
- package/.docs/organized/code-examples/openapi-spec-writer.md +32 -41
- package/.docs/organized/code-examples/quick-start.md +5 -32
- package/.docs/organized/code-examples/stock-price-tool.md +6 -5
- package/.docs/organized/code-examples/weather-agent.md +21 -16
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +3 -2
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +9 -12
- package/.docs/organized/code-examples/workflow-with-memory.md +16 -15
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +2 -2
- package/.docs/organized/code-examples/workflow-with-suspend-resume.md +3 -2
- package/.docs/raw/agents/adding-voice.mdx +27 -22
- package/.docs/raw/agents/agent-memory.mdx +23 -15
- package/.docs/raw/agents/guardrails.mdx +33 -12
- package/.docs/raw/agents/networks.mdx +8 -4
- package/.docs/raw/agents/overview.mdx +21 -15
- package/.docs/raw/agents/using-tools.mdx +11 -8
- package/.docs/raw/auth/auth0.mdx +8 -8
- package/.docs/raw/auth/clerk.mdx +6 -6
- package/.docs/raw/auth/firebase.mdx +8 -8
- package/.docs/raw/auth/index.mdx +6 -6
- package/.docs/raw/auth/jwt.mdx +6 -6
- package/.docs/raw/auth/supabase.mdx +7 -7
- package/.docs/raw/auth/workos.mdx +8 -8
- package/.docs/raw/community/contributing-templates.mdx +3 -3
- package/.docs/raw/community/discord.mdx +1 -1
- package/.docs/raw/course/01-first-agent/08-exporting-your-agent.md +2 -1
- package/.docs/raw/course/01-first-agent/16-adding-memory-to-agent.md +2 -1
- package/.docs/raw/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +2 -0
- package/.docs/raw/course/03-agent-memory/04-creating-basic-memory-agent.md +1 -0
- package/.docs/raw/course/03-agent-memory/10-storage-configuration.md +2 -3
- package/.docs/raw/course/03-agent-memory/13-vector-store-configuration.md +2 -0
- package/.docs/raw/course/03-agent-memory/16-configuring-semantic-recall.md +2 -0
- package/.docs/raw/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +1 -0
- package/.docs/raw/course/03-agent-memory/21-configuring-working-memory.md +2 -0
- package/.docs/raw/course/03-agent-memory/22-custom-working-memory-templates.md +1 -0
- package/.docs/raw/course/03-agent-memory/25-combining-memory-features.md +1 -0
- package/.docs/raw/course/03-agent-memory/27-creating-learning-assistant.md +1 -0
- package/.docs/raw/course/04-workflows/08-running-workflows-programmatically.md +2 -2
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +5 -5
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +7 -5
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +3 -3
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +4 -4
- package/.docs/raw/deployment/cloud-providers/index.mdx +11 -8
- package/.docs/raw/deployment/monorepo.mdx +2 -2
- package/.docs/raw/deployment/overview.mdx +2 -2
- package/.docs/raw/deployment/server-deployment.mdx +2 -10
- package/.docs/raw/deployment/serverless-platforms/cloudflare-deployer.mdx +4 -4
- package/.docs/raw/deployment/serverless-platforms/index.mdx +10 -7
- package/.docs/raw/deployment/serverless-platforms/netlify-deployer.mdx +4 -4
- package/.docs/raw/deployment/serverless-platforms/vercel-deployer.mdx +4 -4
- package/.docs/raw/deployment/web-framework.mdx +8 -8
- package/.docs/raw/{scorers → evals}/custom-scorers.mdx +6 -6
- package/.docs/raw/evals/off-the-shelf-scorers.mdx +50 -0
- package/.docs/raw/{scorers → evals}/overview.mdx +8 -8
- package/.docs/raw/evals/running-in-ci.mdx +113 -0
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +22 -21
- package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +8 -8
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +3 -0
- package/.docs/raw/frameworks/servers/express.mdx +10 -9
- package/.docs/raw/frameworks/web-frameworks/astro.mdx +6 -6
- package/.docs/raw/frameworks/web-frameworks/next-js.mdx +3 -3
- package/.docs/raw/frameworks/web-frameworks/sveltekit.mdx +4 -4
- package/.docs/raw/frameworks/web-frameworks/vite-react.mdx +2 -2
- package/.docs/raw/getting-started/installation.mdx +13 -12
- package/.docs/raw/getting-started/mcp-docs-server.mdx +1 -1
- package/.docs/raw/getting-started/project-structure.mdx +4 -4
- package/.docs/raw/getting-started/studio.mdx +8 -8
- package/.docs/raw/getting-started/templates.mdx +1 -1
- package/.docs/raw/guides/guide/ai-recruiter.mdx +264 -0
- package/.docs/raw/guides/guide/chef-michel.mdx +271 -0
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +450 -0
- package/.docs/raw/guides/guide/research-assistant.mdx +389 -0
- package/.docs/raw/guides/guide/stock-agent.mdx +185 -0
- package/.docs/raw/guides/guide/web-search.mdx +291 -0
- package/.docs/raw/guides/index.mdx +43 -0
- package/.docs/raw/guides/migrations/agentnetwork.mdx +114 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/_template.mdx +50 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +265 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/cli.mdx +48 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/client.mdx +153 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/evals.mdx +230 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/mastra.mdx +171 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/mcp.mdx +114 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/memory.mdx +241 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/overview.mdx +83 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/processors.mdx +62 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +270 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +115 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tracing.mdx +280 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/vectors.mdx +23 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/voice.mdx +39 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +178 -0
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +367 -0
- package/.docs/raw/index.mdx +9 -9
- package/.docs/raw/{observability/logging.mdx → logging.mdx} +4 -4
- package/.docs/raw/mastra-cloud/dashboard.mdx +2 -2
- package/.docs/raw/mastra-cloud/observability.mdx +6 -6
- package/.docs/raw/mastra-cloud/overview.mdx +2 -2
- package/.docs/raw/mastra-cloud/setting-up.mdx +4 -4
- package/.docs/raw/memory/conversation-history.mdx +1 -0
- package/.docs/raw/memory/memory-processors.mdx +4 -3
- package/.docs/raw/memory/overview.mdx +9 -5
- package/.docs/raw/memory/semantic-recall.mdx +12 -7
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +10 -5
- package/.docs/raw/memory/storage/memory-with-pg.mdx +9 -4
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +9 -4
- package/.docs/raw/memory/threads-and-resources.mdx +11 -13
- package/.docs/raw/memory/working-memory.mdx +30 -14
- package/.docs/raw/observability/overview.mdx +13 -30
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/arize.mdx +10 -18
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/braintrust.mdx +7 -16
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/cloud.mdx +11 -17
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/default.mdx +16 -20
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/langfuse.mdx +7 -16
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/langsmith.mdx +7 -16
- package/.docs/raw/observability/{ai-tracing → tracing}/exporters/otel.mdx +9 -18
- package/.docs/raw/observability/{ai-tracing → tracing}/overview.mdx +107 -142
- package/.docs/raw/observability/{ai-tracing → tracing}/processors/sensitive-data-filter.mdx +14 -13
- package/.docs/raw/rag/chunking-and-embedding.mdx +5 -5
- package/.docs/raw/rag/overview.mdx +3 -13
- package/.docs/raw/rag/retrieval.mdx +24 -12
- package/.docs/raw/rag/vector-databases.mdx +7 -1
- package/.docs/raw/reference/agents/agent.mdx +33 -28
- package/.docs/raw/reference/agents/generate.mdx +10 -10
- package/.docs/raw/reference/agents/generateLegacy.mdx +8 -8
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +21 -15
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +69 -0
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +22 -16
- package/.docs/raw/reference/agents/getDescription.mdx +1 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +8 -8
- package/.docs/raw/reference/agents/getLLM.mdx +9 -9
- package/.docs/raw/reference/agents/getMemory.mdx +9 -9
- package/.docs/raw/reference/agents/getModel.mdx +10 -10
- package/.docs/raw/reference/agents/getVoice.mdx +8 -8
- package/.docs/raw/reference/agents/listAgents.mdx +9 -9
- package/.docs/raw/reference/agents/listScorers.mdx +7 -7
- package/.docs/raw/reference/agents/listTools.mdx +7 -7
- package/.docs/raw/reference/agents/listWorkflows.mdx +7 -7
- package/.docs/raw/reference/agents/network.mdx +11 -10
- package/.docs/raw/reference/auth/auth0.mdx +4 -4
- package/.docs/raw/reference/auth/clerk.mdx +4 -4
- package/.docs/raw/reference/auth/firebase.mdx +6 -6
- package/.docs/raw/reference/auth/jwt.mdx +4 -4
- package/.docs/raw/reference/auth/supabase.mdx +4 -4
- package/.docs/raw/reference/auth/workos.mdx +4 -4
- package/.docs/raw/reference/cli/mastra.mdx +7 -7
- package/.docs/raw/reference/client-js/agents.mdx +6 -2
- package/.docs/raw/reference/client-js/mastra-client.mdx +7 -7
- package/.docs/raw/reference/client-js/memory.mdx +24 -16
- package/.docs/raw/reference/client-js/observability.mdx +11 -11
- package/.docs/raw/reference/client-js/workflows.mdx +6 -34
- package/.docs/raw/reference/core/getAgent.mdx +1 -1
- package/.docs/raw/reference/core/getAgentById.mdx +1 -1
- package/.docs/raw/reference/core/getDeployer.mdx +2 -2
- package/.docs/raw/reference/core/getLogger.mdx +2 -2
- package/.docs/raw/reference/core/getMCPServer.mdx +31 -15
- package/.docs/raw/reference/core/getMCPServerById.mdx +81 -0
- package/.docs/raw/reference/core/getScorer.mdx +3 -3
- package/.docs/raw/reference/core/getScorerById.mdx +79 -0
- package/.docs/raw/reference/core/getServer.mdx +2 -2
- package/.docs/raw/reference/core/getStorage.mdx +2 -2
- package/.docs/raw/reference/core/getTelemetry.mdx +2 -2
- package/.docs/raw/reference/core/getVector.mdx +2 -2
- package/.docs/raw/reference/core/getWorkflow.mdx +1 -1
- package/.docs/raw/reference/core/listAgents.mdx +1 -1
- package/.docs/raw/reference/core/listLogs.mdx +2 -2
- package/.docs/raw/reference/core/listLogsByRunId.mdx +2 -2
- package/.docs/raw/reference/core/listMCPServers.mdx +65 -0
- package/.docs/raw/reference/core/listScorers.mdx +3 -3
- package/.docs/raw/reference/core/listVectors.mdx +36 -0
- package/.docs/raw/reference/core/listWorkflows.mdx +6 -6
- package/.docs/raw/reference/core/mastra-class.mdx +3 -2
- package/.docs/raw/reference/core/setLogger.mdx +2 -2
- package/.docs/raw/reference/core/setStorage.mdx +3 -2
- package/.docs/raw/reference/core/setTelemetry.mdx +2 -2
- package/.docs/raw/reference/deployer/cloudflare.mdx +2 -2
- package/.docs/raw/reference/deployer/deployer.mdx +0 -6
- package/.docs/raw/reference/deployer/netlify.mdx +2 -2
- package/.docs/raw/reference/deployer/vercel.mdx +3 -3
- package/.docs/raw/reference/evals/answer-relevancy.mdx +164 -126
- package/.docs/raw/reference/{scorers → evals}/answer-similarity.mdx +27 -27
- package/.docs/raw/reference/evals/bias.mdx +149 -115
- package/.docs/raw/reference/evals/completeness.mdx +148 -117
- package/.docs/raw/reference/evals/content-similarity.mdx +126 -113
- package/.docs/raw/reference/evals/context-precision.mdx +290 -133
- package/.docs/raw/reference/{scorers → evals}/context-relevance.mdx +6 -6
- package/.docs/raw/reference/{scorers → evals}/create-scorer.mdx +11 -11
- package/.docs/raw/reference/evals/faithfulness.mdx +163 -121
- package/.docs/raw/reference/evals/hallucination.mdx +159 -132
- package/.docs/raw/reference/evals/keyword-coverage.mdx +169 -125
- package/.docs/raw/reference/{scorers → evals}/mastra-scorer.mdx +5 -5
- package/.docs/raw/reference/{scorers → evals}/noise-sensitivity.mdx +9 -9
- package/.docs/raw/reference/evals/prompt-alignment.mdx +604 -182
- package/.docs/raw/reference/{scorers/run-experiment.mdx → evals/run-evals.mdx} +17 -18
- package/.docs/raw/reference/evals/textual-difference.mdx +149 -117
- package/.docs/raw/reference/evals/tone-consistency.mdx +149 -125
- package/.docs/raw/reference/{scorers → evals}/tool-call-accuracy.mdx +8 -6
- package/.docs/raw/reference/evals/toxicity.mdx +152 -96
- package/.docs/raw/reference/{observability/logging → logging}/pino-logger.mdx +2 -2
- package/.docs/raw/reference/memory/createThread.mdx +5 -5
- package/.docs/raw/reference/memory/deleteMessages.mdx +7 -7
- package/.docs/raw/reference/memory/getThreadById.mdx +4 -4
- package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +110 -0
- package/.docs/raw/reference/memory/memory-class.mdx +13 -9
- package/.docs/raw/reference/memory/query.mdx +58 -57
- package/.docs/raw/reference/memory/recall.mdx +185 -0
- package/.docs/raw/reference/observability/tracing/configuration.mdx +245 -0
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/arize.mdx +13 -13
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/braintrust.mdx +11 -8
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/cloud-exporter.mdx +21 -19
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/console-exporter.mdx +49 -17
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/default-exporter.mdx +42 -41
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/langfuse.mdx +10 -7
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/langsmith.mdx +10 -7
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/exporters/otel.mdx +5 -5
- package/.docs/raw/reference/observability/tracing/instances.mdx +168 -0
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/interfaces.mdx +115 -89
- package/.docs/raw/reference/observability/{ai-tracing → tracing}/processors/sensitive-data-filter.mdx +3 -3
- package/.docs/raw/reference/observability/{ai-tracing/span.mdx → tracing/spans.mdx} +59 -41
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +1 -1
- package/.docs/raw/reference/processors/language-detector.mdx +1 -1
- package/.docs/raw/reference/processors/moderation-processor.mdx +1 -1
- package/.docs/raw/reference/processors/pii-detector.mdx +1 -1
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +1 -1
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +1 -1
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +1 -1
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +1 -1
- package/.docs/raw/reference/rag/chunk.mdx +1 -8
- package/.docs/raw/reference/rag/database-config.mdx +7 -7
- package/.docs/raw/reference/rag/metadata-filters.mdx +14 -11
- package/.docs/raw/reference/storage/libsql.mdx +2 -0
- package/.docs/raw/reference/storage/mssql.mdx +5 -0
- package/.docs/raw/reference/storage/postgresql.mdx +6 -0
- package/.docs/raw/reference/storage/upstash.mdx +1 -0
- package/.docs/raw/reference/streaming/agents/stream.mdx +12 -12
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +8 -8
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +3 -3
- package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +3 -3
- package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +6 -6
- package/.docs/raw/reference/streaming/workflows/stream.mdx +10 -10
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +11 -11
- package/.docs/raw/reference/templates/overview.mdx +2 -2
- package/.docs/raw/reference/tools/create-tool.mdx +52 -35
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +15 -15
- package/.docs/raw/reference/tools/mcp-client.mdx +1 -1
- package/.docs/raw/reference/tools/mcp-server.mdx +119 -35
- package/.docs/raw/reference/tools/vector-query-tool.mdx +27 -26
- package/.docs/raw/reference/vectors/libsql.mdx +1 -0
- package/.docs/raw/reference/vectors/pg.mdx +3 -0
- package/.docs/raw/reference/vectors/upstash.mdx +1 -0
- package/.docs/raw/reference/voice/google-gemini-live.mdx +1 -1
- package/.docs/raw/reference/voice/voice.addTools.mdx +3 -3
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +4 -4
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +14 -14
- package/.docs/raw/reference/workflows/run-methods/start.mdx +17 -17
- package/.docs/raw/reference/workflows/run.mdx +1 -8
- package/.docs/raw/reference/workflows/step.mdx +5 -5
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +7 -13
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +5 -0
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow.mdx +1 -1
- package/.docs/raw/server-db/custom-api-routes.mdx +2 -2
- package/.docs/raw/server-db/mastra-client.mdx +19 -18
- package/.docs/raw/server-db/middleware.mdx +7 -7
- package/.docs/raw/server-db/production-server.mdx +4 -4
- package/.docs/raw/server-db/{runtime-context.mdx → request-context.mdx} +46 -45
- package/.docs/raw/server-db/storage.mdx +29 -21
- package/.docs/raw/streaming/events.mdx +3 -3
- package/.docs/raw/streaming/overview.mdx +5 -5
- package/.docs/raw/streaming/tool-streaming.mdx +18 -17
- package/.docs/raw/streaming/workflow-streaming.mdx +1 -1
- package/.docs/raw/tools-mcp/advanced-usage.mdx +5 -4
- package/.docs/raw/tools-mcp/mcp-overview.mdx +32 -19
- package/.docs/raw/tools-mcp/overview.mdx +11 -11
- package/.docs/raw/voice/overview.mdx +63 -43
- package/.docs/raw/voice/speech-to-speech.mdx +5 -3
- package/.docs/raw/voice/speech-to-text.mdx +9 -8
- package/.docs/raw/voice/text-to-speech.mdx +12 -11
- package/.docs/raw/workflows/agents-and-tools.mdx +9 -5
- package/.docs/raw/workflows/control-flow.mdx +3 -3
- package/.docs/raw/workflows/error-handling.mdx +2 -21
- package/.docs/raw/workflows/human-in-the-loop.mdx +7 -4
- package/.docs/raw/workflows/inngest-workflow.mdx +2 -2
- package/.docs/raw/workflows/input-data-mapping.mdx +107 -0
- package/.docs/raw/workflows/overview.mdx +17 -16
- package/.docs/raw/workflows/snapshots.mdx +13 -11
- package/.docs/raw/workflows/suspend-and-resume.mdx +23 -15
- package/CHANGELOG.md +52 -47
- package/README.md +11 -2
- package/dist/{chunk-TUAHUTTB.js → chunk-5NJC7NRO.js} +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
- package/dist/prepare-docs/prepare.js +1 -1
- package/dist/prompts/migration.d.ts +6 -0
- package/dist/prompts/migration.d.ts.map +1 -0
- package/dist/stdio.js +402 -30
- package/dist/tools/migration.d.ts +40 -0
- package/dist/tools/migration.d.ts.map +1 -0
- package/package.json +8 -12
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +0 -302
- package/.docs/raw/observability/nextjs-tracing.mdx +0 -109
- package/.docs/raw/observability/otel-tracing.mdx +0 -189
- package/.docs/raw/reference/agents/getScorers.mdx +0 -69
- package/.docs/raw/reference/agents/getTools.mdx +0 -69
- package/.docs/raw/reference/agents/getWorkflows.mdx +0 -69
- package/.docs/raw/reference/client-js/workflows-legacy.mdx +0 -143
- package/.docs/raw/reference/core/getAgents.mdx +0 -35
- package/.docs/raw/reference/core/getLogs.mdx +0 -96
- package/.docs/raw/reference/core/getLogsByRunId.mdx +0 -87
- package/.docs/raw/reference/core/getMCPServers.mdx +0 -36
- package/.docs/raw/reference/core/getMemory.mdx +0 -36
- package/.docs/raw/reference/core/getScorerByName.mdx +0 -78
- package/.docs/raw/reference/core/getScorers.mdx +0 -43
- package/.docs/raw/reference/core/getVectors.mdx +0 -36
- package/.docs/raw/reference/core/getWorkflows.mdx +0 -45
- package/.docs/raw/reference/evals/context-position.mdx +0 -197
- package/.docs/raw/reference/evals/context-relevancy.mdx +0 -196
- package/.docs/raw/reference/evals/contextual-recall.mdx +0 -196
- package/.docs/raw/reference/evals/summarization.mdx +0 -212
- package/.docs/raw/reference/legacyWorkflows/after.mdx +0 -89
- package/.docs/raw/reference/legacyWorkflows/afterEvent.mdx +0 -79
- package/.docs/raw/reference/legacyWorkflows/commit.mdx +0 -33
- package/.docs/raw/reference/legacyWorkflows/createRun.mdx +0 -76
- package/.docs/raw/reference/legacyWorkflows/else.mdx +0 -68
- package/.docs/raw/reference/legacyWorkflows/events.mdx +0 -305
- package/.docs/raw/reference/legacyWorkflows/execute.mdx +0 -110
- package/.docs/raw/reference/legacyWorkflows/if.mdx +0 -108
- package/.docs/raw/reference/legacyWorkflows/resume.mdx +0 -158
- package/.docs/raw/reference/legacyWorkflows/resumeWithEvent.mdx +0 -133
- package/.docs/raw/reference/legacyWorkflows/snapshots.mdx +0 -207
- package/.docs/raw/reference/legacyWorkflows/start.mdx +0 -87
- package/.docs/raw/reference/legacyWorkflows/step-class.mdx +0 -100
- package/.docs/raw/reference/legacyWorkflows/step-condition.mdx +0 -137
- package/.docs/raw/reference/legacyWorkflows/step-function.mdx +0 -93
- package/.docs/raw/reference/legacyWorkflows/step-options.mdx +0 -69
- package/.docs/raw/reference/legacyWorkflows/step-retries.mdx +0 -196
- package/.docs/raw/reference/legacyWorkflows/suspend.mdx +0 -70
- package/.docs/raw/reference/legacyWorkflows/then.mdx +0 -72
- package/.docs/raw/reference/legacyWorkflows/until.mdx +0 -168
- package/.docs/raw/reference/legacyWorkflows/watch.mdx +0 -124
- package/.docs/raw/reference/legacyWorkflows/while.mdx +0 -168
- package/.docs/raw/reference/legacyWorkflows/workflow.mdx +0 -234
- package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +0 -79
- package/.docs/raw/reference/memory/getThreadsByResourceIdPaginated.mdx +0 -110
- package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +0 -185
- package/.docs/raw/reference/observability/ai-tracing/configuration.mdx +0 -238
- package/.docs/raw/reference/observability/otel-tracing/otel-config.mdx +0 -117
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-ax.mdx +0 -81
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-phoenix.mdx +0 -121
- package/.docs/raw/reference/observability/otel-tracing/providers/braintrust.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/dash0.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/index.mdx +0 -20
- package/.docs/raw/reference/observability/otel-tracing/providers/keywordsai.mdx +0 -73
- package/.docs/raw/reference/observability/otel-tracing/providers/laminar.mdx +0 -41
- package/.docs/raw/reference/observability/otel-tracing/providers/langfuse.mdx +0 -84
- package/.docs/raw/reference/observability/otel-tracing/providers/langsmith.mdx +0 -48
- package/.docs/raw/reference/observability/otel-tracing/providers/langwatch.mdx +0 -43
- package/.docs/raw/reference/observability/otel-tracing/providers/new-relic.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/signoz.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/traceloop.mdx +0 -40
- package/.docs/raw/reference/scorers/answer-relevancy.mdx +0 -227
- package/.docs/raw/reference/scorers/bias.mdx +0 -228
- package/.docs/raw/reference/scorers/completeness.mdx +0 -214
- package/.docs/raw/reference/scorers/content-similarity.mdx +0 -197
- package/.docs/raw/reference/scorers/context-precision.mdx +0 -352
- package/.docs/raw/reference/scorers/faithfulness.mdx +0 -241
- package/.docs/raw/reference/scorers/hallucination.mdx +0 -252
- package/.docs/raw/reference/scorers/keyword-coverage.mdx +0 -229
- package/.docs/raw/reference/scorers/prompt-alignment.mdx +0 -668
- package/.docs/raw/reference/scorers/textual-difference.mdx +0 -203
- package/.docs/raw/reference/scorers/tone-consistency.mdx +0 -211
- package/.docs/raw/reference/scorers/toxicity.mdx +0 -228
- package/.docs/raw/reference/workflows/run-methods/watch.mdx +0 -73
- package/.docs/raw/scorers/evals-old-api/custom-eval.mdx +0 -24
- package/.docs/raw/scorers/evals-old-api/overview.mdx +0 -106
- package/.docs/raw/scorers/evals-old-api/running-in-ci.mdx +0 -85
- package/.docs/raw/scorers/evals-old-api/textual-evals.mdx +0 -58
- package/.docs/raw/scorers/off-the-shelf-scorers.mdx +0 -50
- package/.docs/raw/workflows-legacy/control-flow.mdx +0 -774
- package/.docs/raw/workflows-legacy/dynamic-workflows.mdx +0 -239
- package/.docs/raw/workflows-legacy/error-handling.mdx +0 -187
- package/.docs/raw/workflows-legacy/nested-workflows.mdx +0 -360
- package/.docs/raw/workflows-legacy/overview.mdx +0 -182
- package/.docs/raw/workflows-legacy/runtime-variables.mdx +0 -156
- package/.docs/raw/workflows-legacy/steps.mdx +0 -115
- package/.docs/raw/workflows-legacy/suspend-and-resume.mdx +0 -406
- package/.docs/raw/workflows-legacy/variables.mdx +0 -318
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Running Scorers in CI | Evals | Mastra Docs"
|
|
3
|
+
description: "Learn how to run scorer experiments in your CI/CD pipeline using the runEvals function."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Running Scorers in CI
|
|
7
|
+
|
|
8
|
+
Running scorers in your CI pipeline provides quantifiable metrics for measuring agent quality over time. The `runEvals` function processes multiple test cases through your agent or workflow and returns aggregate scores.
|
|
9
|
+
|
|
10
|
+
## Basic Setup
|
|
11
|
+
|
|
12
|
+
You can use any testing framework that supports ESM modules, such as [Vitest](https://vitest.dev/), [Jest](https://jestjs.io/), or [Mocha](https://mochajs.org/).
|
|
13
|
+
|
|
14
|
+
## Creating Test Cases
|
|
15
|
+
|
|
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
|
+
|
|
18
|
+
```typescript copy showLineNumbers title="src/mastra/agents/weather-agent.test.ts"
|
|
19
|
+
import { describe, it, expect } from 'vitest';
|
|
20
|
+
import { createScorer, runEvals } from "@mastra/core/evals";
|
|
21
|
+
import { weatherAgent } from "./weather-agent";
|
|
22
|
+
import { locationScorer } from "../scorers/location-scorer";
|
|
23
|
+
|
|
24
|
+
describe('Weather Agent Tests', () => {
|
|
25
|
+
it('should correctly extract locations from queries', async () => {
|
|
26
|
+
const result = await runEvals({
|
|
27
|
+
data: [
|
|
28
|
+
{
|
|
29
|
+
input: 'weather in Berlin',
|
|
30
|
+
groundTruth: { expectedLocation: 'Berlin', expectedCountry: 'DE' }
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
input: 'weather in Berlin, Maryland',
|
|
34
|
+
groundTruth: { expectedLocation: 'Berlin', expectedCountry: 'US' }
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
input: 'weather in Berlin, Russia',
|
|
38
|
+
groundTruth: { expectedLocation: 'Berlin', expectedCountry: 'RU' }
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
target: weatherAgent,
|
|
42
|
+
scorers: [locationScorer]
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Assert aggregate score meets threshold
|
|
46
|
+
expect(result.scores['location-accuracy']).toBe(1);
|
|
47
|
+
expect(result.summary.totalItems).toBe(3);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
View the full example [here](/examples/v1/evals/running-in-ci)
|
|
53
|
+
|
|
54
|
+
## Understanding Results
|
|
55
|
+
|
|
56
|
+
The `runEvals` function returns an object with:
|
|
57
|
+
|
|
58
|
+
- `scores`: Average scores for each scorer across all test cases
|
|
59
|
+
- `summary.totalItems`: Total number of test cases processed
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
{
|
|
63
|
+
scores: {
|
|
64
|
+
'location-accuracy': 1.0, // Average score across all items
|
|
65
|
+
'another-scorer': 0.85
|
|
66
|
+
},
|
|
67
|
+
summary: {
|
|
68
|
+
totalItems: 3
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Multiple Test Scenarios
|
|
74
|
+
|
|
75
|
+
Create separate test cases for different evaluation scenarios:
|
|
76
|
+
|
|
77
|
+
```typescript copy showLineNumbers title="src/mastra/agents/weather-agent.test.ts"
|
|
78
|
+
describe('Weather Agent Tests', () => {
|
|
79
|
+
const locationScorer = createScorer({ /* ... */ });
|
|
80
|
+
|
|
81
|
+
it('should handle location disambiguation', async () => {
|
|
82
|
+
const result = await runEvals({
|
|
83
|
+
data: [
|
|
84
|
+
{ input: 'weather in Berlin', groundTruth: { /* ... */ } },
|
|
85
|
+
{ input: 'weather in Berlin, Maryland', groundTruth: { /* ... */ } },
|
|
86
|
+
],
|
|
87
|
+
target: weatherAgent,
|
|
88
|
+
scorers: [locationScorer]
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
expect(result.scores['location-accuracy']).toBe(1);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('should handle typos and misspellings', async () => {
|
|
95
|
+
const result = await runEvals({
|
|
96
|
+
data: [
|
|
97
|
+
{ input: 'weather in Berln', groundTruth: { expectedLocation: 'Berlin', expectedCountry: 'DE' } },
|
|
98
|
+
{ input: 'weather in Parris', groundTruth: { expectedLocation: 'Paris', expectedCountry: 'FR' } },
|
|
99
|
+
],
|
|
100
|
+
target: weatherAgent,
|
|
101
|
+
scorers: [locationScorer]
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
expect(result.scores['location-accuracy']).toBe(1);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Next Steps
|
|
110
|
+
|
|
111
|
+
- Learn about [creating custom scorers](/docs/v1/evals/custom-scorers)
|
|
112
|
+
- Explore [off-the-shelf scorers](/docs/v1/evals/off-the-shelf-scorers)
|
|
113
|
+
- Read the [runEvals API reference](/reference/v1/evals/run-evals)
|
|
@@ -18,13 +18,14 @@ When creating agents in Mastra, you can specify any AI SDK-supported model.
|
|
|
18
18
|
import { Agent } from "@mastra/core/agent";
|
|
19
19
|
|
|
20
20
|
export const weatherAgent = new Agent({
|
|
21
|
+
id: "weather-agent",
|
|
21
22
|
name: "Weather Agent",
|
|
22
23
|
instructions: "Instructions for the agent...",
|
|
23
24
|
model: "openai/gpt-4-turbo",
|
|
24
25
|
});
|
|
25
26
|
```
|
|
26
27
|
|
|
27
|
-
> See [Using AI SDK with Mastra](/models#use-ai-sdk-with-mastra) for more information.
|
|
28
|
+
> See [Using AI SDK with Mastra](/models/v1#use-ai-sdk-with-mastra) for more information.
|
|
28
29
|
|
|
29
30
|
## Streaming
|
|
30
31
|
|
|
@@ -55,10 +56,10 @@ The recommended way of using Mastra and AI SDK together is by installing the `@m
|
|
|
55
56
|
|
|
56
57
|
### `chatRoute()`
|
|
57
58
|
|
|
58
|
-
When setting up a [custom API route](/docs/server-db/custom-api-routes), use the `chatRoute()` utility to create a route handler that automatically formats the agent stream into an AI SDK-compatible format.
|
|
59
|
+
When setting up a [custom API route](/docs/v1/server-db/custom-api-routes), use the `chatRoute()` utility to create a route handler that automatically formats the agent stream into an AI SDK-compatible format.
|
|
59
60
|
|
|
60
61
|
```typescript title="src/mastra/index.ts" copy
|
|
61
|
-
import { Mastra } from "@mastra/core
|
|
62
|
+
import { Mastra } from "@mastra/core";
|
|
62
63
|
import { chatRoute } from "@mastra/ai-sdk";
|
|
63
64
|
|
|
64
65
|
export const mastra = new Mastra({
|
|
@@ -110,7 +111,7 @@ const { error, status, sendMessage, messages, regenerate, stop } = useChat({
|
|
|
110
111
|
Use the `workflowRoute()` utility to create a route handler that automatically formats the workflow stream into an AI SDK-compatible format.
|
|
111
112
|
|
|
112
113
|
```typescript title="src/mastra/index.ts" copy
|
|
113
|
-
import { Mastra } from "@mastra/core
|
|
114
|
+
import { Mastra } from "@mastra/core";
|
|
114
115
|
import { workflowRoute } from "@mastra/ai-sdk";
|
|
115
116
|
|
|
116
117
|
export const mastra = new Mastra({
|
|
@@ -149,7 +150,7 @@ const { error, status, sendMessage, messages, regenerate, stop } = useChat({
|
|
|
149
150
|
Use the `networkRoute()` utility to create a route handler that automatically formats the agent network stream into an AI SDK-compatible format.
|
|
150
151
|
|
|
151
152
|
```typescript title="src/mastra/index.ts" copy
|
|
152
|
-
import { Mastra } from "@mastra/core
|
|
153
|
+
import { Mastra } from "@mastra/core";
|
|
153
154
|
import { networkRoute } from "@mastra/ai-sdk";
|
|
154
155
|
|
|
155
156
|
export const mastra = new Mastra({
|
|
@@ -187,7 +188,7 @@ The `@mastra/ai-sdk` package transforms and emits Mastra streams (e.g workflow,
|
|
|
187
188
|
- `data-tool-network`: Nested network emitted from within an tool stream.
|
|
188
189
|
- `data-tool-agent`: Nested agent emitted from within an tool stream.
|
|
189
190
|
|
|
190
|
-
Here's an example: For a [nested agent stream within a tool](/docs/streaming/tool-streaming#tool-using-an-agent), `data-tool-agent` UI message parts will be emitted and can be leveraged on the client as documented below:
|
|
191
|
+
Here's an example: For a [nested agent stream within a tool](/docs/v1/streaming/tool-streaming#tool-using-an-agent), `data-tool-agent` UI message parts will be emitted and can be leveraged on the client as documented below:
|
|
191
192
|
|
|
192
193
|
```typescript title="app/page.tsx" copy
|
|
193
194
|
"use client";
|
|
@@ -276,7 +277,7 @@ export const testTool = createTool({
|
|
|
276
277
|
});
|
|
277
278
|
```
|
|
278
279
|
|
|
279
|
-
For more information about tool streaming see [Tool streaming documentation](/docs/streaming/tool-streaming)
|
|
280
|
+
For more information about tool streaming see [Tool streaming documentation](/docs/v1/streaming/tool-streaming)
|
|
280
281
|
|
|
281
282
|
### Stream Transformations
|
|
282
283
|
|
|
@@ -428,7 +429,7 @@ export async function POST(req: Request) {
|
|
|
428
429
|
}
|
|
429
430
|
```
|
|
430
431
|
|
|
431
|
-
> When using `useChat()` with agent memory, refer to the [Agent Memory section](/docs/agents/agent-memory) for key implementation details.
|
|
432
|
+
> When using `useChat()` with agent memory, refer to the [Agent Memory section](/docs/v1/agents/agent-memory) for key implementation details.
|
|
432
433
|
|
|
433
434
|
### Using `useCompletion()`
|
|
434
435
|
|
|
@@ -473,7 +474,7 @@ export async function POST(req: Request) {
|
|
|
473
474
|
|
|
474
475
|
### Passing additional data
|
|
475
476
|
|
|
476
|
-
`sendMessage()` allows you to pass additional data from the frontend to Mastra. This data can then be used on the server as `
|
|
477
|
+
`sendMessage()` allows you to pass additional data from the frontend to Mastra. This data can then be used on the server as `RequestContext`.
|
|
477
478
|
|
|
478
479
|
```typescript {16-26} title="app/test/chat-extra.tsx" copy
|
|
479
480
|
"use client";
|
|
@@ -518,41 +519,41 @@ export function ChatExtra() {
|
|
|
518
519
|
|
|
519
520
|
```typescript {8,12} title="app/api/chat-extra/route.ts" copy
|
|
520
521
|
import { mastra } from "../../../mastra";
|
|
521
|
-
import {
|
|
522
|
+
import { RequestContext } from "@mastra/core/request-context";
|
|
522
523
|
|
|
523
524
|
export async function POST(req: Request) {
|
|
524
525
|
const { messages, data } = await req.json();
|
|
525
526
|
const myAgent = mastra.getAgent("weatherAgent");
|
|
526
527
|
|
|
527
|
-
const
|
|
528
|
+
const requestContext = new RequestContext();
|
|
528
529
|
|
|
529
530
|
if (data) {
|
|
530
531
|
for (const [key, value] of Object.entries(data)) {
|
|
531
|
-
|
|
532
|
+
requestContext.set(key, value);
|
|
532
533
|
}
|
|
533
534
|
}
|
|
534
535
|
|
|
535
536
|
const stream = await myAgent.stream(messages, {
|
|
536
|
-
|
|
537
|
+
requestContext,
|
|
537
538
|
format: "aisdk",
|
|
538
539
|
});
|
|
539
540
|
return stream.toUIMessageStreamResponse();
|
|
540
541
|
}
|
|
541
542
|
```
|
|
542
543
|
|
|
543
|
-
### Handling `
|
|
544
|
+
### Handling `requestContext` with `server.middleware`
|
|
544
545
|
|
|
545
|
-
You can also populate the `
|
|
546
|
+
You can also populate the `RequestContext` by reading custom data in a server middleware:
|
|
546
547
|
|
|
547
548
|
```typescript {8,17} title="mastra/index.ts" copy
|
|
548
|
-
import { Mastra } from "@mastra/core
|
|
549
|
+
import { Mastra } from "@mastra/core";
|
|
549
550
|
|
|
550
551
|
export const mastra = new Mastra({
|
|
551
552
|
agents: { weatherAgent },
|
|
552
553
|
server: {
|
|
553
554
|
middleware: [
|
|
554
555
|
async (c, next) => {
|
|
555
|
-
const
|
|
556
|
+
const requestContext = c.get("requestContext");
|
|
556
557
|
|
|
557
558
|
if (c.req.method === "POST") {
|
|
558
559
|
try {
|
|
@@ -561,7 +562,7 @@ export const mastra = new Mastra({
|
|
|
561
562
|
|
|
562
563
|
if (body?.data) {
|
|
563
564
|
for (const [key, value] of Object.entries(body.data)) {
|
|
564
|
-
|
|
565
|
+
requestContext.set(key, value);
|
|
565
566
|
}
|
|
566
567
|
}
|
|
567
568
|
} catch {}
|
|
@@ -573,7 +574,7 @@ export const mastra = new Mastra({
|
|
|
573
574
|
});
|
|
574
575
|
```
|
|
575
576
|
|
|
576
|
-
> You can then access this data in your tools via the `
|
|
577
|
+
> You can then access this data in your tools via the `requestContext` parameter. See the [Request Context documentation](/docs/v1/server-db/request-context) for more details.
|
|
577
578
|
|
|
578
579
|
## Migrating from AI SDK v4 to v5
|
|
579
580
|
|
|
@@ -629,7 +630,7 @@ const weatherTool = createTool({
|
|
|
629
630
|
temperature: z.number(),
|
|
630
631
|
conditions: z.string(),
|
|
631
632
|
}),
|
|
632
|
-
execute: async (
|
|
633
|
+
execute: async (inputData) => {
|
|
633
634
|
return {
|
|
634
635
|
temperature: 72,
|
|
635
636
|
conditions: "sunny",
|
|
@@ -668,7 +669,7 @@ const tools = {
|
|
|
668
669
|
outputSchema: z.object({
|
|
669
670
|
result: z.number(),
|
|
670
671
|
}),
|
|
671
|
-
execute: async (
|
|
672
|
+
execute: async (inputData) => {
|
|
672
673
|
// implementation...
|
|
673
674
|
return { result: 0 };
|
|
674
675
|
},
|
|
@@ -81,7 +81,7 @@ export function CopilotKitComponent({ runtimeUrl }: { runtimeUrl: string }) {
|
|
|
81
81
|
|
|
82
82
|
<StepItem>
|
|
83
83
|
|
|
84
|
-
If you have not yet set up your Mastra server, follow the [getting started guide](/docs/getting-started/installation) to set up a new Mastra project.
|
|
84
|
+
If you have not yet set up your Mastra server, follow the [getting started guide](/docs/v1/getting-started/installation) to set up a new Mastra project.
|
|
85
85
|
|
|
86
86
|
In your Mastra server, install additional packages for CopilotKit integration:
|
|
87
87
|
|
|
@@ -116,11 +116,11 @@ pnpm add @copilotkit/runtime @ag-ui/mastra
|
|
|
116
116
|
Configure your Mastra instance to include CopilotKit's runtime endpoint:
|
|
117
117
|
|
|
118
118
|
```typescript title="src/mastra/index.ts" copy {2,5-8,12-28}
|
|
119
|
-
import { Mastra } from "@mastra/core
|
|
119
|
+
import { Mastra } from "@mastra/core";
|
|
120
120
|
import { registerCopilotKit } from "@ag-ui/mastra/copilotkit";
|
|
121
121
|
import { weatherAgent } from "./agents/weather-agent";
|
|
122
122
|
|
|
123
|
-
type
|
|
123
|
+
type WeatherRequestContext = {
|
|
124
124
|
"user-id": string;
|
|
125
125
|
"temperature-scale": "celsius" | "fahrenheit";
|
|
126
126
|
};
|
|
@@ -134,15 +134,15 @@ export const mastra = new Mastra({
|
|
|
134
134
|
allowHeaders: ["*"],
|
|
135
135
|
},
|
|
136
136
|
apiRoutes: [
|
|
137
|
-
registerCopilotKit<
|
|
137
|
+
registerCopilotKit<WeatherRequestContext>({
|
|
138
138
|
path: "/copilotkit",
|
|
139
139
|
resourceId: "weatherAgent",
|
|
140
|
-
setContext: (c,
|
|
141
|
-
|
|
140
|
+
setContext: (c, requestContext) => {
|
|
141
|
+
requestContext.set(
|
|
142
142
|
"user-id",
|
|
143
143
|
c.req.header("X-User-ID") || "anonymous",
|
|
144
144
|
);
|
|
145
|
-
|
|
145
|
+
requestContext.set("temperature-scale", "celsius");
|
|
146
146
|
},
|
|
147
147
|
}),
|
|
148
148
|
],
|
|
@@ -379,4 +379,4 @@ Start building the future!
|
|
|
379
379
|
|
|
380
380
|
- [CopilotKit Documentation](https://docs.copilotkit.ai) - Complete CopilotKit reference
|
|
381
381
|
- [React Hooks with CopilotKit](https://docs.copilotkit.ai/reference/hooks/useCoAgent) - Advanced React integration patterns
|
|
382
|
-
- [Next.js Integration with Mastra](/docs/frameworks/web-frameworks/next-js) - Full-stack Next.js setup guide
|
|
382
|
+
- [Next.js Integration with Mastra](/docs/v1/frameworks/web-frameworks/next-js) - Full-stack Next.js setup guide
|
|
@@ -65,6 +65,7 @@ const openrouter = createOpenRouter({
|
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
export const assistant = new Agent({
|
|
68
|
+
id: "assistant",
|
|
68
69
|
name: "assistant",
|
|
69
70
|
instructions: "You are a helpful assistant.",
|
|
70
71
|
model: openrouter("anthropic/claude-sonnet-4"),
|
|
@@ -119,6 +120,7 @@ const openrouter = createOpenRouter({
|
|
|
119
120
|
});
|
|
120
121
|
|
|
121
122
|
export const assistant = new Agent({
|
|
123
|
+
id: "assistant",
|
|
122
124
|
name: "assistant",
|
|
123
125
|
instructions: "You are a helpful assistant.",
|
|
124
126
|
model: openrouter("anthropic/claude-sonnet-4"),
|
|
@@ -138,6 +140,7 @@ const openrouter = createOpenRouter({
|
|
|
138
140
|
});
|
|
139
141
|
|
|
140
142
|
export const assistant = new Agent({
|
|
143
|
+
id: "assistant",
|
|
141
144
|
name: "assistant",
|
|
142
145
|
instructions: "You are a helpful assistant.",
|
|
143
146
|
model: openrouter("anthropic/claude-sonnet-4", {
|
|
@@ -18,12 +18,12 @@ In this guide you'll learn how to install the necessary Mastra dependencies, cre
|
|
|
18
18
|
## Prerequisites
|
|
19
19
|
|
|
20
20
|
- An existing Express app set up with TypeScript
|
|
21
|
-
- Node.js `
|
|
22
|
-
- An API key from a supported [Model Provider](/models)
|
|
21
|
+
- Node.js `v22.13.0` or later
|
|
22
|
+
- An API key from a supported [Model Provider](/models/v1)
|
|
23
23
|
|
|
24
24
|
## Adding Mastra
|
|
25
25
|
|
|
26
|
-
First, install the necessary Mastra dependencies to run an Agent. This guide uses OpenAI as its model but you can use any supported [model provider](/models).
|
|
26
|
+
First, install the necessary Mastra dependencies to run an Agent. This guide uses OpenAI as its model but you can use any supported [model provider](/models/v1).
|
|
27
27
|
|
|
28
28
|
```bash copy
|
|
29
29
|
npm install mastra@latest @mastra/core@latest @mastra/libsql@latest zod@^3.0.0 @ai-sdk/openai@^1.0.0
|
|
@@ -44,7 +44,7 @@ Each LLM provider uses a different env var. See [Model Capabilities](https://sdk
|
|
|
44
44
|
Create a Mastra configuration file at `src/mastra/index.ts`:
|
|
45
45
|
|
|
46
46
|
```ts title="src/mastra/index.ts" copy
|
|
47
|
-
import { Mastra } from "@mastra/core
|
|
47
|
+
import { Mastra } from "@mastra/core";
|
|
48
48
|
|
|
49
49
|
export const mastra = new Mastra({});
|
|
50
50
|
```
|
|
@@ -80,13 +80,14 @@ import { Agent } from "@mastra/core/agent";
|
|
|
80
80
|
import { weatherTool } from "../tools/weather-tool";
|
|
81
81
|
|
|
82
82
|
export const weatherAgent = new Agent({
|
|
83
|
+
id: "weather-agent",
|
|
83
84
|
name: "Weather Agent",
|
|
84
85
|
instructions: `
|
|
85
86
|
You are a helpful weather assistant that provides accurate weather information.
|
|
86
87
|
|
|
87
88
|
Your primary function is to help users get weather details for specific locations. When responding:
|
|
88
89
|
- Always ask for a location if none is provided
|
|
89
|
-
- If the location name isn
|
|
90
|
+
- If the location name isn't in English, please translate it
|
|
90
91
|
- If giving a location with multiple parts (e.g. "New York, NY"), use the most relevant part (e.g. "New York")
|
|
91
92
|
- Include relevant details like humidity, wind conditions, and precipitation
|
|
92
93
|
- Keep responses concise but informative
|
|
@@ -101,7 +102,7 @@ export const weatherAgent = new Agent({
|
|
|
101
102
|
Lastly, add the `weatherAgent` to `src/mastra/index.ts`:
|
|
102
103
|
|
|
103
104
|
```ts title="src/mastra/index.ts" copy {2, 5}
|
|
104
|
-
import { Mastra } from "@mastra/core
|
|
105
|
+
import { Mastra } from "@mastra/core";
|
|
105
106
|
import { weatherAgent } from "./agents/weather-agent";
|
|
106
107
|
|
|
107
108
|
export const mastra = new Mastra({
|
|
@@ -168,11 +169,11 @@ app.listen(port, () => {
|
|
|
168
169
|
});
|
|
169
170
|
```
|
|
170
171
|
|
|
171
|
-
By importing the `src/mastra/index.ts` file you can use methods like [`.getAgent()`](/reference/core/getAgent) to get programmatic access. With [`.generate()`](/reference/agents/generate) you then can interact with the respective agent.
|
|
172
|
+
By importing the `src/mastra/index.ts` file you can use methods like [`.getAgent()`](/reference/v1/core/getAgent) to get programmatic access. With [`.generate()`](/reference/v1/agents/generate) you then can interact with the respective agent.
|
|
172
173
|
|
|
173
174
|
:::note
|
|
174
175
|
|
|
175
|
-
Read the [Agent reference docs](/reference/agents/agent) to learn more.
|
|
176
|
+
Read the [Agent reference docs](/reference/v1/agents/agent) to learn more.
|
|
176
177
|
|
|
177
178
|
:::
|
|
178
179
|
|
|
@@ -190,7 +191,7 @@ The weather in London is currently sunny. If you need more details like humidity
|
|
|
190
191
|
|
|
191
192
|
## Running the Agent Server
|
|
192
193
|
|
|
193
|
-
In production it's not necessary to run Mastra alongside your Express server. But for development Mastra offers a [Local Development Environment](/docs/getting-started/studio) which you can use to improve and debug your agent.
|
|
194
|
+
In production it's not necessary to run Mastra alongside your Express server. But for development Mastra offers a [Local Development Environment](/docs/v1/getting-started/studio) which you can use to improve and debug your agent.
|
|
194
195
|
|
|
195
196
|
Add a script to your `package.json`:
|
|
196
197
|
|
|
@@ -78,7 +78,7 @@ To integrate Mastra into your project, you have two options:
|
|
|
78
78
|
npx mastra@latest init --default
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
> See [mastra init](/reference/cli/create-mastra) for more information.
|
|
81
|
+
> See [mastra init](/reference/v1/cli/create-mastra) for more information.
|
|
82
82
|
|
|
83
83
|
- Use the Interactive CLI
|
|
84
84
|
|
|
@@ -175,7 +175,7 @@ mastra dev:mastra
|
|
|
175
175
|
</TabItem>
|
|
176
176
|
</Tabs>
|
|
177
177
|
|
|
178
|
-
> Once running, your agents are available locally. See [Local Development Environment](/docs/getting-started/studio) for more information.
|
|
178
|
+
> Once running, your agents are available locally. See [Local Development Environment](/docs/v1/getting-started/studio) for more information.
|
|
179
179
|
|
|
180
180
|
</StepItem>
|
|
181
181
|
|
|
@@ -215,7 +215,7 @@ export const server = {
|
|
|
215
215
|
city: z.string(),
|
|
216
216
|
}),
|
|
217
217
|
handler: async (input) => {
|
|
218
|
-
const city =
|
|
218
|
+
const city = inputData.city;
|
|
219
219
|
const agent = mastra.getAgent("weatherAgent");
|
|
220
220
|
|
|
221
221
|
const result = await agent.generate(
|
|
@@ -371,7 +371,7 @@ To integrate Mastra into your project, you have two options:
|
|
|
371
371
|
npx mastra@latest init --default
|
|
372
372
|
```
|
|
373
373
|
|
|
374
|
-
> See [mastra init](/reference/cli/create-mastra) for more information.
|
|
374
|
+
> See [mastra init](/reference/v1/cli/create-mastra) for more information.
|
|
375
375
|
|
|
376
376
|
- Use the Interactive CLI
|
|
377
377
|
|
|
@@ -468,7 +468,7 @@ mastra dev:mastra
|
|
|
468
468
|
</TabItem>
|
|
469
469
|
</Tabs>
|
|
470
470
|
|
|
471
|
-
> Once running, your agents are available locally. See [Local Development Environment](/docs/getting-started/studio) for more information.
|
|
471
|
+
> Once running, your agents are available locally. See [Local Development Environment](/docs/v1/getting-started/studio) for more information.
|
|
472
472
|
|
|
473
473
|
</StepItem>
|
|
474
474
|
|
|
@@ -598,5 +598,5 @@ Let me know if you need more information!
|
|
|
598
598
|
|
|
599
599
|
## Next Steps
|
|
600
600
|
|
|
601
|
-
- [Deployment | With Astro on Vercel](/docs/deployment/web-framework#with-astro-on-vercel)
|
|
601
|
+
- [Deployment | With Astro on Vercel](/docs/v1/deployment/web-framework#with-astro-on-vercel)
|
|
602
602
|
- [Monorepo Deployment](../../deployment/monorepo)
|
|
@@ -41,7 +41,7 @@ To integrate Mastra into your project, you have two options:
|
|
|
41
41
|
npx mastra@latest init --dir . --components agents,tools --example --llm openai
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
> See [mastra init](/reference/cli/create-mastra) for more information.
|
|
44
|
+
> See [mastra init](/reference/v1/cli/create-mastra) for more information.
|
|
45
45
|
|
|
46
46
|
- Use the Interactive CLI
|
|
47
47
|
|
|
@@ -228,7 +228,7 @@ To integrate Mastra into your project, you have two options:
|
|
|
228
228
|
npx mastra@latest init --dir . --components agents,tools --example --llm openai
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
-
> See [mastra init](/reference/cli/create-mastra) for more information.
|
|
231
|
+
> See [mastra init](/reference/v1/cli/create-mastra) for more information.
|
|
232
232
|
|
|
233
233
|
- Use the Interactive CLI
|
|
234
234
|
|
|
@@ -375,5 +375,5 @@ Let me know if you need more information!
|
|
|
375
375
|
|
|
376
376
|
## Next Steps
|
|
377
377
|
|
|
378
|
-
- [Deployment | With Next.js on Vercel](/docs/deployment/web-framework#with-nextjs-on-vercel)
|
|
378
|
+
- [Deployment | With Next.js on Vercel](/docs/v1/deployment/web-framework#with-nextjs-on-vercel)
|
|
379
379
|
- [Monorepo Deployment](../../deployment/monorepo)
|
|
@@ -66,7 +66,7 @@ To integrate Mastra into your project, you have two options:
|
|
|
66
66
|
npx mastra@latest init --default
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
> See [mastra init](/reference/cli/create-mastra) for more information.
|
|
69
|
+
> See [mastra init](/reference/v1/cli/create-mastra) for more information.
|
|
70
70
|
|
|
71
71
|
- Use the Interactive CLI
|
|
72
72
|
|
|
@@ -161,7 +161,7 @@ Start the Mastra Dev Server to expose your agents as REST endpoints:
|
|
|
161
161
|
</TabItem>
|
|
162
162
|
</Tabs>
|
|
163
163
|
|
|
164
|
-
> Once running, your agents are available locally. See [Local Development Environment](/docs/getting-started/studio) for more information.
|
|
164
|
+
> Once running, your agents are available locally. See [Local Development Environment](/docs/v1/getting-started/studio) for more information.
|
|
165
165
|
|
|
166
166
|
</StepItem>
|
|
167
167
|
|
|
@@ -297,7 +297,7 @@ To integrate Mastra into your project, you have two options:
|
|
|
297
297
|
npx mastra@latest init --default
|
|
298
298
|
```
|
|
299
299
|
|
|
300
|
-
> See [mastra init](/reference/cli/create-mastra) for more information.
|
|
300
|
+
> See [mastra init](/reference/v1/cli/create-mastra) for more information.
|
|
301
301
|
|
|
302
302
|
- Use the Interactive CLI
|
|
303
303
|
|
|
@@ -392,7 +392,7 @@ Start the Mastra Dev Server to expose your agents as REST endpoints:
|
|
|
392
392
|
</TabItem>
|
|
393
393
|
</Tabs>
|
|
394
394
|
|
|
395
|
-
> Once running, your agents are available locally. See [Local Development Environment](/docs/getting-started/studio) for more information.
|
|
395
|
+
> Once running, your agents are available locally. See [Local Development Environment](/docs/v1/getting-started/studio) for more information.
|
|
396
396
|
|
|
397
397
|
</StepItem>
|
|
398
398
|
|
|
@@ -69,7 +69,7 @@ Run the following command to quickly scaffold the default Weather agent with sen
|
|
|
69
69
|
npx mastra@latest init --dir . --components agents,tools --example --llm openai
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
> See [mastra init](/reference/cli/create-mastra) for more information.
|
|
72
|
+
> See [mastra init](/reference/v1/cli/create-mastra) for more information.
|
|
73
73
|
|
|
74
74
|
### 2. Use the Interactive CLI
|
|
75
75
|
|
|
@@ -164,7 +164,7 @@ mastra dev:mastra
|
|
|
164
164
|
</TabItem>
|
|
165
165
|
</Tabs>
|
|
166
166
|
|
|
167
|
-
> Once running, your agents are available locally. See [Local Development Environment](/docs/getting-started/studio) for more information.
|
|
167
|
+
> Once running, your agents are available locally. See [Local Development Environment](/docs/v1/getting-started/studio) for more information.
|
|
168
168
|
|
|
169
169
|
## Start Vite Dev Server
|
|
170
170
|
|
|
@@ -13,12 +13,12 @@ import { VideoPlayer } from "@site/src/components/video-player";
|
|
|
13
13
|
|
|
14
14
|
The `create mastra` CLI command is the quickest way to start a new Mastra project. It walks you through setup and creates example agents, workflows, and tools for you to learn from or adapt.
|
|
15
15
|
|
|
16
|
-
For more control over setup, or to add Mastra to an existing project, see the [manual installation guide](#install-manually). You can also use [`mastra init`](/reference/cli/mastra#mastra-init) for existing projects.
|
|
16
|
+
For more control over setup, or to add Mastra to an existing project, see the [manual installation guide](#install-manually). You can also use [`mastra init`](/reference/v1/cli/mastra#mastra-init) for existing projects.
|
|
17
17
|
|
|
18
18
|
## Before you start
|
|
19
19
|
|
|
20
|
-
- You'll need an API key from a [model provider](/models) to complete setup. We suggest starting with [OpenAI](https://platform.openai.com/api-keys), but if you need a provider that doesn't require a credit card, Google's [Gemini](https://aistudio.google.com/app/api-keys) is also an option.
|
|
21
|
-
- [Install](https://nodejs.org/en/download) Node.js
|
|
20
|
+
- You'll need an API key from a [model provider](/models/v1) to complete setup. We suggest starting with [OpenAI](https://platform.openai.com/api-keys), but if you need a provider that doesn't require a credit card, Google's [Gemini](https://aistudio.google.com/app/api-keys) is also an option.
|
|
21
|
+
- [Install](https://nodejs.org/en/download) Node.js 22.13.0 or later.
|
|
22
22
|
|
|
23
23
|
## Install with `create mastra`
|
|
24
24
|
|
|
@@ -59,7 +59,7 @@ bun create mastra@latest
|
|
|
59
59
|
|
|
60
60
|
:::note
|
|
61
61
|
|
|
62
|
-
You can use flags with `create mastra` like `--no-example` to skip the example weather agent or `--template` to start from a specific [template](/docs/getting-started/templates). Read the [CLI reference](/reference/cli/create-mastra) for all options.
|
|
62
|
+
You can use flags with `create mastra` like `--no-example` to skip the example weather agent or `--template` to start from a specific [template](/docs/v1/getting-started/templates). Read the [CLI reference](/reference/v1/cli/create-mastra) for all options.
|
|
63
63
|
|
|
64
64
|
:::
|
|
65
65
|
|
|
@@ -77,13 +77,13 @@ If you encounter an error, your API key may not be configured correctly. Double-
|
|
|
77
77
|
|
|
78
78
|
:::
|
|
79
79
|
|
|
80
|
-
[Studio](/docs/getting-started/studio) lets you rapidly build and prototype agents without needing to build a UI. Once you're ready, you can integrate your Mastra agent into your application using the guides below.
|
|
80
|
+
[Studio](/docs/v1/getting-started/studio) lets you rapidly build and prototype agents without needing to build a UI. Once you're ready, you can integrate your Mastra agent into your application using the guides below.
|
|
81
81
|
|
|
82
82
|
### Next steps
|
|
83
83
|
|
|
84
|
-
- Read more about [Mastra's features](/docs#why-mastra).
|
|
85
|
-
- Integrate Mastra with your frontend framework: [Next.js](/docs/frameworks/web-frameworks/next-js), [React](/docs/frameworks/web-frameworks/vite-react), or [Astro](/docs/frameworks/web-frameworks/astro).
|
|
86
|
-
- Build an agent from scratch following one of our [guides](/guides).
|
|
84
|
+
- Read more about [Mastra's features](/docs/v1#why-mastra).
|
|
85
|
+
- Integrate Mastra with your frontend framework: [Next.js](/docs/v1/frameworks/web-frameworks/next-js), [React](/docs/v1/frameworks/web-frameworks/vite-react), or [Astro](/docs/v1/frameworks/web-frameworks/astro).
|
|
86
|
+
- Build an agent from scratch following one of our [guides](/guides/v1).
|
|
87
87
|
- Watch conceptual guides on our [YouTube channel](https://www.youtube.com/@mastra-ai) and [subscribe](https://www.youtube.com/@mastra-ai?sub_confirmation=1)!
|
|
88
88
|
|
|
89
89
|
## Install manually
|
|
@@ -206,7 +206,7 @@ GOOGLE_GENERATIVE_AI_API_KEY=<your-api-key>
|
|
|
206
206
|
|
|
207
207
|
:::note
|
|
208
208
|
|
|
209
|
-
This guide uses Google Gemini, but you can use any supported [model provider](/models), including OpenAI, Anthropic, and more.
|
|
209
|
+
This guide uses Google Gemini, but you can use any supported [model provider](/models/v1), including OpenAI, Anthropic, and more.
|
|
210
210
|
|
|
211
211
|
:::
|
|
212
212
|
|
|
@@ -245,7 +245,7 @@ export const weatherTool = createTool({
|
|
|
245
245
|
|
|
246
246
|
:::info
|
|
247
247
|
|
|
248
|
-
We've shortened and simplified the `weatherTool` example here. You can see the complete weather tool under [Giving an Agent a Tool](/docs/agents/using-tools).
|
|
248
|
+
We've shortened and simplified the `weatherTool` example here. You can see the complete weather tool under [Giving an Agent a Tool](/docs/v1/agents/using-tools).
|
|
249
249
|
|
|
250
250
|
:::
|
|
251
251
|
|
|
@@ -266,6 +266,7 @@ import { Agent } from "@mastra/core/agent";
|
|
|
266
266
|
import { weatherTool } from "../tools/weather-tool";
|
|
267
267
|
|
|
268
268
|
export const weatherAgent = new Agent({
|
|
269
|
+
id: "weather-agent",
|
|
269
270
|
name: "Weather Agent",
|
|
270
271
|
instructions: `
|
|
271
272
|
You are a helpful weather assistant that provides accurate weather information.
|
|
@@ -297,7 +298,7 @@ touch src/mastra/index.ts
|
|
|
297
298
|
Add the following code:
|
|
298
299
|
|
|
299
300
|
```ts title="src/mastra/index.ts" showLineNumbers copy
|
|
300
|
-
import { Mastra } from "@mastra/core
|
|
301
|
+
import { Mastra } from "@mastra/core";
|
|
301
302
|
import { weatherAgent } from "./agents/weather-agent";
|
|
302
303
|
|
|
303
304
|
export const mastra = new Mastra({
|
|
@@ -309,7 +310,7 @@ export const mastra = new Mastra({
|
|
|
309
310
|
|
|
310
311
|
<StepItem>
|
|
311
312
|
|
|
312
|
-
You can now launch [Studio](/docs/getting-started/studio) and test your agent.
|
|
313
|
+
You can now launch [Studio](/docs/v1/getting-started/studio) and test your agent.
|
|
313
314
|
|
|
314
315
|
<Tabs>
|
|
315
316
|
<TabItem value="npm" label="npm">
|
|
@@ -19,7 +19,7 @@ In this guide you'll learn how to add Mastra's MCP server to your AI tooling.
|
|
|
19
19
|
|
|
20
20
|
### create-mastra
|
|
21
21
|
|
|
22
|
-
During the interactive [create-mastra](/reference/cli/create-mastra) wizard, choose one of your tools in the MCP step.
|
|
22
|
+
During the interactive [create-mastra](/reference/v1/cli/create-mastra) wizard, choose one of your tools in the MCP step.
|
|
23
23
|
|
|
24
24
|
### Manual setup
|
|
25
25
|
|