@mastra/mcp-docs-server 1.0.0-beta.0 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +1 -15
- package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +1 -7
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +201 -1
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +1 -55
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +250 -50
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fauth.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcodemod.md +26 -0
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +89 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +396 -196
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +200 -0
- package/.docs/organized/changelogs/%40mastra%2Fduckdb.md +42 -0
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Felasticsearch.md +61 -0
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Flance.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +251 -51
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Frag.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Freact.md +128 -1
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +18 -0
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +42 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +251 -51
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +92 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +67 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +201 -1
- package/.docs/organized/changelogs/create-mastra.md +201 -1
- package/.docs/organized/changelogs/mastra.md +201 -1
- package/.docs/organized/code-examples/agui.md +1 -0
- package/.docs/organized/code-examples/ai-elements.md +2 -2
- package/.docs/organized/code-examples/ai-sdk-useChat.md +2 -2
- package/.docs/organized/code-examples/ai-sdk-v5.md +3 -2
- package/.docs/organized/code-examples/assistant-ui.md +2 -2
- package/.docs/organized/code-examples/bird-checker-with-express.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +2 -2
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +2 -2
- package/.docs/organized/code-examples/client-side-tools.md +1 -1
- package/.docs/organized/code-examples/crypto-chatbot.md +2 -2
- package/.docs/organized/code-examples/fireworks-r1.md +1 -1
- package/.docs/organized/code-examples/heads-up-game.md +1 -1
- package/.docs/organized/code-examples/mcp-configuration.md +0 -3
- package/.docs/organized/code-examples/mcp-server-adapters.md +720 -0
- package/.docs/organized/code-examples/memory-per-resource-example.md +1 -1
- package/.docs/organized/code-examples/memory-with-processors.md +1 -1
- package/.docs/organized/code-examples/openapi-spec-writer.md +1 -1
- package/.docs/organized/code-examples/processors-with-ai-sdk.md +14 -0
- package/.docs/organized/code-examples/quick-start.md +2 -2
- package/.docs/organized/code-examples/server-app-access.md +342 -0
- package/.docs/organized/code-examples/server-express-adapter.md +87 -0
- package/.docs/organized/code-examples/server-hono-adapter.md +85 -0
- package/.docs/organized/code-examples/stock-price-tool.md +1 -21
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +1 -1
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +1 -1
- package/.docs/organized/code-examples/workflow-with-memory.md +1 -1
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +1 -1
- package/.docs/organized/code-examples/workflow-with-suspend-resume.md +1 -1
- package/.docs/raw/agents/adding-voice.mdx +56 -10
- package/.docs/raw/agents/agent-approval.mdx +189 -0
- package/.docs/raw/agents/agent-memory.mdx +2 -2
- package/.docs/raw/agents/guardrails.mdx +27 -24
- package/.docs/raw/agents/networks.mdx +3 -3
- package/.docs/raw/agents/overview.mdx +19 -168
- package/.docs/raw/agents/processors.mdx +279 -0
- package/.docs/raw/agents/structured-output.mdx +224 -0
- package/.docs/raw/agents/using-tools.mdx +14 -14
- package/.docs/raw/auth/auth0.mdx +2 -2
- package/.docs/raw/auth/clerk.mdx +2 -2
- package/.docs/raw/auth/firebase.mdx +2 -2
- package/.docs/raw/auth/index.mdx +1 -1
- package/.docs/raw/auth/jwt.mdx +2 -2
- package/.docs/raw/auth/supabase.mdx +2 -2
- package/.docs/raw/auth/workos.mdx +2 -2
- package/.docs/raw/community/contributing-templates.mdx +1 -1
- package/.docs/raw/community/discord.mdx +2 -2
- package/.docs/raw/community/licensing.mdx +1 -1
- package/.docs/raw/course/01-first-agent/03-verifying-installation.md +1 -1
- package/.docs/raw/course/01-first-agent/05-running-playground.md +5 -5
- package/.docs/raw/course/01-first-agent/09-testing-your-agent.md +3 -3
- package/.docs/raw/course/01-first-agent/13-testing-your-tool.md +3 -3
- package/.docs/raw/course/01-first-agent/17-testing-memory.md +2 -2
- package/.docs/raw/course/02-agent-tools-mcp/02-installing-mcp.md +1 -1
- package/.docs/raw/course/03-agent-memory/03-installing-memory.md +1 -1
- package/.docs/raw/course/04-workflows/07-using-playground.md +1 -1
- package/.docs/raw/deployment/{server-deployment.mdx → building-mastra.mdx} +4 -4
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +3 -3
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +4 -4
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +4 -4
- package/.docs/raw/deployment/{serverless-platforms → cloud-providers}/cloudflare-deployer.mdx +2 -2
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +3 -3
- package/.docs/raw/deployment/cloud-providers/index.mdx +26 -29
- package/.docs/raw/deployment/{serverless-platforms → cloud-providers}/netlify-deployer.mdx +46 -15
- package/.docs/raw/deployment/{serverless-platforms → cloud-providers}/vercel-deployer.mdx +2 -2
- package/.docs/raw/{mastra-cloud → deployment/mastra-cloud}/dashboard.mdx +3 -3
- package/.docs/raw/deployment/mastra-cloud/observability.mdx +53 -0
- package/.docs/raw/{mastra-cloud → deployment/mastra-cloud}/overview.mdx +3 -3
- package/.docs/raw/{mastra-cloud → deployment/mastra-cloud}/setting-up.mdx +4 -4
- package/.docs/raw/deployment/monorepo.mdx +3 -3
- package/.docs/raw/deployment/overview.mdx +7 -7
- package/.docs/raw/deployment/web-framework.mdx +6 -6
- package/.docs/raw/evals/{off-the-shelf-scorers.mdx → built-in-scorers.mdx} +17 -15
- package/.docs/raw/evals/custom-scorers.mdx +4 -6
- package/.docs/raw/evals/overview.mdx +6 -7
- package/.docs/raw/evals/running-in-ci.mdx +2 -4
- package/.docs/raw/getting-started/{installation.mdx → manual-install.mdx} +15 -89
- package/.docs/raw/getting-started/mcp-docs-server.mdx +6 -6
- package/.docs/raw/getting-started/project-structure.mdx +2 -2
- package/.docs/raw/getting-started/start.mdx +72 -0
- package/.docs/raw/getting-started/studio.mdx +8 -6
- package/.docs/raw/guides/agent-frameworks/ai-sdk.mdx +147 -0
- package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +627 -0
- package/.docs/raw/{frameworks/agentic-uis → guides/build-your-ui}/assistant-ui.mdx +72 -20
- package/.docs/raw/guides/build-your-ui/copilotkit.mdx +206 -0
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/astro.mdx +28 -30
- package/.docs/raw/{frameworks/servers → guides/getting-started}/express.mdx +4 -5
- package/.docs/raw/guides/getting-started/next-js.mdx +276 -0
- package/.docs/raw/guides/getting-started/quickstart.mdx +97 -0
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/sveltekit.mdx +28 -30
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/vite-react.mdx +12 -12
- package/.docs/raw/guides/guide/ai-recruiter.mdx +2 -3
- package/.docs/raw/guides/guide/chef-michel.mdx +2 -3
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +3 -3
- package/.docs/raw/guides/guide/research-assistant.mdx +8 -18
- package/.docs/raw/guides/guide/stock-agent.mdx +4 -6
- package/.docs/raw/guides/guide/web-search.mdx +12 -10
- package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +421 -0
- package/.docs/raw/guides/index.mdx +3 -35
- package/.docs/raw/guides/migrations/agentnetwork.mdx +4 -4
- package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +119 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +56 -6
- package/.docs/raw/guides/migrations/upgrade-to-v1/client.mdx +42 -2
- package/.docs/raw/guides/migrations/upgrade-to-v1/evals.mdx +31 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/mastra.mdx +29 -5
- package/.docs/raw/guides/migrations/upgrade-to-v1/mcp.mdx +3 -3
- package/.docs/raw/guides/migrations/upgrade-to-v1/memory.mdx +28 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/overview.mdx +59 -37
- package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +80 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +70 -5
- package/.docs/raw/guides/migrations/upgrade-to-v1/tracing.mdx +13 -13
- package/.docs/raw/guides/migrations/upgrade-to-v1/vectors.mdx +25 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/voice.mdx +1 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +175 -2
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +2 -2
- package/.docs/raw/index.mdx +4 -4
- package/.docs/raw/mcp/overview.mdx +358 -0
- package/.docs/raw/mcp/publishing-mcp-server.mdx +139 -0
- package/.docs/raw/memory/conversation-history.mdx +1 -1
- package/.docs/raw/memory/memory-processors.mdx +265 -80
- package/.docs/raw/memory/overview.mdx +3 -3
- package/.docs/raw/memory/semantic-recall.mdx +10 -10
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +5 -10
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +150 -0
- package/.docs/raw/memory/storage/memory-with-pg.mdx +5 -10
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +5 -10
- package/.docs/raw/memory/threads-and-resources.mdx +4 -4
- package/.docs/raw/memory/working-memory.mdx +16 -8
- package/.docs/raw/{logging.mdx → observability/logging.mdx} +8 -8
- package/.docs/raw/observability/overview.mdx +5 -6
- package/.docs/raw/observability/tracing/bridges/otel.mdx +200 -0
- package/.docs/raw/observability/tracing/exporters/arize.mdx +39 -3
- package/.docs/raw/observability/tracing/exporters/braintrust.mdx +22 -3
- package/.docs/raw/observability/tracing/exporters/cloud.mdx +4 -4
- package/.docs/raw/observability/tracing/exporters/default.mdx +6 -6
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +86 -3
- package/.docs/raw/observability/tracing/exporters/langsmith.mdx +15 -3
- package/.docs/raw/observability/tracing/exporters/otel.mdx +128 -30
- package/.docs/raw/observability/tracing/exporters/posthog.mdx +127 -0
- package/.docs/raw/observability/tracing/overview.mdx +100 -29
- package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +2 -3
- package/.docs/raw/rag/chunking-and-embedding.mdx +16 -17
- package/.docs/raw/rag/overview.mdx +5 -4
- package/.docs/raw/rag/retrieval.mdx +44 -39
- package/.docs/raw/rag/vector-databases.mdx +94 -3
- package/.docs/raw/reference/agents/agent.mdx +10 -14
- package/.docs/raw/reference/agents/generate.mdx +67 -99
- package/.docs/raw/reference/agents/generateLegacy.mdx +3 -3
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +1 -1
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +1 -1
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +1 -1
- package/.docs/raw/reference/agents/getDescription.mdx +1 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +1 -1
- package/.docs/raw/reference/agents/getLLM.mdx +2 -2
- package/.docs/raw/reference/agents/getMemory.mdx +1 -1
- package/.docs/raw/reference/agents/getModel.mdx +1 -1
- package/.docs/raw/reference/agents/getTools.mdx +69 -0
- package/.docs/raw/reference/agents/getVoice.mdx +1 -1
- package/.docs/raw/reference/agents/listAgents.mdx +1 -1
- package/.docs/raw/reference/agents/listScorers.mdx +1 -1
- package/.docs/raw/reference/agents/listTools.mdx +2 -2
- package/.docs/raw/reference/agents/listWorkflows.mdx +1 -1
- package/.docs/raw/reference/agents/network.mdx +33 -72
- package/.docs/raw/reference/ai-sdk/chat-route.mdx +127 -0
- package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +117 -0
- package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +64 -0
- package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +116 -0
- package/.docs/raw/reference/ai-sdk/network-route.mdx +99 -0
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-stream.mdx +289 -0
- package/.docs/raw/reference/ai-sdk/with-mastra.mdx +119 -0
- package/.docs/raw/reference/ai-sdk/workflow-route.mdx +110 -0
- package/.docs/raw/reference/auth/auth0.mdx +1 -1
- package/.docs/raw/reference/auth/clerk.mdx +1 -1
- package/.docs/raw/reference/auth/firebase.mdx +1 -1
- package/.docs/raw/reference/auth/jwt.mdx +1 -1
- package/.docs/raw/reference/auth/supabase.mdx +1 -1
- package/.docs/raw/reference/auth/workos.mdx +1 -1
- package/.docs/raw/reference/cli/create-mastra.mdx +11 -11
- package/.docs/raw/reference/cli/mastra.mdx +25 -12
- package/.docs/raw/reference/client-js/agents.mdx +252 -68
- package/.docs/raw/reference/client-js/error-handling.mdx +1 -1
- package/.docs/raw/reference/client-js/logs.mdx +1 -1
- package/.docs/raw/reference/client-js/mastra-client.mdx +4 -4
- package/.docs/raw/reference/client-js/memory.mdx +48 -2
- package/.docs/raw/reference/client-js/observability.mdx +1 -1
- package/.docs/raw/reference/client-js/telemetry.mdx +1 -1
- package/.docs/raw/reference/client-js/tools.mdx +1 -1
- package/.docs/raw/reference/client-js/vectors.mdx +1 -1
- package/.docs/raw/reference/client-js/workflows.mdx +93 -64
- package/.docs/raw/reference/core/addGateway.mdx +59 -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/getGateway.mdx +59 -0
- package/.docs/raw/reference/core/getGatewayById.mdx +62 -0
- package/.docs/raw/reference/core/getLogger.mdx +3 -3
- package/.docs/raw/reference/core/getMCPServer.mdx +4 -4
- package/.docs/raw/reference/core/getMCPServerById.mdx +5 -5
- package/.docs/raw/reference/core/getMemory.mdx +73 -0
- package/.docs/raw/reference/core/getScorer.mdx +1 -1
- package/.docs/raw/reference/core/getScorerById.mdx +1 -1
- package/.docs/raw/reference/core/getServer.mdx +2 -2
- package/.docs/raw/reference/core/getStorage.mdx +1 -1
- package/.docs/raw/reference/core/getStoredAgentById.mdx +183 -0
- package/.docs/raw/reference/core/getTelemetry.mdx +3 -3
- 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/listGateways.mdx +53 -0
- package/.docs/raw/reference/core/listLogs.mdx +3 -3
- package/.docs/raw/reference/core/listLogsByRunId.mdx +3 -3
- package/.docs/raw/reference/core/listMCPServers.mdx +5 -5
- package/.docs/raw/reference/core/listMemory.mdx +70 -0
- package/.docs/raw/reference/core/listScorers.mdx +1 -1
- package/.docs/raw/reference/core/listStoredAgents.mdx +151 -0
- package/.docs/raw/reference/core/listVectors.mdx +1 -1
- package/.docs/raw/reference/core/listWorkflows.mdx +1 -1
- package/.docs/raw/reference/core/mastra-class.mdx +17 -1
- package/.docs/raw/reference/core/mastra-model-gateway.mdx +227 -0
- package/.docs/raw/reference/core/setLogger.mdx +3 -3
- package/.docs/raw/reference/core/setStorage.mdx +1 -1
- package/.docs/raw/reference/core/setTelemetry.mdx +3 -3
- package/.docs/raw/reference/deployer/cloudflare.mdx +1 -1
- package/.docs/raw/reference/deployer/deployer.mdx +1 -1
- package/.docs/raw/reference/deployer/netlify.mdx +2 -3
- package/.docs/raw/reference/deployer/vercel.mdx +1 -1
- package/.docs/raw/reference/evals/answer-relevancy.mdx +29 -99
- package/.docs/raw/reference/evals/answer-similarity.mdx +13 -259
- package/.docs/raw/reference/evals/bias.mdx +30 -88
- package/.docs/raw/reference/evals/completeness.mdx +32 -91
- package/.docs/raw/reference/evals/content-similarity.mdx +29 -89
- package/.docs/raw/reference/evals/context-precision.mdx +29 -131
- package/.docs/raw/reference/evals/context-relevance.mdx +12 -12
- package/.docs/raw/reference/evals/create-scorer.mdx +59 -50
- package/.docs/raw/reference/evals/faithfulness.mdx +29 -102
- package/.docs/raw/reference/evals/hallucination.mdx +29 -104
- package/.docs/raw/reference/evals/keyword-coverage.mdx +29 -108
- package/.docs/raw/reference/evals/mastra-scorer.mdx +3 -1
- package/.docs/raw/reference/evals/noise-sensitivity.mdx +12 -12
- package/.docs/raw/reference/evals/prompt-alignment.mdx +16 -16
- package/.docs/raw/reference/evals/run-evals.mdx +1 -1
- package/.docs/raw/reference/evals/scorer-utils.mdx +362 -0
- package/.docs/raw/reference/evals/textual-difference.mdx +28 -101
- package/.docs/raw/reference/evals/tone-consistency.mdx +26 -99
- package/.docs/raw/reference/evals/tool-call-accuracy.mdx +8 -8
- package/.docs/raw/reference/evals/toxicity.mdx +30 -93
- package/.docs/raw/reference/index.mdx +1 -0
- package/.docs/raw/reference/logging/pino-logger.mdx +2 -2
- package/.docs/raw/reference/memory/createThread.mdx +1 -1
- package/.docs/raw/reference/memory/deleteMessages.mdx +1 -1
- package/.docs/raw/reference/memory/getThreadById.mdx +1 -1
- package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +1 -1
- package/.docs/raw/reference/memory/memory-class.mdx +6 -8
- package/.docs/raw/reference/memory/query.mdx +1 -1
- package/.docs/raw/reference/memory/recall.mdx +1 -1
- package/.docs/raw/reference/observability/tracing/bridges/otel.mdx +177 -0
- package/.docs/raw/reference/observability/tracing/configuration.mdx +12 -16
- package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +31 -2
- package/.docs/raw/reference/observability/tracing/exporters/braintrust.mdx +1 -1
- package/.docs/raw/reference/observability/tracing/exporters/cloud-exporter.mdx +9 -9
- package/.docs/raw/reference/observability/tracing/exporters/console-exporter.mdx +9 -9
- package/.docs/raw/reference/observability/tracing/exporters/default-exporter.mdx +9 -9
- package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +44 -1
- package/.docs/raw/reference/observability/tracing/exporters/langsmith.mdx +18 -2
- package/.docs/raw/reference/observability/tracing/exporters/otel.mdx +34 -44
- package/.docs/raw/reference/observability/tracing/exporters/posthog.mdx +132 -0
- package/.docs/raw/reference/observability/tracing/instances.mdx +8 -12
- package/.docs/raw/reference/observability/tracing/interfaces.mdx +36 -11
- package/.docs/raw/reference/observability/tracing/processors/sensitive-data-filter.mdx +1 -1
- package/.docs/raw/reference/observability/tracing/spans.mdx +7 -11
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +10 -4
- package/.docs/raw/reference/processors/language-detector.mdx +19 -6
- package/.docs/raw/reference/processors/message-history-processor.mdx +131 -0
- package/.docs/raw/reference/processors/moderation-processor.mdx +21 -8
- package/.docs/raw/reference/processors/pii-detector.mdx +21 -8
- package/.docs/raw/reference/processors/processor-interface.mdx +502 -0
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +19 -6
- package/.docs/raw/reference/processors/semantic-recall-processor.mdx +197 -0
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +12 -7
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +11 -5
- package/.docs/raw/reference/processors/tool-call-filter.mdx +125 -0
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +10 -4
- package/.docs/raw/reference/processors/working-memory-processor.mdx +221 -0
- package/.docs/raw/reference/rag/chunk.mdx +1 -1
- package/.docs/raw/reference/rag/database-config.mdx +1 -1
- package/.docs/raw/reference/rag/document.mdx +1 -1
- package/.docs/raw/reference/rag/embeddings.mdx +6 -6
- package/.docs/raw/reference/rag/extract-params.mdx +1 -1
- package/.docs/raw/reference/rag/graph-rag.mdx +1 -1
- package/.docs/raw/reference/rag/metadata-filters.mdx +1 -1
- package/.docs/raw/reference/rag/rerank.mdx +2 -3
- package/.docs/raw/reference/rag/rerankWithScorer.mdx +1 -2
- package/.docs/raw/reference/server/create-route.mdx +328 -0
- package/.docs/raw/reference/server/express-adapter.mdx +260 -0
- package/.docs/raw/reference/server/hono-adapter.mdx +242 -0
- package/.docs/raw/reference/server/mastra-server.mdx +345 -0
- package/.docs/raw/reference/server/routes.mdx +250 -0
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +39 -2
- package/.docs/raw/reference/storage/cloudflare.mdx +2 -2
- package/.docs/raw/reference/storage/convex.mdx +164 -0
- package/.docs/raw/reference/storage/dynamodb.mdx +4 -4
- package/.docs/raw/reference/storage/lance.mdx +35 -2
- package/.docs/raw/reference/storage/libsql.mdx +39 -2
- package/.docs/raw/reference/storage/mongodb.mdx +41 -2
- package/.docs/raw/reference/storage/mssql.mdx +39 -2
- package/.docs/raw/reference/storage/postgresql.mdx +39 -2
- package/.docs/raw/reference/storage/upstash.mdx +2 -2
- package/.docs/raw/reference/streaming/ChunkType.mdx +2 -2
- package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +1 -1
- package/.docs/raw/reference/streaming/agents/stream.mdx +68 -95
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +8 -10
- package/.docs/raw/reference/streaming/workflows/{resumeStreamVNext.mdx → resumeStream.mdx} +51 -11
- package/.docs/raw/reference/streaming/workflows/stream.mdx +84 -25
- package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +170 -0
- package/.docs/raw/reference/templates/overview.mdx +3 -6
- package/.docs/raw/reference/tools/client.mdx +2 -3
- package/.docs/raw/reference/tools/create-tool.mdx +135 -4
- package/.docs/raw/reference/tools/document-chunker-tool.mdx +1 -1
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +7 -7
- package/.docs/raw/reference/tools/mcp-client.mdx +131 -23
- package/.docs/raw/reference/tools/mcp-server.mdx +56 -8
- package/.docs/raw/reference/tools/vector-query-tool.mdx +16 -17
- package/.docs/raw/reference/vectors/astra.mdx +1 -1
- package/.docs/raw/reference/vectors/chroma.mdx +82 -2
- package/.docs/raw/reference/vectors/convex.mdx +429 -0
- package/.docs/raw/reference/vectors/couchbase.mdx +33 -20
- package/.docs/raw/reference/vectors/duckdb.mdx +462 -0
- package/.docs/raw/reference/vectors/elasticsearch.mdx +310 -0
- package/.docs/raw/reference/vectors/lance.mdx +39 -23
- package/.docs/raw/reference/vectors/libsql.mdx +37 -4
- package/.docs/raw/reference/vectors/mongodb.mdx +43 -4
- package/.docs/raw/reference/vectors/opensearch.mdx +38 -17
- package/.docs/raw/reference/vectors/pg.mdx +44 -37
- package/.docs/raw/reference/vectors/pinecone.mdx +70 -3
- package/.docs/raw/reference/vectors/qdrant.mdx +37 -2
- package/.docs/raw/reference/vectors/s3vectors.mdx +2 -2
- package/.docs/raw/reference/vectors/turbopuffer.mdx +75 -1
- package/.docs/raw/reference/vectors/upstash.mdx +1 -1
- package/.docs/raw/reference/vectors/vectorize.mdx +1 -1
- package/.docs/raw/reference/voice/azure.mdx +96 -81
- package/.docs/raw/reference/voice/cloudflare.mdx +1 -1
- package/.docs/raw/reference/voice/composite-voice.mdx +72 -29
- package/.docs/raw/reference/voice/deepgram.mdx +1 -1
- package/.docs/raw/reference/voice/elevenlabs.mdx +1 -1
- package/.docs/raw/reference/voice/google-gemini-live.mdx +1 -1
- package/.docs/raw/reference/voice/google.mdx +160 -21
- package/.docs/raw/reference/voice/mastra-voice.mdx +1 -1
- package/.docs/raw/reference/voice/murf.mdx +1 -1
- package/.docs/raw/reference/voice/openai-realtime.mdx +3 -3
- package/.docs/raw/reference/voice/openai.mdx +1 -1
- package/.docs/raw/reference/voice/playai.mdx +1 -1
- package/.docs/raw/reference/voice/sarvam.mdx +1 -1
- package/.docs/raw/reference/voice/speechify.mdx +1 -1
- package/.docs/raw/reference/voice/voice.addInstructions.mdx +3 -4
- package/.docs/raw/reference/voice/voice.addTools.mdx +2 -2
- package/.docs/raw/reference/voice/voice.answer.mdx +2 -2
- package/.docs/raw/reference/voice/voice.close.mdx +2 -2
- package/.docs/raw/reference/voice/voice.connect.mdx +2 -2
- package/.docs/raw/reference/voice/voice.events.mdx +1 -1
- package/.docs/raw/reference/voice/voice.getSpeakers.mdx +1 -1
- package/.docs/raw/reference/voice/voice.listen.mdx +87 -53
- package/.docs/raw/reference/voice/voice.off.mdx +2 -2
- package/.docs/raw/reference/voice/voice.on.mdx +2 -2
- package/.docs/raw/reference/voice/voice.send.mdx +2 -2
- package/.docs/raw/reference/voice/voice.speak.mdx +76 -41
- package/.docs/raw/reference/voice/voice.updateConfig.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +1 -1
- package/.docs/raw/reference/workflows/run-methods/restart.mdx +142 -0
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +45 -1
- package/.docs/raw/reference/workflows/run-methods/start.mdx +48 -4
- package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +310 -0
- package/.docs/raw/reference/workflows/run.mdx +28 -6
- package/.docs/raw/reference/workflows/step.mdx +65 -1
- 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 +1 -1
- 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 +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +1 -1
- 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 +21 -2
- package/.docs/raw/server-db/custom-adapters.mdx +386 -0
- package/.docs/raw/server-db/custom-api-routes.mdx +6 -6
- package/.docs/raw/server-db/mastra-client.mdx +7 -8
- package/.docs/raw/server-db/{production-server.mdx → mastra-server.mdx} +16 -8
- package/.docs/raw/server-db/middleware.mdx +31 -31
- package/.docs/raw/server-db/request-context.mdx +3 -4
- package/.docs/raw/server-db/server-adapters.mdx +312 -0
- package/.docs/raw/server-db/storage.mdx +12 -1
- package/.docs/raw/streaming/events.mdx +1 -1
- package/.docs/raw/streaming/overview.mdx +27 -16
- package/.docs/raw/streaming/tool-streaming.mdx +58 -19
- package/.docs/raw/streaming/workflow-streaming.mdx +6 -12
- package/.docs/raw/tools-mcp/advanced-usage.mdx +2 -3
- package/.docs/raw/tools-mcp/mcp-overview.mdx +5 -7
- package/.docs/raw/tools-mcp/overview.mdx +1 -1
- package/.docs/raw/voice/overview.mdx +88 -41
- package/.docs/raw/voice/speech-to-speech.mdx +5 -5
- package/.docs/raw/voice/speech-to-text.mdx +3 -4
- package/.docs/raw/voice/text-to-speech.mdx +3 -4
- package/.docs/raw/workflows/agents-and-tools.mdx +43 -5
- package/.docs/raw/workflows/control-flow.mdx +186 -1
- package/.docs/raw/workflows/error-handling.mdx +5 -4
- package/.docs/raw/workflows/human-in-the-loop.mdx +160 -213
- package/.docs/raw/workflows/inngest-workflow.mdx +2 -2
- package/.docs/raw/workflows/input-data-mapping.mdx +1 -1
- package/.docs/raw/workflows/overview.mdx +67 -47
- package/.docs/raw/workflows/snapshots.mdx +5 -3
- package/.docs/raw/workflows/suspend-and-resume.mdx +121 -204
- package/.docs/raw/workflows/time-travel.mdx +313 -0
- package/.docs/raw/workflows/workflow-state.mdx +190 -0
- package/CHANGELOG.md +88 -0
- package/dist/{chunk-5NJC7NRO.js → chunk-4CM2BQNP.js} +24 -4
- package/dist/prepare-docs/package-changes.d.ts.map +1 -1
- package/dist/prepare-docs/prepare.js +1 -1
- package/dist/stdio.js +17 -19
- package/package.json +11 -15
- package/.docs/raw/deployment/serverless-platforms/index.mdx +0 -58
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +0 -688
- package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +0 -123
- package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +0 -382
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +0 -179
- package/.docs/raw/frameworks/web-frameworks/next-js.mdx +0 -379
- package/.docs/raw/getting-started/templates.mdx +0 -73
- package/.docs/raw/mastra-cloud/observability.mdx +0 -51
- package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +0 -47
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +0 -153
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Next.js | Frameworks"
|
|
3
|
+
description: "Get started with Mastra and Next.js"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Integrate Mastra in your Next.js project
|
|
7
|
+
|
|
8
|
+
In this guide, you'll build a tool-calling AI agent using Mastra, then connect it to Next.js by importing and calling the agent directly from your routes.
|
|
9
|
+
|
|
10
|
+
You'll use [AI SDK UI](https://ai-sdk.dev/docs/ai-sdk-ui/overview) and [AI Elements](https://ai-sdk.dev/elements) to create a beautiful, interactive chat experience.
|
|
11
|
+
|
|
12
|
+
<figure>
|
|
13
|
+

