@mastra/mcp-docs-server 1.3.10-alpha.6 → 1.3.10-alpha.7
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/guardrails.md +8 -0
- package/.docs/docs/agents/human-in-the-loop.md +9 -0
- package/.docs/docs/agents/processors.md +3 -0
- package/.docs/docs/agents/tools.md +5 -0
- package/.docs/docs/deployment/mastra-server.md +2 -0
- package/.docs/docs/deployment/monorepo.md +2 -0
- package/.docs/docs/evals/overview.md +2 -0
- package/.docs/docs/harness/background-tasks.md +4 -0
- package/.docs/docs/harness/durable-agents.md +5 -0
- package/.docs/docs/harness/goals.md +2 -0
- package/.docs/docs/harness/schedules.md +3 -0
- package/.docs/docs/mastra-platform/connect/providers.md +27 -26
- package/.docs/docs/mastra-platform/deploy.md +2 -0
- package/.docs/docs/mastra-platform/system-environment-variables.md +3 -0
- package/.docs/docs/mastra-platform/workspaces.md +1 -1
- package/.docs/docs/memory/message-history.md +3 -0
- package/.docs/docs/memory/observational-memory.md +10 -0
- package/.docs/docs/memory/overview.md +6 -0
- package/.docs/docs/memory/semantic-recall.md +5 -1
- package/.docs/docs/observability/logging.md +3 -0
- package/.docs/docs/observability/tracing/overview.md +16 -0
- package/.docs/docs/sandbox/search.md +11 -0
- package/.docs/docs/server/custom-adapters.md +53 -1
- package/.docs/docs/server/custom-api-routes.md +2 -0
- package/.docs/docs/server/request-context.md +6 -0
- package/.docs/docs/subagents.md +7 -1
- package/.docs/docs/workflows/agents-and-tools.md +10 -0
- package/.docs/docs/workflows/control-flow.md +57 -0
- package/.docs/docs/workflows/human-in-the-loop.md +3 -0
- package/.docs/docs/workflows/overview.md +9 -1
- package/.docs/docs/workflows/scheduled-workflows.md +4 -0
- package/.docs/docs/workflows/suspend-and-resume.md +6 -0
- package/.docs/docs/workflows/workflow-state.md +12 -0
- package/.docs/integrations/agentic-ui/copilotkit.md +2 -0
- package/.docs/integrations/auth/better-auth.md +2 -0
- package/.docs/integrations/auth/google.md +2 -0
- package/.docs/integrations/auth/okta.md +2 -0
- package/.docs/integrations/databases/aurora-dsql.md +2 -2
- package/.docs/integrations/databases/dynamodb.md +4 -4
- package/.docs/integrations/databases/postgresql.md +4 -4
- package/.docs/integrations/deploy/inngest.md +1 -0
- package/.docs/integrations/file-storage/archil.md +3 -3
- package/.docs/integrations/file-storage/mesa.md +1 -1
- package/.docs/integrations/observability/datadog.md +5 -0
- package/.docs/integrations/observability/langsmith.md +33 -0
- package/.docs/integrations/observability/sentry.md +22 -22
- package/.docs/integrations/sandboxes/cloudflare-sandbox.md +1 -1
- package/.docs/integrations/sandboxes/daytona.md +3 -3
- package/.docs/integrations/sandboxes/docker.md +1 -1
- package/.docs/integrations/sandboxes/e2b.md +5 -5
- package/.docs/integrations/sandboxes/modal.md +3 -3
- package/.docs/integrations/sandboxes/railway.md +3 -3
- package/.docs/integrations/sandboxes/vercel.md +4 -4
- package/.docs/integrations/tools/brightdata.md +1 -1
- package/.docs/integrations/tools/parallel.md +3 -3
- package/.docs/integrations/tools/perplexity.md +1 -1
- package/.docs/integrations/tools/tavily.md +1 -1
- package/.docs/integrations/voice/azure.md +4 -4
- package/.docs/integrations/voice/cloudflare.md +3 -3
- package/.docs/integrations/voice/deepgram.md +2 -2
- package/.docs/integrations/voice/elevenlabs.md +4 -4
- package/.docs/integrations/voice/gladia.md +10 -10
- package/.docs/integrations/voice/google.md +11 -11
- package/.docs/integrations/voice/inworld.md +23 -23
- package/.docs/integrations/voice/livekit.md +9 -6
- package/.docs/integrations/voice/mistral.md +2 -2
- package/.docs/integrations/voice/modelslab.md +1 -1
- package/.docs/integrations/voice/murf.md +1 -1
- package/.docs/integrations/voice/openai.md +5 -5
- package/.docs/integrations/voice/sarvam.md +6 -6
- package/.docs/integrations/voice/speechify.md +4 -4
- package/.docs/integrations/voice/xai.md +3 -3
- package/.docs/models/gateways/netlify.md +2 -4
- package/.docs/models/gateways/openrouter.md +1 -2
- package/.docs/models/index.md +7 -1
- package/.docs/models/providers/302ai.md +4 -0
- package/.docs/models/providers/abacus.md +4 -0
- package/.docs/models/providers/abliteration-ai.md +4 -0
- package/.docs/models/providers/above.md +4 -0
- package/.docs/models/providers/agentrouter.md +4 -0
- package/.docs/models/providers/agnes.md +4 -0
- package/.docs/models/providers/ai-router.md +4 -0
- package/.docs/models/providers/ai21.md +4 -0
- package/.docs/models/providers/aiand.md +8 -7
- package/.docs/models/providers/aimlapi.md +7 -10
- package/.docs/models/providers/ainetcafe.md +4 -0
- package/.docs/models/providers/aixy.md +4 -0
- package/.docs/models/providers/aki-io.md +4 -0
- package/.docs/models/providers/alibaba-cn.md +4 -0
- package/.docs/models/providers/alibaba-coding-plan-cn.md +4 -0
- package/.docs/models/providers/alibaba-coding-plan.md +4 -0
- package/.docs/models/providers/alibaba-token-plan-cn.md +4 -0
- package/.docs/models/providers/alibaba-token-plan.md +4 -0
- package/.docs/models/providers/alibaba.md +4 -0
- package/.docs/models/providers/ambient.md +4 -0
- package/.docs/models/providers/amd.md +4 -0
- package/.docs/models/providers/anthropic.md +4 -0
- package/.docs/models/providers/anyapi.md +4 -0
- package/.docs/models/providers/arcee.md +4 -0
- package/.docs/models/providers/atomic-chat.md +4 -0
- package/.docs/models/providers/auriko.md +4 -0
- package/.docs/models/providers/bailing.md +4 -0
- package/.docs/models/providers/baseten.md +4 -0
- package/.docs/models/providers/bee.md +4 -0
- package/.docs/models/providers/berget.md +4 -0
- package/.docs/models/providers/blueclaw.md +4 -0
- package/.docs/models/providers/bothub.md +4 -0
- package/.docs/models/providers/boundless.md +4 -0
- package/.docs/models/providers/cerebras.md +4 -0
- package/.docs/models/providers/chutes.md +16 -11
- package/.docs/models/providers/clarifai.md +4 -0
- package/.docs/models/providers/claudinio.md +4 -0
- package/.docs/models/providers/cline-pass.md +4 -0
- package/.docs/models/providers/cloudferro-sherlock.md +4 -0
- package/.docs/models/providers/cloudflare-workers-ai.md +4 -0
- package/.docs/models/providers/commandcode.md +4 -0
- package/.docs/models/providers/coralbricks.md +4 -0
- package/.docs/models/providers/cortecs.md +4 -0
- package/.docs/models/providers/crof.md +4 -0
- package/.docs/models/providers/crossmodel.md +4 -0
- package/.docs/models/providers/crusoe.md +4 -0
- package/.docs/models/providers/daoxe.md +4 -0
- package/.docs/models/providers/databricks.md +4 -0
- package/.docs/models/providers/deepinfra.md +4 -0
- package/.docs/models/providers/deepseek.md +4 -0
- package/.docs/models/providers/digitalocean.md +4 -0
- package/.docs/models/providers/dinference.md +4 -0
- package/.docs/models/providers/drun.md +4 -0
- package/.docs/models/providers/ebcloud.md +4 -0
- package/.docs/models/providers/echo.md +4 -0
- package/.docs/models/providers/edenai.md +9 -8
- package/.docs/models/providers/empiriolabs.md +4 -0
- package/.docs/models/providers/engy.md +4 -0
- package/.docs/models/providers/evroc.md +4 -0
- package/.docs/models/providers/fastrouter.md +4 -0
- package/.docs/models/providers/firepass.md +4 -0
- package/.docs/models/providers/fireworks-ai.md +4 -0
- package/.docs/models/providers/firmware.md +4 -0
- package/.docs/models/providers/freemodel.md +4 -0
- package/.docs/models/providers/friendli.md +4 -0
- package/.docs/models/providers/frogbot.md +4 -0
- package/.docs/models/providers/github-models.md +4 -0
- package/.docs/models/providers/gmicloud.md +4 -0
- package/.docs/models/providers/google.md +4 -0
- package/.docs/models/providers/greenpt.md +4 -0
- package/.docs/models/providers/groq.md +4 -0
- package/.docs/models/providers/helicone.md +4 -0
- package/.docs/models/providers/hetzner.md +4 -0
- package/.docs/models/providers/hpc-ai.md +4 -0
- package/.docs/models/providers/huggingface.md +4 -0
- package/.docs/models/providers/hyper.md +4 -0
- package/.docs/models/providers/iflowcn.md +4 -0
- package/.docs/models/providers/impossibl.md +4 -0
- package/.docs/models/providers/inception.md +4 -0
- package/.docs/models/providers/inceptron.md +9 -5
- package/.docs/models/providers/inco.md +4 -0
- package/.docs/models/providers/infer.md +4 -0
- package/.docs/models/providers/inference.md +4 -0
- package/.docs/models/providers/inferx.md +4 -0
- package/.docs/models/providers/infomaniak.md +4 -0
- package/.docs/models/providers/io-net.md +4 -0
- package/.docs/models/providers/iteracompute.md +4 -0
- package/.docs/models/providers/jalapeno.md +4 -0
- package/.docs/models/providers/jiekou.md +4 -0
- package/.docs/models/providers/kenari.md +4 -0
- package/.docs/models/providers/kilo.md +13 -10
- package/.docs/models/providers/kimi-code-plan-cn.md +4 -0
- package/.docs/models/providers/kimi-code-plan-global.md +4 -0
- package/.docs/models/providers/kimi-for-coding.md +4 -0
- package/.docs/models/providers/kiro.md +4 -0
- package/.docs/models/providers/klokintegration.md +4 -0
- package/.docs/models/providers/kosmik.md +4 -0
- package/.docs/models/providers/kuae-cloud-coding-plan.md +4 -0
- package/.docs/models/providers/lilac.md +4 -0
- package/.docs/models/providers/liquid.md +4 -0
- package/.docs/models/providers/llama.md +4 -0
- package/.docs/models/providers/llmgateway-providers.md +4 -0
- package/.docs/models/providers/llmgateway.md +4 -0
- package/.docs/models/providers/llmtech.md +4 -0
- package/.docs/models/providers/llmtr.md +4 -0
- package/.docs/models/providers/lmstudio.md +4 -0
- package/.docs/models/providers/longcat.md +4 -0
- package/.docs/models/providers/lowrouter.md +4 -0
- package/.docs/models/providers/lucidquery.md +4 -0
- package/.docs/models/providers/lynkr.md +4 -0
- package/.docs/models/providers/meganova.md +4 -0
- package/.docs/models/providers/melious.md +4 -0
- package/.docs/models/providers/meta.md +4 -0
- package/.docs/models/providers/minimax-cn-coding-plan.md +4 -0
- package/.docs/models/providers/minimax-cn.md +4 -0
- package/.docs/models/providers/minimax-coding-plan.md +4 -0
- package/.docs/models/providers/minimax.md +4 -0
- package/.docs/models/providers/mistral.md +4 -0
- package/.docs/models/providers/mixlayer.md +4 -0
- package/.docs/models/providers/moark.md +4 -0
- package/.docs/models/providers/modal.md +4 -0
- package/.docs/models/providers/model-oracle-ai.md +4 -0
- package/.docs/models/providers/modelis.md +4 -0
- package/.docs/models/providers/modelscope.md +4 -0
- package/.docs/models/providers/moonshotai-cn.md +4 -0
- package/.docs/models/providers/moonshotai.md +4 -0
- package/.docs/models/providers/morph.md +18 -6
- package/.docs/models/providers/munito-eu.md +4 -0
- package/.docs/models/providers/munito.md +4 -0
- package/.docs/models/providers/nan.md +4 -0
- package/.docs/models/providers/nano-gpt.md +22 -18
- package/.docs/models/providers/nearai.md +5 -2
- package/.docs/models/providers/nebius.md +4 -0
- package/.docs/models/providers/neosmith.md +4 -0
- package/.docs/models/providers/neuralwatt.md +4 -0
- package/.docs/models/providers/nova.md +4 -0
- package/.docs/models/providers/novita-ai.md +4 -0
- package/.docs/models/providers/nvidia.md +4 -0
- package/.docs/models/providers/oci.md +4 -0
- package/.docs/models/providers/ofox.md +4 -0
- package/.docs/models/providers/ollama-cloud.md +4 -0
- package/.docs/models/providers/openai.md +4 -0
- package/.docs/models/providers/opencode-go.md +4 -0
- package/.docs/models/providers/opencode.md +4 -1
- package/.docs/models/providers/openreason.md +4 -0
- package/.docs/models/providers/opper.md +4 -0
- package/.docs/models/providers/orcarouter.md +4 -0
- package/.docs/models/providers/ovhcloud.md +4 -0
- package/.docs/models/providers/pareto.md +4 -0
- package/.docs/models/providers/pendra.md +4 -0
- package/.docs/models/providers/perplexity-agent.md +4 -0
- package/.docs/models/providers/perplexity.md +4 -0
- package/.docs/models/providers/pioneer.md +4 -0
- package/.docs/models/providers/poe.md +4 -0
- package/.docs/models/providers/poolside.md +4 -0
- package/.docs/models/providers/prime.md +4 -0
- package/.docs/models/providers/privatemode-ai.md +4 -0
- package/.docs/models/providers/qihang-ai.md +4 -0
- package/.docs/models/providers/qiniu-ai.md +4 -0
- package/.docs/models/providers/reflection.md +4 -0
- package/.docs/models/providers/regolo-ai.md +4 -0
- package/.docs/models/providers/requesty.md +6 -1
- package/.docs/models/providers/routing-run.md +4 -0
- package/.docs/models/providers/runinfra.md +4 -0
- package/.docs/models/providers/sakana.md +4 -0
- package/.docs/models/providers/sambanova.md +4 -0
- package/.docs/models/providers/sarvam.md +4 -0
- package/.docs/models/providers/scaleway.md +4 -0
- package/.docs/models/providers/scnet-token-plan.md +4 -0
- package/.docs/models/providers/scx-ai.md +4 -0
- package/.docs/models/providers/scx.md +4 -0
- package/.docs/models/providers/sensenova.md +4 -0
- package/.docs/models/providers/siliconflow-cn.md +4 -0
- package/.docs/models/providers/siliconflow.md +4 -0
- package/.docs/models/providers/snowflake-cortex.md +4 -0
- package/.docs/models/providers/stackit.md +4 -0
- package/.docs/models/providers/standardcompute.md +4 -0
- package/.docs/models/providers/stepfun-ai-step-plan.md +4 -0
- package/.docs/models/providers/stepfun-ai.md +4 -0
- package/.docs/models/providers/stepfun-step-plan.md +4 -0
- package/.docs/models/providers/stepfun.md +4 -0
- package/.docs/models/providers/subconscious.md +4 -0
- package/.docs/models/providers/submodel.md +4 -0
- package/.docs/models/providers/synthetic.md +4 -0
- package/.docs/models/providers/tempr.md +4 -0
- package/.docs/models/providers/tencent-coding-plan.md +4 -0
- package/.docs/models/providers/tencent-token-plan.md +4 -0
- package/.docs/models/providers/tencent-tokenhub.md +4 -0
- package/.docs/models/providers/tensorx.md +4 -0
- package/.docs/models/providers/the-grid-ai.md +4 -0
- package/.docs/models/providers/thinkingmachines.md +4 -0
- package/.docs/models/providers/tinfoil.md +4 -0
- package/.docs/models/providers/togetherai.md +4 -0
- package/.docs/models/providers/tokengo.md +4 -0
- package/.docs/models/providers/tokenrouter.md +4 -0
- package/.docs/models/providers/trustedrouter.md +4 -0
- package/.docs/models/providers/umans-ai-coding-plan.md +4 -0
- package/.docs/models/providers/umans-ai.md +4 -0
- package/.docs/models/providers/unorouter.md +4 -0
- package/.docs/models/providers/upstage.md +4 -0
- package/.docs/models/providers/vancine.md +4 -0
- package/.docs/models/providers/vispark.md +4 -0
- package/.docs/models/providers/vivgrid.md +4 -0
- package/.docs/models/providers/volcengine-coding-plan.md +4 -0
- package/.docs/models/providers/volcengine.md +4 -0
- package/.docs/models/providers/vultr.md +4 -0
- package/.docs/models/providers/wafer.ai.md +4 -0
- package/.docs/models/providers/wallaby.md +4 -0
- package/.docs/models/providers/wandb.md +7 -3
- package/.docs/models/providers/xai.md +4 -0
- package/.docs/models/providers/xiaomi-token-plan-ams.md +4 -0
- package/.docs/models/providers/xiaomi-token-plan-cn.md +4 -0
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +4 -0
- package/.docs/models/providers/xiaomi.md +4 -0
- package/.docs/models/providers/xpersona.md +4 -0
- package/.docs/models/providers/zai-coding-plan.md +4 -0
- package/.docs/models/providers/zai.md +4 -0
- package/.docs/models/providers/zeldoc.md +4 -0
- package/.docs/models/providers/zenifra.md +4 -0
- package/.docs/models/providers/zenmux.md +4 -0
- package/.docs/models/providers/zhipuai-coding-plan.md +4 -0
- package/.docs/models/providers/zhipuai.md +4 -0
- package/.docs/reference/acp/acp-agent.md +1 -1
- package/.docs/reference/acp/create-acp-tool.md +1 -1
- package/.docs/reference/agent-controller/agent-controller-class.md +1 -1
- package/.docs/reference/agents/agent.md +3 -1
- package/.docs/reference/agents/channels.md +20 -3
- package/.docs/reference/agents/createSkill.md +1 -1
- package/.docs/reference/agents/durable-agent.md +1 -1
- package/.docs/reference/agents/generate.md +4 -1
- package/.docs/reference/agents/generateLegacy.md +2 -2
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +1 -1
- package/.docs/reference/auth/auth0.md +2 -2
- package/.docs/reference/auth/better-auth.md +7 -3
- package/.docs/reference/auth/clerk.md +1 -1
- package/.docs/reference/auth/firebase.md +4 -4
- package/.docs/reference/auth/google.md +6 -6
- package/.docs/reference/auth/jwt.md +1 -1
- package/.docs/reference/auth/neon.md +6 -6
- package/.docs/reference/auth/okta.md +9 -8
- package/.docs/reference/auth/workos.md +3 -3
- package/.docs/reference/browser/agent-browser.md +1 -1
- package/.docs/reference/browser/firecrawl-browser.md +1 -1
- package/.docs/reference/browser/stagehand-browser.md +1 -1
- package/.docs/reference/channels/slack-provider.md +2 -2
- package/.docs/reference/channels/teams-provider.md +2 -2
- package/.docs/reference/channels/telegram-provider.md +2 -2
- package/.docs/reference/client-js/agent-controller.md +3 -0
- package/.docs/reference/client-js/agents.md +2 -0
- package/.docs/reference/client-js/conversations.md +3 -3
- package/.docs/reference/client-js/responses.md +4 -4
- package/.docs/reference/client-js/workflows.md +2 -0
- package/.docs/reference/code-sdk/mount-agent-controller.md +1 -1
- package/.docs/reference/coding-agent/create-coding-agent.md +1 -1
- package/.docs/reference/connect/channels.md +1 -1
- package/.docs/reference/connect/providers.md +166 -112
- package/.docs/reference/connect/tools.md +9 -9
- package/.docs/reference/core/mastra-class.md +4 -2
- package/.docs/reference/core/mastra-model-gateway.md +1 -1
- package/.docs/reference/datasets/startExperiment.md +2 -2
- package/.docs/reference/deployer.md +6 -3
- package/.docs/reference/editor/blob-store-provider.md +2 -2
- package/.docs/reference/editor/tool-provider.md +1 -1
- package/.docs/reference/evals/answer-relevancy.md +2 -2
- package/.docs/reference/evals/answer-similarity.md +4 -2
- package/.docs/reference/evals/bias.md +2 -2
- package/.docs/reference/evals/content-similarity.md +2 -2
- package/.docs/reference/evals/hallucination.md +3 -3
- package/.docs/reference/evals/noise-sensitivity.md +1 -1
- package/.docs/reference/evals/prompt-alignment.md +10 -9
- package/.docs/reference/evals/scorer-utils.md +6 -4
- package/.docs/reference/evals/tone-consistency.md +5 -5
- package/.docs/reference/evals/tool-call-accuracy.md +4 -4
- package/.docs/reference/evals/trajectory-accuracy.md +1 -1
- package/.docs/reference/file-based-agents/schedules.md +1 -1
- package/.docs/reference/logging/pino-logger.md +1 -1
- package/.docs/reference/memory/memory-class.md +2 -2
- package/.docs/reference/memory/observational-memory.md +10 -10
- package/.docs/reference/memory/summarizeConversation.md +1 -1
- package/.docs/reference/memory/summarizeThread.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/storage.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/tools.md +7 -1
- package/.docs/reference/migrations/vnext-to-standard-apis.md +1 -1
- package/.docs/reference/observability/tracing/exporters/confident-ai.md +2 -2
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +3 -3
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/langsmith.md +8 -0
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/sentry.md +5 -5
- package/.docs/reference/processors/batch-parts-processor.md +1 -1
- package/.docs/reference/processors/file-upload-processor.md +4 -4
- package/.docs/reference/processors/processor-interface.md +4 -4
- package/.docs/reference/processors/response-cache.md +1 -1
- package/.docs/reference/processors/tool-search-processor.md +2 -2
- package/.docs/reference/processors/unicode-normalizer.md +1 -1
- package/.docs/reference/rag/chunking-and-embedding.md +1 -1
- package/.docs/reference/rag/database-config.md +20 -15
- package/.docs/reference/rag/extract-params.md +2 -2
- package/.docs/reference/rag/retrieval.md +11 -0
- package/.docs/reference/schedules/overview.md +1 -1
- package/.docs/reference/server/koa-adapter.md +2 -0
- package/.docs/reference/storage/overview.md +4 -4
- package/.docs/reference/streaming/agents/MastraModelOutput.md +3 -3
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/streaming/agents/streamLegacy.md +1 -1
- package/.docs/reference/tools/ask-user-tool.md +1 -1
- package/.docs/reference/tools/bedrock-kb-tool.md +2 -2
- package/.docs/reference/tools/create-code-mode.md +1 -1
- package/.docs/reference/tools/mcp-client.md +5 -5
- package/.docs/reference/tools/mcp-server.md +2 -2
- package/.docs/reference/tools/task-tools.md +3 -1
- package/.docs/reference/tools/vector-query-tool.md +1 -0
- package/.docs/reference/vectors/astra.md +1 -1
- package/.docs/reference/vectors/azure-ai-search.md +1 -1
- package/.docs/reference/vectors/chroma.md +2 -2
- package/.docs/reference/vectors/mongodb.md +1 -1
- package/.docs/reference/vectors/pg.md +1 -1
- package/.docs/reference/voice/voice.speak.md +1 -1
- package/.docs/reference/voice/voice.updateConfig.md +1 -1
- package/.docs/reference/workflows/step.md +4 -0
- package/.docs/reference/workflows/workflow-methods/agent.md +2 -0
- package/.docs/reference/workflows/workflow-methods/classifier.md +5 -0
- package/.docs/reference/workflows/workflow-methods/map.md +2 -0
- package/.docs/reference/workflows/workflow.md +2 -2
- package/.docs/reference/workspace/factory-sandbox.md +11 -2
- package/.docs/reference/workspace/filesystem.md +2 -2
- package/.docs/reference/workspace/platform-filesystem.md +3 -3
- package/.docs/reference/workspace/platform-sandbox.md +6 -6
- package/.docs/reference/workspace/workspace-class.md +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-DnH_jHt9.js → src-Cv7bX2-6.js} +10 -19
- package/dist/{src-DnH_jHt9.js.map → src-Cv7bX2-6.js.map} +1 -1
- package/dist/stdio.js +2 -3
- package/package.json +9 -9
|
@@ -18,6 +18,7 @@ The `UnicodeNormalizer()` cleans and normalizes user input by unifying Unicode c
|
|
|
18
18
|
|
|
19
19
|
```typescript
|
|
20
20
|
import { UnicodeNormalizer } from '@mastra/core/processors'
|
|
21
|
+
import { Agent } from '@mastra/core/agent'
|
|
21
22
|
|
|
22
23
|
export const normalizedAgent = new Agent({
|
|
23
24
|
id: 'normalized-agent',
|
|
@@ -39,6 +40,7 @@ The `PromptInjectionDetector()` scans user messages for prompt injection, jailbr
|
|
|
39
40
|
|
|
40
41
|
```typescript
|
|
41
42
|
import { PromptInjectionDetector } from '@mastra/core/processors'
|
|
43
|
+
import { Agent } from '@mastra/core/agent'
|
|
42
44
|
|
|
43
45
|
export const secureAgent = new Agent({
|
|
44
46
|
id: 'secure-agent',
|
|
@@ -65,6 +67,7 @@ The `LanguageDetector()` detects and translates user messages into a target lang
|
|
|
65
67
|
|
|
66
68
|
```typescript
|
|
67
69
|
import { LanguageDetector } from '@mastra/core/processors'
|
|
70
|
+
import { Agent } from '@mastra/core/agent'
|
|
68
71
|
|
|
69
72
|
export const multilingualAgent = new Agent({
|
|
70
73
|
id: 'multilingual-agent',
|
|
@@ -92,6 +95,7 @@ The `BatchPartsProcessor()` combines multiple stream parts before emitting them
|
|
|
92
95
|
|
|
93
96
|
```typescript
|
|
94
97
|
import { BatchPartsProcessor } from '@mastra/core/processors'
|
|
98
|
+
import { Agent } from '@mastra/core/agent'
|
|
95
99
|
|
|
96
100
|
export const batchedAgent = new Agent({
|
|
97
101
|
id: 'batched-agent',
|
|
@@ -114,6 +118,7 @@ The `SystemPromptScrubber()` detects and redacts system prompts or internal inst
|
|
|
114
118
|
|
|
115
119
|
```typescript
|
|
116
120
|
import { SystemPromptScrubber } from '@mastra/core/processors'
|
|
121
|
+
import { Agent } from '@mastra/core/agent'
|
|
117
122
|
|
|
118
123
|
const scrubbedAgent = new Agent({
|
|
119
124
|
id: 'scrubbed-agent',
|
|
@@ -147,6 +152,7 @@ The `ModerationProcessor()` detects inappropriate or harmful content across cate
|
|
|
147
152
|
|
|
148
153
|
```typescript
|
|
149
154
|
import { ModerationProcessor } from '@mastra/core/processors'
|
|
155
|
+
import { Agent } from '@mastra/core/agent'
|
|
150
156
|
|
|
151
157
|
export const moderatedAgent = new Agent({
|
|
152
158
|
id: 'moderated-agent',
|
|
@@ -171,6 +177,7 @@ The `PIIDetector()` detects and removes personally identifiable information such
|
|
|
171
177
|
|
|
172
178
|
```typescript
|
|
173
179
|
import { PIIDetector } from '@mastra/core/processors'
|
|
180
|
+
import { Agent } from '@mastra/core/agent'
|
|
174
181
|
|
|
175
182
|
export const privateAgent = new Agent({
|
|
176
183
|
id: 'private-agent',
|
|
@@ -197,6 +204,7 @@ The `TokenCostControl()` monitors cumulative estimated cost across the agentic l
|
|
|
197
204
|
|
|
198
205
|
```typescript
|
|
199
206
|
import { TokenCostControl } from '@mastra/core/processors'
|
|
207
|
+
import { Agent } from '@mastra/core/agent'
|
|
200
208
|
|
|
201
209
|
export const budgetedAgent = new Agent({
|
|
202
210
|
id: 'budgeted-agent',
|
|
@@ -311,6 +311,9 @@ Instead of pausing every tool call at the agent level, you can mark individual t
|
|
|
311
311
|
Set `requireApproval: true` on a tool definition. The tool pauses before execution regardless of whether `requireToolApproval` is set on the agent:
|
|
312
312
|
|
|
313
313
|
```typescript
|
|
314
|
+
import { createTool } from '@mastra/core/tools'
|
|
315
|
+
import { z } from 'zod'
|
|
316
|
+
|
|
314
317
|
export const testTool = createTool({
|
|
315
318
|
id: 'test-tool',
|
|
316
319
|
description: 'Fetches weather for a location',
|
|
@@ -359,6 +362,9 @@ const handleApproval = async () => {
|
|
|
359
362
|
With this approach, neither the agent nor the tool uses `requireApproval`. Instead, the tool's `execute` function calls `suspend()` to pause at a specific point and return context or confirmation prompts to the user. This is useful when approval depends on runtime conditions rather than being unconditional.
|
|
360
363
|
|
|
361
364
|
```typescript
|
|
365
|
+
import { createTool } from '@mastra/core/tools'
|
|
366
|
+
import { z } from 'zod'
|
|
367
|
+
|
|
362
368
|
export const testToolB = createTool({
|
|
363
369
|
id: 'test-tool-b',
|
|
364
370
|
description: 'Fetches weather for a location',
|
|
@@ -662,6 +668,9 @@ for await (const chunk of stream.fullStream) {
|
|
|
662
668
|
Tools can also use [`suspend()`](#approval-using-suspend) to pause execution and return context to the user. This approach works through the supervisor delegation chain the same way `requireApproval` does: the suspension surfaces at the supervisor level:
|
|
663
669
|
|
|
664
670
|
```typescript
|
|
671
|
+
import { createTool } from '@mastra/core/tools'
|
|
672
|
+
import { z } from 'zod'
|
|
673
|
+
|
|
665
674
|
const conditionalTool = createTool({
|
|
666
675
|
id: 'conditional-operation',
|
|
667
676
|
description: 'Performs an operation that may require confirmation',
|
|
@@ -562,6 +562,8 @@ By default, `ResponseCache` looks up `MASTRA_RESOURCE_ID_KEY` on the request con
|
|
|
562
562
|
Override explicitly when you need a different scope:
|
|
563
563
|
|
|
564
564
|
```typescript
|
|
565
|
+
import { Agent } from '@mastra/core/agent'
|
|
566
|
+
|
|
565
567
|
new Agent({
|
|
566
568
|
id: 'processors-agent',
|
|
567
569
|
inputProcessors: [
|
|
@@ -962,6 +964,7 @@ Processors can request that the LLM retry its response with feedback. This is us
|
|
|
962
964
|
|
|
963
965
|
```typescript
|
|
964
966
|
import type { Processor } from '@mastra/core/processors'
|
|
967
|
+
import { Agent } from '@mastra/core/agent'
|
|
965
968
|
|
|
966
969
|
export class QualityChecker implements Processor {
|
|
967
970
|
id = 'quality-checker'
|
|
@@ -150,6 +150,9 @@ export const weatherTool = createTool({
|
|
|
150
150
|
When a result doesn't match `outputSchema`, Mastra logs a warning and returns a validation error object instead of the result. The model then treats the call as failed and may retry it. For tools whose side effects have already happened by the time the result is produced, set `outputValidation: 'warn'`. Mastra still logs the mismatch, but it returns the real result unchanged, which keeps the model from retrying an order that was already placed.
|
|
151
151
|
|
|
152
152
|
```typescript
|
|
153
|
+
import { createTool } from '@mastra/core/tools'
|
|
154
|
+
import { z } from 'zod'
|
|
155
|
+
|
|
153
156
|
export const placeOrderTool = createTool({
|
|
154
157
|
id: 'place-order',
|
|
155
158
|
description: 'Places an order and returns its id and total',
|
|
@@ -270,6 +273,8 @@ If you need to access tools from the Mastra instance, see [`Mastra.getTool()`](h
|
|
|
270
273
|
Use `toModelOutput` when your tool returns rich structured data for your application, but you want the model to receive a smaller or multimodal representation. This keeps model context focused while preserving the full tool result in your app.
|
|
271
274
|
|
|
272
275
|
```typescript
|
|
276
|
+
import { createTool } from '@mastra/core/tools'
|
|
277
|
+
|
|
273
278
|
export const weatherTool = createTool({
|
|
274
279
|
execute: async ({ location }) => {
|
|
275
280
|
const response = await fetch(`https://wttr.in/${location}?format=j1`)
|
|
@@ -85,6 +85,8 @@ export const mastra = new Mastra({
|
|
|
85
85
|
The value of each option can come from a variable, import, or function call. The option itself must remain a direct property. Don't hide build-time options behind a factory call or an object spread:
|
|
86
86
|
|
|
87
87
|
```typescript
|
|
88
|
+
import { Mastra } from '@mastra/core/mastra'
|
|
89
|
+
|
|
88
90
|
const options = {
|
|
89
91
|
bundler: {
|
|
90
92
|
externals: ['sharp'],
|
|
@@ -92,6 +92,8 @@ When your Mastra application imports from other workspace packages, Mastra handl
|
|
|
92
92
|
For most setups, this works without configuration. If you encounter issues with workspace package imports, add the package to [`transpilePackages`](https://mastra.ai/reference/configuration):
|
|
93
93
|
|
|
94
94
|
```typescript
|
|
95
|
+
import { Mastra } from '@mastra/core'
|
|
96
|
+
|
|
95
97
|
export const mastra = new Mastra({
|
|
96
98
|
bundler: {
|
|
97
99
|
transpilePackages: ['@my-org/utils'],
|
|
@@ -134,6 +134,8 @@ When a run has no trace (observability not configured), the decision is derived
|
|
|
134
134
|
**Eligibility filters**: The optional `filter` parameter uses a declarative predicate over the run context to restrict scorer eligibility. Because filtering occurs before sampling, `sampling.rate` applies only to matching runs:
|
|
135
135
|
|
|
136
136
|
```typescript
|
|
137
|
+
import { Agent } from '@mastra/core/agent'
|
|
138
|
+
|
|
137
139
|
export const myAgent = new Agent({
|
|
138
140
|
// ...
|
|
139
141
|
scorers: {
|
|
@@ -224,6 +224,8 @@ If a subagent isn't listed under the supervisor's `backgroundTasks.tools` but ha
|
|
|
224
224
|
The background config used for the inherited dispatch (for example `waitTimeoutMs`) is derived from the subagent's own `backgroundTasks` config.
|
|
225
225
|
|
|
226
226
|
```typescript
|
|
227
|
+
import { Agent } from '@mastra/core/agent'
|
|
228
|
+
|
|
227
229
|
const researchAgent = new Agent({
|
|
228
230
|
id: 'research-agent',
|
|
229
231
|
description: 'Gathers factual information.',
|
|
@@ -311,6 +313,8 @@ Each layer can register terminal-state callbacks. They don't replace one another
|
|
|
311
313
|
- Manager-level `onTaskComplete` / `onTaskFailed`: scoped globally.
|
|
312
314
|
|
|
313
315
|
```typescript
|
|
316
|
+
import { Mastra } from '@mastra/core'
|
|
317
|
+
|
|
314
318
|
export const mastra = new Mastra({
|
|
315
319
|
storage,
|
|
316
320
|
backgroundTasks: {
|
|
@@ -286,6 +286,8 @@ Durable agent runs are excluded from the generic boot-time restart of active wor
|
|
|
286
286
|
|
|
287
287
|
> **Warning:** Automatic and manual recovery re-run the agentic loop from the last persisted snapshot, which can reissue LLM calls (with real cost) and re-execute tool calls. A sub-agent delegation is one generated `agent-<name>` tool call, and recovery doesn't checkpoint the LLM or tool calls inside that delegation independently. If recovery replays the delegation step, the entire sub-agent run starts again and can repeat inner LLM calls and already-completed tool side effects. Make tools, including tools used by sub-agents, idempotent, or deduplicate their external side effects.
|
|
288
288
|
|
|
289
|
+
Delegation hooks passed per call are closures and can't be restored in a new process. A resumed run falls back to default delegation behavior. Hooks configured on the supervisor's `defaultOptions.delegation` are merged back in when recovery rebuilds the delegation tools. Put hooks that must survive a restart there instead of passing them to `stream()` or `generate()`.
|
|
290
|
+
|
|
289
291
|
### Snapshot persistence
|
|
290
292
|
|
|
291
293
|
The `shouldPersistSnapshot` option on `createDurableAgent()` (also accepted in the agent-level `durable` config) controls which workflow snapshots a durable agent writes. The default policy:
|
|
@@ -315,6 +317,9 @@ Evented agents always persist the full snapshot set: the evented engine coordina
|
|
|
315
317
|
Set `recovery.durableAgents` to `'auto'` in the Mastra config. The deployer calls `recoverAllDurableAgents()` on boot, alongside the workflow run restarts (the two run concurrently):
|
|
316
318
|
|
|
317
319
|
```typescript
|
|
320
|
+
import { Mastra } from '@mastra/core'
|
|
321
|
+
import { PostgresStore } from '@mastra/pg'
|
|
322
|
+
|
|
318
323
|
export const mastra = new Mastra({
|
|
319
324
|
agents: { myAgent: durableAgent },
|
|
320
325
|
storage: new PostgresStore({ connectionString: process.env.DATABASE_URL! }),
|
|
@@ -87,6 +87,8 @@ Pass `goal.scorer` to replace the pipeline with your own [scorer](https://mastra
|
|
|
87
87
|
Configure the default scorer with `judge`, `maxRuns`, and `prompt`:
|
|
88
88
|
|
|
89
89
|
```typescript
|
|
90
|
+
import { Agent } from '@mastra/core/agent'
|
|
91
|
+
|
|
90
92
|
const worker = new Agent({
|
|
91
93
|
id: 'worker',
|
|
92
94
|
name: 'worker',
|
|
@@ -162,6 +162,9 @@ The same operations are available from `@mastra/client-js` over the `/api/schedu
|
|
|
162
162
|
Hooks let you run code at key points in an agent schedule's lifecycle, for example to compute fire-time parameters or react to the outcome. Configure them on the `Mastra` constructor under `schedules`. The hooks are a single flat bundle that runs for every agent's schedules; each hook context carries the firing `agentId`, so branch on it when you need per-agent behavior. Hooks live at the `Mastra` level so they apply to both code-defined and stored agents.
|
|
163
163
|
|
|
164
164
|
```typescript
|
|
165
|
+
import { Mastra } from '@mastra/core'
|
|
166
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
167
|
+
|
|
165
168
|
const mastra = new Mastra({
|
|
166
169
|
agents: { pinger },
|
|
167
170
|
storage: new LibSQLStore({ id: 'mastra-storage', url: 'file:./mastra.db' }),
|
|
@@ -10,32 +10,33 @@ A provider is a service you can connect to your project, identified by a provide
|
|
|
10
10
|
|
|
11
11
|
This directory covers the generated toolsets and channel setup documented here, rather than every provider in the platform catalog. Run [`mastra connect list`](https://mastra.ai/reference/cli/mastra) to see providers available to your project and their connection status.
|
|
12
12
|
|
|
13
|
-
| Provider ID
|
|
14
|
-
|
|
|
15
|
-
| `clerk`
|
|
16
|
-
| `discord`
|
|
17
|
-
| `fireflies`
|
|
18
|
-
| `github`
|
|
19
|
-
| `google-calendar`
|
|
20
|
-
| `google-docs`
|
|
21
|
-
| `google-drive`
|
|
22
|
-
| `google-mail`
|
|
23
|
-
| `google-sheet`
|
|
24
|
-
| `hubspot`
|
|
25
|
-
| `incident-io`
|
|
26
|
-
| `jira`
|
|
27
|
-
| `linear`
|
|
28
|
-
| `microsoft-
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `slack
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
13
|
+
| Provider ID | Provider | Gives you |
|
|
14
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| `clerk` |  Clerk | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
16
|
+
| `discord` |  Discord | [Tools](https://mastra.ai/reference/connect/providers), [Channels](https://mastra.ai/docs/mastra-platform/connect/channels) |
|
|
17
|
+
| `fireflies` |  Fireflies.ai | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
18
|
+
| `github` |  GitHub | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
19
|
+
| `google-calendar` |  Google Calendar | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
20
|
+
| `google-docs` |  Google Docs | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
21
|
+
| `google-drive` |  Google Drive | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
22
|
+
| `google-mail` |  Gmail | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
23
|
+
| `google-sheet` |  Google Sheets | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
24
|
+
| `hubspot` |  HubSpot | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
25
|
+
| `incident-io` |  incident.io | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
26
|
+
| `jira` |  Jira | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
27
|
+
| `linear` |  Linear | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
28
|
+
| `microsoft-powerpoint` |  Microsoft PowerPoint | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
29
|
+
| `microsoft-teams` |  Microsoft Teams | [Tools](https://mastra.ai/reference/connect/providers), [Channels](https://mastra.ai/docs/mastra-platform/connect/channels) |
|
|
30
|
+
| `notion` |  Notion | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
31
|
+
| `openai` |  OpenAI | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
32
|
+
| `posthog` |  PostHog | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
33
|
+
| `resend` |  Resend | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
34
|
+
| `slack` |  Slack | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
35
|
+
| `slack-channels` |  Slack channels | [Channels](https://mastra.ai/docs/mastra-platform/connect/channels) |
|
|
36
|
+
| `snowflake` |  Snowflake | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
37
|
+
| `supabase` |  Supabase | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
38
|
+
| `telegram` |  Telegram | [Channels](https://mastra.ai/docs/mastra-platform/connect/channels) |
|
|
39
|
+
| `workos` |  WorkOS | [Tools](https://mastra.ai/reference/connect/providers) |
|
|
39
40
|
|
|
40
41
|
Generated toolsets are included in `@mastra/connect`. Upgrading the package gives you toolsets added in newer releases, but provider availability depends on the platform catalog. The [provider toolsets reference](https://mastra.ai/reference/connect/providers) lists the generated tools.
|
|
41
42
|
|
|
@@ -55,6 +55,8 @@ A local `.env` file is optional. Environment variables stored on the platform ar
|
|
|
55
55
|
> **Note:** If preflight reports a hard-coded local path instead (`Build contains a host-local storage URL`), it can't offer the inline fix. Guard the path with an environment variable first so the file is only used during local development:
|
|
56
56
|
>
|
|
57
57
|
> ```ts
|
|
58
|
+
> import { LibSQLStore } from '@mastra/libsql'
|
|
59
|
+
>
|
|
58
60
|
> new LibSQLStore({
|
|
59
61
|
> id: 'mastra-storage',
|
|
60
62
|
> // Uses the hosted database when deployed, a local file during development
|
|
@@ -38,6 +38,9 @@ Attaching a hosted database adds its connection variables to the environments th
|
|
|
38
38
|
| Turso | `TURSO_DATABASE_URL`, `TURSO_AUTH_TOKEN` |
|
|
39
39
|
| Neon | `DATABASE_URL` |
|
|
40
40
|
| Postgres | `DATABASE_URL` |
|
|
41
|
+
| Redis | `REDIS_URL` |
|
|
42
|
+
|
|
43
|
+
Managed Redis isn't enabled for every organization yet. When it's off for your organization, Redis doesn't appear as a database option and attaching it fails.
|
|
41
44
|
|
|
42
45
|
Values are resolved at deploy time and never stored in your project. An environment-scoped database replaces the values of a project-scoped database of the same provider for that environment.
|
|
43
46
|
|
|
@@ -82,7 +82,7 @@ export const mastra = new Mastra({
|
|
|
82
82
|
|
|
83
83
|
- `start()` provisions a fresh sandbox (or reattaches when you passed `sandboxId`).
|
|
84
84
|
- `executeCommand()` runs commands against it.
|
|
85
|
-
- `stop()` releases this process's lease without touching the remote sandbox. The VM keeps running under the environment's idle policy, and a later `start()` with the same `id`
|
|
85
|
+
- `stop()` releases this process's lease without touching the remote sandbox. The VM keeps running under the environment's idle policy, and a later `start()` with the saved `sandboxId` reattaches to it. Reusing only the same `id` provisions a new sandbox, seeded from that `id`'s recovery checkpoint when one exists.
|
|
86
86
|
- `destroy()` releases the VM. On Railway, it also deletes the recovery checkpoint associated with a caller-supplied recovery `id`. On E2B, it only kills the VM, and any snapshot you captured remains yours to manage.
|
|
87
87
|
|
|
88
88
|
A statically configured `PlatformSandbox` is shared across every request and agent using that configuration rather than creating separate sandboxes for requests or memory threads. `PlatformFilesystem` is also a separate provider: configuring both providers doesn't mount the environment bucket inside the sandbox.
|
|
@@ -138,6 +138,9 @@ If you assemble the request input yourself and need it processed exactly as sent
|
|
|
138
138
|
Message count is a poor proxy for context size: a tool result can be a few tokens or thousands. Use `messageHistory` to keep recent history within a token budget instead:
|
|
139
139
|
|
|
140
140
|
```typescript
|
|
141
|
+
import { Agent } from '@mastra/core/agent'
|
|
142
|
+
import { Memory } from '@mastra/memory'
|
|
143
|
+
|
|
141
144
|
export const agent = new Agent({
|
|
142
145
|
id: 'test-agent',
|
|
143
146
|
memory: new Memory({
|
|
@@ -149,6 +149,8 @@ OM can activate buffered observations before the token threshold is reached. Thi
|
|
|
149
149
|
Top-level early activation settings apply to observations by default:
|
|
150
150
|
|
|
151
151
|
```typescript
|
|
152
|
+
import { Memory } from '@mastra/memory'
|
|
153
|
+
|
|
152
154
|
const memory = new Memory({
|
|
153
155
|
options: {
|
|
154
156
|
observationalMemory: {
|
|
@@ -163,6 +165,8 @@ const memory = new Memory({
|
|
|
163
165
|
Use nested `observation` and `reflection` settings for per-phase control. Reflection early activation is opt-in, so top-level settings affect only observations.
|
|
164
166
|
|
|
165
167
|
```typescript
|
|
168
|
+
import { Memory } from '@mastra/memory'
|
|
169
|
+
|
|
166
170
|
const memory = new Memory({
|
|
167
171
|
options: {
|
|
168
172
|
observationalMemory: {
|
|
@@ -187,6 +191,8 @@ In this example, the top-level idle setting is disabled for observations, while
|
|
|
187
191
|
Set `observation.bufferOnIdle` to `true` to run background observation buffering when an agent turn ends and the agent becomes idle. This is useful for apps that want short turns to be observed without waiting for the next turn or the `messageTokens` threshold.
|
|
188
192
|
|
|
189
193
|
```typescript
|
|
194
|
+
import { Memory } from '@mastra/memory'
|
|
195
|
+
|
|
190
196
|
const memory = new Memory({
|
|
191
197
|
options: {
|
|
192
198
|
observationalMemory: {
|
|
@@ -209,6 +215,8 @@ Observer and Reflector model calls are retried on transient provider errors. By
|
|
|
209
215
|
- `failurePolicy`: what happens once retries are exhausted, either `'abort'` (default) or `'continue'`.
|
|
210
216
|
|
|
211
217
|
```typescript
|
|
218
|
+
import { Memory } from '@mastra/memory'
|
|
219
|
+
|
|
212
220
|
const memory = new Memory({
|
|
213
221
|
options: {
|
|
214
222
|
observationalMemory: {
|
|
@@ -391,6 +399,8 @@ This setting adds `WorkingMemoryExtractor`, defaults `workingMemory.agentManaged
|
|
|
391
399
|
Use `onExtracted` to normalize or react to custom extracted values before they're persisted:
|
|
392
400
|
|
|
393
401
|
```typescript
|
|
402
|
+
import { z } from 'zod'
|
|
403
|
+
|
|
394
404
|
new Extractor({
|
|
395
405
|
name: 'Project status',
|
|
396
406
|
instructions: 'Extract the current project status.',
|
|
@@ -164,6 +164,9 @@ const response = await memoryAgent.generate('Remember my favorite color is blue.
|
|
|
164
164
|
Scopes can also come from the agent and from the request context. Mastra combines all three sources:
|
|
165
165
|
|
|
166
166
|
```typescript
|
|
167
|
+
import { Agent } from '@mastra/core/agent'
|
|
168
|
+
import { Memory } from '@mastra/memory'
|
|
169
|
+
|
|
167
170
|
export const memoryAgent = new Agent({
|
|
168
171
|
id: 'memory-agent',
|
|
169
172
|
name: 'Memory Agent',
|
|
@@ -271,6 +274,9 @@ Open [Studio](https://mastra.ai/docs/studio/overview) and select the **Observabi
|
|
|
271
274
|
Use [`RequestContext`](https://mastra.ai/docs/server/request-context) to access request-specific values. This lets you conditionally select different memory or storage configurations based on the context of the request.
|
|
272
275
|
|
|
273
276
|
```typescript
|
|
277
|
+
import { Agent } from '@mastra/core/agent'
|
|
278
|
+
import { Memory } from '@mastra/memory'
|
|
279
|
+
|
|
274
280
|
export type UserTier = {
|
|
275
281
|
'user-tier': 'enterprise' | 'pro'
|
|
276
282
|
}
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
# Semantic recall
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Semantic recall is a built-in form of Retrieval-Augmented Generation (RAG) for agent memory. When a user sends a message, Mastra searches earlier messages for ones with a similar meaning and adds the most relevant ones to the agent's context.
|
|
8
|
+
|
|
9
|
+
Matching on meaning matters because people often remember the idea behind something, not the exact words they used. A user might ask "What did we decide about the refund?" after originally writing "Let's give them their money back." A keyword search misses that connection, but semantic recall finds it.
|
|
10
|
+
|
|
11
|
+
Use semantic recall when your agent needs details from earlier in a long conversation, or from a user's other conversations, that are no longer in [recent message history](https://mastra.ai/docs/memory/message-history).
|
|
8
12
|
|
|
9
13
|
> **📹 Watch:** Watch [Mastra semantic recall](https://www.youtube.com/watch?v=UVZtK8cK8xQ\&pp=ygUVbWFzdHJhIHdvcmtpbmcgbWVtb3J5) to see how agents retrieve relevant messages from past conversations.
|
|
10
14
|
|
|
@@ -41,6 +41,9 @@ When a log call happens inside a traced operation (an agent run, workflow step,
|
|
|
41
41
|
To get machine-parseable JSON on stdout, configure `PinoLogger` with `prettyPrint: false`, pretty printing is enabled by default and produces human-readable text instead of JSON:
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
44
|
+
import { Mastra } from '@mastra/core/mastra'
|
|
45
|
+
import { PinoLogger } from '@mastra/loggers'
|
|
46
|
+
|
|
44
47
|
export const mastra = new Mastra({
|
|
45
48
|
logger: new PinoLogger({ name: 'Mastra', level: 'info', prettyPrint: false }),
|
|
46
49
|
})
|
|
@@ -35,6 +35,9 @@ Sampling strategies let you capture a representative subset of traces while ensu
|
|
|
35
35
|
You can configure sampling at the observability config level:
|
|
36
36
|
|
|
37
37
|
```ts
|
|
38
|
+
import { Mastra } from '@mastra/core'
|
|
39
|
+
import { Observability } from '@mastra/observability'
|
|
40
|
+
|
|
38
41
|
export const mastra = new Mastra({
|
|
39
42
|
observability: new Observability({
|
|
40
43
|
configs: {
|
|
@@ -131,6 +134,9 @@ Metadata set here will be shown in all configured exporters.
|
|
|
131
134
|
Set the top-level `environment` field on Mastra to automatically attach the deployment environment to all observability signals without passing `tracingOptions.metadata.environment` on each call.
|
|
132
135
|
|
|
133
136
|
```ts
|
|
137
|
+
import { Mastra } from '@mastra/core'
|
|
138
|
+
import { Observability } from '@mastra/observability'
|
|
139
|
+
|
|
134
140
|
export const mastra = new Mastra({
|
|
135
141
|
environment: 'production',
|
|
136
142
|
observability: new Observability({
|
|
@@ -157,6 +163,9 @@ Instead of manually adding metadata to each span, you can configure Mastra to au
|
|
|
157
163
|
Define which RequestContext keys to extract in your tracing configuration. These keys will be automatically included as metadata for all spans created with this configuration:
|
|
158
164
|
|
|
159
165
|
```ts
|
|
166
|
+
import { Mastra } from '@mastra/core'
|
|
167
|
+
import { Observability } from '@mastra/observability'
|
|
168
|
+
|
|
160
169
|
export const mastra = new Mastra({
|
|
161
170
|
observability: new Observability({
|
|
162
171
|
configs: {
|
|
@@ -451,6 +460,8 @@ You can create custom span processors by implementing the `SpanOutputProcessor`
|
|
|
451
460
|
|
|
452
461
|
```ts
|
|
453
462
|
import type { SpanOutputProcessor, AnySpan } from '@mastra/core/observability'
|
|
463
|
+
import { Mastra } from '@mastra/core'
|
|
464
|
+
import { Observability } from '@mastra/observability'
|
|
454
465
|
|
|
455
466
|
export class LowercaseInputProcessor implements SpanOutputProcessor {
|
|
456
467
|
name = 'lowercase-processor'
|
|
@@ -552,6 +563,8 @@ import { BraintrustExporter } from '@mastra/braintrust'
|
|
|
552
563
|
import { LangfuseExporter } from '@mastra/langfuse'
|
|
553
564
|
import { SpanType } from '@mastra/core/observability'
|
|
554
565
|
import type { CustomSpanFormatter } from '@mastra/core/observability'
|
|
566
|
+
import { Mastra } from '@mastra/core'
|
|
567
|
+
import { Observability } from '@mastra/observability'
|
|
555
568
|
|
|
556
569
|
// Formatter that extracts plain text from AI messages
|
|
557
570
|
const plainTextFormatter: CustomSpanFormatter = span => {
|
|
@@ -675,6 +688,9 @@ Serialization options control how span data (input, output, and attributes) is t
|
|
|
675
688
|
Add `serializationOptions` to your observability configuration:
|
|
676
689
|
|
|
677
690
|
```ts
|
|
691
|
+
import { Mastra } from '@mastra/core'
|
|
692
|
+
import { Observability } from '@mastra/observability'
|
|
693
|
+
|
|
678
694
|
export const mastra = new Mastra({
|
|
679
695
|
observability: new Observability({
|
|
680
696
|
configs: {
|
|
@@ -53,6 +53,8 @@ BM25 scores documents by term frequency and document length. It needs no externa
|
|
|
53
53
|
To tune term-frequency saturation and document-length normalization, pass `k1` and `b`:
|
|
54
54
|
|
|
55
55
|
```typescript
|
|
56
|
+
import { Workspace, LocalFilesystem } from '@mastra/core/workspace'
|
|
57
|
+
|
|
56
58
|
const workspace = new Workspace({
|
|
57
59
|
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
58
60
|
bm25: {
|
|
@@ -142,6 +144,8 @@ const workspace = new Workspace({
|
|
|
142
144
|
Configure both BM25 and vector search to combine keyword and semantic results:
|
|
143
145
|
|
|
144
146
|
```typescript
|
|
147
|
+
import { Workspace, LocalFilesystem } from '@mastra/core/workspace'
|
|
148
|
+
|
|
145
149
|
const workspace = new Workspace({
|
|
146
150
|
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
147
151
|
bm25: true,
|
|
@@ -155,6 +159,8 @@ const workspace = new Workspace({
|
|
|
155
159
|
The vector index name defaults to a sanitized version of the workspace ID followed by `_search`. Set `searchIndexName` when you need a stable or shared name:
|
|
156
160
|
|
|
157
161
|
```typescript
|
|
162
|
+
import { Workspace, LocalFilesystem } from '@mastra/core/workspace'
|
|
163
|
+
|
|
158
164
|
const workspace = new Workspace({
|
|
159
165
|
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
160
166
|
vectorStore: pineconeVector,
|
|
@@ -275,6 +281,8 @@ const workspace = new Workspace({
|
|
|
275
281
|
The index tool accepts the same supplied `path`, `content`, and optional metadata as `workspace.index()`. Because it can trigger embedding calls and vector-store writes, require approval when agents shouldn't mutate the index without review:
|
|
276
282
|
|
|
277
283
|
```typescript
|
|
284
|
+
import { Workspace, LocalFilesystem } from '@mastra/core/workspace'
|
|
285
|
+
|
|
278
286
|
const workspace = new Workspace({
|
|
279
287
|
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
280
288
|
bm25: true,
|
|
@@ -324,6 +332,9 @@ Top-level `await` keeps module startup pending until initialization finishes. Wh
|
|
|
324
332
|
Each `autoIndexPaths` entry can be a file, directory, or glob pattern. Recursive directory and glob traversal is limited to ten levels:
|
|
325
333
|
|
|
326
334
|
```typescript
|
|
335
|
+
import { Mastra } from '@mastra/core'
|
|
336
|
+
import { Workspace, LocalFilesystem } from '@mastra/core/workspace'
|
|
337
|
+
|
|
327
338
|
const workspace = new Workspace({
|
|
328
339
|
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
329
340
|
bm25: true,
|
|
@@ -40,7 +40,7 @@ These type parameters ensure type safety throughout your adapter implementation
|
|
|
40
40
|
|
|
41
41
|
## Required methods
|
|
42
42
|
|
|
43
|
-
You must implement these
|
|
43
|
+
You must implement these seven abstract methods. Each handles a specific part of the request lifecycle, from attaching context to sending responses.
|
|
44
44
|
|
|
45
45
|
### `registerContextMiddleware()`
|
|
46
46
|
|
|
@@ -105,6 +105,53 @@ registerAuthMiddleware(): void {
|
|
|
105
105
|
}
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
+
### `registerHttpLoggingMiddleware()`
|
|
109
|
+
|
|
110
|
+
Register request logging middleware. `init()` calls this after the context, auth, and user middleware. Return early when request logging isn't enabled in `this.httpLoggingConfig`, and skip paths that `this.shouldLogRequest()` excludes. Implement this method as a no-op if your framework has no way to log requests.
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
registerHttpLoggingMiddleware(): void {
|
|
114
|
+
if (!this.httpLoggingConfig?.enabled) return;
|
|
115
|
+
|
|
116
|
+
this.app.use((req, res, next) => {
|
|
117
|
+
if (!this.shouldLogRequest(req.path)) {
|
|
118
|
+
return next();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const start = Date.now();
|
|
122
|
+
const method = req.method;
|
|
123
|
+
const path = req.path;
|
|
124
|
+
|
|
125
|
+
res.on('finish', () => {
|
|
126
|
+
const duration = Date.now() - start;
|
|
127
|
+
const level = this.httpLoggingConfig?.level || 'info';
|
|
128
|
+
const logData: Record<string, unknown> = {
|
|
129
|
+
method,
|
|
130
|
+
path,
|
|
131
|
+
status: res.statusCode,
|
|
132
|
+
duration: `${duration}ms`,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
if (this.httpLoggingConfig?.includeQueryParams) {
|
|
136
|
+
logData.query = req.query;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (this.httpLoggingConfig?.includeHeaders) {
|
|
140
|
+
const headers = { ...req.headers };
|
|
141
|
+
for (const name of this.httpLoggingConfig.redactHeaders || []) {
|
|
142
|
+
const key = name.toLowerCase();
|
|
143
|
+
if (headers[key] !== undefined) headers[key] = '[REDACTED]';
|
|
144
|
+
}
|
|
145
|
+
logData.headers = headers;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
this.logger[level](`${method} ${path} ${res.statusCode} ${duration}ms`, logData);
|
|
149
|
+
});
|
|
150
|
+
next();
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
108
155
|
### `registerRoute()`
|
|
109
156
|
|
|
110
157
|
Register a single route with your framework. This method is called once for each Mastra route during initialization. It receives a `ServerRoute` object containing the path, HTTP method, handler function, and Zod schemas for validation. Your implementation should wire this up to your framework's routing system.
|
|
@@ -326,6 +373,11 @@ export class MyFrameworkServer extends MastraServer<MyApp, MyRequest, MyResponse
|
|
|
326
373
|
// ... implement auth middleware
|
|
327
374
|
}
|
|
328
375
|
|
|
376
|
+
registerHttpLoggingMiddleware(): void {
|
|
377
|
+
if (!this.httpLoggingConfig?.enabled) return
|
|
378
|
+
// ... implement request logging
|
|
379
|
+
}
|
|
380
|
+
|
|
329
381
|
async registerRoute(
|
|
330
382
|
app: MyApp,
|
|
331
383
|
route: ServerRoute,
|
|
@@ -306,6 +306,8 @@ Built-in streaming helpers such as [`chatRoute()`](https://mastra.ai/reference/a
|
|
|
306
306
|
For custom streaming routes that should stop when the client disconnects, pass `c.req.raw.signal` to long-running work such as `agent.stream()`. Mastra's Node-based adapters also stop reading streamed `Response` bodies from custom routes when the client connection closes. Streamed response body errors that aren't caused by client disconnects still propagate through the adapter's normal error handling. In Hono, disconnect behavior depends on the host runtime forwarding connection closes to `request.signal`.
|
|
307
307
|
|
|
308
308
|
```typescript
|
|
309
|
+
import { registerApiRoute } from '@mastra/core/server'
|
|
310
|
+
|
|
309
311
|
registerApiRoute('/stream', {
|
|
310
312
|
method: 'GET',
|
|
311
313
|
handler: async c => {
|