@mastra/mcp-docs-server 1.2.15-alpha.9 → 1.2.16-alpha.1
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/docs/agents/agent-approval.md +19 -5
- package/.docs/docs/agents/code-mode.md +17 -2
- package/.docs/docs/agents/networks.md +2 -2
- package/.docs/docs/agents/overview.md +6 -6
- package/.docs/docs/agents/processors.md +3 -3
- package/.docs/docs/agents/using-tools.md +1 -1
- package/.docs/docs/browser/overview.md +9 -9
- package/.docs/docs/browser/recording.md +4 -4
- package/.docs/docs/capabilities/{channels/overview.md → channels.md} +71 -8
- package/.docs/docs/capabilities/subagents.md +7 -4
- package/.docs/docs/connections/overview.md +1 -1
- package/.docs/docs/datasets/overview.md +1 -1
- package/.docs/docs/datasets/running-experiments.md +49 -0
- package/.docs/docs/deployment/cloud-providers.md +13 -11
- package/.docs/docs/deployment/mastra-server.md +1 -1
- package/.docs/docs/deployment/monorepo.md +1 -1
- package/.docs/docs/deployment/overview.md +13 -10
- package/.docs/docs/deployment/sandbox.md +4 -4
- package/.docs/docs/deployment/web-framework.md +7 -7
- package/.docs/docs/deployment/workers.md +249 -3
- package/.docs/docs/deployment/workflow-runners.md +2 -2
- package/.docs/docs/evals/overview.md +1 -1
- package/.docs/docs/evals/quick-checks.md +1 -1
- package/.docs/docs/getting-started/develop.md +1 -1
- package/.docs/{guides/concepts → docs/guides}/multi-agent-systems.md +1 -1
- package/.docs/docs/harness/agent-controller.md +50 -9
- package/.docs/docs/harness/overview.md +3 -5
- package/.docs/docs/index.md +8 -8
- package/.docs/docs/long-running-agents/durable-agents.md +3 -3
- package/.docs/docs/long-running-agents/goals.md +1 -1
- package/.docs/docs/long-running-agents/schedules.md +1 -1
- package/.docs/docs/long-running-agents/signal-providers.md +5 -18
- package/.docs/docs/long-running-agents/signals.md +2 -2
- package/.docs/docs/mastra-platform/database.md +2 -2
- package/.docs/docs/mastra-platform/deploy.md +28 -1
- package/.docs/docs/mastra-platform/observability.md +63 -18
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/mastra-platform/server.md +1 -1
- package/.docs/docs/mastra-platform/trace-intelligence.md +9 -13
- package/.docs/docs/mcp/overview.md +43 -1
- package/.docs/docs/memory/memory-processors.md +5 -5
- package/.docs/docs/memory/message-history.md +3 -3
- package/.docs/docs/memory/multi-user-threads.md +1 -1
- package/.docs/docs/memory/observational-memory.md +2 -2
- package/.docs/docs/memory/semantic-recall.md +2 -1
- package/.docs/docs/memory/working-memory.md +2 -1
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +18 -17
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/metrics/overview.md +1 -1
- package/.docs/docs/observability/overview.md +1 -5
- package/.docs/docs/observability/tracing/overview.md +3 -6
- package/.docs/docs/server/auth/fga.md +1 -1
- package/.docs/docs/server/auth/simple-auth.md +1 -1
- package/.docs/docs/server/auth/workers.md +3 -1
- package/.docs/docs/server/auth.md +15 -13
- package/.docs/docs/server/custom-adapters.md +1 -1
- package/.docs/docs/server/custom-api-routes.md +35 -0
- package/.docs/docs/server/mastra-client.md +3 -3
- package/.docs/docs/server/mastra-server.md +2 -2
- package/.docs/docs/storage/overview.md +20 -17
- package/.docs/docs/studio/observability.md +1 -1
- package/.docs/docs/workflows/dynamic-workflows.md +1 -1
- package/.docs/docs/workflows/human-in-the-loop.md +2 -2
- package/.docs/docs/workflows/overview.md +4 -4
- package/.docs/docs/workflows/snapshots.md +12 -10
- package/.docs/docs/workflows/time-travel.md +2 -0
- package/.docs/docs/workspace/filesystem.md +15 -15
- package/.docs/docs/workspace/sandbox.md +18 -19
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/{guides/build-your-ui → integrations/agentic-ui}/ai-sdk-ui.md +6 -6
- package/.docs/{guides/build-your-ui → integrations/agentic-ui}/assistant-ui.md +2 -2
- package/.docs/{guides/build-your-ui/copilotkit/overview.md → integrations/agentic-ui/copilotkit.md} +258 -5
- package/.docs/{guides/build-your-ui → integrations/agentic-ui}/openui.md +1 -1
- package/.docs/{docs/server → integrations}/auth/auth0.md +1 -1
- package/.docs/{docs/server → integrations}/auth/clerk.md +2 -2
- package/.docs/{docs/server → integrations}/auth/firebase.md +1 -1
- package/.docs/{docs/server → integrations}/auth/okta.md +24 -4
- package/.docs/{docs/server → integrations}/auth/supabase.md +2 -2
- package/.docs/{docs/server → integrations}/auth/workos.md +1 -1
- package/.docs/{docs/browser → integrations/browsers}/agent-browser.md +2 -2
- package/.docs/{docs/browser → integrations/browsers}/browser-viewer.md +3 -3
- package/.docs/{docs/browser → integrations/browsers}/firecrawl.md +2 -2
- package/.docs/{docs/browser → integrations/browsers}/stagehand.md +1 -1
- package/.docs/{docs/capabilities → integrations}/channels/discord.md +2 -2
- package/.docs/integrations/channels/github.md +103 -0
- package/.docs/{docs/capabilities → integrations}/channels/imessage.md +12 -4
- package/.docs/{docs/capabilities → integrations}/channels/slack.md +4 -4
- package/.docs/{docs/capabilities → integrations}/channels/teams.md +2 -2
- package/.docs/{docs/capabilities → integrations}/channels/telegram.md +2 -2
- package/.docs/{docs/capabilities → integrations}/channels/whatsapp.md +2 -2
- package/.docs/{reference/storage/dsql.md → integrations/databases/aurora-dsql.md} +1 -1
- package/.docs/{reference/storage → integrations/databases}/clickhouse.md +2 -2
- package/.docs/{reference/storage → integrations/databases}/cloudflare-d1.md +1 -1
- package/.docs/{reference/storage/cloudflare.md → integrations/databases/cloudflare-kv.md} +1 -1
- package/.docs/{reference/storage → integrations/databases}/convex.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/duckdb.md +5 -5
- package/.docs/{reference/storage → integrations/databases}/dynamodb.md +1 -1
- package/.docs/{reference/storage/lance.md → integrations/databases/lancedb.md} +1 -1
- package/.docs/{reference/storage → integrations/databases}/libsql.md +2 -2
- package/.docs/{reference/storage → integrations/databases}/mongodb.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/mssql.md +1 -1
- package/.docs/integrations/databases/neon.md +220 -0
- package/.docs/integrations/databases/oracledb.md +239 -0
- package/.docs/{reference/storage → integrations/databases}/postgresql.md +9 -9
- package/.docs/{reference/storage → integrations/databases}/redis.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/spanner.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/upstash.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/amazon-ec2.md +3 -3
- package/.docs/{guides/deployment → integrations/deploy}/aws-bedrock-agentcore.md +2 -2
- package/.docs/{guides/deployment → integrations/deploy}/aws-lambda.md +4 -4
- package/.docs/{guides/deployment → integrations/deploy}/azure-app-services.md +4 -4
- package/.docs/{guides/deployment → integrations/deploy}/cloudflare.md +4 -4
- package/.docs/{guides/deployment → integrations/deploy}/digital-ocean.md +5 -5
- package/.docs/{guides/deployment → integrations/deploy}/inngest.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/kubernetes.md +4 -5
- package/.docs/{guides/deployment → integrations/deploy}/netlify.md +5 -5
- package/.docs/{guides/deployment → integrations/deploy}/temporal.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/vercel.md +5 -5
- package/.docs/{reference/workspace/agentfs-filesystem.md → integrations/file-storage/agentfs.md} +1 -1
- package/.docs/{reference/workspace/s3-filesystem.md → integrations/file-storage/amazon-s3.md} +6 -6
- package/.docs/{reference/workspace/archil-filesystem.md → integrations/file-storage/archil.md} +4 -4
- package/.docs/{reference/workspace/azure-blob-filesystem.md → integrations/file-storage/azure-blob.md} +3 -3
- package/.docs/{reference/workspace/gcs-filesystem.md → integrations/file-storage/google-cloud-storage.md} +6 -6
- package/.docs/{reference/workspace/google-drive-filesystem.md → integrations/file-storage/google-drive.md} +1 -1
- package/.docs/{reference/workspace/mesa-filesystem.md → integrations/file-storage/mesa.md} +3 -3
- package/.docs/{reference/workspace/files-sdk-filesystem.md → integrations/file-storage/vercel-files.md} +6 -6
- package/.docs/{guides/getting-started → integrations/frameworks}/astro.md +2 -2
- package/.docs/{guides/getting-started → integrations/frameworks}/electron.md +4 -4
- package/.docs/{guides/getting-started → integrations/frameworks}/express.md +1 -1
- package/.docs/{guides/getting-started → integrations/frameworks}/hono.md +1 -1
- package/.docs/{guides/getting-started → integrations/frameworks}/nestjs.md +1 -1
- package/.docs/{guides/getting-started → integrations/frameworks}/next-js.md +3 -3
- package/.docs/{guides/getting-started → integrations/frameworks}/nuxt.md +2 -2
- package/.docs/{guides/getting-started → integrations/frameworks}/sveltekit.md +2 -2
- package/.docs/{guides/getting-started → integrations/frameworks}/vite-react.md +2 -2
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/arize.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/arthur.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/braintrust.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/confident-ai.md +1 -1
- package/.docs/integrations/observability/datadog.md +538 -0
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/laminar.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/langfuse.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/langsmith.md +1 -1
- package/.docs/{docs/observability/integrations/exporters/otel.md → integrations/observability/opentelemetry.md} +278 -46
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/posthog.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/sentry.md +1 -1
- package/.docs/{reference/workspace/agentcore-runtime-sandbox.md → integrations/sandboxes/agentcore.md} +1 -1
- package/.docs/{reference/workspace/apple-container-sandbox.md → integrations/sandboxes/apple-container.md} +2 -2
- package/.docs/{reference/workspace/blaxel-sandbox.md → integrations/sandboxes/blaxel.md} +1 -1
- package/.docs/{reference/workspace/daytona-sandbox.md → integrations/sandboxes/daytona.md} +24 -3
- package/.docs/{reference/workspace/docker-sandbox.md → integrations/sandboxes/docker.md} +2 -2
- package/.docs/{reference/workspace/e2b-sandbox.md → integrations/sandboxes/e2b.md} +4 -4
- package/.docs/{reference/workspace/modal-sandbox.md → integrations/sandboxes/modal.md} +3 -3
- package/.docs/{reference/workspace/railway-sandbox.md → integrations/sandboxes/railway.md} +9 -1
- package/.docs/{reference/workspace/vercel-sandbox.md → integrations/sandboxes/vercel.md} +143 -12
- package/.docs/{reference → integrations}/tools/brightdata.md +1 -1
- package/.docs/{guides/guide → integrations/tools}/firecrawl.md +2 -2
- package/.docs/{reference → integrations}/tools/perplexity.md +1 -1
- package/.docs/{reference → integrations}/tools/tavily.md +1 -1
- package/.docs/{reference → integrations}/voice/aws-nova-sonic.md +1 -1
- package/.docs/{reference → integrations}/voice/cloudflare.md +3 -3
- package/.docs/{reference/voice/google-gemini-live.md → integrations/voice/google.md} +305 -30
- package/.docs/{reference/voice/inworld-realtime.md → integrations/voice/inworld.md} +163 -25
- package/.docs/{reference → integrations}/voice/livekit.md +436 -33
- package/.docs/{reference/voice/openai-realtime.md → integrations/voice/openai.md} +117 -20
- package/.docs/integrations.md +147 -0
- package/.docs/models/embeddings.md +3 -3
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/gateways/custom-gateways.md +4 -0
- package/.docs/models/gateways/neon.md +1 -1
- package/.docs/models/gateways/netlify.md +1 -1
- package/.docs/models/gateways/openrouter.md +9 -3
- package/.docs/models/gateways/vercel.md +6 -4
- package/.docs/models/index.md +3 -3
- package/.docs/models/providers/302ai.md +1 -1
- package/.docs/models/providers/abacus.md +1 -1
- package/.docs/models/providers/abliteration-ai.md +1 -1
- package/.docs/models/providers/agentrouter.md +1 -1
- package/.docs/models/providers/ai-router.md +1 -1
- package/.docs/models/providers/aiand.md +1 -1
- package/.docs/models/providers/aki-io.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +1 -1
- package/.docs/models/providers/alibaba-coding-plan-cn.md +1 -1
- package/.docs/models/providers/alibaba-coding-plan.md +1 -1
- package/.docs/models/providers/alibaba-token-plan-cn.md +1 -1
- package/.docs/models/providers/alibaba-token-plan.md +1 -1
- package/.docs/models/providers/alibaba.md +7 -5
- package/.docs/models/providers/ambient.md +2 -2
- package/.docs/models/providers/anyapi.md +1 -1
- package/.docs/models/providers/atomic-chat.md +1 -1
- package/.docs/models/providers/auriko.md +1 -1
- package/.docs/models/providers/bailing.md +1 -1
- package/.docs/models/providers/baseten.md +2 -2
- package/.docs/models/providers/berget.md +1 -1
- package/.docs/models/providers/blueclaw.md +1 -1
- package/.docs/models/providers/chutes.md +1 -1
- package/.docs/models/providers/clarifai.md +1 -1
- package/.docs/models/providers/claudinio.md +1 -1
- package/.docs/models/providers/cline-pass.md +1 -1
- package/.docs/models/providers/cloudferro-sherlock.md +1 -1
- package/.docs/models/providers/cloudflare-workers-ai.md +1 -1
- package/.docs/models/providers/coralbricks.md +75 -0
- package/.docs/models/providers/cortecs.md +3 -5
- package/.docs/models/providers/crof.md +1 -1
- package/.docs/models/providers/crossmodel.md +2 -3
- package/.docs/models/providers/daoxe.md +1 -1
- package/.docs/models/providers/databricks.md +1 -1
- package/.docs/models/providers/deepinfra.md +6 -5
- package/.docs/models/providers/digitalocean.md +5 -5
- package/.docs/models/providers/dinference.md +1 -1
- package/.docs/models/providers/drun.md +1 -1
- package/.docs/models/providers/ebcloud.md +1 -1
- package/.docs/models/providers/empiriolabs.md +3 -2
- package/.docs/models/providers/evroc.md +3 -4
- package/.docs/models/providers/fastrouter.md +1 -1
- package/.docs/models/providers/firepass.md +1 -1
- package/.docs/models/providers/fireworks-ai.md +1 -1
- package/.docs/models/providers/firmware.md +1 -1
- package/.docs/models/providers/freemodel.md +1 -1
- package/.docs/models/providers/friendli.md +1 -1
- package/.docs/models/providers/frogbot.md +1 -1
- package/.docs/models/providers/github-models.md +1 -1
- package/.docs/models/providers/gmicloud.md +1 -1
- package/.docs/models/providers/google.md +1 -1
- package/.docs/models/providers/greenpt.md +1 -1
- package/.docs/models/providers/helicone.md +1 -1
- package/.docs/models/providers/hetzner.md +8 -5
- package/.docs/models/providers/hpc-ai.md +1 -1
- package/.docs/models/providers/huggingface.md +1 -1
- package/.docs/models/providers/hyper.md +7 -7
- package/.docs/models/providers/iflowcn.md +1 -1
- package/.docs/models/providers/impossibl.md +1 -1
- package/.docs/models/providers/inception.md +1 -1
- package/.docs/models/providers/inceptron.md +1 -1
- package/.docs/models/providers/inference.md +1 -1
- package/.docs/models/providers/inferx.md +1 -1
- package/.docs/models/providers/infomaniak.md +1 -1
- package/.docs/models/providers/io-intelligence.md +1 -1
- package/.docs/models/providers/io-net.md +1 -1
- package/.docs/models/providers/jiekou.md +1 -1
- package/.docs/models/providers/kenari.md +1 -1
- package/.docs/models/providers/kilo.md +19 -13
- package/.docs/models/providers/kimi-for-coding.md +1 -1
- package/.docs/models/providers/kiro.md +1 -1
- package/.docs/models/providers/kuae-cloud-coding-plan.md +1 -1
- package/.docs/models/providers/lilac.md +1 -1
- package/.docs/models/providers/llama.md +1 -1
- package/.docs/models/providers/llmgateway.md +2 -7
- package/.docs/models/providers/llmtr.md +1 -1
- package/.docs/models/providers/lmstudio.md +1 -1
- package/.docs/models/providers/longcat.md +1 -1
- package/.docs/models/providers/lucidquery.md +1 -1
- package/.docs/models/providers/lynkr.md +1 -1
- package/.docs/models/providers/meganova.md +1 -1
- package/.docs/models/providers/meta.md +1 -1
- package/.docs/models/providers/minimax-cn-coding-plan.md +1 -1
- package/.docs/models/providers/minimax-cn.md +1 -1
- package/.docs/models/providers/minimax-coding-plan.md +1 -1
- package/.docs/models/providers/minimax.md +1 -1
- package/.docs/models/providers/mixlayer.md +1 -1
- package/.docs/models/providers/moark.md +1 -1
- package/.docs/models/providers/modal.md +1 -1
- package/.docs/models/providers/model-oracle-ai.md +1 -1
- package/.docs/models/providers/modelis.md +1 -1
- package/.docs/models/providers/modelscope.md +1 -1
- package/.docs/models/providers/moonshotai-cn.md +1 -1
- package/.docs/models/providers/moonshotai.md +1 -1
- package/.docs/models/providers/morph.md +1 -1
- package/.docs/models/providers/nano-gpt.md +11 -7
- package/.docs/models/providers/nearai.md +1 -1
- package/.docs/models/providers/nebius.md +3 -2
- package/.docs/models/providers/neuralwatt.md +1 -1
- package/.docs/models/providers/nova.md +1 -1
- package/.docs/models/providers/novita-ai.md +1 -1
- package/.docs/models/providers/nvidia.md +3 -2
- package/.docs/models/providers/ofox.md +4 -3
- package/.docs/models/providers/ollama-cloud.md +1 -1
- package/.docs/models/providers/opencode-go.md +1 -1
- package/.docs/models/providers/opencode.md +64 -64
- package/.docs/models/providers/orcarouter.md +1 -1
- package/.docs/models/providers/ovhcloud.md +1 -1
- package/.docs/models/providers/perplexity-agent.md +1 -1
- package/.docs/models/providers/pioneer.md +1 -1
- package/.docs/models/providers/poe.md +1 -1
- package/.docs/models/providers/poolside.md +1 -1
- package/.docs/models/providers/privatemode-ai.md +12 -10
- package/.docs/models/providers/qihang-ai.md +1 -1
- package/.docs/models/providers/qiniu-ai.md +1 -1
- package/.docs/models/providers/regolo-ai.md +26 -21
- package/.docs/models/providers/requesty.md +3 -3
- package/.docs/models/providers/routing-run.md +1 -1
- package/.docs/models/providers/sakana.md +1 -1
- package/.docs/models/providers/sarvam.md +1 -1
- package/.docs/models/providers/scaleway.md +1 -1
- package/.docs/models/providers/scx.md +1 -1
- package/.docs/models/providers/siliconflow-cn.md +1 -1
- package/.docs/models/providers/siliconflow.md +1 -1
- package/.docs/models/providers/snowflake-cortex.md +6 -2
- package/.docs/models/providers/stackit.md +1 -1
- package/.docs/models/providers/stepfun-ai-step-plan.md +1 -1
- package/.docs/models/providers/stepfun-ai.md +1 -1
- package/.docs/models/providers/stepfun-step-plan.md +1 -1
- package/.docs/models/providers/stepfun.md +1 -1
- package/.docs/models/providers/subconscious.md +1 -1
- package/.docs/models/providers/submodel.md +1 -1
- package/.docs/models/providers/synthetic.md +1 -1
- package/.docs/models/providers/tencent-coding-plan.md +1 -1
- package/.docs/models/providers/tencent-token-plan.md +1 -1
- package/.docs/models/providers/tencent-tokenhub.md +1 -1
- package/.docs/models/providers/tensorx.md +1 -1
- package/.docs/models/providers/the-grid-ai.md +1 -1
- package/.docs/models/providers/thinkingmachines.md +1 -1
- package/.docs/models/providers/tinfoil.md +2 -2
- package/.docs/models/providers/togetherai.md +1 -1
- package/.docs/models/providers/trustedrouter.md +1 -1
- package/.docs/models/providers/umans-ai-coding-plan.md +1 -1
- package/.docs/models/providers/umans-ai.md +1 -1
- package/.docs/models/providers/unorouter.md +1 -1
- package/.docs/models/providers/upstage.md +1 -1
- package/.docs/models/providers/venice.md +1 -1
- package/.docs/models/providers/vivgrid.md +1 -1
- package/.docs/models/providers/vultr.md +1 -1
- package/.docs/models/providers/wafer.ai.md +1 -1
- package/.docs/models/providers/wandb.md +3 -2
- package/.docs/models/providers/xiaomi-token-plan-ams.md +1 -1
- package/.docs/models/providers/xiaomi-token-plan-cn.md +1 -1
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +1 -1
- package/.docs/models/providers/xiaomi.md +1 -1
- package/.docs/models/providers/xpersona.md +1 -1
- package/.docs/models/providers/zai-coding-plan.md +1 -1
- package/.docs/models/providers/zai.md +1 -1
- package/.docs/models/providers/zeldoc.md +8 -8
- package/.docs/models/providers/zenifra.md +1 -1
- package/.docs/models/providers/zenmux.md +1 -16
- package/.docs/models/providers/zhipuai-coding-plan.md +1 -1
- package/.docs/models/providers/zhipuai.md +1 -1
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/agent-controller/agent-controller-class.md +35 -4
- package/.docs/reference/agent-controller/session.md +5 -3
- package/.docs/reference/agents/channels.md +2 -2
- package/.docs/reference/agents/durable-agent.md +2 -0
- package/.docs/reference/agents/generateLegacy.md +2 -2
- package/.docs/reference/agents/getDefaultOptions.md +1 -1
- package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
- package/.docs/reference/agents/getVoice.md +1 -1
- package/.docs/reference/agents/inngest-agent.md +3 -1
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/ai-sdk/handle-network-stream.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +1 -1
- package/.docs/{guides/agent-frameworks/ai-sdk.md → reference/ai-sdk/overview.md} +2 -2
- package/.docs/reference/auth/auth0.md +1 -1
- package/.docs/reference/auth/better-auth.md +1 -1
- package/.docs/reference/auth/clerk.md +1 -1
- package/.docs/reference/auth/firebase.md +1 -1
- package/.docs/reference/auth/google.md +1 -1
- package/.docs/reference/auth/okta.md +5 -1
- package/.docs/reference/auth/supabase.md +1 -1
- package/.docs/reference/auth/workos.md +1 -1
- package/.docs/reference/browser/agent-browser.md +2 -2
- package/.docs/reference/browser/browser-viewer.md +1 -1
- package/.docs/reference/browser/firecrawl-browser.md +1 -1
- package/.docs/reference/browser/mastra-browser.md +1 -1
- package/.docs/reference/browser/stagehand-browser.md +2 -2
- package/.docs/reference/channels/channel-provider.md +1 -1
- package/.docs/reference/channels/slack-provider.md +2 -2
- package/.docs/reference/cli/mastra.md +6 -6
- package/.docs/reference/client-js/agents.md +2 -1
- package/.docs/reference/client-js/workflows.md +3 -3
- package/.docs/reference/code-sdk/mount-agent-controller.md +1 -1
- package/.docs/reference/configuration.md +22 -28
- package/.docs/reference/core/addDynamicWorkflow.md +2 -2
- package/.docs/reference/core/addDynamicWorkflows.md +2 -2
- package/.docs/reference/core/getStorage.md +1 -1
- package/.docs/reference/core/getVector.md +2 -2
- package/.docs/reference/core/listVectors.md +2 -2
- package/.docs/reference/core/setStorage.md +1 -1
- package/.docs/reference/datasets/startExperiment.md +8 -0
- package/.docs/reference/file-based-agents/config.md +2 -0
- package/.docs/reference/file-based-agents/instructions.md +2 -0
- package/.docs/reference/file-based-agents/logger.md +2 -0
- package/.docs/reference/file-based-agents/memory.md +2 -0
- package/.docs/reference/file-based-agents/observability.md +2 -0
- package/.docs/reference/file-based-agents/processors.md +2 -0
- package/.docs/reference/file-based-agents/schedules.md +2 -0
- package/.docs/reference/file-based-agents/scorers.md +2 -0
- package/.docs/reference/file-based-agents/server.md +2 -0
- package/.docs/reference/file-based-agents/skills.md +2 -0
- package/.docs/reference/file-based-agents/storage.md +3 -1
- package/.docs/reference/file-based-agents/studio.md +3 -1
- package/.docs/reference/file-based-agents/subagents.md +2 -0
- package/.docs/reference/file-based-agents/tools.md +2 -0
- package/.docs/reference/file-based-agents/workflows.md +2 -0
- package/.docs/reference/file-based-agents/workspace.md +2 -0
- package/.docs/reference/index.md +34 -55
- package/.docs/{guides/getting-started → reference}/manual-install.md +3 -3
- package/.docs/{guides → reference}/migrations/ai-sdk-v4-to-v5.md +1 -1
- package/.docs/{guides → reference}/migrations/mastra-cloud.md +2 -2
- package/.docs/{guides → reference}/migrations/network-to-supervisor.md +1 -1
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/cli.md +1 -1
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/memory.md +1 -1
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/overview.md +41 -41
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/tools.md +1 -1
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/tracing.md +11 -13
- package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
- package/.docs/reference/observability/tracing/bridges/otel.md +2 -2
- package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
- package/.docs/reference/observability/tracing/exporters/arthur.md +1 -1
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +0 -1
- package/.docs/reference/observability/tracing/exporters/confident-ai.md +1 -1
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +0 -1
- package/.docs/reference/observability/tracing/exporters/datadog.md +1 -1
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +0 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +12 -1
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +0 -1
- package/.docs/reference/observability/tracing/exporters/otel.md +2 -2
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +111 -99
- package/.docs/reference/observability/tracing/span-filtering.md +1 -1
- package/.docs/reference/processors/pii-detector.md +2 -0
- package/.docs/reference/processors/prompt-injection-detector.md +2 -0
- package/.docs/reference/processors/regex-filter-processor.md +20 -0
- package/.docs/reference/processors/response-cache.md +2 -0
- package/.docs/reference/processors/tool-search-processor.md +33 -1
- package/.docs/reference/pubsub/lease-provider.md +1 -1
- package/.docs/{guides → reference}/rag/chunking-and-embedding.md +16 -19
- package/.docs/reference/rag/database-config.md +1 -1
- package/.docs/{guides/rag/graph-rag.md → reference/rag/graph-rag-guide.md} +1 -1
- package/.docs/reference/rag/metadata-filters.md +13 -4
- package/.docs/{guides → reference}/rag/overview.md +2 -2
- package/.docs/{guides → reference}/rag/retrieval.md +18 -1
- package/.docs/{guides → reference}/rag/vector-databases.md +42 -1
- package/.docs/reference/schedules/overview.md +2 -0
- package/.docs/reference/server/create-route.md +27 -1
- package/.docs/reference/server/register-api-route.md +2 -0
- package/.docs/reference/signals/create-notification-inbox-tool.md +2 -0
- package/.docs/reference/signals/signal-provider.md +2 -0
- package/.docs/reference/signals/task-signal-provider.md +2 -0
- package/.docs/reference/signals/webhook-signal-provider.md +2 -0
- package/.docs/reference/storage/composite.md +4 -4
- package/.docs/reference/storage/overview.md +1 -1
- package/.docs/reference/storage/retention.md +4 -4
- package/.docs/reference/streaming/ChunkType.md +3 -3
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/streaming/agents/streamLegacy.md +3 -3
- package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
- package/.docs/reference/templates/overview.md +1 -1
- package/.docs/reference/tools/create-code-mode.md +3 -1
- package/.docs/reference/tools/isolated-vm-transport.md +1 -1
- package/.docs/reference/tools/mcp-client.md +51 -0
- package/.docs/reference/tools/mcp-server.md +1 -1
- package/.docs/reference/tools/quickjs-transport.md +92 -0
- package/.docs/reference/vectors/chroma.md +1 -1
- package/.docs/reference/vectors/convex.md +2 -2
- package/.docs/reference/vectors/oracledb.md +347 -0
- package/.docs/{guides → reference}/voice/overview.md +58 -109
- package/.docs/{guides → reference}/voice/speech-to-speech.md +1 -1
- package/.docs/{guides → reference}/voice/speech-to-text.md +8 -8
- package/.docs/{guides → reference}/voice/text-to-speech.md +11 -12
- package/.docs/reference/workers/overview.md +10 -8
- package/.docs/reference/workflows/dynamic-workflow-definition.md +3 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -0
- package/.docs/reference/workflows/workflow.md +18 -0
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/platform-filesystem.md +3 -3
- package/.docs/reference/workspace/platform-sandbox.md +11 -3
- package/.docs/reference/workspace/process-manager.md +3 -3
- package/.docs/reference/workspace/sandbox.md +10 -0
- package/CHANGELOG.md +97 -0
- package/dist/index.js +1 -1
- package/dist/{src-BZcgzbk9.js → src-D-W-bx5t.js} +2 -2
- package/dist/{src-BZcgzbk9.js.map → src-D-W-bx5t.js.map} +1 -1
- package/dist/stdio.js +1 -1
- package/package.json +6 -6
- package/.docs/docs/capabilities/channels/other-adapters.md +0 -68
- package/.docs/docs/observability/integrations/bridges/datadog.md +0 -219
- package/.docs/docs/observability/integrations/bridges/otel.md +0 -234
- package/.docs/docs/observability/integrations/exporters/datadog.md +0 -321
- package/.docs/docs/observability/integrations/exporters/mastra-platform.md +0 -201
- package/.docs/docs/observability/integrations/overview.md +0 -47
- package/.docs/docs/observability/integrations/processors/sensitive-data-filter.md +0 -302
- package/.docs/guides/build-your-ui/copilotkit/channels.md +0 -86
- package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +0 -174
- package/.docs/guides/deployment/mastra-workers.md +0 -576
- package/.docs/guides/getting-started/quickstart.md +0 -88
- package/.docs/guides/guide/ai-recruiter.md +0 -228
- package/.docs/guides/guide/chef-michel.md +0 -211
- package/.docs/guides/guide/code-review-bot.md +0 -228
- package/.docs/guides/guide/coding-agent.md +0 -392
- package/.docs/guides/guide/dev-assistant.md +0 -309
- package/.docs/guides/guide/docs-manager.md +0 -240
- package/.docs/guides/guide/github-actions-pr-description.md +0 -238
- package/.docs/guides/guide/notes-mcp-server.md +0 -418
- package/.docs/guides/guide/publishing-mcp-server.md +0 -137
- package/.docs/guides/guide/research-assistant.md +0 -350
- package/.docs/guides/guide/research-coordinator.md +0 -418
- package/.docs/guides/guide/signal-provider.md +0 -221
- package/.docs/guides/guide/slack-assistant.md +0 -193
- package/.docs/guides/guide/stock-agent.md +0 -132
- package/.docs/guides/guide/web-search.md +0 -322
- package/.docs/guides/guide/whatsapp-chat-bot.md +0 -407
- package/.docs/guides/index.md +0 -24
- package/.docs/guides/voice/realtime-voice.md +0 -430
- package/.docs/reference/voice/google.md +0 -290
- package/.docs/reference/voice/inworld.md +0 -137
- package/.docs/reference/voice/openai.md +0 -96
- package/.docs/reference/voice/playai.md +0 -82
- package/.docs/reference/workspace/vercel-serverless.md +0 -128
- /package/.docs/{guides/concepts → docs/guides}/streaming.md +0 -0
- /package/.docs/{reference → docs}/mastra-platform/api.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/better-auth.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/google.md +0 -0
- /package/.docs/{reference → integrations}/voice/azure.md +0 -0
- /package/.docs/{reference → integrations}/voice/deepgram.md +0 -0
- /package/.docs/{reference → integrations}/voice/elevenlabs.md +0 -0
- /package/.docs/{reference → integrations}/voice/mistral.md +0 -0
- /package/.docs/{reference → integrations}/voice/murf.md +0 -0
- /package/.docs/{reference → integrations}/voice/sarvam.md +0 -0
- /package/.docs/{reference → integrations}/voice/speechify.md +0 -0
- /package/.docs/{reference/voice/xai-realtime.md → integrations/voice/xai.md} +0 -0
- /package/.docs/{guides → reference}/migrations/agentnetwork.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/agent.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/client.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/deployment.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/evals.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/mastra.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/mcp.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/processors.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/rag.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/storage.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/vectors.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/voice.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/workflows.md +0 -0
- /package/.docs/{guides → reference}/migrations/vnext-to-standard-apis.md +0 -0
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Building a Slack assistant
|
|
4
|
-
|
|
5
|
-
In this guide, you'll build a Mastra agent that responds to messages and mentions on Slack. You'll learn how to configure a channel adapter, set up a Slack app with the right permissions, connect it to your agent via a webhook, and test the interaction.
|
|
6
|
-
|
|
7
|
-
## Prerequisites
|
|
8
|
-
|
|
9
|
-
- Node.js `v22.13.0` or later installed
|
|
10
|
-
- An API key from a supported [Model Provider](https://mastra.ai/models)
|
|
11
|
-
- An existing Mastra project. Follow the [installation guide](https://mastra.ai/guides/getting-started/quickstart) if needed.
|
|
12
|
-
- A [Slack workspace](https://slack.com/) where you can create apps
|
|
13
|
-
|
|
14
|
-
## Create the agent
|
|
15
|
-
|
|
16
|
-
Install the Slack adapter:
|
|
17
|
-
|
|
18
|
-
**npm**:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install @chat-adapter/slack
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**pnpm**:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
pnpm add @chat-adapter/slack
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
**Yarn**:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
yarn add @chat-adapter/slack
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**Bun**:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
bun add @chat-adapter/slack
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Create a new file `src/mastra/agents/slack-agent.ts` and define your agent:
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
import { Agent } from '@mastra/core/agent'
|
|
46
|
-
import { createSlackAdapter } from '@chat-adapter/slack'
|
|
47
|
-
|
|
48
|
-
export const slackAgent = new Agent({
|
|
49
|
-
id: 'slack-agent',
|
|
50
|
-
name: 'Slack Agent',
|
|
51
|
-
instructions:
|
|
52
|
-
'You are a helpful assistant. Answer questions, help with tasks, and have natural conversations.',
|
|
53
|
-
model: 'anthropic/claude-opus-4-7',
|
|
54
|
-
channels: {
|
|
55
|
-
adapters: {
|
|
56
|
-
slack: createSlackAdapter(),
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
})
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
The `channels` property tells Mastra to generate a webhook endpoint for each adapter. In this case, the Slack adapter handles event verification, signature validation, and message formatting automatically.
|
|
63
|
-
|
|
64
|
-
Register the agent in your `src/mastra/index.ts` file:
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
import { Mastra } from '@mastra/core'
|
|
68
|
-
import { slackAgent } from './agents/slack-agent'
|
|
69
|
-
|
|
70
|
-
export const mastra = new Mastra({
|
|
71
|
-
agents: { slackAgent },
|
|
72
|
-
})
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Create a Slack app
|
|
76
|
-
|
|
77
|
-
You need a Slack app to connect your agent to a workspace.
|
|
78
|
-
|
|
79
|
-
Go to <https://api.slack.com/apps> and select **Create New App** > **From scratch**. Give it a name and select your workspace.
|
|
80
|
-
|
|
81
|
-
Navigate to **OAuth & Permissions** and scroll to **Bot Token Scopes**. Add the following scopes:
|
|
82
|
-
|
|
83
|
-
- `app_mentions:read`
|
|
84
|
-
- `channels:history`
|
|
85
|
-
- `channels:read`
|
|
86
|
-
- `chat:write`
|
|
87
|
-
- `users:read`
|
|
88
|
-
|
|
89
|
-
At the top of **OAuth & Permissions**, select **Install to Workspace**. Copy the **Bot User OAuth Token** (`xoxb-...`).
|
|
90
|
-
|
|
91
|
-
Go to **Basic Information** > **App Credentials** and copy the **Signing Secret** (e.g. `c3a4...`).
|
|
92
|
-
|
|
93
|
-
Ensure **Socket Mode** is turned **off** under **Settings** > **Socket Mode**.
|
|
94
|
-
|
|
95
|
-
Add the credentials to your `.env` file:
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
SLACK_SIGNING_SECRET=your-signing-secret
|
|
99
|
-
SLACK_BOT_TOKEN=xoxb-your-bot-token
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
The adapter reads these environment variables by default. See the [Chat SDK Slack adapter docs](https://chat-sdk.dev/adapters/slack) for more details.
|
|
103
|
-
|
|
104
|
-
## Connect the webhook
|
|
105
|
-
|
|
106
|
-
Slack delivers events to your agent via a webhook. Mastra generates this endpoint automatically for each channel adapter.
|
|
107
|
-
|
|
108
|
-
Start the dev server:
|
|
109
|
-
|
|
110
|
-
**npm**:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
npm run dev
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
**pnpm**:
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
pnpm run dev
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**Yarn**:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
yarn dev
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
**Bun**:
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
bun run dev
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
During local development, Slack needs a public URL to reach your local server. Open a new terminal and start a tunnel:
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
npx cloudflared tunnel --url http://localhost:4111
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
This outputs a temporary public URL like `https://triple-arms-solutions-kit.trycloudflare.com`. The URL changes each time you restart the tunnel.
|
|
141
|
-
|
|
142
|
-
In your Slack app settings, go to **Event Subscriptions** and toggle **Enable Events** to **On**.
|
|
143
|
-
|
|
144
|
-
Set the **Request URL** to your tunnel URL with the agent webhook path:
|
|
145
|
-
|
|
146
|
-
```text
|
|
147
|
-
https://<your-tunnel-url>/api/agents/slack-agent/channels/slack/webhook
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Slack sends a verification request. If your dev server is running, it responds with a green checkmark.
|
|
151
|
-
|
|
152
|
-
Under **Subscribe to bot events**, add:
|
|
153
|
-
|
|
154
|
-
- `app_mention`
|
|
155
|
-
- `message.channels`
|
|
156
|
-
|
|
157
|
-
Select **Save Changes**. Slack requires you to reinstall the app after changing event subscriptions. Go to **OAuth & Permissions** and select **Reinstall to Workspace** to apply the updated permissions.
|
|
158
|
-
|
|
159
|
-
> **Note:** The tunnel URL is for local development only. When you [deploy your application](https://mastra.ai/docs/deployment/overview), update the **Request URL** in your Slack app's **Event Subscriptions** to your production URL (e.g. `https://your-app.example.com/api/agents/slack-agent/channels/slack/webhook`).
|
|
160
|
-
|
|
161
|
-
## Test the agent
|
|
162
|
-
|
|
163
|
-
Before testing with Slack, you can refine your agent's behavior in [Studio](https://mastra.ai/docs/studio/overview). Open <http://localhost:4111/> to chat with your agent and adjust its instructions. Inspect traces to see how responses are generated.
|
|
164
|
-
|
|
165
|
-
Once you're happy with the agent's responses, test the Slack integration. Invite the bot to a channel in Slack:
|
|
166
|
-
|
|
167
|
-
```text
|
|
168
|
-
/invite @your-bot-name
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
Mention the bot in the channel:
|
|
172
|
-
|
|
173
|
-
```text
|
|
174
|
-
@your-bot-name What can you help me with?
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
The agent responds in the thread. Output may vary depending on the model and instructions.
|
|
178
|
-
|
|
179
|
-
## Next steps
|
|
180
|
-
|
|
181
|
-
You can extend this agent to:
|
|
182
|
-
|
|
183
|
-
- [Deploy your application](https://mastra.ai/docs/deployment/overview) and update the Slack **Request URL** to your production endpoint
|
|
184
|
-
- Add more adapters (Discord, Telegram) to the same agent so it responds on multiple platforms
|
|
185
|
-
- Configure [multimodal content](https://mastra.ai/docs/capabilities/channels/overview) to let your agent process images, video, and audio shared in chat
|
|
186
|
-
- Add [tools](https://mastra.ai/docs/agents/using-tools) to give the agent access to external APIs and data
|
|
187
|
-
|
|
188
|
-
Learn more:
|
|
189
|
-
|
|
190
|
-
- [Channels overview](https://mastra.ai/docs/capabilities/channels/overview)
|
|
191
|
-
- [Studio](https://mastra.ai/docs/studio/overview)
|
|
192
|
-
- [Deployment overview](https://mastra.ai/docs/deployment/overview)
|
|
193
|
-
- [Chat SDK adapter docs](https://chat-sdk.dev)
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Building an AI stock agent
|
|
4
|
-
|
|
5
|
-
In this guide, you'll create an agent that fetches the previous day's closing stock price for a symbol. You'll create a tool and add it to an agent, then use the agent to fetch stock prices.
|
|
6
|
-
|
|
7
|
-
## Prerequisites
|
|
8
|
-
|
|
9
|
-
- Node.js `v22.13.0` or later installed
|
|
10
|
-
- An API key from a supported [Model Provider](https://mastra.ai/models)
|
|
11
|
-
- An existing Mastra project (Follow the [installation guide](https://mastra.ai/guides/getting-started/quickstart) to set up a new project)
|
|
12
|
-
|
|
13
|
-
## Creating the agent
|
|
14
|
-
|
|
15
|
-
To create an agent in Mastra use the `Agent` class to define it and then register it with Mastra.
|
|
16
|
-
|
|
17
|
-
1. Create a new file `src/mastra/agents/stockAgent.ts` and define your agent:
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
import { Agent } from '@mastra/core/agent'
|
|
21
|
-
|
|
22
|
-
export const stockAgent = new Agent({
|
|
23
|
-
id: 'stock-agent',
|
|
24
|
-
name: 'Stock Agent',
|
|
25
|
-
instructions:
|
|
26
|
-
'You are a helpful assistant that provides current stock prices. When asked about a stock, use the stock price tool to fetch the stock price.',
|
|
27
|
-
model: 'openai/gpt-5.6-sol',
|
|
28
|
-
})
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
2. In your `src/mastra/index.ts` file, register the agent:
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
import { Mastra } from '@mastra/core'
|
|
35
|
-
import { stockAgent } from './agents/stockAgent'
|
|
36
|
-
|
|
37
|
-
export const mastra = new Mastra({
|
|
38
|
-
agents: { stockAgent },
|
|
39
|
-
})
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Creating the stock price tool
|
|
43
|
-
|
|
44
|
-
The Stock Agent doesn't yet know anything about current stock prices. To change this, create a tool and add it to the agent.
|
|
45
|
-
|
|
46
|
-
1. Create a new file `src/mastra/tools/stockPrices.ts`. Inside, add a `stockPrices` tool that will fetch the last day's closing stock price for a given symbol:
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { createTool } from '@mastra/core/tools'
|
|
50
|
-
import { z } from 'zod'
|
|
51
|
-
|
|
52
|
-
const getStockPrice = async (symbol: string) => {
|
|
53
|
-
const data = await fetch(
|
|
54
|
-
`https://mastra-stock-data.vercel.app/api/stock-data?symbol=${symbol}`,
|
|
55
|
-
).then(r => r.json())
|
|
56
|
-
return data.prices['4. close']
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export const stockPrices = createTool({
|
|
60
|
-
id: 'Get Stock Price',
|
|
61
|
-
inputSchema: z.object({
|
|
62
|
-
symbol: z.string(),
|
|
63
|
-
}),
|
|
64
|
-
description: `Fetches the last day's closing stock price for a given symbol`,
|
|
65
|
-
execute: async inputData => {
|
|
66
|
-
console.log('Using tool to fetch stock price for', inputData.symbol)
|
|
67
|
-
return {
|
|
68
|
-
symbol: inputData.symbol,
|
|
69
|
-
currentPrice: await getStockPrice(inputData.symbol),
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
})
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
2. Inside `src/mastra/agents/stockAgent.ts` import your newly created `stockPrices` tool and add it to the agent.
|
|
76
|
-
|
|
77
|
-
```ts
|
|
78
|
-
import { Agent } from '@mastra/core/agent'
|
|
79
|
-
import { stockPrices } from '../tools/stockPrices'
|
|
80
|
-
|
|
81
|
-
export const stockAgent = new Agent({
|
|
82
|
-
id: 'stock-agent',
|
|
83
|
-
name: 'Stock Agent',
|
|
84
|
-
instructions:
|
|
85
|
-
'You are a helpful assistant that provides current stock prices. When asked about a stock, use the stock price tool to fetch the stock price.',
|
|
86
|
-
model: 'openai/gpt-5.6-sol',
|
|
87
|
-
tools: {
|
|
88
|
-
stockPrices,
|
|
89
|
-
},
|
|
90
|
-
})
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Running the agent server
|
|
94
|
-
|
|
95
|
-
Learn how to interact with your agent through Mastra's API.
|
|
96
|
-
|
|
97
|
-
1. You can run your agent as a service using the `mastra dev` command:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
mastra dev
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
This will start a server exposing endpoints to interact with your registered agents. Within [Studio](https://mastra.ai/docs/studio/overview) you can test your `stockAgent` and `stockPrices` tool through a UI.
|
|
104
|
-
|
|
105
|
-
2. By default, `mastra dev` runs on `http://localhost:4111`. Your Stock agent will be available at:
|
|
106
|
-
|
|
107
|
-
```text
|
|
108
|
-
POST http://localhost:4111/api/agents/stockAgent/generate
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
3. You can interact with the agent using `curl` from the command line:
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
curl -X POST http://localhost:4111/api/agents/stockAgent/generate \
|
|
115
|
-
-H "Content-Type: application/json" \
|
|
116
|
-
-d '{
|
|
117
|
-
"messages": [
|
|
118
|
-
{ "role": "user", "content": "What is the current stock price of Apple (AAPL)?" }
|
|
119
|
-
]
|
|
120
|
-
}'
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
You should receive a JSON response similar to:
|
|
124
|
-
|
|
125
|
-
```json
|
|
126
|
-
{
|
|
127
|
-
"text": "The current price of Apple (AAPL) is $174.55.",
|
|
128
|
-
"agent": "Stock Agent"
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
This indicates that your agent successfully processed the request, used the `stockPrices` tool to fetch the stock price, and returned the result.
|
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Building an agent that can search the web
|
|
4
|
-
|
|
5
|
-
When building a web search agent, you have two main strategies to consider:
|
|
6
|
-
|
|
7
|
-
1. **Native search tools from the LLM**: Certain language models offer integrated web search capabilities that work out of the box.
|
|
8
|
-
2. **Implement a custom search tool**: Develop your own integration with a search provider's API to handle queries and retrieve results.
|
|
9
|
-
|
|
10
|
-
## Prerequisites
|
|
11
|
-
|
|
12
|
-
- Node.js `v22.13.0` or later installed
|
|
13
|
-
- An API key from a supported [Model Provider](https://mastra.ai/models)
|
|
14
|
-
- An existing Mastra project (Follow the [installation guide](https://mastra.ai/guides/getting-started/quickstart) to set up a new project)
|
|
15
|
-
|
|
16
|
-
## Using native search tools
|
|
17
|
-
|
|
18
|
-
Some LLM providers include built-in web search capabilities that can be used directly without additional API integrations. OpenAI's and Google's models both offer native search tools that the model can invoke during generation.
|
|
19
|
-
|
|
20
|
-
1. Install dependencies
|
|
21
|
-
|
|
22
|
-
**OpenAI**:
|
|
23
|
-
|
|
24
|
-
**npm**:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm install @ai-sdk/openai
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
**pnpm**:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
pnpm add @ai-sdk/openai
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**Yarn**:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
yarn add @ai-sdk/openai
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Bun**:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
bun add @ai-sdk/openai
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
**Gemini**:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
npm install @ai-sdk/openai
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
**Tab 3**:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
pnpm add @ai-sdk/openai
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
**Tab 4**:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
yarn add @ai-sdk/openai
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
**Tab 5**:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
bun add @ai-sdk/openai
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
**Tab 6**:
|
|
73
|
-
|
|
74
|
-
**npm**:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
npm install @ai-sdk/google
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**pnpm**:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
pnpm add @ai-sdk/google
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
**Yarn**:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
yarn add @ai-sdk/google
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
**Bun**:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
bun add @ai-sdk/google
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**Tab 7**:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
npm install @ai-sdk/google
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**Tab 8**:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
pnpm add @ai-sdk/google
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
**Tab 9**:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
yarn add @ai-sdk/google
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
**Tab 10**:
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
bun add @ai-sdk/google
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
2. Create a new file `src/mastra/agents/searchAgent.ts` and define your agent:
|
|
123
|
-
|
|
124
|
-
**OpenAI**:
|
|
125
|
-
|
|
126
|
-
```ts
|
|
127
|
-
import { Agent } from '@mastra/core/agent'
|
|
128
|
-
|
|
129
|
-
export const searchAgent = new Agent({
|
|
130
|
-
id: 'search-agent',
|
|
131
|
-
name: 'Search Agent',
|
|
132
|
-
instructions: 'You are a search agent that can search the web for information.',
|
|
133
|
-
model: 'openai/gpt-5.6-sol',
|
|
134
|
-
})
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**Gemini**:
|
|
138
|
-
|
|
139
|
-
```ts
|
|
140
|
-
import { Agent } from '@mastra/core/agent'
|
|
141
|
-
|
|
142
|
-
export const searchAgent = new Agent({
|
|
143
|
-
id: 'search-agent',
|
|
144
|
-
name: 'Search Agent',
|
|
145
|
-
instructions: 'You are a search agent that can search the web for information.',
|
|
146
|
-
model: 'google/gemini-2.5-flash',
|
|
147
|
-
})
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
3. Setup the tool:
|
|
151
|
-
|
|
152
|
-
**OpenAI**:
|
|
153
|
-
|
|
154
|
-
```ts
|
|
155
|
-
import { openai } from '@ai-sdk/openai'
|
|
156
|
-
import { Agent } from '@mastra/core/agent'
|
|
157
|
-
|
|
158
|
-
export const searchAgent = new Agent({
|
|
159
|
-
id: 'search-agent',
|
|
160
|
-
name: 'Search Agent',
|
|
161
|
-
instructions: 'You are a search agent that can search the web for information.',
|
|
162
|
-
model: 'openai/gpt-5.6-sol',
|
|
163
|
-
tools: {
|
|
164
|
-
webSearch: openai.tools.webSearch(),
|
|
165
|
-
},
|
|
166
|
-
})
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
**Gemini**:
|
|
170
|
-
|
|
171
|
-
```ts
|
|
172
|
-
import { google } from '@ai-sdk/google'
|
|
173
|
-
import { Agent } from '@mastra/core/agent'
|
|
174
|
-
|
|
175
|
-
export const searchAgent = new Agent({
|
|
176
|
-
id: 'search-agent',
|
|
177
|
-
name: 'Search Agent',
|
|
178
|
-
instructions: 'You are a search agent that can search the web for information.',
|
|
179
|
-
model: 'google/gemini-2.5-flash',
|
|
180
|
-
tools: {
|
|
181
|
-
webSearch: google.tools.googleSearch({
|
|
182
|
-
mode: 'MODE_DYNAMIC',
|
|
183
|
-
}),
|
|
184
|
-
},
|
|
185
|
-
})
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
4. In your `src/mastra/index.ts` file, register the agent:
|
|
189
|
-
|
|
190
|
-
```ts
|
|
191
|
-
import { Mastra } from '@mastra/core'
|
|
192
|
-
import { searchAgent } from './agents/searchAgent'
|
|
193
|
-
|
|
194
|
-
export const mastra = new Mastra({
|
|
195
|
-
agents: { searchAgent },
|
|
196
|
-
})
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
5. You can test your agent with [Studio](https://mastra.ai/docs/studio/overview) using the `mastra dev` command:
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
mastra dev
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
Inside Studio navigate to the **"Search Agent"** and ask it: "What happened last week in AI news?"
|
|
206
|
-
|
|
207
|
-
## Using search APIs
|
|
208
|
-
|
|
209
|
-
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.
|
|
210
|
-
|
|
211
|
-
1. Install dependencies
|
|
212
|
-
|
|
213
|
-
**npm**:
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
npm install exa-js
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
**pnpm**:
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
pnpm add exa-js
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
**Yarn**:
|
|
226
|
-
|
|
227
|
-
```bash
|
|
228
|
-
yarn add exa-js
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
**Bun**:
|
|
232
|
-
|
|
233
|
-
```bash
|
|
234
|
-
bun add exa-js
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
2. Create a new file `src/mastra/agents/searchAgent.ts` and define your agent:
|
|
238
|
-
|
|
239
|
-
```ts
|
|
240
|
-
import { Agent } from '@mastra/core/agent'
|
|
241
|
-
|
|
242
|
-
export const searchAgent = new Agent({
|
|
243
|
-
id: 'search-agent',
|
|
244
|
-
name: 'Search Agent',
|
|
245
|
-
instructions: 'You are a search agent that can search the web for information.',
|
|
246
|
-
model: 'openai/gpt-5.6-sol',
|
|
247
|
-
})
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
3. Setup the tool
|
|
251
|
-
|
|
252
|
-
```ts
|
|
253
|
-
import { createTool } from '@mastra/core/tools'
|
|
254
|
-
import z from 'zod'
|
|
255
|
-
import Exa from 'exa-js'
|
|
256
|
-
|
|
257
|
-
export const exa = new Exa(process.env.EXA_API_KEY)
|
|
258
|
-
|
|
259
|
-
export const webSearch = createTool({
|
|
260
|
-
id: 'exa-web-search',
|
|
261
|
-
description: 'Search the web',
|
|
262
|
-
inputSchema: z.object({
|
|
263
|
-
query: z.string().min(1).max(50).describe('The search query'),
|
|
264
|
-
}),
|
|
265
|
-
outputSchema: z.array(
|
|
266
|
-
z.object({
|
|
267
|
-
title: z.string().nullable(),
|
|
268
|
-
url: z.string(),
|
|
269
|
-
content: z.string(),
|
|
270
|
-
publishedDate: z.string().optional(),
|
|
271
|
-
}),
|
|
272
|
-
),
|
|
273
|
-
execute: async inputData => {
|
|
274
|
-
const { results } = await exa.searchAndContents(inputData.query, {
|
|
275
|
-
livecrawl: 'always',
|
|
276
|
-
numResults: 2,
|
|
277
|
-
})
|
|
278
|
-
|
|
279
|
-
return results.map(result => ({
|
|
280
|
-
title: result.title,
|
|
281
|
-
url: result.url,
|
|
282
|
-
content: result.text.slice(0, 500),
|
|
283
|
-
publishedDate: result.publishedDate,
|
|
284
|
-
}))
|
|
285
|
-
},
|
|
286
|
-
})
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
4. Add to your Agent
|
|
290
|
-
|
|
291
|
-
```ts
|
|
292
|
-
import { webSearch } from './tools/searchTool'
|
|
293
|
-
|
|
294
|
-
export const searchAgent = new Agent({
|
|
295
|
-
id: 'search-agent',
|
|
296
|
-
name: 'Search Agent',
|
|
297
|
-
instructions: 'You are a search agent that can search the web for information.',
|
|
298
|
-
model: 'openai/gpt-5.6-sol',
|
|
299
|
-
tools: {
|
|
300
|
-
webSearch,
|
|
301
|
-
},
|
|
302
|
-
})
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
5. In your `src/mastra/index.ts` file, register the agent:
|
|
306
|
-
|
|
307
|
-
```ts
|
|
308
|
-
import { Mastra } from '@mastra/core'
|
|
309
|
-
import { searchAgent } from './agents/searchAgent'
|
|
310
|
-
|
|
311
|
-
export const mastra = new Mastra({
|
|
312
|
-
agents: { searchAgent },
|
|
313
|
-
})
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
6. You can test your agent with [Studio](https://mastra.ai/docs/studio/overview) using the `mastra dev` command:
|
|
317
|
-
|
|
318
|
-
```bash
|
|
319
|
-
mastra dev
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
Inside Studio navigate to the **"Search Agent"** and ask it: "What happened last week in AI news?"
|