|
|
14
|
+
<figcaption class="text-sm text-center">What you'll build: an agent that can call a weather tool, display the JSON result, stream a weather summary in the chat UI, and persist conversation history across reloads.</figcaption>
|
|
15
|
+
</figure>
|
|
16
|
+
|
|
17
|
+
## Before you begin
|
|
18
|
+
|
|
19
|
+
* You'll need an API key from a supported [model provider](/models/v1). If you don't have a preference, use [OpenAI](/models/v1/providers/openai).
|
|
20
|
+
|
|
21
|
+
## Create a new Next.js app (optional)
|
|
22
|
+
|
|
23
|
+
If you already have a Next.js app, skip to the next step.
|
|
24
|
+
|
|
25
|
+
Run the following command to [create a new Next.js app](https://nextjs.org/docs/app/getting-started/installation):
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx create-next-app \
|
|
29
|
+
my-nextjs-agent \
|
|
30
|
+
--yes \
|
|
31
|
+
--ts \
|
|
32
|
+
--eslint \
|
|
33
|
+
--tailwind \
|
|
34
|
+
--src-dir \
|
|
35
|
+
--app \
|
|
36
|
+
--turbopack \
|
|
37
|
+
--no-react-compiler \
|
|
38
|
+
--no-import-alias
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This creates a project called `my-nextjs-agent`, but you can replace it with any name you want.
|
|
42
|
+
|
|
43
|
+
## Initialize Mastra
|
|
44
|
+
`cd` into your Next.js project and run [`mastra init`](/reference/v1/cli/create-mastra).
|
|
45
|
+
|
|
46
|
+
When prompted, choose a provider (e.g. OpenAI) and enter your key:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cd my-nextjs-agent
|
|
50
|
+
npx --force mastra@beta init
|
|
51
|
+
```
|
|
52
|
+
This creates a `src/mastra` folder with an example weather agent and the following files:
|
|
53
|
+
|
|
54
|
+
- `index.ts` - Mastra config, including memory
|
|
55
|
+
- `tools/weather-tool.ts` - a tool to fetch weather for a given location
|
|
56
|
+
- `agents/weather-agent.ts`- a weather agent with a prompt that uses the tool
|
|
57
|
+
|
|
58
|
+
You'll call `weather-agent.ts` from your Next.js routes in the next steps.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## Install AI SDK and AI Elements
|
|
62
|
+
|
|
63
|
+
Install AI SDK along with the Mastra adapter:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install \
|
|
67
|
+
@mastra/ai-sdk \
|
|
68
|
+
@ai-sdk/react \
|
|
69
|
+
ai
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Next, initialize AI Elements. When prompted, choose the default options:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx ai-elements@latest
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This downloads the entire AI Elements UI component library into a `@/components/ai-elements` folder.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## Create a chat route
|
|
82
|
+
|
|
83
|
+
Create `src/app/api/chat/route.ts`:
|
|
84
|
+
|
|
85
|
+
```ts title="src/app/api/chat/route.ts"
|
|
86
|
+
import { mastra } from "@/mastra";
|
|
87
|
+
import { NextResponse } from "next/server";
|
|
88
|
+
import { toAISdkStream } from "@mastra/ai-sdk";
|
|
89
|
+
import { convertMessages } from "@mastra/core/agent";
|
|
90
|
+
import { createUIMessageStreamResponse } from "ai";
|
|
91
|
+
|
|
92
|
+
const weatherAgent = mastra.getAgent("weatherAgent");
|
|
93
|
+
|
|
94
|
+
export async function POST(req: Request) {
|
|
95
|
+
const { messages } = await req.json();
|
|
96
|
+
|
|
97
|
+
const stream = await weatherAgent.stream(messages, {
|
|
98
|
+
memory: {
|
|
99
|
+
thread: "example-user-id",
|
|
100
|
+
resource: "weather-chat",
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return createUIMessageStreamResponse({
|
|
105
|
+
stream: toAISdkStream(stream, { from: "agent" }),
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export async function GET() {
|
|
110
|
+
const memory = await weatherAgent.getMemory();
|
|
111
|
+
const response = await memory?.query({
|
|
112
|
+
threadId: "example-user-id",
|
|
113
|
+
resourceId: "weather-chat",
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const uiMessages =
|
|
117
|
+
convertMessages(response?.uiMessages ?? []).to("AIV5.UI");
|
|
118
|
+
return NextResponse.json(uiMessages);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The POST route accepts a prompt and streams the agent's response back in AI SDK format, while the GET route fetches message history from memory so the UI can be hydrated when the client reloads.
|
|
123
|
+
|
|
124
|
+
## Create a chat page
|
|
125
|
+
|
|
126
|
+
Create `src/app/chat/page.tsx`:
|
|
127
|
+
|
|
128
|
+
```tsx title="src/app/chat/page.tsx"
|
|
129
|
+
'use client';
|
|
130
|
+
|
|
131
|
+
import '@/app/globals.css';
|
|
132
|
+
import { useEffect, useState } from 'react';
|
|
133
|
+
import { DefaultChatTransport } from 'ai';
|
|
134
|
+
import { useChat } from '@ai-sdk/react';
|
|
135
|
+
|
|
136
|
+
import {
|
|
137
|
+
PromptInput,
|
|
138
|
+
PromptInputBody,
|
|
139
|
+
PromptInputTextarea,
|
|
140
|
+
} from '@/components/ai-elements/prompt-input';
|
|
141
|
+
|
|
142
|
+
import {
|
|
143
|
+
Conversation,
|
|
144
|
+
ConversationContent,
|
|
145
|
+
ConversationScrollButton,
|
|
146
|
+
} from '@/components/ai-elements/conversation';
|
|
147
|
+
|
|
148
|
+
import { Message, MessageContent, MessageResponse } from '@/components/ai-elements/message';
|
|
149
|
+
|
|
150
|
+
import {
|
|
151
|
+
Tool,
|
|
152
|
+
ToolHeader,
|
|
153
|
+
ToolContent,
|
|
154
|
+
ToolInput,
|
|
155
|
+
ToolOutput,
|
|
156
|
+
} from '@/components/ai-elements/tool';
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
function Chat() {
|
|
160
|
+
const [input, setInput] = useState<string>('');
|
|
161
|
+
|
|
162
|
+
const { messages, setMessages, sendMessage, status } = useChat({
|
|
163
|
+
transport: new DefaultChatTransport({
|
|
164
|
+
api: '/api/chat',
|
|
165
|
+
}),
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
const fetchMessages = async () => {
|
|
170
|
+
const res = await fetch('/api/chat');
|
|
171
|
+
const data = await res.json();
|
|
172
|
+
setMessages([...data]);
|
|
173
|
+
};
|
|
174
|
+
fetchMessages();
|
|
175
|
+
}, [setMessages]);
|
|
176
|
+
|
|
177
|
+
const handleSubmit = async () => {
|
|
178
|
+
if (!input.trim()) return;
|
|
179
|
+
|
|
180
|
+
sendMessage({ text: input });
|
|
181
|
+
setInput('');
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<div className="w-full p-6 relative size-full h-screen">
|
|
186
|
+
<div className="flex flex-col h-full">
|
|
187
|
+
<Conversation className="h-full">
|
|
188
|
+
<ConversationContent>
|
|
189
|
+
{messages.map((message: any) => (
|
|
190
|
+
<div key={message.id}>
|
|
191
|
+
{message.parts?.map((part: any, i: number) => {
|
|
192
|
+
if (part.type === 'text') {
|
|
193
|
+
return (
|
|
194
|
+
<Message
|
|
195
|
+
key={`${message.id}-${i}`}
|
|
196
|
+
from={message.role}>
|
|
197
|
+
<MessageContent>
|
|
198
|
+
<MessageResponse>{part.text}</MessageResponse>
|
|
199
|
+
</MessageContent>
|
|
200
|
+
</Message>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (part.type?.startsWith('tool-')) {
|
|
205
|
+
return (
|
|
206
|
+
<Tool key={`${message.id}-${i}`}>
|
|
207
|
+
<ToolHeader
|
|
208
|
+
type={part.type}
|
|
209
|
+
state={part.state || 'output-available'}
|
|
210
|
+
className="cursor-pointer"
|
|
211
|
+
/>
|
|
212
|
+
<ToolContent>
|
|
213
|
+
<ToolInput input={part.input || part.args || {}} />
|
|
214
|
+
<ToolOutput
|
|
215
|
+
output={part.output || part.result}
|
|
216
|
+
errorText={part.errorText || part.error}
|
|
217
|
+
/>
|
|
218
|
+
</ToolContent>
|
|
219
|
+
</Tool>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return null;
|
|
224
|
+
})}
|
|
225
|
+
</div>
|
|
226
|
+
))}
|
|
227
|
+
<ConversationScrollButton />
|
|
228
|
+
</ConversationContent>
|
|
229
|
+
</Conversation>
|
|
230
|
+
|
|
231
|
+
<PromptInput onSubmit={handleSubmit} className="mt-20">
|
|
232
|
+
<PromptInputBody>
|
|
233
|
+
<PromptInputTextarea
|
|
234
|
+
onChange={(e: any) => setInput(e.target.value)}
|
|
235
|
+
className="md:leading-10"
|
|
236
|
+
value={input}
|
|
237
|
+
placeholder="Type your message..."
|
|
238
|
+
disabled={status !== 'ready'}
|
|
239
|
+
/>
|
|
240
|
+
</PromptInputBody>
|
|
241
|
+
</PromptInput>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export default Chat;
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
This component connects [`useChat()`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-chat) to the `api/chat` endpoint, sending prompts there and streaming the response back in chunks.
|
|
251
|
+
|
|
252
|
+
It renders the response text using the [`<MessageResponse>`](https://ai-sdk.dev/elements/components/message#messageresponse-) component, and shows any tool invocations with the [`<Tool>`](https://ai-sdk.dev/elements/components/tool) component.
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
## Test your agent
|
|
256
|
+
1. Run your Next.js app with `npm run dev`
|
|
257
|
+
|
|
258
|
+
2. Open the chat at http://localhost:3000/chat
|
|
259
|
+
|
|
260
|
+
3. Try asking about the weather. If your API key is set up correctly, you'll get a response
|
|
261
|
+
|
|
262
|
+
## Next steps
|
|
263
|
+
|
|
264
|
+
Congratulations on building your Mastra agent with Next.js! 🎉
|
|
265
|
+
|
|
266
|
+
From here, you can extend the project with your own tools and logic:
|
|
267
|
+
|
|
268
|
+
- Learn more about [agents](/docs/v1/agents/overview)
|
|
269
|
+
- Give your agent its own [tools](/docs/v1/agents/using-tools)
|
|
270
|
+
- Add human-like [memory](/docs/v1/agents/agent-memory) to your agent
|
|
271
|
+
|
|
272
|
+
When you're ready, read more about how Mastra integrates with AI SDK and Next.js, and how to deploy your agent anywhere, including Vercel:
|
|
273
|
+
|
|
274
|
+
- Integrate Mastra with [AI SDK](/guides/v1/build-your-ui/ai-sdk-ui)
|
|
275
|
+
- Deploy your agent to [Vercel](/docs/v1/deployment/cloud-providers/vercel-deployer)
|
|
276
|
+
- Deploy your agent [anywhere](/docs/v1/deployment/overview)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Quickstart"
|
|
3
|
+
description: Get started with Mastra using the create mastra CLI to build a server with agents, workflows, and tools.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import Tabs from "@theme/Tabs";
|
|
7
|
+
import TabItem from "@theme/TabItem";
|
|
8
|
+
import Steps from "@site/src/components/Steps";
|
|
9
|
+
import StepItem from "@site/src/components/StepItem";
|
|
10
|
+
import { VideoPlayer } from "@site/src/components/video-player";
|
|
11
|
+
|
|
12
|
+
# Mastra Quickstart
|
|
13
|
+
|
|
14
|
+
The `create mastra` CLI command is the quickest way to get started. It walks you through setup and creates example agents, workflows, and tools for you to run locally or adapt
|
|
15
|
+
|
|
16
|
+
If you need more control over the setup, see the [manual installation guide](/docs/v1/getting-started/manual-install). You can also use [`mastra init`](/reference/v1/cli/mastra#mastra-init) for existing projects.
|
|
17
|
+
|
|
18
|
+
## Before you begin
|
|
19
|
+
|
|
20
|
+
* You'll need an API key from a supported [model provider](/models/v1). If you don't have a preference, use [OpenAI](/models/v1/providers/openai).
|
|
21
|
+
|
|
22
|
+
## Initialize Mastra
|
|
23
|
+
|
|
24
|
+
You can run `create mastra` anywhere on your machine.
|
|
25
|
+
|
|
26
|
+
When prompted, choose a provider (e.g. OpenAI) and enter your key:
|
|
27
|
+
|
|
28
|
+
<Tabs>
|
|
29
|
+
<TabItem value="npm" label="npm">
|
|
30
|
+
|
|
31
|
+
```bash copy
|
|
32
|
+
npm create mastra@beta
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
</TabItem>
|
|
36
|
+
<TabItem value="pnpm" label="pnpm">
|
|
37
|
+
|
|
38
|
+
```bash copy
|
|
39
|
+
pnpm create mastra@beta
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
</TabItem>
|
|
43
|
+
<TabItem value="yarn" label="yarn">
|
|
44
|
+
|
|
45
|
+
```bash copy
|
|
46
|
+
yarn create mastra@beta
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
</TabItem>
|
|
50
|
+
<TabItem value="bun" label="bun">
|
|
51
|
+
|
|
52
|
+
```bash copy
|
|
53
|
+
bun create mastra@beta
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
:::warning
|
|
57
|
+
|
|
58
|
+
Due to a [known issue with Bun](https://github.com/oven-sh/bun/issues/25314) you'll need to run these steps after creating the project:
|
|
59
|
+
|
|
60
|
+
- `bun add @mastra/server@beta`
|
|
61
|
+
- Delete your `node_modules` folder
|
|
62
|
+
- Delete your `bun.lock` file
|
|
63
|
+
- Run `bun install` to reinstall your packages
|
|
64
|
+
|
|
65
|
+
:::
|
|
66
|
+
|
|
67
|
+
</TabItem>
|
|
68
|
+
</Tabs>
|
|
69
|
+
|
|
70
|
+
This creates a new directory for your project with a `src/mastra` folder containing an example weather agent and the following files:
|
|
71
|
+
|
|
72
|
+
- `index.ts` - Mastra config, including memory
|
|
73
|
+
- `tools/weather-tool.ts` - a tool to fetch weather for a given location
|
|
74
|
+
- `agents/weather-agent.ts` - a weather agent with a prompt that uses the tool
|
|
75
|
+
|
|
76
|
+
:::tip
|
|
77
|
+
|
|
78
|
+
You can use [flags](/reference/v1/cli/create-mastra#cli-flags) with `create mastra` like `--no-example` to skip the example weather agent or `--template` to start from a specific [template](https://mastra.ai/templates)
|
|
79
|
+
|
|
80
|
+
:::
|
|
81
|
+
|
|
82
|
+
## Test your agent
|
|
83
|
+
|
|
84
|
+
Once setup is complete, follow the instructions in your terminal to start the Mastra dev server, then open Studio at [localhost:4111](http://localhost:4111).
|
|
85
|
+
|
|
86
|
+
Try asking about the weather. If your API key is set up correctly, you'll get a response:
|
|
87
|
+
|
|
88
|
+
<VideoPlayer src="https://res.cloudinary.com/mastra-assets/video/upload/v1751406022/local-dev-agents-playground_100_m3begx.mp4" />
|
|
89
|
+
|
|
90
|
+
[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 app using the guides below.
|
|
91
|
+
|
|
92
|
+
## Next steps
|
|
93
|
+
|
|
94
|
+
- Integrate Mastra with your frontend framework: [Next.js](/guides/v1/getting-started/next-js), [React](/guides/v1/getting-started/vite-react), or [Astro](/guides/v1/getting-started/astro)
|
|
95
|
+
- Read more about [Mastra's features](/docs/v1#why-mastra)
|
|
96
|
+
- Build an agent from scratch following one of our [guides](/guides/v1)
|
|
97
|
+
- Watch conceptual guides on our [YouTube channel](https://www.youtube.com/@mastra-ai) and [subscribe](https://www.youtube.com/@mastra-ai?sub_confirmation=1)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Integrate Mastra in your SvelteKit project | Frameworks
|
|
2
|
+
title: "Integrate Mastra in your SvelteKit project | Frameworks"
|
|
3
3
|
description: A step-by-step guide to integrating Mastra with SvelteKit.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -27,27 +27,27 @@ Use this guide to scaffold and integrate Mastra with your SvelteKit project.
|
|
|
27
27
|
|
|
28
28
|
Install Mastra
|
|
29
29
|
|
|
30
|
-
Install the required
|
|
30
|
+
Install the required packages:
|
|
31
31
|
|
|
32
32
|
<Tabs>
|
|
33
33
|
<TabItem value="npm" label="npm">
|
|
34
34
|
```bash copy
|
|
35
|
-
npm install mastra@
|
|
35
|
+
npm install mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
36
36
|
```
|
|
37
37
|
</TabItem>
|
|
38
38
|
<TabItem value="yarn" label="yarn">
|
|
39
39
|
```bash copy
|
|
40
|
-
yarn add mastra@
|
|
40
|
+
yarn add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
41
41
|
```
|
|
42
42
|
</TabItem>
|
|
43
43
|
<TabItem value="pnpm" label="pnpm">
|
|
44
44
|
```bash copy
|
|
45
|
-
pnpm add mastra@
|
|
45
|
+
pnpm add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
46
46
|
```
|
|
47
47
|
</TabItem>
|
|
48
48
|
<TabItem value="bun" label="bun">
|
|
49
49
|
```bash copy
|
|
50
|
-
bun add mastra@
|
|
50
|
+
bun add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
51
51
|
```
|
|
52
52
|
</TabItem>
|
|
53
53
|
</Tabs>
|
|
@@ -63,7 +63,7 @@ To integrate Mastra into your project, you have two options:
|
|
|
63
63
|
Run the following command to quickly scaffold the default Weather agent with sensible defaults:
|
|
64
64
|
|
|
65
65
|
```bash copy
|
|
66
|
-
npx mastra@
|
|
66
|
+
npx mastra@beta init --default
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
> See [mastra init](/reference/v1/cli/create-mastra) for more information.
|
|
@@ -73,7 +73,7 @@ To integrate Mastra into your project, you have two options:
|
|
|
73
73
|
If you prefer to customize the setup, run the `init` command and choose from the options when prompted:
|
|
74
74
|
|
|
75
75
|
```bash copy
|
|
76
|
-
npx mastra@
|
|
76
|
+
npx mastra@beta init
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
Add the `dev` and `build` scripts to `package.json`:
|
|
@@ -128,14 +128,13 @@ Add `.mastra` to your `.gitignore` file:
|
|
|
128
128
|
|
|
129
129
|
Update the Mastra Agent
|
|
130
130
|
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
+ import { createOpenAI } from "@ai-sdk/openai";
|
|
131
|
+
```typescript title="src/mastra/agents/weather-agent.ts"
|
|
132
|
+
import { createOpenAI } from "@ai-sdk/openai";
|
|
134
133
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
const openai = createOpenAI({
|
|
135
|
+
apiKey: import.meta.env?.VITE_OPENAI_API_KEY || process.env.VITE_OPENAI_API_KEY,
|
|
136
|
+
compatibility: "strict"
|
|
137
|
+
});
|
|
139
138
|
```
|
|
140
139
|
|
|
141
140
|
By reading env vars from both `import.meta.env` and `process.env`, we ensure that the API key is available in both the SvelteKit dev server and the Mastra Dev Server.
|
|
@@ -258,27 +257,27 @@ If you need more details or information about a different location, feel free to
|
|
|
258
257
|
|
|
259
258
|
<StepItem>
|
|
260
259
|
|
|
261
|
-
Install the required
|
|
260
|
+
Install the required packages:
|
|
262
261
|
|
|
263
262
|
<Tabs>
|
|
264
263
|
<TabItem value="npm" label="npm">
|
|
265
264
|
```bash copy
|
|
266
|
-
npm install mastra@
|
|
265
|
+
npm install mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
267
266
|
```
|
|
268
267
|
</TabItem>
|
|
269
268
|
<TabItem value="yarn" label="yarn">
|
|
270
269
|
```bash copy
|
|
271
|
-
yarn add mastra@
|
|
270
|
+
yarn add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
272
271
|
```
|
|
273
272
|
</TabItem>
|
|
274
273
|
<TabItem value="pnpm" label="pnpm">
|
|
275
274
|
```bash copy
|
|
276
|
-
pnpm add mastra@
|
|
275
|
+
pnpm add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
277
276
|
```
|
|
278
277
|
</TabItem>
|
|
279
278
|
<TabItem value="bun" label="bun">
|
|
280
279
|
```bash copy
|
|
281
|
-
bun add mastra@
|
|
280
|
+
bun add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
282
281
|
```
|
|
283
282
|
</TabItem>
|
|
284
283
|
</Tabs>
|
|
@@ -294,7 +293,7 @@ To integrate Mastra into your project, you have two options:
|
|
|
294
293
|
Run the following command to quickly scaffold the default Weather agent with sensible defaults:
|
|
295
294
|
|
|
296
295
|
```bash copy
|
|
297
|
-
npx mastra@
|
|
296
|
+
npx mastra@beta init --default
|
|
298
297
|
```
|
|
299
298
|
|
|
300
299
|
> See [mastra init](/reference/v1/cli/create-mastra) for more information.
|
|
@@ -304,7 +303,7 @@ To integrate Mastra into your project, you have two options:
|
|
|
304
303
|
If you prefer to customize the setup, run the `init` command and choose from the options when prompted:
|
|
305
304
|
|
|
306
305
|
```bash copy
|
|
307
|
-
npx mastra@
|
|
306
|
+
npx mastra@beta init
|
|
308
307
|
```
|
|
309
308
|
|
|
310
309
|
Add the `dev` and `build` scripts to `package.json`:
|
|
@@ -359,14 +358,13 @@ Add `.mastra` to your `.gitignore` file:
|
|
|
359
358
|
|
|
360
359
|
Update the Mastra Agent
|
|
361
360
|
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
+ import { createOpenAI } from "@ai-sdk/openai";
|
|
361
|
+
```typescript title="src/mastra/agents/weather-agent.ts"
|
|
362
|
+
import { createOpenAI } from "@ai-sdk/openai";
|
|
365
363
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
364
|
+
const openai = createOpenAI({
|
|
365
|
+
apiKey: import.meta.env?.VITE_OPENAI_API_KEY || process.env.VITE_OPENAI_API_KEY,
|
|
366
|
+
compatibility: "strict"
|
|
367
|
+
});
|
|
370
368
|
```
|
|
371
369
|
|
|
372
370
|
By reading env vars from both `import.meta.env` and `process.env`, we ensure that the API key is available in both the SvelteKit dev server and the Mastra Dev Server.
|
|
@@ -499,4 +497,4 @@ If you need more details or information about a different location, feel free to
|
|
|
499
497
|
|
|
500
498
|
## Next steps
|
|
501
499
|
|
|
502
|
-
- [Monorepo Deployment](
|
|
500
|
+
- [Monorepo Deployment](/docs/v1/deployment/monorepo)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Integrate Mastra in your
|
|
3
|
-
description: A step-by-step guide to integrating Mastra with
|
|
2
|
+
title: "Integrate Mastra in your React + Vite project | Frameworks"
|
|
3
|
+
description: A step-by-step guide to integrating Mastra with React and Vite.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
import Tabs from "@theme/Tabs";
|
|
7
7
|
import TabItem from "@theme/TabItem";
|
|
8
8
|
|
|
9
|
-
# Integrate Mastra in your
|
|
9
|
+
# Integrate Mastra in your React + Vite project
|
|
10
10
|
|
|
11
11
|
Mastra integrates with Vite, making it easy to:
|
|
12
12
|
|
|
@@ -14,11 +14,11 @@ Mastra integrates with Vite, making it easy to:
|
|
|
14
14
|
- Simplify deployment with a unified codebase for frontend and backend
|
|
15
15
|
- Take advantage of Mastra's Client SDK
|
|
16
16
|
|
|
17
|
-
Use this guide to scaffold and integrate Mastra with your
|
|
17
|
+
Use this guide to scaffold and integrate Mastra with your React + Vite project.
|
|
18
18
|
|
|
19
19
|
:::warning
|
|
20
20
|
|
|
21
|
-
This guide assumes you're using
|
|
21
|
+
This guide assumes you're using React + Vite with React Router v7 at the root of your project, e.g., `app`.
|
|
22
22
|
|
|
23
23
|
:::
|
|
24
24
|
|
|
@@ -30,28 +30,28 @@ Install the required Mastra packages:
|
|
|
30
30
|
<TabItem value="npm" label="npm">
|
|
31
31
|
|
|
32
32
|
```bash copy
|
|
33
|
-
npm install mastra@
|
|
33
|
+
npm install mastra@beta @mastra/core@beta @mastra/libsql@beta @mastra/client-js@beta
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
</TabItem>
|
|
37
37
|
<TabItem value="yarn" label="yarn">
|
|
38
38
|
|
|
39
39
|
```bash copy
|
|
40
|
-
yarn add mastra@
|
|
40
|
+
yarn add mastra@beta @mastra/core@beta @mastra/libsql@beta @mastra/client-js@beta
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
</TabItem>
|
|
44
44
|
<TabItem value="pnpm" label="pnpm">
|
|
45
45
|
|
|
46
46
|
```bash copy
|
|
47
|
-
pnpm add mastra@
|
|
47
|
+
pnpm add mastra@beta @mastra/core@beta @mastra/libsql@beta @mastra/client-js@beta
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
</TabItem>
|
|
51
51
|
<TabItem value="bun" label="bun">
|
|
52
52
|
|
|
53
53
|
```bash copy
|
|
54
|
-
bun add mastra@
|
|
54
|
+
bun add mastra@beta @mastra/core@beta @mastra/libsql@beta @mastra/client-js@beta
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
</TabItem>
|
|
@@ -66,7 +66,7 @@ To integrate Mastra into your project, you have two options:
|
|
|
66
66
|
Run the following command to quickly scaffold the default Weather agent with sensible defaults:
|
|
67
67
|
|
|
68
68
|
```bash copy
|
|
69
|
-
npx mastra@
|
|
69
|
+
npx mastra@beta init --dir . --components agents,tools --example --llm openai
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
> See [mastra init](/reference/v1/cli/create-mastra) for more information.
|
|
@@ -81,7 +81,7 @@ npx mastra@latest init
|
|
|
81
81
|
|
|
82
82
|
:::warning
|
|
83
83
|
|
|
84
|
-
By default, `mastra init` suggests `src` as the install location. If you're using
|
|
84
|
+
By default, `mastra init` suggests `src` as the install location. If you're using React + Vite at the root of your project (e.g., `app`, not `src/app`), enter `.` when prompted:
|
|
85
85
|
|
|
86
86
|
:::
|
|
87
87
|
|
|
@@ -252,4 +252,4 @@ The current weather in London is partly cloudy with a temperature of 19.3°C, fe
|
|
|
252
252
|
|
|
253
253
|
## Next steps
|
|
254
254
|
|
|
255
|
-
- [Monorepo Deployment](
|
|
255
|
+
- [Monorepo Deployment](/docs/v1/deployment/monorepo)
|
|
@@ -16,7 +16,7 @@ You'll create a workflow that gathers information from a candidate's resume, the
|
|
|
16
16
|
|
|
17
17
|
- Node.js `v22.13.0` or later installed
|
|
18
18
|
- An API key from a supported [Model Provider](/models/v1)
|
|
19
|
-
- An existing Mastra project (Follow the [installation guide](/
|
|
19
|
+
- An existing Mastra project (Follow the [installation guide](/guides/v1/getting-started/quickstart) to set up a new project)
|
|
20
20
|
|
|
21
21
|
## Building the Workflow
|
|
22
22
|
|
|
@@ -58,13 +58,12 @@ To the existing `src/mastra/workflows/candidate-workflow.ts` file add the follow
|
|
|
58
58
|
|
|
59
59
|
```ts copy title="src/mastra/workflows/candidate-workflow.ts"
|
|
60
60
|
import { Agent } from "@mastra/core/agent";
|
|
61
|
-
import { openai } from "@ai-sdk/openai";
|
|
62
61
|
|
|
63
62
|
const recruiter = new Agent({
|
|
64
63
|
id: "recruiter-agent",
|
|
65
64
|
name: "Recruiter Agent",
|
|
66
65
|
instructions: `You are a recruiter.`,
|
|
67
|
-
model: openai
|
|
66
|
+
model: "openai/gpt-5.1",
|
|
68
67
|
});
|
|
69
68
|
|
|
70
69
|
const gatherCandidateInfo = createStep({
|
|
@@ -19,7 +19,7 @@ You'll learn how to create the agent and register it with Mastra. Next, you'll i
|
|
|
19
19
|
|
|
20
20
|
- Node.js `v22.13.0` or later installed
|
|
21
21
|
- An API key from a supported [Model Provider](/models/v1)
|
|
22
|
-
- An existing Mastra project (Follow the [installation guide](/
|
|
22
|
+
- An existing Mastra project (Follow the [installation guide](/guides/v1/getting-started/quickstart) to set up a new project)
|
|
23
23
|
|
|
24
24
|
## Creating the Agent
|
|
25
25
|
|
|
@@ -32,7 +32,6 @@ To create an agent in Mastra use the `Agent` class to define it and then registe
|
|
|
32
32
|
Create a new file `src/mastra/agents/chefAgent.ts` and define your agent:
|
|
33
33
|
|
|
34
34
|
```ts copy title="src/mastra/agents/chefAgent.ts"
|
|
35
|
-
import { openai } from "@ai-sdk/openai";
|
|
36
35
|
import { Agent } from "@mastra/core/agent";
|
|
37
36
|
|
|
38
37
|
export const chefAgent = new Agent({
|
|
@@ -41,7 +40,7 @@ export const chefAgent = new Agent({
|
|
|
41
40
|
instructions:
|
|
42
41
|
"You are Michel, a practical and experienced home chef" +
|
|
43
42
|
"You help people cook with whatever ingredients they have available.",
|
|
44
|
-
model: openai
|
|
43
|
+
model: "openai/gpt-5.1",
|
|
45
44
|
});
|
|
46
45
|
```
|
|
47
46
|
|