@mastra/mcp-docs-server 0.13.39 → 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 -10
- package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +0 -10
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +36 -36
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +0 -10
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +70 -70
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +40 -40
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fauth.md +4 -14
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +18 -18
- 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 +190 -190
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +199 -199
- 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 +74 -74
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +67 -67
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +70 -70
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +67 -67
- 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 +34 -34
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +5 -13
- package/.docs/organized/changelogs/%40mastra%2Flance.md +182 -182
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +199 -199
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +58 -58
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +65 -65
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +228 -228
- 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 +19 -19
- 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 +217 -217
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Frag.md +61 -61
- package/.docs/organized/changelogs/%40mastra%2Freact.md +70 -70
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -17
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -30
- 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 +190 -190
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +56 -56
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +56 -56
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +20 -20
- package/.docs/organized/changelogs/create-mastra.md +33 -33
- package/.docs/organized/changelogs/mastra.md +86 -86
- 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 -57
- 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,291 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Guide: Building an Agent that can search the web | Mastra Guide"
|
|
3
|
+
description: "A step-by-step guide to creating an agent that can search the web."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import Steps from "@site/src/components/Steps";
|
|
7
|
+
import StepItem from "@site/src/components/StepItem";
|
|
8
|
+
import Tabs from "@theme/Tabs";
|
|
9
|
+
import TabItem from "@theme/TabItem";
|
|
10
|
+
|
|
11
|
+
# Building an Agent that can search the web
|
|
12
|
+
|
|
13
|
+
When building a web search agent, you have two main strategies to consider:
|
|
14
|
+
|
|
15
|
+
1. **Native search tools from the LLM**: Certain language models offer integrated web search capabilities that work out of the box.
|
|
16
|
+
2. **Implement a custom search tool**: Develop your own integration with a search provider's API to handle queries and retrieve results.
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
- Node.js `v22.13.0` or later installed
|
|
21
|
+
- An API key from a supported [Model Provider](/models/v1)
|
|
22
|
+
- An existing Mastra project (Follow the [installation guide](/docs/v1/getting-started/installation) to set up a new project)
|
|
23
|
+
|
|
24
|
+
## Using native search tools
|
|
25
|
+
|
|
26
|
+
Some LLM providers include built-in web search capabilities that can be used directly without additional API integrations. OpenAI's GPT-4o-mini and Google's Gemini 2.5 Flash both offer native search tools that the model can invoke during generation.
|
|
27
|
+
|
|
28
|
+
<Steps>
|
|
29
|
+
|
|
30
|
+
<StepItem title="Install dependencies">
|
|
31
|
+
|
|
32
|
+
Install dependencies
|
|
33
|
+
|
|
34
|
+
<Tabs>
|
|
35
|
+
<TabItem value="openai" label="Open AI">
|
|
36
|
+
```bash copy
|
|
37
|
+
npm install @ai-sdk/openai
|
|
38
|
+
```
|
|
39
|
+
</TabItem>
|
|
40
|
+
<TabItem value="gemini" label="Gemini">
|
|
41
|
+
```bash copy
|
|
42
|
+
npm install @ai-sdk/google
|
|
43
|
+
```
|
|
44
|
+
</TabItem>
|
|
45
|
+
</Tabs>
|
|
46
|
+
|
|
47
|
+
</StepItem>
|
|
48
|
+
|
|
49
|
+
<StepItem title="Define the Agent">
|
|
50
|
+
|
|
51
|
+
Create a new file `src/mastra/agents/searchAgent.ts` and define your agent:
|
|
52
|
+
|
|
53
|
+
<Tabs>
|
|
54
|
+
<TabItem value="openai" label="Open AI">
|
|
55
|
+
|
|
56
|
+
```ts copy title="src/mastra/agents/searchAgent.ts"
|
|
57
|
+
import { Agent } from "@mastra/core/agent";
|
|
58
|
+
|
|
59
|
+
export const searchAgent = new Agent({
|
|
60
|
+
id: "search-agent",
|
|
61
|
+
name: "Search Agent",
|
|
62
|
+
instructions:
|
|
63
|
+
"You are a search agent that can search the web for information.",
|
|
64
|
+
model: 'openai/gpt-4o-mini',
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
</TabItem>
|
|
69
|
+
<TabItem value="gemini" label="Gemini">
|
|
70
|
+
|
|
71
|
+
```ts copy title="src/mastra/agents/searchAgent.ts"
|
|
72
|
+
import { Agent } from "@mastra/core/agent";
|
|
73
|
+
|
|
74
|
+
export const searchAgent = new Agent({
|
|
75
|
+
id: "search-agent",
|
|
76
|
+
name: "Search Agent",
|
|
77
|
+
instructions:
|
|
78
|
+
"You are a search agent that can search the web for information.",
|
|
79
|
+
model: 'google/gemini-2.5-flash',
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
</TabItem>
|
|
84
|
+
|
|
85
|
+
</Tabs>
|
|
86
|
+
|
|
87
|
+
</StepItem>
|
|
88
|
+
|
|
89
|
+
<StepItem title="Setup the tool">
|
|
90
|
+
|
|
91
|
+
Setup the tool:
|
|
92
|
+
|
|
93
|
+
<Tabs>
|
|
94
|
+
<TabItem value="openai" label="Open AI">
|
|
95
|
+
|
|
96
|
+
```ts copy title="src/mastra/agents/searchAgent.ts" {9-11}
|
|
97
|
+
import { openai } from "@ai-sdk/openai";
|
|
98
|
+
import { Agent } from "@mastra/core/agent";
|
|
99
|
+
|
|
100
|
+
export const searchAgent = new Agent({
|
|
101
|
+
id: "search-agent",
|
|
102
|
+
name: "Search Agent",
|
|
103
|
+
instructions:
|
|
104
|
+
"You are a search agent that can search the web for information.",
|
|
105
|
+
model: 'openai/gpt-4o-mini',
|
|
106
|
+
tools: {
|
|
107
|
+
webSearch: openai.tools.webSearch()
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
</TabItem>
|
|
113
|
+
<TabItem value="gemini" label="Gemini">
|
|
114
|
+
|
|
115
|
+
```ts copy title="src/mastra/agents/searchAgent.ts" {9-11}
|
|
116
|
+
import { google } from "@ai-sdk/google";
|
|
117
|
+
import { Agent } from "@mastra/core/agent";
|
|
118
|
+
|
|
119
|
+
export const searchAgent = new Agent({
|
|
120
|
+
id: "search-agent",
|
|
121
|
+
name: "Search Agent",
|
|
122
|
+
instructions:
|
|
123
|
+
"You are a search agent that can search the web for information.",
|
|
124
|
+
model: 'google/gemini-2.5-flash',
|
|
125
|
+
tools: {
|
|
126
|
+
webSearch: google.tools.googleSearch()
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
</TabItem>
|
|
132
|
+
|
|
133
|
+
</Tabs>
|
|
134
|
+
|
|
135
|
+
</StepItem>
|
|
136
|
+
|
|
137
|
+
<StepItem title="Register the Agent with Mastra">
|
|
138
|
+
|
|
139
|
+
In your `src/mastra/index.ts` file, register the agent:
|
|
140
|
+
|
|
141
|
+
```ts copy title="src/mastra/index.ts" {2, 5}
|
|
142
|
+
import { Mastra } from "@mastra/core";
|
|
143
|
+
import { searchAgent } from "./agents/searchAgent";
|
|
144
|
+
|
|
145
|
+
export const mastra = new Mastra({
|
|
146
|
+
agents: { searchAgent },
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
</StepItem>
|
|
151
|
+
|
|
152
|
+
<StepItem title="Test your agent">
|
|
153
|
+
|
|
154
|
+
You can test your agent with [Studio](/docs/v1/getting-started/studio) using the `mastra dev` command:
|
|
155
|
+
|
|
156
|
+
```bash copy
|
|
157
|
+
mastra dev
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Inside Studio navigate to the **"Search Agent"** and ask it: "What happened last week in AI news?"
|
|
161
|
+
|
|
162
|
+
</StepItem>
|
|
163
|
+
|
|
164
|
+
</Steps>
|
|
165
|
+
|
|
166
|
+
## Using Search APIs
|
|
167
|
+
|
|
168
|
+
For more control over search behavior, you can integrate external search APIs as custom tools. [Exa](https://exa.ai/) is a search engine built specifically for AI applications, offering semantic search, configurable filters (category, domain, date range), and the ability to retrieve full page contents. The search API is wrapped in a Mastra tool that defines the input schema, output format, and execution logic.
|
|
169
|
+
|
|
170
|
+
<Steps>
|
|
171
|
+
|
|
172
|
+
<StepItem title="Install dependencies">
|
|
173
|
+
|
|
174
|
+
Install dependencies
|
|
175
|
+
|
|
176
|
+
```bash copy
|
|
177
|
+
npm install exa-js
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
</StepItem>
|
|
181
|
+
|
|
182
|
+
<StepItem title="Define the Agent">
|
|
183
|
+
|
|
184
|
+
Create a new file `src/mastra/agents/searchAgent.ts` and define your agent:
|
|
185
|
+
|
|
186
|
+
```ts copy title="src/mastra/agents/searchAgent.ts"
|
|
187
|
+
import { Agent } from "@mastra/core/agent";
|
|
188
|
+
|
|
189
|
+
export const searchAgent = new Agent({
|
|
190
|
+
id: "search-agent",
|
|
191
|
+
name: "Search Agent",
|
|
192
|
+
instructions:
|
|
193
|
+
"You are a search agent that can search the web for information.",
|
|
194
|
+
model: "openai/gpt-4o-mini",
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
</StepItem>
|
|
199
|
+
|
|
200
|
+
<StepItem title="Setup the tool">
|
|
201
|
+
|
|
202
|
+
Setup the tool
|
|
203
|
+
|
|
204
|
+
```ts copy title="src/mastra/tools/searchTool.ts"
|
|
205
|
+
import { createTool } from "@mastra/core/tools";
|
|
206
|
+
import z from "zod";
|
|
207
|
+
import Exa from "exa-js";
|
|
208
|
+
|
|
209
|
+
export const exa = new Exa(process.env.EXA_API_KEY);
|
|
210
|
+
|
|
211
|
+
export const webSearch = createTool({
|
|
212
|
+
id: "exa-web-search",
|
|
213
|
+
description: "Search the web",
|
|
214
|
+
inputSchema: z.object({
|
|
215
|
+
query: z.string().min(1).max(50).describe("The search query"),
|
|
216
|
+
}),
|
|
217
|
+
outputSchema: z.array(
|
|
218
|
+
z.object({
|
|
219
|
+
title: z.string().nullable(),
|
|
220
|
+
url: z.string(),
|
|
221
|
+
content: z.string(),
|
|
222
|
+
publishedDate: z.string().optional(),
|
|
223
|
+
}),
|
|
224
|
+
),
|
|
225
|
+
execute: async (inputData) => {
|
|
226
|
+
const { results } = await exa.searchAndContents(inputData.query, {
|
|
227
|
+
livecrawl: "always",
|
|
228
|
+
numResults: 2,
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
return results.map((result) => ({
|
|
232
|
+
title: result.title,
|
|
233
|
+
url: result.url,
|
|
234
|
+
content: result.text.slice(0, 500),
|
|
235
|
+
publishedDate: result.publishedDate,
|
|
236
|
+
}));
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
</StepItem>
|
|
242
|
+
|
|
243
|
+
<StepItem title="Add to your Agent">
|
|
244
|
+
|
|
245
|
+
Add to your Agent
|
|
246
|
+
|
|
247
|
+
```ts copy title="src/mastra/agents/searchAgent.ts"
|
|
248
|
+
import { webSearch } from "./tools/searchTool";
|
|
249
|
+
|
|
250
|
+
export const searchAgent = new Agent({
|
|
251
|
+
id: "search-agent",
|
|
252
|
+
name: "Search Agent",
|
|
253
|
+
instructions:
|
|
254
|
+
"You are a search agent that can search the web for information.",
|
|
255
|
+
model: "openai/gpt-4o-mini",
|
|
256
|
+
tools: {
|
|
257
|
+
webSearch,
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
</StepItem>
|
|
263
|
+
|
|
264
|
+
<StepItem title="Register the Agent with Mastra">
|
|
265
|
+
|
|
266
|
+
In your `src/mastra/index.ts` file, register the agent:
|
|
267
|
+
|
|
268
|
+
```ts copy title="src/mastra/index.ts" {2, 5}
|
|
269
|
+
import { Mastra } from "@mastra/core";
|
|
270
|
+
import { searchAgent } from "./agents/searchAgent";
|
|
271
|
+
|
|
272
|
+
export const mastra = new Mastra({
|
|
273
|
+
agents: { searchAgent },
|
|
274
|
+
});
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
</StepItem>
|
|
278
|
+
|
|
279
|
+
<StepItem title="Test your agent">
|
|
280
|
+
|
|
281
|
+
You can test your agent with [Studio](/docs/v1/getting-started/studio) using the `mastra dev` command:
|
|
282
|
+
|
|
283
|
+
```bash copy
|
|
284
|
+
mastra dev
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Inside Studio navigate to the **"Search Agent"** and ask it: "What happened last week in AI news?"
|
|
288
|
+
|
|
289
|
+
</StepItem>
|
|
290
|
+
|
|
291
|
+
</Steps>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Overview"
|
|
3
|
+
description: "Guides on building with Mastra"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { CardGrid, CardGridItem } from "@site/src/components/CardGrid";
|
|
7
|
+
|
|
8
|
+
# Guides
|
|
9
|
+
|
|
10
|
+
While examples show quick implementations and docs explain specific features, these guides are a bit longer and designed to demonstrate core Mastra concepts:
|
|
11
|
+
|
|
12
|
+
<CardGrid>
|
|
13
|
+
<CardGridItem
|
|
14
|
+
title="AI Recruiter"
|
|
15
|
+
description="Create a workflow that processes candidate resumes and conducts interviews, demonstrating branching logic and LLM integration in Mastra workflows."
|
|
16
|
+
href="/guides/v1/guide/ai-recruiter"
|
|
17
|
+
/>
|
|
18
|
+
<CardGridItem
|
|
19
|
+
title="Chef Assistant"
|
|
20
|
+
description="Build an AI chef agent that helps users cook meals with available ingredients, showing how to create interactive agents with custom tools."
|
|
21
|
+
href="/guides/v1/guide/chef-michel"
|
|
22
|
+
/>
|
|
23
|
+
<CardGridItem
|
|
24
|
+
title="Research Assistant"
|
|
25
|
+
description="Develop an AI research assistant that analyzes academic papers using Retrieval Augmented Generation (RAG), demonstrating document processing and question answering."
|
|
26
|
+
href="/guides/v1/guide/research-assistant"
|
|
27
|
+
/>
|
|
28
|
+
<CardGridItem
|
|
29
|
+
title="Stock Agent"
|
|
30
|
+
description="Implement a simple agent that fetches stock prices, illustrating the basics of creating tools and integrating them with Mastra agents."
|
|
31
|
+
href="/guides/v1/guide/stock-agent"
|
|
32
|
+
/>
|
|
33
|
+
<CardGridItem
|
|
34
|
+
title="Notes MCP Server"
|
|
35
|
+
description="Build an AI notes assistant that helps users manage their notes, showing how to create interactive agents with custom tools."
|
|
36
|
+
href="/guides/v1/guide/notes-mcp-server"
|
|
37
|
+
/>
|
|
38
|
+
<CardGridItem
|
|
39
|
+
title="Web Search"
|
|
40
|
+
description="A step-by-step guide to creating an agent that can search the web."
|
|
41
|
+
href="/guides/v1/guide/web-search"
|
|
42
|
+
/>
|
|
43
|
+
</CardGrid>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Migration: AgentNetwork to .network() | Migration Guide"
|
|
3
|
+
description: "Learn how to migrate from AgentNetwork primitives to .network() in Mastra."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Migrate from AgentNetwork to `.network()`
|
|
7
|
+
|
|
8
|
+
As of `v0.20.0` for `@mastra/core`, the following changes apply.
|
|
9
|
+
|
|
10
|
+
### Upgrade from AI SDK v4 to v5
|
|
11
|
+
|
|
12
|
+
- Bump all your model provider packages by a major version.
|
|
13
|
+
|
|
14
|
+
:::note
|
|
15
|
+
|
|
16
|
+
This will ensure that they are all v5 models now.
|
|
17
|
+
|
|
18
|
+
:::
|
|
19
|
+
|
|
20
|
+
### Memory is required
|
|
21
|
+
|
|
22
|
+
- Memory is now required for the agent network to function properly.
|
|
23
|
+
|
|
24
|
+
:::note
|
|
25
|
+
|
|
26
|
+
You must configure memory for the agent.
|
|
27
|
+
|
|
28
|
+
:::
|
|
29
|
+
|
|
30
|
+
## Migration paths
|
|
31
|
+
|
|
32
|
+
If you were using the `AgentNetwork` primitive, you can replace the `AgentNetwork` with `Agent`.
|
|
33
|
+
|
|
34
|
+
Before:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { AgentNetwork } from "@mastra/core/network";
|
|
38
|
+
|
|
39
|
+
const agent = new AgentNetwork({
|
|
40
|
+
name: "agent-network",
|
|
41
|
+
agents: [agent1, agent2],
|
|
42
|
+
tools: { tool1, tool2 },
|
|
43
|
+
model: openai("gpt-4o"),
|
|
44
|
+
instructions:
|
|
45
|
+
"You are a network agent that can help users with a variety of tasks.",
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
await agent.stream("Find me the weather in Tokyo.");
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
After:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { Agent } from "@mastra/core/agent";
|
|
55
|
+
import { Memory } from "@mastra/memory";
|
|
56
|
+
|
|
57
|
+
const memory = new Memory();
|
|
58
|
+
|
|
59
|
+
const agent = new Agent({
|
|
60
|
+
id: "agent-network",
|
|
61
|
+
name: "agent-network",
|
|
62
|
+
agents: { agent1, agent2 },
|
|
63
|
+
tools: { tool1, tool2 },
|
|
64
|
+
model: openai("gpt-4o"),
|
|
65
|
+
instructions:
|
|
66
|
+
"You are a network agent that can help users with a variety of tasks.",
|
|
67
|
+
memory,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
await agent.network("Find me the weather in Tokyo.");
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If you were using the `NewAgentNetwork` primitive, you can replace the `NewAgentNetwork` with `Agent`.
|
|
74
|
+
|
|
75
|
+
Before:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { NewAgentNetwork } from "@mastra/core/network/vnext";
|
|
79
|
+
|
|
80
|
+
const agent = new NewAgentNetwork({
|
|
81
|
+
id: "agent-network",
|
|
82
|
+
name: "agent-network",
|
|
83
|
+
agents: { agent1, agent2 },
|
|
84
|
+
workflows: { workflow1 },
|
|
85
|
+
tools: { tool1, tool2 },
|
|
86
|
+
model: openai("gpt-4o"),
|
|
87
|
+
instructions:
|
|
88
|
+
"You are a network agent that can help users with a variety of tasks.",
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
await agent.loop("Find me the weather in Tokyo.");
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
After:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { Agent } from "@mastra/core/agent";
|
|
98
|
+
import { Memory } from "@mastra/memory";
|
|
99
|
+
|
|
100
|
+
const memory = new Memory();
|
|
101
|
+
|
|
102
|
+
const agent = new Agent({
|
|
103
|
+
name: "agent-network",
|
|
104
|
+
agents: { agent1, agent2 },
|
|
105
|
+
workflows: { workflow1 },
|
|
106
|
+
tools: { tool1, tool2 },
|
|
107
|
+
model: openai("gpt-4o"),
|
|
108
|
+
instructions:
|
|
109
|
+
"You are a network agent that can help users with a variety of tasks.",
|
|
110
|
+
memory,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
await agent.network("Find me the weather in Tokyo.");
|
|
114
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
This template is a styleguide on how to populate individual migration guides. Use this as guidance on how to structure files in this directory. You're not allowed to deviate from this structure.
|
|
2
|
+
|
|
3
|
+
Follow the `.cursor/rules/writing-documentation.mdc` instructions on how to write the prose content.
|
|
4
|
+
|
|
5
|
+
After you found all the changes that need to be documented, you should group them in two big groups: "Changed" and "Removed".
|
|
6
|
+
|
|
7
|
+
Example:
|
|
8
|
+
|
|
9
|
+
```md
|
|
10
|
+
## Changed
|
|
11
|
+
|
|
12
|
+
## Removed
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
All changes MUST go under these two sections.
|
|
16
|
+
|
|
17
|
+
Each change (be it "changed" or "removed") should be a h3 heading. You must follow that format exactly.
|
|
18
|
+
|
|
19
|
+
Example:
|
|
20
|
+
|
|
21
|
+
```md
|
|
22
|
+
## Changed
|
|
23
|
+
|
|
24
|
+
### `oldFunction` to `newFunction`
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Now that the headings are in place, you need to follow an EXACT structure for each change. You're not allowed to deviate from this structure.
|
|
28
|
+
|
|
29
|
+
Provide a brief description of the change in one or two sentences. Next, explain in one sentence why it was changed.
|
|
30
|
+
|
|
31
|
+
The third element of each change has to be the explanation how to migrate existing code to the new version. Keep it concise but clear, try not to cut too much information. Afterwards a code block MUST be provided using the "diff" syntax. Inside the code block you need to show a "before" and "after" example of the code that needs to be changed with that diff syntax.
|
|
32
|
+
|
|
33
|
+
Example:
|
|
34
|
+
|
|
35
|
+
````md
|
|
36
|
+
## Changed
|
|
37
|
+
|
|
38
|
+
### `oldFunction` to `newFunction`
|
|
39
|
+
|
|
40
|
+
The `oldFunction` has been renamed to `newFunction`. This change improves clarity and consistency across the API.
|
|
41
|
+
|
|
42
|
+
To migrate, replace all instances of `oldFunction` with `newFunction` in your codebase.
|
|
43
|
+
|
|
44
|
+
```diff
|
|
45
|
+
- const result = oldFunction(args);
|
|
46
|
+
+ const result = newFunction(args);
|
|
47
|
+
```
|
|
48
|
+
````
|
|
49
|
+
|
|
50
|
+
If the migration requires more steps than just a simple find-and-replace, you can add additional explanation before the code block. If it requires multiple steps, use a numbered list to explain each step clearly.
|