@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Control flow
|
|
4
4
|
|
|
5
|
-
Workflows run a sequence of predefined tasks, and you can control how that flow is executed. Tasks are divided into **steps**, which can be executed in different ways depending on your requirements. They can run sequentially
|
|
5
|
+
Workflows run a sequence of predefined tasks, and you can control how that flow is executed. Tasks are divided into **steps**, which can be executed in different ways depending on your requirements. They can run sequentially or in parallel, or alternatively follow different paths based on conditions.
|
|
6
6
|
|
|
7
7
|
Each step connects to the next in the workflow through defined schemas that keep data controlled and consistent.
|
|
8
8
|
|
|
@@ -53,7 +53,7 @@ export const testWorkflow = createWorkflow({
|
|
|
53
53
|
|
|
54
54
|
## Simultaneous steps with `.parallel()`
|
|
55
55
|
|
|
56
|
-
Use `.parallel()` to run steps
|
|
56
|
+
Use `.parallel()` to run steps simultaneously. All parallel steps must complete before the workflow continues to the next step. Each step's `id` is used when defining a following step's `inputSchema` and becomes the key on the `inputData` object used to access the previous step's values. The outputs of parallel steps can then be referenced or combined by a following step.
|
|
57
57
|
|
|
58
58
|

|
|
59
59
|
|
|
@@ -103,7 +103,7 @@ export const testWorkflow = createWorkflow({
|
|
|
103
103
|
|
|
104
104
|
### Output structure
|
|
105
105
|
|
|
106
|
-
When steps run in parallel, the output is an object where each key is the step's `id` and the value is that step's output.
|
|
106
|
+
When steps run in parallel, the output is an object where each key is the step's `id` and the value is that step's output. You can access each parallel step's result independently.
|
|
107
107
|
|
|
108
108
|
```typescript
|
|
109
109
|
const step1 = createStep({
|
|
@@ -168,7 +168,7 @@ export const testWorkflow = createWorkflow({
|
|
|
168
168
|
|
|
169
169
|
### Handling step failures
|
|
170
170
|
|
|
171
|
-
If any parallel step throws an error, the entire parallel block fails. To build resilient parallel workflows where some steps may fail
|
|
171
|
+
If any parallel step throws an error, the entire parallel block fails. To build resilient parallel workflows where some steps may fail, for example, multiple research agents where one might have an expired auth token, handle errors inside the step itself using try/catch:
|
|
172
172
|
|
|
173
173
|
```typescript
|
|
174
174
|
const resilientStep = createStep({
|
|
@@ -505,7 +505,7 @@ export const testWorkflow = createWorkflow({
|
|
|
505
505
|
|
|
506
506
|
#### Concurrency limits
|
|
507
507
|
|
|
508
|
-
Use `concurrency` to control the number of array items processed
|
|
508
|
+
Use `concurrency` to control the number of array items processed. The default is `1`, which runs steps sequentially. Increasing the value allows `.foreach()` to process multiple items simultaneously.
|
|
509
509
|
|
|
510
510
|
```typescript
|
|
511
511
|
const step1 = createStep({...})
|
|
@@ -633,7 +633,7 @@ export const multiDocWorkflow = createWorkflow({...})
|
|
|
633
633
|
.commit();
|
|
634
634
|
```
|
|
635
635
|
|
|
636
|
-
**Option 2: Use foreach for documents
|
|
636
|
+
**Option 2: Use foreach for documents and aggregate chunks, plus then foreach for embeddings**
|
|
637
637
|
|
|
638
638
|
```typescript
|
|
639
639
|
const downloadStep = createStep({
|
|
@@ -776,7 +776,7 @@ const processDocWorkflow = createWorkflow({...})
|
|
|
776
776
|
workflow.foreach(processDocWorkflow, { concurrency: 3 })
|
|
777
777
|
```
|
|
778
778
|
|
|
779
|
-
|
|
779
|
+
The single `.foreach()` keeps the result flat. Chaining `.foreach().foreach()` creates nested arrays.
|
|
780
780
|
|
|
781
781
|
**Inside `.parallel()`** - when a parallel branch needs its own multi-step pipeline:
|
|
782
782
|
|
|
@@ -837,7 +837,9 @@ workflow.foreach(fetchDataStep, { concurrency: 10 })
|
|
|
837
837
|
|
|
838
838
|
## Loop management
|
|
839
839
|
|
|
840
|
-
Loop conditions can be implemented in different ways depending on how you want the loop to end.
|
|
840
|
+
Loop conditions can be implemented in different ways depending on how you want the loop to end.
|
|
841
|
+
|
|
842
|
+
Common patterns check values returned in `inputData` and set a maximum number of iterations. They can also abort execution when a limit is reached.
|
|
841
843
|
|
|
842
844
|
### Aborting loops
|
|
843
845
|
|
|
@@ -58,7 +58,7 @@ if (result.status === 'failed') {
|
|
|
58
58
|
|
|
59
59
|
## Lifecycle callbacks
|
|
60
60
|
|
|
61
|
-
For scenarios where you need to handle workflow completion without awaiting the result
|
|
61
|
+
For scenarios where you need to handle workflow completion without awaiting the result, such as background jobs, fire-and-forget workflows, or centralized logging, you can use lifecycle callbacks.
|
|
62
62
|
|
|
63
63
|
### `onFinish`
|
|
64
64
|
|
|
@@ -168,7 +168,7 @@ const pipelineWorkflow = createWorkflow({
|
|
|
168
168
|
|
|
169
169
|
### Error handling in callbacks
|
|
170
170
|
|
|
171
|
-
Errors thrown inside callbacks are caught and logged
|
|
171
|
+
Errors thrown inside callbacks are caught and logged, they won't affect the workflow result or cause it to fail. As a result, callback issues don't break your workflows in production.
|
|
172
172
|
|
|
173
173
|
```typescript
|
|
174
174
|
options: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Workflows overview
|
|
4
4
|
|
|
5
|
-
Workflows let you define complex sequences of tasks using clear, structured steps rather than relying on the reasoning of a single agent. They give you full control over how tasks are broken down
|
|
5
|
+
Workflows let you define complex sequences of tasks using clear, structured steps rather than relying on the reasoning of a single agent. They give you full control over how tasks are broken down and how data moves between them, plus what gets executed when. Workflows run using the built-in execution engine by default, or can be deployed to [workflow runners](https://mastra.ai/docs/deployment/workflow-runners) like Inngest for managed infrastructure.
|
|
6
6
|
|
|
7
7
|
**For AI agents:** Run `npx mastra api workflow run start test-workflow '{"inputData":{"message":"Hello, world!"}}'` to start this workflow directly instead of writing a temporary script. The command requires a running Mastra server; start the local server with `npx mastra dev`, or pass the reachable server's base URL with `--url`. Run `npx mastra api workflow run start --schema` before constructing different input. Install Mastra's skill with `npx skills add mastra-ai/skills --skill mastra` for complete API CLI discovery, targeting, schema, authentication, and error-handling guidance.
|
|
8
8
|
|
|
@@ -192,7 +192,7 @@ Open [Studio](https://mastra.ai/docs/studio/overview) and select a workflow from
|
|
|
192
192
|
|
|
193
193
|
## Workflow state
|
|
194
194
|
|
|
195
|
-
Workflow state lets you share values across steps without passing them through every step's inputSchema and outputSchema. Use state for tracking progress
|
|
195
|
+
Workflow state lets you share values across steps without passing them through every step's inputSchema and outputSchema. Use state for tracking progress or accumulating results, or alternatively sharing configuration across the entire workflow.
|
|
196
196
|
|
|
197
197
|
```typescript
|
|
198
198
|
const step1 = createStep({
|
|
@@ -292,11 +292,11 @@ const testWorkflow = mastra.getWorkflow('testWorkflow')
|
|
|
292
292
|
> 1. It provides access to the Mastra instance configuration (logger, telemetry, storage, registered agents, and vector stores)
|
|
293
293
|
> 2. It provides full TypeScript type inference for workflow input and output schemas
|
|
294
294
|
>
|
|
295
|
-
>
|
|
295
|
+
> Use `getWorkflow()` with the workflow's **registration key** (the key used when adding it to Mastra). While `getWorkflowById()` is available for retrieving workflows by their `id` property, it doesn't provide the same level of type inference.
|
|
296
296
|
|
|
297
297
|
## Running workflows
|
|
298
298
|
|
|
299
|
-
Workflows can be run in two modes: start waits for all steps to complete before returning,
|
|
299
|
+
Workflows can be run in two modes: start waits for all steps to complete before returning, while stream emits events during execution. Choose the approach that fits your use case: start when you only need the final result and stream when you want to monitor progress or trigger actions as steps complete.
|
|
300
300
|
|
|
301
301
|
**.start()**:
|
|
302
302
|
|
|
@@ -411,7 +411,7 @@ For generic `writer` API usage, see [Streaming](https://mastra.ai/guides/concept
|
|
|
411
411
|
|
|
412
412
|
### Inspecting workflow stream payloads
|
|
413
413
|
|
|
414
|
-
Events written to the stream are included in the emitted chunks.
|
|
414
|
+
Events written to the stream are included in the emitted chunks. Inspect these chunks to access custom fields such as event types, intermediate values, or step-specific data.
|
|
415
415
|
|
|
416
416
|
```typescript
|
|
417
417
|
const testWorkflow = mastra.getWorkflow('testWorkflow')
|
|
@@ -478,7 +478,7 @@ export const testStep = createStep({
|
|
|
478
478
|
|
|
479
479
|
## Restarting active workflow runs
|
|
480
480
|
|
|
481
|
-
When a workflow run loses connection to the server
|
|
481
|
+
When a workflow run loses connection to the server and it can be restarted from the last active step. This is useful for long-running workflows that might still be running when the server loses connection. Restarting a workflow run will resume execution from the last active step, plus the workflow will continue from there.
|
|
482
482
|
|
|
483
483
|
### Restarting all active workflow runs of a workflow with `restartAllActiveWorkflowRuns()`
|
|
484
484
|
|
|
@@ -545,4 +545,5 @@ For a closer look at workflows, see our [Workflow Guide](https://mastra.ai/guide
|
|
|
545
545
|
- [Control Flow](https://mastra.ai/docs/workflows/control-flow)
|
|
546
546
|
- [Suspend and Resume](https://mastra.ai/docs/workflows/suspend-and-resume)
|
|
547
547
|
- [Error Handling](https://mastra.ai/docs/workflows/error-handling)
|
|
548
|
+
- [Workers](https://mastra.ai/docs/deployment/workers): Offload workflow orchestration to dedicated processes in production
|
|
548
549
|
- 📹 [Agentic workflows with Mastra workshop](https://www.youtube.com/watch?v=HGt8pVPpX9g)
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
# Scheduled workflows
|
|
4
4
|
|
|
5
|
-
Declare a `schedule` field on a workflow and Mastra will fire it on the cron you specify. The same workflow remains callable directly with `workflow.start()
|
|
5
|
+
Declare a `schedule` field on a workflow and Mastra will fire it on the cron you specify. The same workflow remains callable directly with `workflow.start()`, scheduled fires and manual runs share a single execution path.
|
|
6
6
|
|
|
7
7
|
## Quickstart
|
|
8
8
|
|
|
9
|
-
The following workflow runs every day at 9am New York time. Register it on `Mastra` as you would any other workflow
|
|
9
|
+
The following workflow runs every day at 9am New York time. Register it on `Mastra` as you would any other workflow, the scheduler picks it up automatically.
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
import { createWorkflow, createStep } from '@mastra/core/workflows'
|
|
@@ -40,7 +40,7 @@ A separate "register schedule" call won't happen. The scheduler reads `schedule`
|
|
|
40
40
|
|
|
41
41
|
## What `schedule` changes
|
|
42
42
|
|
|
43
|
-
A workflow that declares `schedule` is auto-promoted to the **evented execution engine**. The public API (`workflow.start()`, `workflow.startAsync()`, `streamLegacy()`, `resume()`) is unchanged
|
|
43
|
+
A workflow that declares `schedule` is auto-promoted to the **evented execution engine**. The public API (`workflow.start()`, `workflow.startAsync()`, `streamLegacy()`, `resume()`) is unchanged, `EventedWorkflow extends Workflow` and overrides each method with matching signatures. From your code, scheduled fires and manual runs are indistinguishable.
|
|
44
44
|
|
|
45
45
|
The promotion has one practical implication: evented runs require a storage adapter that supports concurrent updates, for example `@mastra/libsql`. If your adapter doesn't, `createRun()` throws a clear error pointing at the `schedule` field. Switch adapters or remove the schedule.
|
|
46
46
|
|
|
@@ -84,7 +84,7 @@ const statusCheck = createWorkflow({
|
|
|
84
84
|
})
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
Each entry creates an independent schedule row
|
|
87
|
+
Each entry creates an independent schedule row and fires on its own cron, plus shows up separately in the Studio Schedules view.
|
|
88
88
|
|
|
89
89
|
## Viewing schedules in Studio
|
|
90
90
|
|
|
@@ -92,11 +92,11 @@ Studio surfaces schedules as a top-level area, not as a tab inside a workflow:
|
|
|
92
92
|
|
|
93
93
|
- **All schedules**: open `/workflows/schedules` for a cross-workflow list. Each row shows the workflow id, cron, next fire, and the most recent run's status, so the list answers "is anything broken?" at a glance.
|
|
94
94
|
- **Filtered by workflow**: append `?workflowId=<id>` to scope the list to a single workflow, for example `/workflows/schedules?workflowId=daily-report`.
|
|
95
|
-
- **Schedule detail**:
|
|
95
|
+
- **Schedule detail**: Select any row to open `/workflows/schedules/:scheduleId`. The page shows schedule metadata and **Pause** / **Resume** controls, followed by the full trigger history.
|
|
96
96
|
|
|
97
97
|
A workflow's header includes a **Schedules** action when the workflow has at least one schedule:
|
|
98
98
|
|
|
99
|
-
-
|
|
99
|
+
- When one schedule matches, the action links straight to its detail page.
|
|
100
100
|
- Multiple schedules: the action links to the workflow-filtered list at `/workflows/schedules?workflowId=<id>`.
|
|
101
101
|
- No schedules: the action is hidden.
|
|
102
102
|
|
|
@@ -135,9 +135,9 @@ A few rules worth knowing:
|
|
|
135
135
|
|
|
136
136
|
- Pause is durable. The status is written to the schedules table and survives process restarts and redeploys. The declarative-config upsert never overwrites a user-set status, even when you change `cron`, `timezone`, or other fields.
|
|
137
137
|
- Resume recomputes `nextFireAt` from now. A schedule paused for a week doesn't fire seven backlogged runs the moment you resume it. It fires on the next regular cron tick.
|
|
138
|
-
-
|
|
138
|
+
- Unpause with `resumeSchedule` or the **Resume** button in Studio. Editing the workflow's `schedule` config doesn't unpause a paused row.
|
|
139
139
|
- Pause and resume are idempotent. Calling pause on an already-paused schedule is a no-op.
|
|
140
|
-
- This
|
|
140
|
+
- This operational override controls existing schedules. Author declarative schedules in code. Declarative schedules are created, deleted, and edited in code via the `schedule` field on `createWorkflow`. To create schedules imperatively at runtime instead, use the unified [`mastra.schedules`](https://mastra.ai/docs/long-running-agents/schedules) service with a `workflowId`.
|
|
141
141
|
|
|
142
142
|
The underlying HTTP routes are `POST /api/schedules/:scheduleId/pause` and `POST /api/schedules/:scheduleId/resume`. Both require the `schedules:write` permission.
|
|
143
143
|
|
|
@@ -153,15 +153,15 @@ Removing a schedule entry from a workflow's `schedule` array deletes its row on
|
|
|
153
153
|
|
|
154
154
|
## Deployment topology
|
|
155
155
|
|
|
156
|
-
The built-in scheduler
|
|
156
|
+
The built-in scheduler uses a `setInterval` tick loop to poll the schedules table and claim due rows. It dispatches workflow runs through the in-process pubsub. It assumes a long-lived host process.
|
|
157
157
|
|
|
158
158
|
### Long-lived host (recommended)
|
|
159
159
|
|
|
160
|
-
Deploy targets such as Fly Machines, Railway, Render, AWS ECS, GKE, or your own server keep the Mastra process alive between cron ticks. Schedules work without extra setup.
|
|
160
|
+
Deploy targets such as Fly Machines, Railway, Render, AWS ECS, GKE, or your own server keep the Mastra process alive between cron ticks. Schedules work without extra setup. For production deployments, you can run the scheduler as a [dedicated worker process](https://mastra.ai/docs/deployment/workers) to isolate it from the API layer.
|
|
161
161
|
|
|
162
162
|
### Serverless platforms
|
|
163
163
|
|
|
164
|
-
Functions-as-a-service platforms such as Vercel, Netlify, AWS Lambda, and Cloudflare Workers shut the process down after each request.
|
|
164
|
+
Functions-as-a-service platforms such as Vercel, Netlify, AWS Lambda, and Cloudflare Workers shut the process down after each request. Because the tick loop doesn't get a second tick, schedules declared in code don't fire on these platforms with the built-in scheduler today.
|
|
165
165
|
|
|
166
166
|
On these platforms, use [`@mastra/inngest`](#inngest-workflows) instead. Inngest is serverless-native and holds the cron state for you.
|
|
167
167
|
|
|
@@ -181,4 +181,4 @@ Manage Inngest schedules from the [Inngest dashboard](https://www.inngest.com/do
|
|
|
181
181
|
|
|
182
182
|
- [Workflow overview](https://mastra.ai/docs/workflows/overview)
|
|
183
183
|
- [Suspend and resume](https://mastra.ai/docs/workflows/suspend-and-resume)
|
|
184
|
-
- [Agent schedules](https://mastra.ai/docs/long-running-agents/schedules):
|
|
184
|
+
- [Agent schedules](https://mastra.ai/docs/long-running-agents/schedules): Run an agent rather than a workflow on a cron schedule, and manage both schedule types at runtime through `mastra.schedules`.
|
|
@@ -24,11 +24,11 @@ Snapshots are the key mechanism enabling Mastra's suspend and resume capabilitie
|
|
|
24
24
|
5. Later, when `resume()` is called on the suspended step, the snapshot is retrieved
|
|
25
25
|
6. The workflow execution resumes from exactly where it left off
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
The mechanism provides a powerful way to implement human-in-the-loop workflows, handle rate limiting, wait for external resources, and implement complex branching workflows that may need to pause for extended periods.
|
|
28
28
|
|
|
29
29
|
## Snapshot anatomy
|
|
30
30
|
|
|
31
|
-
Each snapshot includes the `runId`, input, step status (`success`, `suspended`, etc.), any suspend and resume payloads, and the final output.
|
|
31
|
+
Each snapshot includes the `runId`, input, step status (`success`, `suspended`, etc.), any suspend and resume payloads, and the final output. As a result, full context is available when resuming execution.
|
|
32
32
|
|
|
33
33
|
```json
|
|
34
34
|
{
|
|
@@ -152,7 +152,7 @@ export const mastra = new Mastra({
|
|
|
152
152
|
1. **Ensure Serializability**: Any data that needs to be included in the snapshot must be serializable (convertible to JSON).
|
|
153
153
|
2. **Minimize Snapshot Size**: Avoid storing large data objects directly in the workflow context. Instead, store references to them (like IDs) and retrieve the data when needed.
|
|
154
154
|
3. **Handle Resume Context Carefully**: When resuming a workflow, carefully consider what context to provide. This will be merged with the existing snapshot data.
|
|
155
|
-
4. **Set Up Proper Monitoring**: Implement monitoring for suspended workflows
|
|
155
|
+
4. **Set Up Proper Monitoring**: Implement monitoring for suspended workflows and especially long-running ones, plus to ensure they're properly resumed.
|
|
156
156
|
5. **Consider Storage Scaling**: For applications with many suspended workflows, ensure your storage solution is appropriately scaled.
|
|
157
157
|
|
|
158
158
|
## Custom snapshot metadata
|
|
@@ -157,7 +157,7 @@ const approvalStep = createStep({
|
|
|
157
157
|
})
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
The `suspendData` parameter is automatically populated when a step is resumed and contains the exact data that was passed to the `suspend()` function during the original suspension.
|
|
160
|
+
The `suspendData` parameter is automatically populated when a step is resumed and contains the exact data that was passed to the `suspend()` function during the original suspension. You can maintain context about why the workflow was suspended and use that information during the resume process.
|
|
161
161
|
|
|
162
162
|
## Identifying suspended executions
|
|
163
163
|
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# Time travel
|
|
4
4
|
|
|
5
|
-
Time travel allows you to re-execute a workflow starting from any specific step, using either stored snapshot data or custom context you provide.
|
|
5
|
+
Time travel allows you to re-execute a workflow starting from any specific step, using either stored snapshot data or custom context you provide.
|
|
6
|
+
|
|
7
|
+
This is useful for debugging failed workflows or testing individual steps with different inputs, or alternatively recovering from errors without re-running the entire workflow. You can also use time travel to execute a workflow that hasn't been run yet, starting from any specific step.
|
|
6
8
|
|
|
7
9
|
## How time travel works
|
|
8
10
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Workflow state
|
|
4
4
|
|
|
5
|
-
Workflow state lets you share values across steps without passing them through every step's inputSchema and outputSchema. This is useful for tracking progress
|
|
5
|
+
Workflow state lets you share values across steps without passing them through every step's inputSchema and outputSchema. This is useful for tracking progress or accumulating results, or alternatively sharing configuration across the entire workflow.
|
|
6
6
|
|
|
7
7
|
## State vs step input/output
|
|
8
8
|
|
|
@@ -26,7 +26,7 @@ Available providers:
|
|
|
26
26
|
- [`PlatformFilesystem`](https://mastra.ai/reference/workspace/platform-filesystem): Stores files in a Mastra Platform workspace bucket
|
|
27
27
|
- [`GoogleDriveFilesystem`](https://mastra.ai/reference/workspace/google-drive-filesystem): Stores files inside a Google Drive folder
|
|
28
28
|
- [`AzureBlobFilesystem`](https://mastra.ai/reference/workspace/azure-blob-filesystem): Stores files in Azure Blob Storage
|
|
29
|
-
- [`FilesSDKFilesystem`](https://mastra.ai/reference/workspace/files-sdk-filesystem): Stores files in any [FilesSDK](https://files-sdk.dev) adapter (S3, R2, GCS, Azure Blob, Vercel Blob, local filesystem, and more)
|
|
29
|
+
- [`FilesSDKFilesystem`](https://mastra.ai/reference/workspace/files-sdk-filesystem): Stores files in any [FilesSDK](https://files-sdk.dev) adapter (S3, R2, GCS, Azure Blob, Vercel Blob, local filesystem, and more): useful when you want one provider that can target multiple backends
|
|
30
30
|
- [`AgentFSFilesystem`](https://mastra.ai/reference/workspace/agentfs-filesystem): Stores files in a Turso/SQLite database via AgentFS
|
|
31
31
|
- [`MesaFilesystem`](https://mastra.ai/reference/workspace/mesa-filesystem): Stores files in versioned Mesa repos
|
|
32
32
|
- [`ArchilFilesystem`](https://mastra.ai/reference/workspace/archil-filesystem): Stores files on Archil elastic, serverless disks
|
|
@@ -49,7 +49,7 @@ const workspace = new Workspace({
|
|
|
49
49
|
|
|
50
50
|
const agent = new Agent({
|
|
51
51
|
id: 'file-agent',
|
|
52
|
-
model: 'openai/gpt-5.
|
|
52
|
+
model: 'openai/gpt-5.6-sol',
|
|
53
53
|
instructions: 'You are a helpful file management assistant.',
|
|
54
54
|
workspace,
|
|
55
55
|
})
|
|
@@ -60,12 +60,12 @@ const response = await agent.generate('List all files in the workspace')
|
|
|
60
60
|
|
|
61
61
|
## Containment
|
|
62
62
|
|
|
63
|
-
By default, `LocalFilesystem` runs in **contained mode
|
|
63
|
+
By default, `LocalFilesystem` runs in **contained mode**, all file operations are restricted to stay within `basePath`. This prevents path traversal attacks and symlink escapes.
|
|
64
64
|
|
|
65
65
|
In contained mode:
|
|
66
66
|
|
|
67
67
|
- **Relative paths** (e.g. `src/index.ts`) resolve against `basePath`
|
|
68
|
-
- **Absolute paths** (e.g. `/home/user/.config/file.txt`) are treated as real filesystem paths
|
|
68
|
+
- **Absolute paths** (e.g. `/home/user/.config/file.txt`) are treated as real filesystem paths: if they fall outside `basePath` and any `allowedPaths`, a `PermissionError` is thrown
|
|
69
69
|
- **Tilde paths** (e.g. `~/Documents`) expand to the home directory and follow the same containment rules
|
|
70
70
|
|
|
71
71
|
If your agent needs to access specific paths outside `basePath`, use `allowedPaths` to grant access without disabling containment entirely. Relative paths are resolved against `basePath`, and absolute paths are used as-is:
|
|
@@ -86,7 +86,7 @@ Allowed paths can be updated at runtime using the `setAllowedPaths()` method:
|
|
|
86
86
|
workspace.filesystem.setAllowedPaths(prev => [...prev, '/home/user/documents'])
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
This is the recommended approach for least-privilege access
|
|
89
|
+
This is the recommended approach for least-privilege access, the agent can only reach the specific directories you allow.
|
|
90
90
|
|
|
91
91
|
If your agent needs unrestricted access to the entire filesystem, disable containment:
|
|
92
92
|
|
|
@@ -121,7 +121,7 @@ const workspace = new Workspace({
|
|
|
121
121
|
|
|
122
122
|
const agent = new Agent({
|
|
123
123
|
id: 'multi-role-agent',
|
|
124
|
-
model: 'openai/gpt-5.
|
|
124
|
+
model: 'openai/gpt-5.6-sol',
|
|
125
125
|
workspace,
|
|
126
126
|
})
|
|
127
127
|
```
|
|
@@ -170,7 +170,7 @@ const workspace = new Workspace({
|
|
|
170
170
|
|
|
171
171
|
With a static filesystem, write tools (`write_file`, `edit_file`, `delete`, `mkdir`) are excluded from the agent's toolset entirely. The agent can still read and list files.
|
|
172
172
|
|
|
173
|
-
When using a [dynamic filesystem](#dynamic-filesystem), write tools are always included because `readOnly` isn't known until the resolver runs. Instead, write operations are blocked at runtime
|
|
173
|
+
When using a [dynamic filesystem](#dynamic-filesystem), write tools are always included because `readOnly` isn't known until the resolver runs. Instead, write operations are blocked at runtime, the tool returns an error if the resolved filesystem is read-only.
|
|
174
174
|
|
|
175
175
|
## Mounts and `CompositeFilesystem`
|
|
176
176
|
|
|
@@ -207,9 +207,9 @@ With this configuration:
|
|
|
207
207
|
|
|
208
208
|
### Path routing
|
|
209
209
|
|
|
210
|
-
All file paths must start with a mount prefix
|
|
210
|
+
All file paths must start with a mount prefix because operations fail when their paths don't match a mount. Listing the root directory (`/`) returns virtual directory entries for each mount point.
|
|
211
211
|
|
|
212
|
-
Mount paths can't be nested
|
|
212
|
+
Mount paths can't be nested, for example, you can't mount at both `/data` and `/data/sub`.
|
|
213
213
|
|
|
214
214
|
### `filesystem` vs `mounts`
|
|
215
215
|
|
|
@@ -218,7 +218,7 @@ Mount paths can't be nested — for example, you can't mount at both `/data` and
|
|
|
218
218
|
- Use **`filesystem`** when you have a single storage provider and don't need to mount it into a sandbox. The agent gets file tools that operate directly against the provider.
|
|
219
219
|
- Use **`mounts`** when you need cloud storage accessible inside a sandbox, or when you want to combine multiple providers. The workspace creates a CompositeFilesystem for file tools and FUSE-mounts the storage into the sandbox.
|
|
220
220
|
|
|
221
|
-
For local development, you typically don't need `mounts
|
|
221
|
+
For local development, you typically don't need `mounts`, a `LocalFilesystem` and `LocalSandbox` pointed at the same directory gives you both file tools and command execution on the same files. See [configuration patterns](https://mastra.ai/docs/workspace/overview) for more detail.
|
|
222
222
|
|
|
223
223
|
## Agent tools
|
|
224
224
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Added in:** `@mastra/core@1.1.0`
|
|
6
6
|
|
|
7
|
-
LSP inspection gives workspace-backed agents semantic code intelligence. When you enable LSP on a workspace, agents can inspect symbols in supported files to retrieve hover information
|
|
7
|
+
LSP inspection gives workspace-backed agents semantic code intelligence. When you enable LSP on a workspace, agents can inspect symbols in supported files to retrieve hover information and jump to definitions. They can also find implementations.
|
|
8
8
|
|
|
9
9
|
## When to use LSP inspection
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Added in:** `@mastra/core@1.1.0`
|
|
6
6
|
|
|
7
|
-
A Mastra workspace gives agents a persistent environment for storing files and executing commands. Agents use workspace tools to read and write files
|
|
7
|
+
A Mastra workspace gives agents a persistent environment for storing files and executing commands. Agents use workspace tools to read and write files and run shell commands, plus search indexed content.
|
|
8
8
|
|
|
9
9
|
A workspace supports the following features:
|
|
10
10
|
|
|
@@ -77,7 +77,7 @@ const workspace = new Workspace({
|
|
|
77
77
|
|
|
78
78
|
export const myAgent = new Agent({
|
|
79
79
|
id: 'my-agent',
|
|
80
|
-
model: 'openai/gpt-5.
|
|
80
|
+
model: 'openai/gpt-5.6-sol',
|
|
81
81
|
workspace,
|
|
82
82
|
})
|
|
83
83
|
```
|
|
@@ -88,11 +88,11 @@ Mastra registers global and agent workspaces so they can be listed and retrieved
|
|
|
88
88
|
|
|
89
89
|
For manual cleanup, use [`mastra.removeWorkspace()`](https://mastra.ai/reference/core/removeWorkspace). Pass `{ destroy: true }` when the workspace should be destroyed before it's removed from the registry.
|
|
90
90
|
|
|
91
|
-
Static providers are owned by the workspace. Resolver-backed providers are owned by your application because the workspace creates them at request time. See [
|
|
91
|
+
Static providers are owned by the workspace. Resolver-backed providers are owned by your application because the workspace creates them at request time. See [runtime sandbox lifecycle ownership](https://mastra.ai/docs/workspace/sandbox) for the resolver cleanup model.
|
|
92
92
|
|
|
93
93
|
## Configuration patterns
|
|
94
94
|
|
|
95
|
-
Workspaces support several configuration patterns depending on what capabilities your agent needs. The
|
|
95
|
+
Workspaces support several configuration patterns depending on what capabilities your agent needs. The main building blocks are `filesystem` (file tools) and `sandbox` (command execution), with `mounts` as the way to bridge cloud storage into sandboxes.
|
|
96
96
|
|
|
97
97
|
### Filesystem + sandbox (local)
|
|
98
98
|
|
|
@@ -132,7 +132,7 @@ Under the hood, `mounts` creates a [CompositeFilesystem](https://mastra.ai/docs/
|
|
|
132
132
|
|
|
133
133
|
You can mount multiple providers at different paths. Each mount path must be unique and non-overlapping.
|
|
134
134
|
|
|
135
|
-
> **Note:** `filesystem` and `mounts` are mutually exclusive
|
|
135
|
+
> **Note:** `filesystem` and `mounts` are mutually exclusive, you can't use both in the same workspace. Use `filesystem` for a single provider without a sandbox, or `mounts` when you need to combine cloud storage with a sandbox.
|
|
136
136
|
|
|
137
137
|
### Filesystem only
|
|
138
138
|
|
|
@@ -252,7 +252,7 @@ const workspace = new Workspace({
|
|
|
252
252
|
|
|
253
253
|
### Dynamic tool configuration
|
|
254
254
|
|
|
255
|
-
Tool options that accept functions receive a context object and return a boolean.
|
|
255
|
+
Tool options that accept functions receive a context object and return a boolean. It enables context-aware tool behavior.
|
|
256
256
|
|
|
257
257
|
```typescript
|
|
258
258
|
const workspace = new Workspace({
|
|
@@ -280,7 +280,7 @@ Functions for `enabled` receive `{ requestContext, workspace }`. Functions for `
|
|
|
280
280
|
|
|
281
281
|
### Tool name remapping
|
|
282
282
|
|
|
283
|
-
Rename workspace tools to match the conventions your agent expects. The config key remains the original `WORKSPACE_TOOLS` constant
|
|
283
|
+
Rename workspace tools to match the conventions your agent expects. The config key remains the original `WORKSPACE_TOOLS` constant, only the exposed name changes.
|
|
284
284
|
|
|
285
285
|
```typescript
|
|
286
286
|
import { Workspace, LocalFilesystem, LocalSandbox, WORKSPACE_TOOLS } from '@mastra/core/workspace'
|
|
@@ -299,7 +299,7 @@ const workspace = new Workspace({
|
|
|
299
299
|
})
|
|
300
300
|
```
|
|
301
301
|
|
|
302
|
-
The agent sees `view`, `search_content`, `find_files`, `execute_command`, and `lsp_inspect` instead of the default `mastra_workspace_*` names. Tool names must be unique
|
|
302
|
+
The agent sees `view`, `search_content`, `find_files`, `execute_command`, and `lsp_inspect` instead of the default `mastra_workspace_*` names. Tool names must be unique, duplicate names or conflicts with other default names throw an error.
|
|
303
303
|
|
|
304
304
|
### Tool hooks
|
|
305
305
|
|
|
@@ -325,17 +325,17 @@ const workspace = new Workspace({
|
|
|
325
325
|
|
|
326
326
|
Return `{ proceed: false, output }` from `beforeToolCall` to skip the tool call and use `output` as its result.
|
|
327
327
|
|
|
328
|
-
If the owning agent also defines [tool hooks](https://mastra.ai/docs/agents/using-tools), workspace hooks run inside the agent hook wrapper
|
|
328
|
+
If the owning agent also defines [tool hooks](https://mastra.ai/docs/agents/using-tools), workspace hooks run inside the agent hook wrapper. The order is agent `beforeToolCall`, workspace `beforeToolCall`, the tool, workspace `afterToolCall`, and agent `afterToolCall`.
|
|
329
329
|
|
|
330
330
|
## LSP inspection
|
|
331
331
|
|
|
332
|
-
Enable `lsp` on a workspace to add semantic code inspection through language servers. This adds the `mastra_workspace_lsp_inspect` tool by default, which can return hover information
|
|
332
|
+
Enable `lsp` on a workspace to add semantic code inspection through language servers. This adds the `mastra_workspace_lsp_inspect` tool by default, which can return hover information and definition locations, plus implementations for a symbol at a specific cursor position.
|
|
333
333
|
|
|
334
334
|
See [LSP inspection](https://mastra.ai/docs/workspace/lsp) for configuration, examples, and tool name remapping.
|
|
335
335
|
|
|
336
336
|
### Output truncation
|
|
337
337
|
|
|
338
|
-
Workspace tools automatically truncate large outputs to avoid exceeding LLM context limits.
|
|
338
|
+
Workspace tools automatically truncate large outputs to avoid exceeding LLM context limits. These layers of truncation apply:
|
|
339
339
|
|
|
340
340
|
1. **Line-based tail**: Command output is limited to the last 200 lines by default (configurable per-command via the `tail` parameter)
|
|
341
341
|
2. **Token-based limit**: Tool output is capped at 2000 tokens by default
|
|
@@ -380,7 +380,7 @@ await filesystem.writeFile('/docs/file.md', newContent, {
|
|
|
380
380
|
|
|
381
381
|
## Initialization
|
|
382
382
|
|
|
383
|
-
Calling `init()` is optional in most cases
|
|
383
|
+
Calling `init()` is optional in most cases, some providers initialize on first operation. Call `init()` manually when using a workspace outside of Mastra (standalone scripts, tests) or when you need to pre-provision resources before the first agent interaction.
|
|
384
384
|
|
|
385
385
|
```typescript
|
|
386
386
|
import { Workspace, LocalFilesystem, LocalSandbox } from '@mastra/core/workspace'
|
|
@@ -51,7 +51,7 @@ const workspace = new Workspace({
|
|
|
51
51
|
|
|
52
52
|
const agent = new Agent({
|
|
53
53
|
id: 'dev-agent',
|
|
54
|
-
model: 'openai/gpt-5.
|
|
54
|
+
model: 'openai/gpt-5.6-sol',
|
|
55
55
|
instructions: 'You are a helpful development assistant.',
|
|
56
56
|
workspace,
|
|
57
57
|
})
|
|
@@ -100,9 +100,9 @@ const bobCtx = new RequestContext([['user-id', 'bob']])
|
|
|
100
100
|
await agent.generate('List files in cwd', { requestContext: bobCtx })
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
By default, workspace instructions describe the
|
|
103
|
+
By default, workspace instructions describe the runtime sandbox with stable placeholder text. See [Workspace instructions](#workspace-instructions) to include concrete per-request details.
|
|
104
104
|
|
|
105
|
-
The resolver can also be asynchronous
|
|
105
|
+
The resolver can also be asynchronous, for example to look up tenant configuration from a database:
|
|
106
106
|
|
|
107
107
|
```typescript
|
|
108
108
|
const workspace = new Workspace({
|
|
@@ -115,9 +115,11 @@ const workspace = new Workspace({
|
|
|
115
115
|
|
|
116
116
|
### Lifecycle ownership
|
|
117
117
|
|
|
118
|
-
When the sandbox is a static instance, `workspace.init()` calls its `start()` method and `workspace.destroy()` calls its `destroy()` method. With a resolver, the workspace has no instance to manage at construction time
|
|
118
|
+
When the sandbox is a static instance, `workspace.init()` calls its `start()` method and `workspace.destroy()` calls its `destroy()` method. With a resolver, the workspace has no instance to manage at construction time, the caller owns the returned sandbox's lifecycle.
|
|
119
119
|
|
|
120
|
-
The resolver must return a sandbox that's ready to use, either already started or able to handle calls without explicit startup. The caller also owns cleanup timing for returned sandboxes.
|
|
120
|
+
The resolver must return a sandbox that's ready to use, either already started or able to handle calls without explicit startup. The caller also owns cleanup timing for returned sandboxes.
|
|
121
|
+
|
|
122
|
+
Cleanup can happen per request, tenant, or user. It can also be part of a long-lived sandbox pool. `workspace.destroy()` doesn't destroy resolver-returned sandboxes.
|
|
121
123
|
|
|
122
124
|
> **Note:** `sandbox` resolvers are incompatible with `mounts` and `lsp: true`. Both require a concrete sandbox instance at construction time, so combining them with a resolver throws an `INVALID_CONFIG` error (for `mounts`) or disables LSP with a warning (for `lsp: true`).
|
|
123
125
|
|
|
@@ -208,7 +210,7 @@ By default, background processes inherit the agent's abort signal and are killed
|
|
|
208
210
|
|
|
209
211
|
- **`undefined`** (default): Uses the agent's abort signal
|
|
210
212
|
- **`AbortSignal`**: Uses a custom signal
|
|
211
|
-
- **`null` or `false`**: Disables abort
|
|
213
|
+
- **`null` or `false`**: Disables abort: processes persist after agent shutdown
|
|
212
214
|
|
|
213
215
|
```typescript
|
|
214
216
|
import { Workspace, LocalSandbox, WORKSPACE_TOOLS } from '@mastra/core/workspace'
|
|
@@ -227,7 +229,7 @@ const workspace = new Workspace({
|
|
|
227
229
|
|
|
228
230
|
Use `null` or `false` for cloud sandboxes (for example, E2B, Daytona, or Modal) where processes should outlive the agent.
|
|
229
231
|
|
|
230
|
-
> **Note:** For the full `SandboxProcessManager` API (spawning processes programmatically
|
|
232
|
+
> **Note:** For the full `SandboxProcessManager` API (spawning processes programmatically and reading output, plus sending stdin), see the [`SandboxProcessManager` reference](https://mastra.ai/reference/workspace/process-manager).
|
|
231
233
|
|
|
232
234
|
## Related
|
|
233
235
|
|
|
@@ -32,7 +32,7 @@ When you search:
|
|
|
32
32
|
2. Documents are scored based on relevance to the query
|
|
33
33
|
3. Results are ranked by score and returned with the matching content
|
|
34
34
|
|
|
35
|
-
Workspaces support three search modes: BM25 keyword search
|
|
35
|
+
Workspaces support three search modes: BM25 keyword search and vector semantic search, plus hybrid search that combines both.
|
|
36
36
|
|
|
37
37
|
## BM25 keyword search
|
|
38
38
|
|
|
@@ -91,7 +91,7 @@ The embedder above takes one text at a time. Indexing a workspace with hundreds
|
|
|
91
91
|
|
|
92
92
|
When the provider supports batching (for example, OpenAI's `embedMany`), pass an embedder that takes an array of texts and accepts many embeddings back in one call. To opt in, set a `batch: true` property on the function. Mastra checks for that property at runtime and switches to the batched path.
|
|
93
93
|
|
|
94
|
-
The following example replaces the single-text embedder with a batched one. The embedder function takes an array
|
|
94
|
+
The following example replaces the single-text embedder with a batched one. The embedder function takes an array and returns an array of embeddings in the same order, plus carries two extra properties:
|
|
95
95
|
|
|
96
96
|
- `batch: true`: marks the function as batch-capable. Without this property, Mastra calls it one text at a time.
|
|
97
97
|
- `maxBatchSize`: the largest array the provider accepts in one call. Mastra splits larger requests into chunks of this size and sends them in parallel. Set this to your provider's documented limit (for example, 2048 for OpenAI, 96 for Cohere, 128 for Voyage). Omit it to send every pending text in one request.
|
|
@@ -149,7 +149,7 @@ const workspace = new Workspace({
|
|
|
149
149
|
})
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
The index name must be a valid SQL identifier: start with a letter or underscore, contain only letters, numbers, or
|
|
152
|
+
The index name must be a valid SQL identifier: start with a letter or underscore, contain only letters, numbers, or shows, and be at most 63 characters long.
|
|
153
153
|
|
|
154
154
|
## Indexing content
|
|
155
155
|
|
|
@@ -102,7 +102,7 @@ const workspace = new Workspace({
|
|
|
102
102
|
|
|
103
103
|
## Dynamic skills
|
|
104
104
|
|
|
105
|
-
For
|
|
105
|
+
For runtime skill paths based on context, pass a function:
|
|
106
106
|
|
|
107
107
|
```typescript
|
|
108
108
|
const workspace = new Workspace({
|
|
@@ -123,11 +123,11 @@ When a workspace has skills configured, agents automatically get access to skill
|
|
|
123
123
|
|
|
124
124
|
The agent has three skill tools:
|
|
125
125
|
|
|
126
|
-
- **`skill
|
|
127
|
-
- **`skill_read
|
|
128
|
-
- **`skill_search
|
|
126
|
+
- **`skill`**: Loads a skill's full instructions and returns them in the tool result. The agent calls this whenever it needs a skill's guidance.
|
|
127
|
+
- **`skill_read`**: Reads a file from a skill's `references/`, `scripts/`, or `assets/` directory.
|
|
128
|
+
- **`skill_search`**: Searches across all skill content. Uses BM25 or vector search when configured, otherwise falls back to basic text matching.
|
|
129
129
|
|
|
130
|
-
This design is stateless
|
|
130
|
+
This design is stateless, there is no activation state to track. If the skill instructions leave the conversation context (due to context window limits or compaction), the agent can call `skill` again to reload them.
|
|
131
131
|
|
|
132
132
|
## Same-named skills
|
|
133
133
|
|
|
@@ -136,7 +136,7 @@ When multiple skill directories contain a skill with the same name, all of them
|
|
|
136
136
|
When the agent activates a skill by name, tie-breaking determines which one is returned:
|
|
137
137
|
|
|
138
138
|
1. **Source-type priority**: local skills take precedence over managed (`.mastra/`) skills, which take precedence over external (`node_modules/`) skills.
|
|
139
|
-
2. **Unresolvable conflicts throw**: if two skills share the same name
|
|
139
|
+
2. **Unresolvable conflicts throw**: if two skills share the same name and the same source type (for example, two local skills both named `brand-guidelines`), `get()` throws an error. Rename one or move it to a different source type to resolve the conflict.
|
|
140
140
|
3. **Path escape hatch**: the agent can pass a skill's full path instead of its name to activate a specific skill, bypassing tie-breaking entirely.
|
|
141
141
|
|
|
142
142
|
```typescript
|
|
@@ -191,7 +191,7 @@ When `skillSource` is provided, it's used instead of the workspace filesystem fo
|
|
|
191
191
|
|
|
192
192
|
## Agent-level skills
|
|
193
193
|
|
|
194
|
-
You can also attach skills directly to an agent without a workspace using `createSkill()` and the agent's `skills` config. When both agent-level and workspace-level skills exist, they merge
|
|
194
|
+
You can also attach skills directly to an agent without a workspace using `createSkill()` and the agent's `skills` config. When both agent-level and workspace-level skills exist, they merge, agent-level skills take precedence on name conflicts.
|
|
195
195
|
|
|
196
196
|
See [Agent skills](https://mastra.ai/docs/agents/skills) for details.
|
|
197
197
|
|