@mastra/mcp-docs-server 1.2.11 → 1.2.12-alpha.3
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/agent-builder/access-control.md +3 -3
- package/.docs/docs/agent-builder/browser.md +1 -1
- package/.docs/docs/agent-builder/channels.md +1 -1
- package/.docs/docs/agent-builder/configuration.md +3 -3
- package/.docs/docs/agent-builder/deploying.md +2 -2
- package/.docs/docs/agent-builder/integrations.md +8 -8
- package/.docs/docs/agent-builder/memory.md +2 -2
- package/.docs/docs/agent-builder/overview.md +1 -1
- package/.docs/docs/agent-controller/channels.md +8 -6
- package/.docs/docs/agent-controller/modes.md +6 -6
- package/.docs/docs/agent-controller/overview.md +13 -9
- package/.docs/docs/agent-controller/session.md +27 -9
- package/.docs/docs/agent-controller/subagents.md +9 -6
- package/.docs/docs/agent-controller/threads-and-state.md +12 -8
- package/.docs/docs/agent-controller/tool-approvals.md +7 -3
- package/.docs/docs/agents/a2a.md +4 -2
- package/.docs/docs/agents/acp.md +5 -5
- package/.docs/docs/agents/agent-approval.md +13 -11
- package/.docs/docs/agents/code-mode.md +29 -6
- package/.docs/docs/agents/guardrails.md +8 -8
- package/.docs/docs/agents/networks.md +2 -2
- package/.docs/docs/agents/overview.md +9 -7
- package/.docs/docs/agents/processors.md +15 -15
- package/.docs/docs/agents/skills.md +6 -6
- package/.docs/docs/agents/structured-output.md +6 -6
- package/.docs/docs/agents/supervisor-agents.md +19 -13
- package/.docs/docs/agents/using-tools.md +48 -21
- package/.docs/docs/browser/agent-browser.md +4 -4
- package/.docs/docs/browser/browser-viewer.md +2 -2
- package/.docs/docs/browser/firecrawl.md +1 -1
- package/.docs/docs/browser/overview.md +2 -2
- package/.docs/docs/browser/recording.md +1 -1
- package/.docs/docs/browser/stagehand.md +7 -7
- package/.docs/docs/capabilities/channels/discord.md +1 -1
- package/.docs/docs/capabilities/channels/other-adapters.md +1 -1
- package/.docs/docs/capabilities/channels/overview.md +9 -5
- package/.docs/docs/capabilities/channels/slack.md +2 -2
- package/.docs/docs/capabilities/channels/teams.md +1 -1
- package/.docs/docs/capabilities/channels/telegram.md +1 -1
- package/.docs/docs/capabilities/channels/whatsapp.md +1 -1
- package/.docs/docs/deployment/mastra-server.md +1 -1
- package/.docs/docs/deployment/overview.md +6 -2
- package/.docs/docs/deployment/sandbox.md +3 -1
- package/.docs/docs/deployment/workers.md +137 -0
- package/.docs/docs/editor/overview.md +37 -31
- package/.docs/docs/editor/prompts.md +8 -4
- package/.docs/docs/editor/tools.md +3 -3
- package/.docs/docs/evals/built-in-scorers.md +4 -4
- package/.docs/docs/evals/custom-scorers.md +5 -5
- package/.docs/docs/evals/datasets/running-experiments.md +7 -7
- package/.docs/docs/evals/evals-with-memory.md +4 -4
- package/.docs/docs/evals/gates-and-verdicts.md +4 -4
- package/.docs/docs/evals/multi-turn.md +12 -12
- package/.docs/docs/evals/overview.md +6 -4
- package/.docs/docs/evals/quick-checks.md +2 -2
- package/.docs/docs/getting-started/build-with-ai.md +6 -4
- package/.docs/docs/getting-started/file-based-agents.md +6 -4
- package/.docs/docs/getting-started/manual-install.md +1 -1
- package/.docs/docs/index.md +9 -90
- package/.docs/docs/long-running-agents/background-tasks.md +10 -10
- package/.docs/docs/long-running-agents/durable-agents.md +46 -5
- package/.docs/docs/long-running-agents/goals.md +15 -11
- package/.docs/docs/long-running-agents/schedules.md +3 -3
- package/.docs/docs/long-running-agents/signal-providers.md +8 -6
- package/.docs/docs/long-running-agents/signals.md +9 -5
- package/.docs/docs/mastra-platform/configuration.md +3 -3
- package/.docs/docs/mastra-platform/database.md +8 -8
- package/.docs/docs/mastra-platform/deploy.md +8 -4
- package/.docs/docs/mastra-platform/environments.md +8 -4
- package/.docs/docs/mastra-platform/github.md +3 -1
- package/.docs/docs/mastra-platform/server.md +1 -1
- package/.docs/docs/mastra-platform/studio.md +2 -2
- package/.docs/docs/mastra-platform/workspace.md +6 -6
- package/.docs/docs/mcp/mcp-apps.md +1 -1
- package/.docs/docs/mcp/overview.md +9 -9
- package/.docs/docs/memory/memory-processors.md +10 -10
- package/.docs/docs/memory/message-history.md +11 -5
- package/.docs/docs/memory/multi-user-threads.md +6 -6
- package/.docs/docs/memory/observational-memory.md +27 -25
- package/.docs/docs/memory/overview.md +10 -10
- package/.docs/docs/memory/semantic-recall.md +3 -3
- package/.docs/docs/memory/working-memory.md +8 -8
- package/.docs/docs/observability/integrations/bridges/datadog.md +6 -6
- package/.docs/docs/observability/integrations/bridges/otel.md +5 -5
- package/.docs/docs/observability/integrations/exporters/datadog.md +1 -1
- package/.docs/docs/observability/integrations/exporters/laminar.md +1 -1
- package/.docs/docs/observability/integrations/exporters/langfuse.md +3 -3
- package/.docs/docs/observability/integrations/exporters/langsmith.md +4 -4
- package/.docs/docs/observability/integrations/exporters/mastra-platform.md +1 -1
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +1 -1
- package/.docs/docs/observability/integrations/exporters/otel.md +26 -4
- package/.docs/docs/observability/integrations/exporters/sentry.md +1 -1
- package/.docs/docs/observability/integrations/overview.md +1 -1
- package/.docs/docs/observability/integrations/processors/sensitive-data-filter.md +1 -1
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/metrics/overview.md +1 -1
- package/.docs/docs/observability/metrics/querying.md +8 -8
- package/.docs/docs/observability/overview.md +4 -4
- package/.docs/docs/observability/tracing/overview.md +18 -12
- package/.docs/docs/rag/chunking-and-embedding.md +1 -1
- package/.docs/docs/rag/graph-rag.md +7 -7
- package/.docs/docs/rag/overview.md +2 -2
- package/.docs/docs/rag/retrieval.md +18 -18
- package/.docs/docs/rag/vector-databases.md +2 -2
- package/.docs/docs/server/auth/composite-auth.md +2 -2
- package/.docs/docs/server/auth/fga.md +6 -6
- package/.docs/docs/server/auth/firebase.md +2 -2
- package/.docs/docs/server/auth/simple-auth.md +1 -1
- package/.docs/docs/server/auth/workers.md +133 -0
- package/.docs/docs/server/custom-adapters.md +4 -4
- package/.docs/docs/server/mastra-client.md +3 -3
- package/.docs/docs/server/mastra-server.md +2 -2
- package/.docs/docs/server/middleware.md +1 -1
- package/.docs/docs/server/pubsub.md +7 -4
- package/.docs/docs/server/request-context.md +11 -11
- package/.docs/docs/server/server-adapters.md +2 -2
- package/.docs/docs/storage/overview.md +2 -2
- package/.docs/docs/studio/auth.md +5 -5
- package/.docs/docs/studio/deployment.md +1 -1
- package/.docs/docs/studio/observability.md +2 -2
- package/.docs/docs/studio/overview.md +11 -9
- package/.docs/docs/voice/overview.md +26 -26
- package/.docs/docs/voice/realtime-voice.md +8 -8
- package/.docs/docs/voice/speech-to-speech.md +9 -9
- package/.docs/docs/voice/speech-to-text.md +3 -3
- package/.docs/docs/voice/text-to-speech.md +6 -6
- package/.docs/docs/what-is-mastra.md +161 -0
- package/.docs/docs/workflows/agents-and-tools.md +3 -3
- package/.docs/docs/workflows/control-flow.md +10 -8
- package/.docs/docs/workflows/error-handling.md +2 -2
- package/.docs/docs/workflows/overview.md +7 -6
- package/.docs/docs/workflows/scheduled-workflows.md +12 -12
- package/.docs/docs/workflows/snapshots.md +3 -3
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workflows/time-travel.md +3 -1
- package/.docs/docs/workflows/workflow-state.md +1 -1
- package/.docs/docs/workspace/filesystem.md +10 -10
- package/.docs/docs/workspace/lsp.md +1 -1
- package/.docs/docs/workspace/overview.md +12 -12
- package/.docs/docs/workspace/sandbox.md +9 -7
- package/.docs/docs/workspace/search.md +3 -3
- package/.docs/docs/workspace/skills.md +7 -7
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +6 -6
- package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +9 -9
- package/.docs/guides/build-your-ui/copilotkit/overview.md +2 -2
- package/.docs/guides/build-your-ui/openui.md +2 -2
- package/.docs/guides/concepts/multi-agent-systems.md +5 -5
- package/.docs/guides/concepts/streaming.md +10 -10
- package/.docs/guides/deployment/amazon-ec2.md +1 -1
- package/.docs/guides/deployment/aws-lambda.md +1 -1
- package/.docs/guides/deployment/azure-app-services.md +1 -1
- package/.docs/guides/deployment/cloudflare.md +1 -1
- package/.docs/guides/deployment/inngest.md +6 -6
- package/.docs/guides/deployment/kubernetes.md +1 -1
- package/.docs/guides/deployment/mastra-workers.md +232 -0
- package/.docs/guides/deployment/temporal.md +1 -1
- package/.docs/guides/deployment/vercel.md +1 -1
- package/.docs/guides/getting-started/astro.md +1 -1
- package/.docs/guides/getting-started/electron.md +1 -1
- package/.docs/guides/getting-started/nestjs.md +5 -5
- package/.docs/guides/getting-started/vite-react.md +1 -1
- package/.docs/guides/guide/ai-recruiter.md +1 -1
- package/.docs/guides/guide/chef-michel.md +2 -2
- package/.docs/guides/guide/code-review-bot.md +2 -2
- package/.docs/guides/guide/coding-agent.md +5 -5
- package/.docs/guides/guide/dev-assistant.md +2 -2
- package/.docs/guides/guide/docs-manager.md +4 -4
- package/.docs/guides/guide/firecrawl.md +1 -1
- package/.docs/guides/guide/github-actions-pr-description.md +5 -5
- package/.docs/guides/guide/research-assistant.md +4 -4
- package/.docs/guides/guide/research-coordinator.md +5 -5
- package/.docs/guides/guide/signal-provider.md +1 -1
- package/.docs/guides/guide/slack-assistant.md +1 -1
- package/.docs/guides/guide/stock-agent.md +3 -3
- package/.docs/guides/guide/web-search.md +4 -4
- package/.docs/guides/guide/whatsapp-chat-bot.md +2 -2
- package/.docs/guides/index.md +1 -1
- package/.docs/guides/migrations/agentnetwork.md +4 -4
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +1 -1
- package/.docs/guides/migrations/mastra-cloud.md +6 -6
- package/.docs/guides/migrations/network-to-supervisor.md +9 -9
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +6 -6
- package/.docs/guides/migrations/upgrade-to-v1/cli.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/client.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/processors.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +11 -11
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +1 -1
- package/.docs/guides/migrations/vnext-to-standard-apis.md +2 -2
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/gateways/custom-gateways.md +3 -3
- package/.docs/models/gateways/openrouter.md +1 -3
- package/.docs/models/gateways/vercel.md +2 -1
- package/.docs/models/index.md +6 -6
- package/.docs/models/providers/baseten.md +1 -1
- package/.docs/models/providers/chutes.md +2 -1
- package/.docs/models/providers/crossmodel.md +2 -2
- package/.docs/models/providers/deepinfra.md +1 -1
- package/.docs/models/providers/hyper.md +3 -3
- package/.docs/models/providers/llmgateway.md +4 -3
- package/.docs/models/providers/modal.md +73 -0
- package/.docs/models/providers/wandb.md +2 -1
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/acp/acp-agent.md +4 -4
- package/.docs/reference/acp/create-acp-tool.md +3 -3
- package/.docs/reference/agent-controller/agent-controller-class.md +36 -36
- package/.docs/reference/agent-controller/session.md +6 -6
- package/.docs/reference/agents/agent.md +14 -14
- package/.docs/reference/agents/channels.md +29 -13
- package/.docs/reference/agents/durable-agent.md +54 -5
- package/.docs/reference/agents/generate.md +3 -3
- package/.docs/reference/agents/generateLegacy.md +1 -1
- package/.docs/reference/agents/getDefaultOptions.md +1 -1
- package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
- package/.docs/reference/agents/getLLM.md +2 -2
- package/.docs/reference/agents/getMetadata.md +2 -2
- package/.docs/reference/agents/inngest-agent.md +1 -1
- package/.docs/reference/agents/listScorers.md +1 -1
- package/.docs/reference/agents/listSkills.md +1 -1
- package/.docs/reference/agents/listSuspendedRuns.md +2 -2
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/ai-sdk/chat-route.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +1 -1
- package/.docs/reference/ai-sdk/workflow-route.md +1 -1
- package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +2 -2
- package/.docs/reference/auth/auth0.md +1 -1
- package/.docs/reference/auth/fga.md +2 -2
- package/.docs/reference/auth/google.md +2 -2
- package/.docs/reference/auth/okta.md +1 -1
- package/.docs/reference/auth/workos.md +2 -2
- package/.docs/reference/browser/agent-browser.md +3 -3
- package/.docs/reference/browser/browser-viewer.md +4 -4
- package/.docs/reference/browser/firecrawl-browser.md +1 -1
- package/.docs/reference/browser/mastra-browser.md +4 -4
- package/.docs/reference/browser/stagehand-browser.md +8 -8
- package/.docs/reference/channels/slack-provider.md +2 -2
- package/.docs/reference/cli/create-mastra.md +1 -1
- package/.docs/reference/cli/mastra.md +155 -24
- package/.docs/reference/client-js/agents.md +26 -9
- package/.docs/reference/client-js/memory.md +2 -2
- package/.docs/reference/client-js/workflows.md +1 -1
- package/.docs/reference/coding-agent/build-base-prompt.md +2 -2
- package/.docs/reference/coding-agent/create-coding-agent.md +2 -2
- package/.docs/reference/configuration.md +7 -7
- package/.docs/reference/core/getAgentById.md +1 -1
- package/.docs/reference/core/getMCPServer.md +1 -1
- package/.docs/reference/core/getScorer.md +1 -1
- package/.docs/reference/core/mastra-class.md +48 -1
- package/.docs/reference/core/mastra-model-gateway.md +1 -1
- package/.docs/reference/datasets/addItem.md +1 -1
- package/.docs/reference/datasets/listItems.md +1 -1
- package/.docs/reference/deployer/netlify.md +4 -4
- package/.docs/reference/deployer/vercel.md +7 -7
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +4 -4
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +6 -6
- package/.docs/reference/editor/agent-builder/builder-models.md +3 -3
- package/.docs/reference/editor/blob-store-provider.md +1 -1
- package/.docs/reference/editor/browser-provider.md +3 -3
- package/.docs/reference/editor/filesystem-provider.md +4 -4
- package/.docs/reference/editor/mastra-editor.md +5 -5
- package/.docs/reference/editor/processor-provider.md +3 -3
- package/.docs/reference/editor/sandbox-provider.md +4 -4
- package/.docs/reference/editor/storage-browser-ref.md +6 -6
- package/.docs/reference/editor/storage-workspace-ref.md +4 -4
- package/.docs/reference/editor/tool-provider.md +1 -1
- package/.docs/reference/evals/answer-relevancy.md +5 -5
- package/.docs/reference/evals/answer-similarity.md +1 -1
- package/.docs/reference/evals/bias.md +4 -4
- package/.docs/reference/evals/checks.md +3 -3
- package/.docs/reference/evals/completeness.md +5 -5
- package/.docs/reference/evals/content-similarity.md +5 -5
- package/.docs/reference/evals/context-precision.md +5 -5
- package/.docs/reference/evals/context-recall.md +11 -11
- package/.docs/reference/evals/context-relevance.md +15 -15
- package/.docs/reference/evals/create-scorer.md +1 -1
- package/.docs/reference/evals/faithfulness.md +4 -4
- package/.docs/reference/evals/filter-run.md +2 -2
- package/.docs/reference/evals/hallucination.md +11 -11
- package/.docs/reference/evals/keyword-coverage.md +6 -6
- package/.docs/reference/evals/mastra-scorer.md +2 -2
- package/.docs/reference/evals/noise-sensitivity.md +15 -15
- package/.docs/reference/evals/prompt-alignment.md +20 -20
- package/.docs/reference/evals/rubric.md +2 -2
- package/.docs/reference/evals/run-evals.md +3 -3
- package/.docs/reference/evals/scorer-utils.md +4 -4
- package/.docs/reference/evals/textual-difference.md +4 -4
- package/.docs/reference/evals/tool-call-accuracy.md +4 -4
- package/.docs/reference/evals/toxicity.md +5 -5
- package/.docs/reference/evals/trajectory-accuracy.md +10 -10
- package/.docs/reference/file-based-agents/config.md +3 -3
- package/.docs/reference/file-based-agents/instructions.md +3 -3
- package/.docs/reference/file-based-agents/logger.md +1 -1
- package/.docs/reference/file-based-agents/observability.md +1 -1
- package/.docs/reference/file-based-agents/processors.md +1 -1
- package/.docs/reference/file-based-agents/skills.md +1 -1
- package/.docs/reference/file-based-agents/storage.md +1 -1
- package/.docs/reference/file-based-agents/studio.md +1 -1
- package/.docs/reference/file-based-agents/subagents.md +4 -4
- package/.docs/reference/file-based-agents/tools.md +1 -1
- package/.docs/reference/file-based-agents/workspace.md +1 -1
- package/.docs/reference/index.md +2 -0
- package/.docs/reference/logging/pino-logger.md +3 -3
- package/.docs/reference/memory/clone-utilities.md +1 -1
- package/.docs/reference/memory/cloneThread.md +3 -3
- package/.docs/reference/memory/listThreads.md +1 -1
- package/.docs/reference/memory/memory-class.md +4 -4
- package/.docs/reference/memory/observational-memory.md +15 -15
- package/.docs/reference/memory/recall.md +2 -2
- package/.docs/reference/memory/serialized-memory-config.md +4 -4
- package/.docs/reference/memory/summarizeConversation.md +3 -3
- package/.docs/reference/memory/summarizeThread.md +3 -3
- package/.docs/reference/observability/feedback.md +1 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +7 -7
- package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -3
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/langfuse.md +1 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +4 -4
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +1 -1
- package/.docs/reference/observability/tracing/interfaces.md +1 -1
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -1
- package/.docs/reference/observability/tracing/span-filtering.md +1 -1
- package/.docs/reference/processors/batch-parts-processor.md +1 -1
- package/.docs/reference/processors/cost-guard-processor.md +1 -1
- package/.docs/reference/processors/language-detector.md +1 -1
- package/.docs/reference/processors/message-history-processor.md +1 -1
- package/.docs/reference/processors/moderation-processor.md +2 -2
- package/.docs/reference/processors/pii-detector.md +3 -3
- package/.docs/reference/processors/processor-interface.md +13 -13
- package/.docs/reference/processors/prompt-injection-detector.md +2 -2
- package/.docs/reference/processors/provider-history-compat.md +1 -1
- package/.docs/reference/processors/regex-filter-processor.md +1 -1
- package/.docs/reference/processors/response-cache.md +8 -8
- package/.docs/reference/processors/semantic-recall-processor.md +1 -1
- package/.docs/reference/processors/skill-search-processor.md +1 -1
- package/.docs/reference/processors/system-prompt-scrubber.md +2 -2
- package/.docs/reference/processors/token-limiter-processor.md +4 -4
- package/.docs/reference/processors/tool-call-filter.md +2 -2
- package/.docs/reference/processors/tool-search-processor.md +9 -9
- package/.docs/reference/processors/unicode-normalizer.md +2 -2
- package/.docs/reference/processors/working-memory-processor.md +1 -1
- package/.docs/reference/project-structure.md +1 -1
- package/.docs/reference/pubsub/base.md +4 -4
- package/.docs/reference/pubsub/google-cloud-pubsub.md +2 -2
- package/.docs/reference/pubsub/lease-provider.md +4 -4
- package/.docs/reference/pubsub/redis-streams.md +1 -1
- package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
- package/.docs/reference/rag/chunk.md +5 -5
- package/.docs/reference/rag/database-config.md +2 -2
- package/.docs/reference/rag/metadata-filters.md +2 -2
- package/.docs/reference/rag/rerank.md +1 -1
- package/.docs/reference/schedules/overview.md +1 -1
- package/.docs/reference/server/register-api-route.md +1 -1
- package/.docs/reference/server/routes.md +7 -7
- package/.docs/reference/signals/create-notification-inbox-tool.md +1 -1
- package/.docs/reference/signals/signal-provider.md +8 -8
- package/.docs/reference/storage/clickhouse.md +4 -4
- package/.docs/reference/storage/cloudflare-d1.md +4 -4
- package/.docs/reference/storage/convex.md +4 -4
- package/.docs/reference/storage/dsql.md +3 -3
- package/.docs/reference/storage/dynamodb.md +7 -7
- package/.docs/reference/storage/lance.md +1 -1
- package/.docs/reference/storage/mongodb.md +2 -2
- package/.docs/reference/storage/mssql.md +1 -1
- package/.docs/reference/storage/postgresql.md +2 -2
- package/.docs/reference/storage/redis.md +1 -1
- package/.docs/reference/storage/retention.md +33 -33
- package/.docs/reference/storage/spanner.md +8 -8
- package/.docs/reference/storage/upstash.md +1 -1
- package/.docs/reference/streaming/ChunkType.md +2 -2
- package/.docs/reference/streaming/agents/MastraModelOutput.md +1 -1
- package/.docs/reference/streaming/agents/stream.md +2 -2
- package/.docs/reference/streaming/agents/streamUntilIdle.md +2 -2
- package/.docs/reference/streaming/workflows/observeStream.md +1 -1
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/streaming/workflows/stream.md +1 -1
- package/.docs/reference/streaming/workflows/timeTravelStream.md +2 -2
- package/.docs/reference/templates/overview.md +1 -1
- package/.docs/reference/tools/brightdata.md +1 -1
- package/.docs/reference/tools/create-code-mode.md +3 -3
- package/.docs/reference/tools/create-tool.md +1 -1
- package/.docs/reference/tools/graph-rag-tool.md +1 -1
- package/.docs/reference/tools/isolated-vm-transport.md +74 -0
- package/.docs/reference/tools/mcp-client.md +15 -15
- package/.docs/reference/tools/mcp-server.md +21 -21
- package/.docs/reference/tools/submit-plan-tool.md +1 -1
- package/.docs/reference/tools/tavily.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +5 -5
- package/.docs/reference/vectors/astra.md +1 -1
- package/.docs/reference/vectors/chroma.md +2 -2
- package/.docs/reference/vectors/convex.md +2 -2
- package/.docs/reference/vectors/couchbase.md +4 -4
- package/.docs/reference/vectors/libsql.md +2 -2
- package/.docs/reference/vectors/mongodb.md +3 -3
- package/.docs/reference/vectors/pg.md +5 -5
- package/.docs/reference/vectors/qdrant.md +2 -2
- package/.docs/reference/vectors/s3vectors.md +4 -4
- package/.docs/reference/vectors/turbopuffer.md +1 -1
- package/.docs/reference/vectors/upstash.md +1 -1
- package/.docs/reference/voice/aws-nova-sonic.md +1 -1
- package/.docs/reference/voice/azure.md +1 -1
- package/.docs/reference/voice/google-gemini-live.md +4 -4
- package/.docs/reference/voice/inworld-realtime.md +7 -7
- package/.docs/reference/voice/livekit.md +13 -13
- package/.docs/reference/voice/mistral.md +1 -1
- package/.docs/reference/voice/openai-realtime.md +1 -1
- package/.docs/reference/voice/sarvam.md +1 -1
- package/.docs/reference/voice/voice.addInstructions.md +1 -1
- package/.docs/reference/voice/voice.addTools.md +1 -1
- package/.docs/reference/voice/voice.events.md +1 -1
- package/.docs/reference/voice/voice.getSpeakers.md +2 -2
- package/.docs/reference/voice/voice.on.md +2 -2
- package/.docs/reference/voice/xai-realtime.md +2 -2
- package/.docs/reference/workers/overview.md +85 -0
- package/.docs/reference/workflows/run-methods/cancel.md +1 -1
- package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workflows/workflow-methods/foreach.md +1 -1
- package/.docs/reference/workflows/workflow-methods/sleep.md +1 -1
- package/.docs/reference/workflows/workflow-state-reader.md +2 -2
- package/.docs/reference/workspace/agentfs-filesystem.md +1 -1
- package/.docs/reference/workspace/apple-container-sandbox.md +2 -2
- package/.docs/reference/workspace/daytona-sandbox.md +3 -3
- package/.docs/reference/workspace/docker-sandbox.md +2 -2
- package/.docs/reference/workspace/e2b-sandbox.md +2 -2
- package/.docs/reference/workspace/files-sdk-filesystem.md +3 -3
- package/.docs/reference/workspace/google-drive-filesystem.md +4 -4
- package/.docs/reference/workspace/local-filesystem.md +3 -3
- package/.docs/reference/workspace/local-sandbox.md +3 -3
- package/.docs/reference/workspace/modal-sandbox.md +1 -1
- package/.docs/reference/workspace/platform-filesystem.md +3 -3
- package/.docs/reference/workspace/platform-sandbox.md +2 -2
- package/.docs/reference/workspace/process-manager.md +1 -1
- package/.docs/reference/workspace/railway-sandbox.md +4 -4
- package/.docs/reference/workspace/s3-filesystem.md +1 -1
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/vercel-sandbox.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +10 -10
- package/CHANGELOG.md +21 -0
- package/package.json +3 -3
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Workers
|
|
4
|
+
|
|
5
|
+
When workers run in separate processes from the API, they communicate over HTTP. The orchestration worker calls the API's step execution endpoint to run workflow steps on the API server. Push-mode PubSub brokers (like Google Cloud Pub/Sub in push mode) can also deliver events directly to the API's event endpoint. This is a distinct integration path from pull-mode workers, which pull events from the broker themselves. Both HTTP endpoints require authentication when an auth provider is configured.
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
Worker authentication uses the same auth pipeline as the rest of your Mastra server. The orchestration worker sends credentials with each HTTP request, and the server's configured `authenticateToken` provider validates them.
|
|
10
|
+
|
|
11
|
+
| Endpoint | Used by | Purpose |
|
|
12
|
+
| ----------------------------------------------------------- | --------------------------------------------- | ---------------------------------- |
|
|
13
|
+
| `POST /api/workflows/:workflowId/runs/:runId/steps/execute` | Orchestration worker via `HttpRemoteStrategy` | Execute a workflow step on the API |
|
|
14
|
+
| `POST /api/workflows/events` | Push-mode brokers (GCP Pub/Sub, SNS) | Deliver workflow events to the API |
|
|
15
|
+
|
|
16
|
+
Both routes have `requiresAuth: true`. When no auth provider is configured, they're publicly accessible.
|
|
17
|
+
|
|
18
|
+
> **Warning:** When deploying workers as separate processes, always configure an auth provider on the server. Without one, the step execution and event endpoints are open to any caller.
|
|
19
|
+
|
|
20
|
+
## Setting up worker auth
|
|
21
|
+
|
|
22
|
+
### Configure an auth provider on the server
|
|
23
|
+
|
|
24
|
+
Use any Mastra auth provider. `SimpleAuth` works well for worker tokens:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { Mastra } from '@mastra/core/mastra'
|
|
28
|
+
import { SimpleAuth } from '@mastra/core/server'
|
|
29
|
+
|
|
30
|
+
export const mastra = new Mastra({
|
|
31
|
+
server: {
|
|
32
|
+
auth: new SimpleAuth({
|
|
33
|
+
tokens: {
|
|
34
|
+
[process.env.WORKER_TOKEN!]: {
|
|
35
|
+
id: 'worker',
|
|
36
|
+
name: 'Orchestration Worker',
|
|
37
|
+
role: 'worker',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
// ... storage, pubsub, etc.
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Set the worker token
|
|
47
|
+
|
|
48
|
+
On each worker container, set `MASTRA_WORKER_AUTH_TOKEN` to a token that the server's auth provider recognizes:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
services:
|
|
52
|
+
api:
|
|
53
|
+
environment:
|
|
54
|
+
WORKER_TOKEN: ${WORKER_TOKEN}
|
|
55
|
+
# ... other env vars
|
|
56
|
+
|
|
57
|
+
orchestration-worker:
|
|
58
|
+
environment:
|
|
59
|
+
MASTRA_WORKER_AUTH_TOKEN: ${WORKER_TOKEN}
|
|
60
|
+
MASTRA_STEP_EXECUTION_URL: http://api:4111/api
|
|
61
|
+
# ... other env vars
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
WORKER_TOKEN=sk-worker-secret-token
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The orchestration worker reads `MASTRA_WORKER_AUTH_TOKEN` and sends it as a `Bearer` token in the `Authorization` header on every step execution request.
|
|
69
|
+
|
|
70
|
+
## Auth credential types
|
|
71
|
+
|
|
72
|
+
The `HttpRemoteStrategy` supports three credential formats. The default (`bearer`) covers most setups.
|
|
73
|
+
|
|
74
|
+
### Bearer token
|
|
75
|
+
|
|
76
|
+
Set `MASTRA_WORKER_AUTH_TOKEN` and the strategy sends `Authorization: Bearer <token>`:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
MASTRA_WORKER_AUTH_TOKEN=sk-worker-secret-token
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### API key header
|
|
83
|
+
|
|
84
|
+
Send the credential as `x-worker-api-key` instead of `Authorization`:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { HttpRemoteStrategy } from '@mastra/core/worker'
|
|
88
|
+
|
|
89
|
+
const strategy = new HttpRemoteStrategy({
|
|
90
|
+
serverUrl: 'http://api:4111/api',
|
|
91
|
+
auth: { type: 'api-key', key: process.env.WORKER_API_KEY! },
|
|
92
|
+
})
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Your server's auth provider must read the `x-worker-api-key` header to validate this credential.
|
|
96
|
+
|
|
97
|
+
### Custom header
|
|
98
|
+
|
|
99
|
+
Use any header name and value:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { HttpRemoteStrategy } from '@mastra/core/worker'
|
|
103
|
+
|
|
104
|
+
const strategy = new HttpRemoteStrategy({
|
|
105
|
+
serverUrl: 'http://api:4111/api',
|
|
106
|
+
auth: {
|
|
107
|
+
type: 'header',
|
|
108
|
+
name: 'X-Internal-Service-Key',
|
|
109
|
+
value: process.env.INTERNAL_KEY!,
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Push-mode broker authentication
|
|
115
|
+
|
|
116
|
+
When using a push-mode PubSub (like Google Cloud Pub/Sub), the broker POSTs events directly to the `/api/workflows/events` endpoint. The broker attaches its own credentials. For example, Google Cloud Pub/Sub sends a Google-signed OIDC token.
|
|
117
|
+
|
|
118
|
+
Your auth provider's `authenticateToken` callback must recognize whatever credential the broker sends. See your broker's documentation for the authentication scheme it uses.
|
|
119
|
+
|
|
120
|
+
## Security recommendations
|
|
121
|
+
|
|
122
|
+
- **Use different tokens for different worker types.** This lets you revoke access to one worker without affecting others.
|
|
123
|
+
- **Rotate tokens on a schedule.** Update the `WORKER_TOKEN` environment variable and restart the affected containers.
|
|
124
|
+
- **Use TLS in production.** Worker-to-API communication should go over HTTPS to protect tokens in transit. Within a private network (Docker bridge, Kubernetes cluster), plain HTTP is acceptable.
|
|
125
|
+
- **Restrict network access.** The step execution and event endpoints are internal. If possible, keep them off the public internet using network policies or firewall rules.
|
|
126
|
+
|
|
127
|
+
## Related
|
|
128
|
+
|
|
129
|
+
- [Auth overview](https://mastra.ai/docs/server/auth): Available auth providers and how they work
|
|
130
|
+
- [Token-based auth](https://mastra.ai/docs/server/auth/simple-auth): Token-to-user mapping authentication
|
|
131
|
+
- [Worker deployment](https://mastra.ai/guides/deployment/mastra-workers): Set up split worker processes
|
|
132
|
+
- [Workers reference](https://mastra.ai/reference/workers/overview): Configuration details for all worker types
|
|
133
|
+
- [CLI reference](https://mastra.ai/reference/cli/mastra): `mastra worker build` and `mastra worker start`
|
|
@@ -42,7 +42,7 @@ You must implement these six abstract methods. Each handles a specific part of t
|
|
|
42
42
|
|
|
43
43
|
### `registerContextMiddleware()`
|
|
44
44
|
|
|
45
|
-
This method runs first and attaches Mastra context to every incoming request. Route handlers need access to the Mastra instance, tools, and other context to function. How you attach this context depends on your framework
|
|
45
|
+
This method runs first and attaches Mastra context to every incoming request. Route handlers need access to the Mastra instance, tools, and other context to function. How you attach this context depends on your framework, Express uses `res.locals`, Hono uses `c.set()`, and other frameworks have their own patterns.
|
|
46
46
|
|
|
47
47
|
```typescript
|
|
48
48
|
registerContextMiddleware(): void {
|
|
@@ -152,7 +152,7 @@ async registerRoute(
|
|
|
152
152
|
|
|
153
153
|
### `getParams()`
|
|
154
154
|
|
|
155
|
-
Extract URL parameters, query parameters, and request body from the incoming request. Different frameworks expose these values in different ways
|
|
155
|
+
Extract URL parameters, query parameters, and request body from the incoming request. Different frameworks expose these values in different ways, Express uses `req.params`, `req.query`, and `req.body`, while other frameworks may use different property names or require method calls. This method normalizes the extraction for your framework.
|
|
156
156
|
|
|
157
157
|
```typescript
|
|
158
158
|
async getParams(
|
|
@@ -294,7 +294,7 @@ See [Server Adapters](https://mastra.ai/docs/server/server-adapters) for full do
|
|
|
294
294
|
|
|
295
295
|
## Full example
|
|
296
296
|
|
|
297
|
-
Here's a skeleton implementation showing all the required methods. This uses pseudocode for framework-specific parts
|
|
297
|
+
Here's a skeleton implementation showing all the required methods. This uses pseudocode for framework-specific parts, replace with your framework's actual APIs:
|
|
298
298
|
|
|
299
299
|
```typescript
|
|
300
300
|
import { MastraServer, ServerRoute } from '@mastra/server/server-adapter'
|
|
@@ -369,7 +369,7 @@ await server.init()
|
|
|
369
369
|
app.listen(4111)
|
|
370
370
|
```
|
|
371
371
|
|
|
372
|
-
> **Tip:** The existing [@mastra/hono](https://github.com/mastra-ai/mastra/blob/main/server-adapters/hono/src/index.ts) and [@mastra/express](https://github.com/mastra-ai/mastra/blob/main/server-adapters/express/src/index.ts) implementations are good references when building your custom adapter. They show how to handle framework-specific patterns for context storage
|
|
372
|
+
> **Tip:** The existing [@mastra/hono](https://github.com/mastra-ai/mastra/blob/main/server-adapters/hono/src/index.ts) and [@mastra/express](https://github.com/mastra-ai/mastra/blob/main/server-adapters/express/src/index.ts) implementations are good references when building your custom adapter. They show how to handle framework-specific patterns for context storage and middleware registration, plus response handling.
|
|
373
373
|
>
|
|
374
374
|
> If you want to use [Studio](https://mastra.ai/docs/studio/overview) with your server adapter, use [`mastra studio`](https://mastra.ai/reference/cli/mastra) to only launch the Studio UI.
|
|
375
375
|
|
|
@@ -138,7 +138,7 @@ Visit [MastraClient](https://mastra.ai/reference/client-js/mastra-client) for mo
|
|
|
138
138
|
|
|
139
139
|
## Credentials and session cookies
|
|
140
140
|
|
|
141
|
-
**Authenticate Mastra API calls with session cookies** when your UI and Mastra API aren't on the same origin
|
|
141
|
+
**Authenticate Mastra API calls with session cookies** when your UI and Mastra API aren't on the same origin, different host, subdomain, or port (for example Mastra Studio on one port and a custom server on another). Add **`credentials: 'include'`** to `MastraClient` so each request carries the cookies the user already has after sign-in. Skip this and you will often get **`401`** responses from Mastra even though login succeeded in the browser.
|
|
142
142
|
|
|
143
143
|
```typescript
|
|
144
144
|
import { MastraClient } from '@mastra/client-js'
|
|
@@ -149,7 +149,7 @@ export const mastraClient = new MastraClient({
|
|
|
149
149
|
})
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
**Allow credentialed cross-origin requests on your server
|
|
152
|
+
**Allow credentialed cross-origin requests on your server**, see [CORS: requests with credentials](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS#requests_with_credentials). You need a concrete `Access-Control-Allow-Origin` (not `*`) and `Access-Control-Allow-Credentials: true`, or the browser will block the call before it reaches Mastra.
|
|
153
153
|
|
|
154
154
|
**Using `@mastra/react`?** Wrap your app with `MastraReactProvider`, set `baseUrl` and `apiPrefix` to match your server, and rely on the default `credentials: 'include'`. Change `credentials` only when you want `same-origin` or `omit` behavior.
|
|
155
155
|
|
|
@@ -237,7 +237,7 @@ export const colorAgent = new Agent({
|
|
|
237
237
|
instructions: `You are a helpful CSS assistant.
|
|
238
238
|
You can change the background color of web pages.
|
|
239
239
|
Respond with a hex reference for the color requested by the user`,
|
|
240
|
-
model: 'openai/gpt-5.
|
|
240
|
+
model: 'openai/gpt-5.6-sol',
|
|
241
241
|
})
|
|
242
242
|
```
|
|
243
243
|
|
|
@@ -14,7 +14,7 @@ Mastra runs as an HTTP server that exposes your agents, workflows, and other fun
|
|
|
14
14
|
- **[Server Adapters](https://mastra.ai/docs/server/server-adapters)**: Run Mastra with Express, Hono, or your own HTTP server instead of the generated server.
|
|
15
15
|
- **[Custom Adapters](https://mastra.ai/docs/server/custom-adapters)**: Build adapters for frameworks not officially supported.
|
|
16
16
|
- **[Mastra Client SDK](https://mastra.ai/docs/server/mastra-client)**: Type-safe client for calling agents, workflows, and tools from browser or server environments.
|
|
17
|
-
- **[A2A](https://mastra.ai/docs/agents/a2a)**: Expose agents through A2A agent cards
|
|
17
|
+
- **[A2A](https://mastra.ai/docs/agents/a2a)**: Expose agents through A2A agent cards and task streams, plus push notifications.
|
|
18
18
|
- **[Authentication](https://mastra.ai/docs/server/auth)**: Secure endpoints with JWT, Clerk, Supabase, Firebase, Auth0, or WorkOS.
|
|
19
19
|
|
|
20
20
|
## Configuration
|
|
@@ -47,7 +47,7 @@ The server provides:
|
|
|
47
47
|
- API endpoints for all registered agents and workflows
|
|
48
48
|
- Custom API routes and middleware
|
|
49
49
|
- Authentication across providers
|
|
50
|
-
- Request context for
|
|
50
|
+
- Request context for runtime configuration
|
|
51
51
|
- Stream data redaction for secure responses
|
|
52
52
|
|
|
53
53
|
## REST API
|
|
@@ -56,7 +56,7 @@ registerApiRoute('/my-custom-route', {
|
|
|
56
56
|
|
|
57
57
|
### Using `RequestContext`
|
|
58
58
|
|
|
59
|
-
You can populate `RequestContext`
|
|
59
|
+
You can populate `RequestContext` in a runtime server middleware by extracting information from the request. In this example, the `temperature-unit` is set based on the Cloudflare `CF-IPCountry` header to ensure responses match the user's locale.
|
|
60
60
|
|
|
61
61
|
```typescript
|
|
62
62
|
import { Mastra } from '@mastra/core'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# PubSub
|
|
4
4
|
|
|
5
|
-
Mastra uses a publish/subscribe (pub/sub) system as its internal event bus. Components publish events to
|
|
5
|
+
Mastra uses a publish/subscribe (pub/sub) system as its internal event bus. Components publish events to topics, and other components subscribe to those topics to react. The backend you configure decides how far those events travel: within one process or across processes on one host, or alternatively across separate instances.
|
|
6
6
|
|
|
7
7
|
You set the backend once on the `Mastra` instance, and the rest of the system uses it without changes. By default, Mastra uses an in-process backend that needs no setup.
|
|
8
8
|
|
|
@@ -25,7 +25,7 @@ Backends deliver events in one of two modes, defined by the [`PubSub`](https://m
|
|
|
25
25
|
- **Pull**: Consumers read from the backend on their own, which Mastra does with a long-lived worker loop. Distributed backends such as [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) use this mode.
|
|
26
26
|
- **Push**: Events arrive without the consumer asking, either in process or over HTTP. The default [`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter) delivers this way in process.
|
|
27
27
|
|
|
28
|
-
Subscribers can also
|
|
28
|
+
Subscribers can also distribute work through consumer groups. Members of the same group split the events so each event is handled once. A subscriber without a group receives every event, which fans the stream out to all ungrouped subscribers.
|
|
29
29
|
|
|
30
30
|
## Default backend
|
|
31
31
|
|
|
@@ -68,7 +68,9 @@ export const mastra = new Mastra({
|
|
|
68
68
|
|
|
69
69
|
### Distributed deployments
|
|
70
70
|
|
|
71
|
-
Use a distributed backend when you run more than one instance or host, so every instance receives the same events. This matters whenever a request handled by one instance must reach work running on another.
|
|
71
|
+
Use a distributed backend when you run more than one instance or host, so every instance receives the same events. This matters whenever a request handled by one instance must reach work running on another.
|
|
72
|
+
|
|
73
|
+
For example, sending a signal to an agent run requires the signal event to cross the process boundary to the instance that owns the run. With the in-process default, that instance never receives the event.
|
|
72
74
|
|
|
73
75
|
Both backends below deliver across processes and hosts and persist events for redelivery.
|
|
74
76
|
|
|
@@ -123,4 +125,5 @@ Visit the [PubSub reference](https://mastra.ai/reference/pubsub/base) for the fu
|
|
|
123
125
|
- [PubSub reference](https://mastra.ai/reference/pubsub/base)
|
|
124
126
|
- [Mastra class](https://mastra.ai/reference/core/mastra-class)
|
|
125
127
|
- [Background task streaming](https://mastra.ai/docs/long-running-agents/background-tasks)
|
|
126
|
-
- [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows)
|
|
128
|
+
- [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows)
|
|
129
|
+
- [Workers](https://mastra.ai/docs/deployment/workers): Run workflow orchestration and background tasks in dedicated processes using PubSub
|
|
@@ -6,7 +6,7 @@ Agents, tools, and workflows can all accept `RequestContext` as a parameter, mak
|
|
|
6
6
|
|
|
7
7
|
## When to use `RequestContext`
|
|
8
8
|
|
|
9
|
-
Use `RequestContext` when a primitive's behavior should change based on runtime conditions. For example
|
|
9
|
+
Use `RequestContext` when a primitive's behavior should change based on runtime conditions. For example or you might switch models or storage backends based on user attributes, or alternatively adjust instructions and tool selection based on language.
|
|
10
10
|
|
|
11
11
|
> **Note:** `RequestContext` is primarily used for passing data into specific requests. It's distinct from agent memory, which handles conversation history and state persistence across multiple calls.
|
|
12
12
|
|
|
@@ -58,7 +58,7 @@ await weatherTool.execute({ location: 'London' }, { requestContext })
|
|
|
58
58
|
|
|
59
59
|
### Setting values based on request headers
|
|
60
60
|
|
|
61
|
-
You can populate `requestContext`
|
|
61
|
+
You can populate `requestContext` in a runtime server middleware by extracting information from the request. In this example, the `temperature-unit` is set based on the Cloudflare `CF-IPCountry` header to ensure responses match the user's locale.
|
|
62
62
|
|
|
63
63
|
```typescript
|
|
64
64
|
import { Mastra } from '@mastra/core'
|
|
@@ -86,7 +86,7 @@ Visit [Middleware](https://mastra.ai/docs/server/middleware) for how to use serv
|
|
|
86
86
|
|
|
87
87
|
## Studio
|
|
88
88
|
|
|
89
|
-
When developing locally, you can define
|
|
89
|
+
When developing locally, you can define presets in a JSON file and load them into [Studio](https://mastra.ai/docs/studio/overview) with the [`--request-context-presets`](https://mastra.ai/reference/cli/mastra) CLI flag. This adds a dropdown to the request context editor in Studio so you can quickly switch between configurations without manually editing JSON each time.
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
92
|
mastra dev --request-context-presets ./presets.json
|
|
@@ -129,7 +129,7 @@ You can also use `requestContext` with other options like `agents`, `workflows`,
|
|
|
129
129
|
|
|
130
130
|
### Dynamic instructions
|
|
131
131
|
|
|
132
|
-
Agent instructions can be provided as an async function, enabling you to resolve prompts
|
|
132
|
+
Agent instructions can be provided as an async function, enabling you to resolve prompts at runtime. Combined with `requestContext`, this enables patterns like:
|
|
133
133
|
|
|
134
134
|
- **Personalization**: Tailor instructions based on user attributes, preferences, or tier
|
|
135
135
|
- **Localization**: Adjust tone, language, or behavior based on locale
|
|
@@ -157,13 +157,13 @@ export const dynamicAgent = new Agent({
|
|
|
157
157
|
|
|
158
158
|
return `${basePrompt} ${localeInstructions}`.trim()
|
|
159
159
|
},
|
|
160
|
-
model: 'openai/gpt-5.
|
|
160
|
+
model: 'openai/gpt-5.6-sol',
|
|
161
161
|
})
|
|
162
162
|
```
|
|
163
163
|
|
|
164
164
|
#### Fetching from a prompt registry
|
|
165
165
|
|
|
166
|
-
If your organization uses a prompt registry service for central prompt management, you can fetch instructions at runtime.
|
|
166
|
+
If your organization uses a prompt registry service for central prompt management, you can fetch instructions at runtime. You can update prompts without redeploying and run experiments with variants, plus track prompt usage across your agents.
|
|
167
167
|
|
|
168
168
|
```typescript
|
|
169
169
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -184,7 +184,7 @@ export const registryAgent = new Agent({
|
|
|
184
184
|
|
|
185
185
|
return prompt.content
|
|
186
186
|
},
|
|
187
|
-
model: 'openai/gpt-5.
|
|
187
|
+
model: 'openai/gpt-5.6-sol',
|
|
188
188
|
})
|
|
189
189
|
```
|
|
190
190
|
|
|
@@ -247,7 +247,7 @@ auth: {
|
|
|
247
247
|
}
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
When the resource ID is derived this way, clients can omit `memory.resource` from agent generate and stream request bodies
|
|
250
|
+
When the resource ID is derived this way, clients can omit `memory.resource` from agent generate and stream request bodies, the server-derived value is used instead (and always takes precedence over any client-provided value). If a request uses memory and neither the body nor the request context provides a resource ID, the server responds with a 400 error.
|
|
251
251
|
|
|
252
252
|
You can also set these keys manually in middleware:
|
|
253
253
|
|
|
@@ -312,7 +312,7 @@ for (const [key, value] of ctx.entries()) {
|
|
|
312
312
|
|
|
313
313
|
## Schema validation
|
|
314
314
|
|
|
315
|
-
Use `requestContextSchema` to define a [Standard JSON Schema](https://standardschema.dev/json-schema) ([Zod](https://zod.dev/), [Valibot](https://valibot.dev/), [ArkType](https://arktype.io/), etc.) that validates request context values at runtime. This catches missing or invalid context values early
|
|
315
|
+
Use `requestContextSchema` to define a [Standard JSON Schema](https://standardschema.dev/json-schema) ([Zod](https://zod.dev/), [Valibot](https://valibot.dev/), [ArkType](https://arktype.io/), etc.) that validates request context values at runtime. This catches missing or invalid context values early and provides clear error messages, plus gives you type inference within your component.
|
|
316
316
|
|
|
317
317
|
### Agent schema validation
|
|
318
318
|
|
|
@@ -340,7 +340,7 @@ export const validatedAgent = new Agent({
|
|
|
340
340
|
|
|
341
341
|
return `You are helping user ${userId}`
|
|
342
342
|
},
|
|
343
|
-
model: 'openai/gpt-5.
|
|
343
|
+
model: 'openai/gpt-5.6-sol',
|
|
344
344
|
})
|
|
345
345
|
```
|
|
346
346
|
|
|
@@ -453,7 +453,7 @@ Steps can also define their own `requestContextSchema` for step-level validation
|
|
|
453
453
|
|
|
454
454
|
### Best practices
|
|
455
455
|
|
|
456
|
-
**Match your middleware**: Define the same required fields in your schema that your middleware sets.
|
|
456
|
+
**Match your middleware**: Define the same required fields in your schema that your middleware sets. As a result, the contract between middleware and components is explicit and validated.
|
|
457
457
|
|
|
458
458
|
```typescript
|
|
459
459
|
// Middleware sets these fields
|
|
@@ -10,7 +10,7 @@ Server adapters let you run Mastra with your own HTTP server instead of the Hono
|
|
|
10
10
|
- You need direct access to the server instance for custom configuration
|
|
11
11
|
- Your team prefers using another server framework instead of the Hono server created by `mastra build`.
|
|
12
12
|
|
|
13
|
-
> **Tip:** For deployments without custom server requirements, use `mastra build` instead. It configures server setup
|
|
13
|
+
> **Tip:** For deployments without custom server requirements, use `mastra build` instead. It configures server setup and registers middleware, plus applies deployment settings based on your project configuration. See [Server Configuration](https://mastra.ai/docs/server/mastra-server).
|
|
14
14
|
>
|
|
15
15
|
> If you want to use [Studio](https://mastra.ai/docs/studio/overview) with your server adapter, use [`mastra studio`](https://mastra.ai/reference/cli/mastra) to only launch the Studio UI.
|
|
16
16
|
|
|
@@ -517,7 +517,7 @@ See [MastraServer](https://mastra.ai/reference/server/mastra-server) for full co
|
|
|
517
517
|
|
|
518
518
|
## Per-route auth overrides
|
|
519
519
|
|
|
520
|
-
When authentication is configured on your Mastra instance, all routes require authentication by default. Sometimes you need exceptions: public health check endpoints
|
|
520
|
+
When authentication is configured on your Mastra instance, all routes require authentication by default. Sometimes you need exceptions: public health check endpoints or webhook receivers, or alternatively admin routes that need stricter controls.
|
|
521
521
|
|
|
522
522
|
Use `customRouteAuthConfig` to override authentication behavior for specific routes. Keys follow the format `METHOD:PATH` where method is `GET`, `POST`, `PUT`, `DELETE`, or `ALL`. Paths support wildcards (`*`) for matching multiple routes. Setting a value to `false` makes the route public, while `true` requires authentication.
|
|
523
523
|
|
|
@@ -14,7 +14,7 @@ Storage powers:
|
|
|
14
14
|
|
|
15
15
|
## When to configure storage
|
|
16
16
|
|
|
17
|
-
Configure a persistent storage adapter when state must survive restarts
|
|
17
|
+
Configure a persistent storage adapter when state must survive restarts or be shared across processes. Persistent storage also keeps state visible in Studio across sessions. The default in-memory store is useful for tests and short local experiments, but it loses data when the process exits.
|
|
18
18
|
|
|
19
19
|
Use storage when your application needs any of these behaviors:
|
|
20
20
|
|
|
@@ -144,7 +144,7 @@ export const supportAgent = new Agent({
|
|
|
144
144
|
id: 'support-agent',
|
|
145
145
|
name: 'Support agent',
|
|
146
146
|
instructions: 'Answer customer support questions.',
|
|
147
|
-
model: 'openai/gpt-5.
|
|
147
|
+
model: 'openai/gpt-5.6-sol',
|
|
148
148
|
memory: new Memory({
|
|
149
149
|
storage: new PostgresStore({
|
|
150
150
|
id: 'support-agent-storage',
|
|
@@ -9,7 +9,7 @@ Without authentication, Studio and all API routes are publicly accessible.
|
|
|
9
9
|
## When to use Studio Auth
|
|
10
10
|
|
|
11
11
|
- Multiple team members need to interact with agents, workflows, and tools through a shared Studio deployment.
|
|
12
|
-
- Permissions must restrict who can execute agents
|
|
12
|
+
- Permissions must restrict who can execute agents or edit workflows, or alternatively delete datasets.
|
|
13
13
|
- A login screen (SSO, email/password, or both) should gate access to your Studio deployment.
|
|
14
14
|
|
|
15
15
|
## Quickstart
|
|
@@ -64,7 +64,7 @@ Studio handles the token as follows:
|
|
|
64
64
|
- It removes `auth_header` from the address bar while preserving other query parameters and the hash.
|
|
65
65
|
- It keeps the token in memory only and never writes it to local storage, so the token stays transient and doesn't persist across page reloads.
|
|
66
66
|
|
|
67
|
-
The token rides in a URL parameter, so the host application is responsible for how that URL is generated and transmitted. URL parameters can be exposed through browser history
|
|
67
|
+
The token rides in a URL parameter, so the host application is responsible for how that URL is generated and transmitted. URL parameters can be exposed through browser history and referrer headers, plus server access logs.
|
|
68
68
|
|
|
69
69
|
## Role-based access control
|
|
70
70
|
|
|
@@ -72,7 +72,7 @@ RBAC lets you control what each user can see and do inside Studio. It's separate
|
|
|
72
72
|
|
|
73
73
|
### Default roles
|
|
74
74
|
|
|
75
|
-
Mastra
|
|
75
|
+
Mastra includes four default roles. Import them from `@mastra/core/auth/ee`:
|
|
76
76
|
|
|
77
77
|
| Role | Permissions |
|
|
78
78
|
| -------- | ------------------------ |
|
|
@@ -106,7 +106,7 @@ export const mastra = new Mastra({
|
|
|
106
106
|
})
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
When RBAC is active, Studio hides actions the user doesn't have permission for. A viewer doesn't see delete buttons
|
|
109
|
+
When RBAC is active, Studio hides actions the user doesn't have permission for. A viewer doesn't see delete buttons. A member can't modify agent configurations.
|
|
110
110
|
|
|
111
111
|
### Permission format
|
|
112
112
|
|
|
@@ -153,7 +153,7 @@ Sign-up can be enabled or disabled per provider. When disabled, Studio hides the
|
|
|
153
153
|
|
|
154
154
|
## EE licensing
|
|
155
155
|
|
|
156
|
-
Studio Auth features (SSO login, RBAC, permission-based UI) are part of the Mastra Enterprise Edition.
|
|
156
|
+
Studio Auth features (SSO login, RBAC, permission-based UI) are part of the Mastra Enterprise Edition. A license is optional when using Simple Auth or running locally. Production deployments with third-party providers require a valid EE license from [Mastra sales](https://mastra.ai/contact).
|
|
157
157
|
|
|
158
158
|
## Related
|
|
159
159
|
|
|
@@ -99,7 +99,7 @@ Some of the [Cloud providers](https://mastra.ai/docs/deployment/cloud-providers)
|
|
|
99
99
|
|
|
100
100
|
### Manual
|
|
101
101
|
|
|
102
|
-
You can't directly deploy the built Studio assets to a CDN, as the UI relies on some
|
|
102
|
+
You can't directly deploy the built Studio assets to a CDN, as the UI relies on some runtime configuration. With a bit of extra setup, you can create a standalone SPA out of the built assets and deploy it to any static hosting service.
|
|
103
103
|
|
|
104
104
|
Follow the example below to create a SPA using Vite.
|
|
105
105
|
|
|
@@ -98,11 +98,11 @@ When you run an agent or workflow, the Observability tab displays traces that hi
|
|
|
98
98
|
|
|
99
99
|
Tracing filters out low-level framework details so your traces stay focused and readable. Visit the [tracing overview](https://mastra.ai/docs/observability/tracing/overview) for more details.
|
|
100
100
|
|
|
101
|
-
To export a trace, select **Download trace JSON** in the trace panel header. This saves the entire trace as a `trace-<id>.json` file, with every span and its full input, output, metadata, and attributes. Use it to share a trace
|
|
101
|
+
To export a trace, select **Download trace JSON** in the trace panel header. This saves the entire trace as a `trace-<id>.json` file, with every span and its full input, output, metadata, and attributes. Use it to share a trace or attach it to a bug report, or alternatively build an evaluation dataset offline.
|
|
102
102
|
|
|
103
103
|
## Logs
|
|
104
104
|
|
|
105
|
-
Browse internal Mastra logs forwarded to your observability storage. Logs provide full-text search (across message content, entity names, and trace IDs), date presets (last 24 hours to 30 days), and multi-select filters for level, entity type, and entity name. Selecting a log opens a detail panel showing the full message, structured data, and metadata. If the log is correlated with a trace, you can
|
|
105
|
+
Browse internal Mastra logs forwarded to your observability storage. Logs provide full-text search (across message content, entity names, and trace IDs), date presets (last 24 hours to 30 days), and multi-select filters for level, entity type, and entity name. Selecting a log opens a detail panel showing the full message, structured data, and metadata. If the log is correlated with a trace, you can move through directly to the trace and span timeline.
|
|
106
106
|
|
|
107
107
|
Log forwarding is enabled by default when you configure observability. See [logging](https://mastra.ai/docs/observability/logging) for level configuration, query examples, and customization details.
|
|
108
108
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Studio
|
|
4
4
|
|
|
5
|
-
Studio provides an interactive UI for building, testing, and managing your agents, workflows, and tools. Run it locally during development, add [authentication](https://mastra.ai/docs/studio/auth), or [deploy it](https://mastra.ai/docs/studio/deployment) to production so your team can manage agents
|
|
5
|
+
Studio provides an interactive UI for building, testing, and managing your agents, workflows, and tools. Run it locally during development, add [authentication](https://mastra.ai/docs/studio/auth), or [deploy it](https://mastra.ai/docs/studio/deployment) to production so your team can manage agents and monitor performance, plus gain insights through built-in observability.
|
|
6
6
|
|
|
7
7
|
> **📹 Watch:** Watch [Mastra Studio overview](https://youtu.be/ojGu6Bi4wYk) for a short walkthrough of building, testing, and managing agents in Studio.
|
|
8
8
|
|
|
@@ -49,23 +49,25 @@ When you're ready to share Studio with your team, you can deploy it to productio
|
|
|
49
49
|
|
|
50
50
|
### Agents
|
|
51
51
|
|
|
52
|
-
Chat with your agent directly,
|
|
52
|
+
Chat with your agent directly, switch [models](https://mastra.ai/models), and tweak settings like temperature and top-p to understand how they affect the output.
|
|
53
53
|
|
|
54
|
-
When you interact with your agent, you can follow
|
|
54
|
+
When you interact with your agent, you can follow its reasoning and view tool call outputs. You can also [observe](#observability) traces and logs to see how responses are generated.
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
You can also attach [scorers](#scorers) to measure and compare response quality over time.
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
You can send a follow-up message in the same thread during an agent response stream. Studio shows the message as pending until the stream confirms it, then continues the response below that follow-up. Other Studio tabs that have the same thread open can observe the active stream.
|
|
59
|
+
|
|
60
|
+
Use [Editor](https://mastra.ai/docs/editor/overview) to let non-technical team members iterate on agents and version every change, plus run experiments without redeploying.
|
|
59
61
|
|
|
60
62
|
### Workflows
|
|
61
63
|
|
|
62
64
|
Visualize your workflow as a graph and run it step by step with a custom input. During execution, the interface updates in real time to show the active step and the path taken.
|
|
63
65
|
|
|
64
|
-
When running a workflow, you can also view detailed traces showing tool calls
|
|
66
|
+
When running a workflow, you can also view detailed traces showing tool calls and raw JSON outputs, plus any errors that might have occurred along the way.
|
|
65
67
|
|
|
66
68
|
### Processors
|
|
67
69
|
|
|
68
|
-
View the input and output processors attached to each agent. The agent detail panel lists every processor by name and type, so you can verify your guardrails
|
|
70
|
+
View the input and output processors attached to each agent. The agent detail panel lists every processor by name and type, so you can verify your guardrails and token limiters, plus custom processors are wired up correctly before testing.
|
|
69
71
|
|
|
70
72
|
See [processors](https://mastra.ai/docs/agents/processors) and [guardrails](https://mastra.ai/docs/agents/guardrails) for configuration details.
|
|
71
73
|
|
|
@@ -95,11 +97,11 @@ Use the date filter to limit score metrics to a preset or custom time range.
|
|
|
95
97
|
|
|
96
98
|
### Scorers
|
|
97
99
|
|
|
98
|
-
The Scorers tab displays the results of your agent's scorers as they run. When messages pass through your agent, the defined scorers evaluate each output asynchronously and render their results here.
|
|
100
|
+
The Scorers tab displays the results of your agent's scorers as they run. When messages pass through your agent, the defined scorers evaluate each output asynchronously and render their results here. You can understand how your scorers respond to different interactions and compare performance across test cases, plus identify areas for improvement.
|
|
99
101
|
|
|
100
102
|
### Datasets
|
|
101
103
|
|
|
102
|
-
Create and manage collections of test cases to evaluate your agents and workflows. Import items from CSV or JSON
|
|
104
|
+
Create and manage collections of test cases to evaluate your agents and workflows. Import items from CSV or JSON and define input and ground-truth schemas, plus pin to specific versions so you can reproduce experiments exactly. Run experiments with [scorers](https://mastra.ai/docs/evals/overview) to compare quality across prompts, models, or code changes.
|
|
103
105
|
|
|
104
106
|
See [datasets overview](https://mastra.ai/docs/evals/datasets/overview) for the full API and versioning details.
|
|
105
107
|
|