@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
|
@@ -44,7 +44,7 @@ You're now ready to follow the integration guides and recipes below!
|
|
|
44
44
|
|
|
45
45
|
## Integration guides
|
|
46
46
|
|
|
47
|
-
Typically, you'll set up API routes that stream Mastra content in AI SDK-compatible format, and then use those routes in AI SDK UI hooks like `useChat()`.
|
|
47
|
+
Typically, you'll set up API routes that stream Mastra content in AI SDK-compatible format, and then use those routes in AI SDK UI hooks like `useChat()`. Choose one of these approaches:
|
|
48
48
|
|
|
49
49
|
- [Mastra's server](#mastras-server)
|
|
50
50
|
- [Framework-agnostic](#framework-agnostic)
|
|
@@ -298,7 +298,7 @@ export default function Page() {
|
|
|
298
298
|
}
|
|
299
299
|
```
|
|
300
300
|
|
|
301
|
-
|
|
301
|
+
Choose a backend implementation:
|
|
302
302
|
|
|
303
303
|
**Mastra Server**:
|
|
304
304
|
|
|
@@ -380,7 +380,7 @@ export async function POST(req: Request) {
|
|
|
380
380
|
|
|
381
381
|
## Custom UI
|
|
382
382
|
|
|
383
|
-
Custom UI (also known as Generative UI) allows you to render custom React components based on data streamed from Mastra. Instead of displaying raw text or JSON, you can create visual components for tool outputs
|
|
383
|
+
Custom UI (also known as Generative UI) allows you to render custom React components based on data streamed from Mastra. Instead of displaying raw text or JSON, you can create visual components for tool outputs and workflow progress, including agent network execution and custom events.
|
|
384
384
|
|
|
385
385
|
Use Custom UI when you want to:
|
|
386
386
|
|
|
@@ -990,7 +990,7 @@ export function ChatAdditional() {
|
|
|
990
990
|
}
|
|
991
991
|
```
|
|
992
992
|
|
|
993
|
-
|
|
993
|
+
Implement the backend with either of these examples.
|
|
994
994
|
|
|
995
995
|
**Mastra Server**:
|
|
996
996
|
|
|
@@ -1308,7 +1308,7 @@ import { nestedAgentTool } from '../tools/nested-agent-tool'
|
|
|
1308
1308
|
export const forecastAgent = new Agent({
|
|
1309
1309
|
id: 'forecast-agent',
|
|
1310
1310
|
instructions: 'Use the nested-agent-stream tool when asked about weather.',
|
|
1311
|
-
model: 'openai/gpt-5.
|
|
1311
|
+
model: 'openai/gpt-5.6-sol',
|
|
1312
1312
|
tools: { nestedAgentTool },
|
|
1313
1313
|
})
|
|
1314
1314
|
```
|
|
@@ -1545,7 +1545,7 @@ For a complete implementation, see the [workflow-agent-text-stream example](http
|
|
|
1545
1545
|
|
|
1546
1546
|
### Multi-stage progress with branching workflows
|
|
1547
1547
|
|
|
1548
|
-
For workflows with conditional branching (e.g., express vs standard
|
|
1548
|
+
For workflows with conditional branching (e.g., express vs standard delivery), you can track progress across different branches by including an identifier in your custom events.
|
|
1549
1549
|
|
|
1550
1550
|
The UI Dojo example uses a `stage` field in the event data to identify which branch is executing (e.g., `"validation"`, `"standard-processing"`, `"express-processing"`). The frontend groups events by this field to show a pipeline-style progress UI.
|
|
1551
1551
|
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
# CopilotKit generative UI
|
|
4
4
|
|
|
5
|
-
Generative UI
|
|
5
|
+
Generative UI describes interfaces that agents help create and that users can interact with. CopilotKit organizes these interfaces along a single axis, the **generative UI spectrum**, which runs from author-controlled (you decide every pixel) to agent-invented (the agent owns the rendered surface). Your position on the axis is a trade-off between predictability and breadth.
|
|
6
6
|
|
|
7
7
|
The spectrum has three tiers:
|
|
8
8
|
|
|
9
9
|
| Tier | Who controls the surface | Primitives |
|
|
10
10
|
| --------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------- |
|
|
11
|
-
| **Controlled** | You wrote the component
|
|
12
|
-
| **Declarative** | The agent emits a structured spec
|
|
11
|
+
| **Controlled** | You wrote the component. The agent picks which one to use and what data to pass. | Tool call rendering, state rendering, reasoning, components as tools |
|
|
12
|
+
| **Declarative** | The agent emits a structured spec. The frontend composes it from a catalog you registered. | A2UI (fixed-schema and flexible variants) |
|
|
13
13
|
| **Open-ended** | The UI is invented elsewhere (an MCP server) and you sandbox it. | MCP Apps |
|
|
14
14
|
|
|
15
15
|
Each tier is a Mastra agent exposed through `registerCopilotKit()` (see [CopilotKit overview](https://mastra.ai/guides/build-your-ui/copilotkit/overview)) plus the matching CopilotKit hook on the frontend. For the full concept, see CopilotKit's [generative UI spectrum](https://www.copilotkit.ai/generative-ui-spectrum) and [generative UI overview](https://docs.copilotkit.ai/concepts/generative-ui-overview).
|
|
16
16
|
|
|
17
|
-
> **Tip:** Mastra's [UI Dojo](https://ui-dojo.mastra.ai/) has working CopilotKit examples
|
|
17
|
+
> **Tip:** Mastra's [UI Dojo](https://ui-dojo.mastra.ai/) has working CopilotKit examples. Browse the source under `src/pages/copilot-kit`.
|
|
18
18
|
|
|
19
19
|
## Controlled
|
|
20
20
|
|
|
21
|
-
You
|
|
21
|
+
You provide a fixed set of components. The agent chooses which component to render and supplies its data. This predictable, brand-safe approach works well for high-traffic surfaces. The Controlled primitives use CopilotKit's v2 API, imported from `@copilotkit/react-core/v2`.
|
|
22
22
|
|
|
23
23
|
### Tool call rendering
|
|
24
24
|
|
|
@@ -32,7 +32,7 @@ export const weatherAgent = new Agent({
|
|
|
32
32
|
id: 'weather-agent',
|
|
33
33
|
name: 'Weather Agent',
|
|
34
34
|
instructions: 'Use the weatherTool to fetch current weather data.',
|
|
35
|
-
model: 'openai/gpt-5.
|
|
35
|
+
model: 'openai/gpt-5.6-sol',
|
|
36
36
|
tools: { weatherTool },
|
|
37
37
|
})
|
|
38
38
|
```
|
|
@@ -125,7 +125,7 @@ Reasoning is zero-config: when your Mastra agent runs a reasoning-capable model,
|
|
|
125
125
|
|
|
126
126
|
## Declarative
|
|
127
127
|
|
|
128
|
-
Instead of a fixed component per tool, you register a catalog of typed building blocks and the agent assembles them into a UI tree per request. CopilotKit calls this **A2UI** (Agent-to-UI),
|
|
128
|
+
Instead of a fixed component per tool, you register a catalog of typed building blocks and the agent assembles them into a UI tree per request. CopilotKit calls this **A2UI** (Agent-to-UI), which has fixed-schema and flexible variants. It suits the long tail of secondary interactions where breadth matters more than pixel-perfection.
|
|
129
129
|
|
|
130
130
|
The path of least resistance is to pass your catalog to the `<CopilotKit>` provider. That single prop enables A2UI rendering and injects the A2UI tool into your agent, so no backend change is needed:
|
|
131
131
|
|
|
@@ -146,11 +146,11 @@ export default function Page() {
|
|
|
146
146
|
}
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
The catalog defines the primitives (their schemas) and the renderers (how each primitive displays). In the fixed-schema variant the components are pre-authored and the agent's tool only supplies data
|
|
149
|
+
The catalog defines the primitives (their schemas) and the renderers (how each primitive displays). In the fixed-schema variant, the components are pre-authored and the agent's tool only supplies data. The flexible variant lets the agent compose the tree more freely. See CopilotKit's [A2UI documentation](https://docs.copilotkit.ai/a2a/generative-ui/a2ui).
|
|
150
150
|
|
|
151
151
|
## Open-ended
|
|
152
152
|
|
|
153
|
-
At the far end of the spectrum, the agent owns the entire surface: the UI is invented elsewhere and sandboxed in your app. CopilotKit supports this through **MCP Apps**, where an MCP server
|
|
153
|
+
At the far end of the spectrum, the agent owns the entire surface: the UI is invented elsewhere and sandboxed in your app. CopilotKit supports this through **MCP Apps**, where an MCP server provides UI that renders inside your application. This tier trades determinism for novelty and is the most experimental point on the spectrum.
|
|
154
154
|
|
|
155
155
|
The path of least resistance keeps the frontend untouched: your existing `<CopilotKit>` provider is enough. On the backend, point `registerCopilotKit()` at one or more MCP servers with the `mcpApps` option (it's forwarded to the CopilotKit runtime):
|
|
156
156
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Using CopilotKit
|
|
4
4
|
|
|
5
|
-
[CopilotKit](https://www.copilotkit.ai/) provides React components to quickly integrate customizable AI copilots into your application. Combined with Mastra, you can build
|
|
5
|
+
[CopilotKit](https://www.copilotkit.ai/) provides React components to quickly integrate customizable AI copilots into your application. Combined with Mastra, you can build AI apps with bidirectional state synchronization and interactive UIs.
|
|
6
6
|
|
|
7
7
|
CopilotKit talks to Mastra through the [AG-UI protocol](https://docs.ag-ui.com/). The `@ag-ui/mastra` package exposes your Mastra agents as an AG-UI endpoint, and CopilotKit's React hooks and components consume it. This unlocks a spectrum of experiences on top of ordinary chat: [generative UI, human-in-the-loop, and frontend tools](https://mastra.ai/guides/build-your-ui/copilotkit/generative-ui), plus deploying the same agent to [messaging channels like Slack](https://mastra.ai/guides/build-your-ui/copilotkit/channels).
|
|
8
8
|
|
|
@@ -266,7 +266,7 @@ Your CopilotKit frontend now communicates with a standalone Mastra agent server.
|
|
|
266
266
|
|
|
267
267
|
## Chat UI options
|
|
268
268
|
|
|
269
|
-
`CopilotChat` renders an inline, full-height chat. CopilotKit
|
|
269
|
+
`CopilotChat` renders an inline, full-height chat. CopilotKit provides two other drop-in surfaces that share the same props:
|
|
270
270
|
|
|
271
271
|
- `CopilotSidebar`: a collapsible panel docked to the side of your app.
|
|
272
272
|
- `CopilotPopup`: a floating button that opens a chat window.
|
|
@@ -131,7 +131,7 @@ Embed Mastra in your Next.js API route and connect an OpenUI `<AgentInterface />
|
|
|
131
131
|
name: 'OpenUI Agent',
|
|
132
132
|
instructions: `You are a helpful assistant. Use tools when relevant.\n\n${systemPrompt}`,
|
|
133
133
|
model: {
|
|
134
|
-
id: 'openai/gpt-5.
|
|
134
|
+
id: 'openai/gpt-5.6-sol',
|
|
135
135
|
apiKey: process.env.OPENAI_API_KEY,
|
|
136
136
|
},
|
|
137
137
|
tools: { getWeather },
|
|
@@ -253,7 +253,7 @@ OpenUI generates UI from a component library. The library defines which componen
|
|
|
253
253
|
|
|
254
254
|
### Built-in libraries
|
|
255
255
|
|
|
256
|
-
`@openuidev/react-ui`
|
|
256
|
+
`@openuidev/react-ui` provides two libraries you can use as-is:
|
|
257
257
|
|
|
258
258
|
- `openuiChatLibrary`: components for chat interfaces (cards, forms, tables, charts).
|
|
259
259
|
- `openuiDashboardLibrary`: components for dashboards and data-heavy surfaces.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
A multi-agent system distributes a task across multiple agents instead of asking one agent to do everything. In Mastra, this usually means combining agents, workflows, or both so each part of the system has a clear role.
|
|
6
6
|
|
|
7
|
-
The goal is to assign the right context, tools, and responsibilities to the right component. When that split is clear, a multi-agent system can be easier to reason about than one agent with a long prompt
|
|
7
|
+
The goal is to assign the right context, tools, and responsibilities to the right component. When that split is clear, a multi-agent system can be easier to reason about than one agent burdened with a long prompt and too many tools or responsibilities.
|
|
8
8
|
|
|
9
9
|
## When to use multi-agent systems
|
|
10
10
|
|
|
@@ -34,9 +34,9 @@ In Mastra, implement this pattern by combining [agents](https://mastra.ai/docs/a
|
|
|
34
34
|
|
|
35
35
|
A workflow pattern defines the execution path in code. Instead of asking an agent to decide what happens next, you define the sequence through steps, branches, loops, and parallel blocks.
|
|
36
36
|
|
|
37
|
-
Use workflows when the task is well understood and the execution path is known in advance. The main advantage is predictability: The system
|
|
37
|
+
Use workflows when the task is well understood and the execution path is known in advance. The main advantage is predictability: The explicit structure makes the system easier to debug and audit. The tradeoff is flexibility, since workflows are less adaptive when the task changes as it unfolds.
|
|
38
38
|
|
|
39
|
-
In Mastra, [workflows](https://mastra.ai/docs/workflows/overview) can implement
|
|
39
|
+
In Mastra, [workflows](https://mastra.ai/docs/workflows/overview) can implement coordination patterns such as handoffs and councils. A workflow is distinct because its control logic lives in the workflow itself, regardless of which agents it calls.
|
|
40
40
|
|
|
41
41
|
## Supervisors
|
|
42
42
|
|
|
@@ -54,7 +54,7 @@ A council pattern asks multiple agents to work on the same problem independently
|
|
|
54
54
|
|
|
55
55
|
Use this pattern when the question is ambiguous, evaluative, or high-stakes and answer quality matters more than speed. The tradeoff is cost, since councils intentionally duplicate effort and usually take longer and use more tokens than other patterns.
|
|
56
56
|
|
|
57
|
-
Mastra doesn't provide a dedicated council primitive. In Mastra, implement this pattern with [agents](https://mastra.ai/docs/agents/overview) and [workflows](https://mastra.ai/docs/workflows/overview): Run multiple agents in parallel
|
|
57
|
+
Mastra doesn't provide a dedicated council primitive. In Mastra, implement this pattern with [agents](https://mastra.ai/docs/agents/overview) and [workflows](https://mastra.ai/docs/workflows/overview): Run multiple agents in parallel and collect their outputs. Then add a final synthesis or review step. Workflow control flow methods such as `.parallel()` provide the structure for this pattern.
|
|
58
58
|
|
|
59
59
|
## Choosing a pattern
|
|
60
60
|
|
|
@@ -64,7 +64,7 @@ These patterns differ mainly in how they distribute control:
|
|
|
64
64
|
| ----------------- | -------------------- | ------------------------------------------------ | -------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
65
65
|
| Handoffs | Current specialist | Ownership should move between specialists | Context transfer becomes more important | Agents with workflows and memory |
|
|
66
66
|
| Workflows | Execution graph | The path is known in advance | Less adaptive when the task changes | [Workflows](https://mastra.ai/docs/workflows/overview) |
|
|
67
|
-
| Supervisor agents | One lead agent |
|
|
67
|
+
| Supervisor agents | One lead agent | Delegation must adapt during execution | Results depend on good coordination and clear boundaries | [Supervisor agents](https://mastra.ai/docs/agents/supervisor-agents) |
|
|
68
68
|
| Council | Final synthesis step | The task needs multiple independent perspectives | Higher cost and latency | Agents with workflow parallelism |
|
|
69
69
|
|
|
70
70
|
In practice, these patterns are often combined:
|
|
@@ -46,7 +46,7 @@ Here are some questions to consider:
|
|
|
46
46
|
|
|
47
47
|
### Agent stream properties
|
|
48
48
|
|
|
49
|
-
An agent stream provides access to
|
|
49
|
+
An agent stream provides access to these response properties:
|
|
50
50
|
|
|
51
51
|
- **`stream.textStream`**: A readable stream that emits text chunks.
|
|
52
52
|
- **`stream.text`**: Promise that resolves to the full text response.
|
|
@@ -124,13 +124,13 @@ The event structure includes `runId` and `from` at the top level, making it easi
|
|
|
124
124
|
|
|
125
125
|
### Workflow stream properties
|
|
126
126
|
|
|
127
|
-
A workflow stream provides access to
|
|
127
|
+
A workflow stream provides access to these response properties:
|
|
128
128
|
|
|
129
129
|
- **`stream.status`**: The status of the workflow run.
|
|
130
130
|
- **`stream.result`**: The result of the workflow run.
|
|
131
131
|
- **`stream.usage`**: The total token usage of the workflow run.
|
|
132
132
|
|
|
133
|
-
Streaming from agents or workflows provides real-time visibility into either the LLM’s output or the status of a workflow run.
|
|
133
|
+
Streaming from agents or workflows provides real-time visibility into either the LLM’s output or the status of a workflow run. Pass this feedback directly to the user, or use it in an application to display workflow status as it changes.
|
|
134
134
|
|
|
135
135
|
Events emitted from agents or workflows represent different stages of generation and execution, such as when a run starts, when text is produced, or when a tool is invoked.
|
|
136
136
|
|
|
@@ -193,11 +193,11 @@ Below is an example of events that may be emitted. Each event always includes a
|
|
|
193
193
|
|
|
194
194
|
## Writer API
|
|
195
195
|
|
|
196
|
-
The `writer` API is shared by tools and workflow steps
|
|
196
|
+
The `writer` API is shared by tools and workflow steps. See the Tools and Workflows docs for feature-specific examples.
|
|
197
197
|
|
|
198
198
|
## Agent using tool
|
|
199
199
|
|
|
200
|
-
Agent streaming can be combined with tool calls, allowing tool outputs to be written directly into the agent’s streaming response. This
|
|
200
|
+
Agent streaming can be combined with tool calls, allowing tool outputs to be written directly into the agent’s streaming response. This surfaces tool activity as part of the interaction.
|
|
201
201
|
|
|
202
202
|
```typescript
|
|
203
203
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -207,14 +207,14 @@ export const testAgent = new Agent({
|
|
|
207
207
|
id: 'test-agent',
|
|
208
208
|
name: 'Test Agent',
|
|
209
209
|
instructions: 'You are a weather agent.',
|
|
210
|
-
model: 'openai/gpt-5.
|
|
210
|
+
model: 'openai/gpt-5.6-sol',
|
|
211
211
|
tools: { testTool },
|
|
212
212
|
})
|
|
213
213
|
```
|
|
214
214
|
|
|
215
215
|
### Using `context.writer`
|
|
216
216
|
|
|
217
|
-
The `context.writer` object is available in a tool's `execute()` function and can
|
|
217
|
+
The `context.writer` object is available in a tool's `execute()` function and can emit custom events, data, or values into the active stream. Tools use these events to provide intermediate results or status updates during execution.
|
|
218
218
|
|
|
219
219
|
> **Warning:** You must `await` the call to `writer.write()` or else you will lock the stream and get a `WritableStream is locked` error.
|
|
220
220
|
|
|
@@ -274,7 +274,7 @@ export const testTool = createTool({
|
|
|
274
274
|
|
|
275
275
|
### Transient data chunks
|
|
276
276
|
|
|
277
|
-
By default, `data-*` chunks emitted with `writer.custom()` are persisted to storage as part of the message history. For chunks that are only needed during live streaming
|
|
277
|
+
By default, `data-*` chunks emitted with `writer.custom()` are persisted to storage as part of the message history. For chunks that are only needed during live streaming, such as progress updates or verbose log output, set `transient: true` to skip storage persistence. Transient chunks are still streamed to the client in real time but aren't saved to the database.
|
|
278
278
|
|
|
279
279
|
```typescript
|
|
280
280
|
await context?.writer?.custom({
|
|
@@ -284,11 +284,11 @@ await context?.writer?.custom({
|
|
|
284
284
|
})
|
|
285
285
|
```
|
|
286
286
|
|
|
287
|
-
Use transient chunks when the data is large or high-frequency and only relevant during the live session. After a page refresh, transient chunks are no longer available
|
|
287
|
+
Use transient chunks when the data is large or high-frequency and only relevant during the live session. After a page refresh, transient chunks are no longer available. Only the tool's return value and any non-transient chunks are loaded from storage.
|
|
288
288
|
|
|
289
289
|
## Using the `writer` argument
|
|
290
290
|
|
|
291
|
-
The `writer` argument is passed to a workflow step's `execute` function and can
|
|
291
|
+
The `writer` argument is passed to a workflow step's `execute` function and can emit custom events, data, or values into the active stream. Workflow steps use these events to provide intermediate results or status updates during execution.
|
|
292
292
|
|
|
293
293
|
> **Warning:** You must `await` the call to `writer.write(...)` or else you will lock the stream and get a `WritableStream is locked` error.
|
|
294
294
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Deploy Mastra to Amazon EC2
|
|
4
4
|
|
|
5
|
-
Deploy your Mastra server to Amazon EC2.
|
|
5
|
+
Deploy your Mastra server to Amazon EC2. The server runs on infrastructure you manage and can support long-running agents and workflows.
|
|
6
6
|
|
|
7
7
|
> **Info:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/mastra-server). If you're using a [server adapter](https://mastra.ai/docs/server/server-adapters) or [web framework](https://mastra.ai/docs/deployment/web-framework), deploy the way you normally would for that framework.
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ You'll need:
|
|
|
12
12
|
|
|
13
13
|
- A [Mastra application](https://mastra.ai/guides/getting-started/quickstart)
|
|
14
14
|
- An [AWS account](https://aws.amazon.com/) with permissions for Lambda, ECR, and IAM
|
|
15
|
-
- **[AWS CLI](https://aws.amazon.com/cli/)** installed
|
|
15
|
+
- **[AWS CLI](https://aws.amazon.com/cli/)** installed: Run `aws configure` to authenticate
|
|
16
16
|
- **[Docker](https://www.docker.com/)** installed and running
|
|
17
17
|
|
|
18
18
|
> **Warning:** On AWS Lambda, the filesystem is ephemeral, so any local database file will be lost between invocations. If you're using [LibSQLStore](https://mastra.ai/reference/storage/libsql) with a local file, configure it to use a remote LibSQL-compatible database (for example, [Turso](https://turso.tech/)) instead.
|
|
@@ -71,7 +71,7 @@ In these steps, you'll connect your Azure App Service to your GitHub repository
|
|
|
71
71
|
run: (cd .mastra/output && zip ../../release.zip -r .)
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
The deployment package then contains only the build outputs from `.mastra/output`.
|
|
75
75
|
|
|
76
76
|
5. Commit and push your workflow modifications. The build will be automatically triggered in the **Deployment Center** in your Azure dashboard. Monitor the deployment progress until it completes successfully.
|
|
77
77
|
|
|
@@ -56,7 +56,7 @@ export const mastra = new Mastra({
|
|
|
56
56
|
})
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
To test your Cloudflare Worker locally, also install the [`wrangler` CLI](https://developers.cloudflare.com/workers/wrangler/install-and-update/):
|
|
60
60
|
|
|
61
61
|
**npm**:
|
|
62
62
|
|
|
@@ -8,11 +8,11 @@ For a complete example with advanced flow control features, see the [Inngest wor
|
|
|
8
8
|
|
|
9
9
|
## How Inngest works with Mastra
|
|
10
10
|
|
|
11
|
-
Inngest and Mastra integrate by aligning their workflow models: Inngest organizes logic into functions composed of steps, and Mastra workflows defined using `createWorkflow()` and `createStep()` map directly onto this
|
|
11
|
+
Inngest and Mastra integrate by aligning their workflow models: Inngest organizes logic into functions composed of steps, and Mastra workflows defined using `createWorkflow()` and `createStep()` map directly onto this structure. Each Mastra workflow becomes an Inngest function with a unique identifier, and each step within the workflow maps to an Inngest step.
|
|
12
12
|
|
|
13
13
|
The `serve()` function bridges the two systems by registering Mastra workflows as Inngest functions and setting up the necessary event handlers for execution and monitoring.
|
|
14
14
|
|
|
15
|
-
When an event triggers a workflow, Inngest executes it step by step
|
|
15
|
+
When an event triggers a workflow, Inngest executes it step by step and memoizes each result. On retry or resume, Inngest skips completed steps based on those saved results. Mastra control flow primitives, such as loops, conditionals, and nested workflows, map to the same Inngest function and step model while preserving composition, branching, and suspension.
|
|
16
16
|
|
|
17
17
|
Real-time monitoring, suspend/resume, and step-level observability are enabled via Inngest's publish-subscribe system and dashboard. As each step executes, its state and output are tracked using Mastra storage and can be resumed as needed.
|
|
18
18
|
|
|
@@ -194,7 +194,7 @@ export const mastra = new Mastra({
|
|
|
194
194
|
|
|
195
195
|
3. Open the Inngest Dashboard at <http://localhost:8288> and go to the **Apps** section in the sidebar to verify your Mastra workflow is registered
|
|
196
196
|
|
|
197
|
-
4.
|
|
197
|
+
4. In **Functions**, open your workflow. Select **Invoke** and provide the following input:
|
|
198
198
|
|
|
199
199
|
```json
|
|
200
200
|
{
|
|
@@ -256,7 +256,7 @@ Before you begin, make sure you have:
|
|
|
256
256
|
|
|
257
257
|
> **Warning:** Inngest's auto-discover convention assumes `/api/inngest`. Because this guide uses `/inngest/api`, set the **URL** field on the Inngest app to your deployed origin plus `/inngest/api` (for example `https://your-app.vercel.app/inngest/api`). If you leave it on the default, the Inngest dashboard won't find your app's functions.
|
|
258
258
|
|
|
259
|
-
6.
|
|
259
|
+
6. In **Functions**, open `workflow.increment-workflow`. Select **All actions** > **Invoke** and provide the following input:
|
|
260
260
|
|
|
261
261
|
```json
|
|
262
262
|
{
|
|
@@ -496,7 +496,7 @@ When migrating an existing production app from `serve()` to `connect()`, test th
|
|
|
496
496
|
- `functions`: Optional array of additional Inngest functions to register alongside Mastra workflows.
|
|
497
497
|
- `instanceId`: Stable identifier for the worker, shown in the Inngest dashboard. Defaults to the machine hostname.
|
|
498
498
|
- `maxWorkerConcurrency`: Maximum number of steps the worker runs at a time. Defaults to unlimited.
|
|
499
|
-
- `registerOptions`: Forwarded to Inngest during app registration (for example `signingKey`). When a field is set both here and at the top level, `registerOptions` wins
|
|
499
|
+
- `registerOptions`: Forwarded to Inngest during app registration (for example `signingKey`). When a field is set both here and at the top level, `registerOptions` wins. This matches the behavior of `serve()`.
|
|
500
500
|
|
|
501
501
|
`connect()` returns Inngest's `WorkerConnection`. The Inngest SDK handles `SIGINT` and `SIGTERM` by default. Store the returned connection and call `.close()` only when your worker needs custom shutdown control.
|
|
502
502
|
|
|
@@ -663,7 +663,7 @@ All flow control options are optional. If not specified, workflows run with Inng
|
|
|
663
663
|
|
|
664
664
|
## Cron scheduling
|
|
665
665
|
|
|
666
|
-
|
|
666
|
+
Use cron expressions to trigger Inngest workflows on a schedule. Common uses include daily reports and hourly data syncs, as well as maintenance tasks.
|
|
667
667
|
|
|
668
668
|
### Basic cron scheduling
|
|
669
669
|
|
|
@@ -99,7 +99,7 @@ const agent = new Agent({
|
|
|
99
99
|
id: 'assistant',
|
|
100
100
|
name: 'Assistant',
|
|
101
101
|
instructions: 'You are a helpful assistant.',
|
|
102
|
-
model: 'openai/gpt-5.
|
|
102
|
+
model: 'openai/gpt-5.6-sol',
|
|
103
103
|
})
|
|
104
104
|
|
|
105
105
|
export const durableAssistant = createDurableAgent({ agent })
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Deploy Mastra workers
|
|
4
|
+
|
|
5
|
+
Run [Mastra workers](https://mastra.ai/docs/deployment/workers) as separate processes so you can scale orchestration, scheduling, and background tasks independently from the API. This guide walks through a fully split deployment using Docker Compose.
|
|
6
|
+
|
|
7
|
+
> **Info:** This guide covers splitting workers into their own containers. If you only need workers to run in-process alongside the API, see [Workers](https://mastra.ai/docs/deployment/workers). No extra setup is required.
|
|
8
|
+
|
|
9
|
+
## Before you begin
|
|
10
|
+
|
|
11
|
+
You'll need:
|
|
12
|
+
|
|
13
|
+
- A [Mastra application](https://mastra.ai/guides/getting-started/quickstart)
|
|
14
|
+
- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/)
|
|
15
|
+
- A distributed PubSub backend: [Redis](https://redis.io/) for [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), or a [Google Cloud](https://cloud.google.com/) project for [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub)
|
|
16
|
+
- A shared database reachable from every container. See [supported storage backends](https://mastra.ai/reference/workers/overview) for the full list.
|
|
17
|
+
|
|
18
|
+
> **Warning:** The default in-memory PubSub can't deliver events across processes. You must configure a distributed PubSub backend before splitting workers into separate containers.
|
|
19
|
+
|
|
20
|
+
## Configure shared infrastructure
|
|
21
|
+
|
|
22
|
+
Point the `Mastra` instance at a distributed PubSub backend and a shared database. Use environment variables so the same image runs in every container.
|
|
23
|
+
|
|
24
|
+
**Redis Streams + PostgreSQL**:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { Mastra } from '@mastra/core/mastra'
|
|
28
|
+
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
29
|
+
import { PostgresStore } from '@mastra/pg'
|
|
30
|
+
|
|
31
|
+
export const mastra = new Mastra({
|
|
32
|
+
storage: new PostgresStore({
|
|
33
|
+
connectionString: process.env.DATABASE_URL!,
|
|
34
|
+
}),
|
|
35
|
+
pubsub: new RedisStreamsPubSub({
|
|
36
|
+
url: process.env.REDIS_URL!,
|
|
37
|
+
}),
|
|
38
|
+
})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Google Cloud Pub/Sub + LibSQL**:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { Mastra } from '@mastra/core/mastra'
|
|
45
|
+
import { GoogleCloudPubSub } from '@mastra/google-cloud-pubsub'
|
|
46
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
47
|
+
|
|
48
|
+
export const mastra = new Mastra({
|
|
49
|
+
storage: new LibSQLStore({
|
|
50
|
+
url: process.env.DATABASE_URL!,
|
|
51
|
+
}),
|
|
52
|
+
pubsub: new GoogleCloudPubSub({
|
|
53
|
+
projectId: process.env.GCP_PROJECT_ID!,
|
|
54
|
+
}),
|
|
55
|
+
})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Any [supported storage backend](https://mastra.ai/reference/workers/overview) works. Swap the storage adapter for your preferred database.
|
|
59
|
+
|
|
60
|
+
## Deploy
|
|
61
|
+
|
|
62
|
+
1. Build your Mastra application. The output runs in every container.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
mastra build
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
This produces a self-contained `.mastra/output/` directory. See [Deploy a Mastra server](https://mastra.ai/docs/deployment/mastra-server) for details on the build output.
|
|
69
|
+
|
|
70
|
+
2. Create a Dockerfile that copies the pre-built output and installs production dependencies:
|
|
71
|
+
|
|
72
|
+
```dockerfile
|
|
73
|
+
FROM node:22-alpine
|
|
74
|
+
|
|
75
|
+
WORKDIR /app
|
|
76
|
+
|
|
77
|
+
COPY .mastra/output/package.json .mastra/output/.npmrc* ./
|
|
78
|
+
RUN npm install --omit=dev
|
|
79
|
+
|
|
80
|
+
COPY .mastra/output/ .
|
|
81
|
+
|
|
82
|
+
EXPOSE 4111
|
|
83
|
+
CMD ["node", "index.mjs"]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
3. Create a `docker-compose.yml` that runs the fully split topology. The file defines six services: a database, a PubSub backend, the API server, and three workers. Each worker container runs the same image with a different `MASTRA_WORKERS` value to control which worker starts.
|
|
87
|
+
|
|
88
|
+
The API container sets `MASTRA_WORKERS: "false"` to disable all event processing. The orchestration worker sets `MASTRA_STEP_EXECUTION_URL` to point step execution requests at the API's internal URL. See [step execution URL](#step-execution-url) for details.
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
services:
|
|
92
|
+
postgres:
|
|
93
|
+
image: postgres:16-alpine
|
|
94
|
+
environment:
|
|
95
|
+
POSTGRES_USER: mastra
|
|
96
|
+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
97
|
+
POSTGRES_DB: mastra
|
|
98
|
+
ports:
|
|
99
|
+
- '5432:5432'
|
|
100
|
+
volumes:
|
|
101
|
+
- pgdata:/var/lib/postgresql/data
|
|
102
|
+
healthcheck:
|
|
103
|
+
test: ['CMD-SHELL', 'pg_isready -U mastra']
|
|
104
|
+
interval: 5s
|
|
105
|
+
timeout: 3s
|
|
106
|
+
retries: 5
|
|
107
|
+
|
|
108
|
+
redis:
|
|
109
|
+
image: redis:7-alpine
|
|
110
|
+
ports:
|
|
111
|
+
- '6379:6379'
|
|
112
|
+
healthcheck:
|
|
113
|
+
test: ['CMD', 'redis-cli', 'ping']
|
|
114
|
+
interval: 5s
|
|
115
|
+
timeout: 3s
|
|
116
|
+
retries: 5
|
|
117
|
+
|
|
118
|
+
api:
|
|
119
|
+
build: ./app
|
|
120
|
+
ports:
|
|
121
|
+
- '4111:4111'
|
|
122
|
+
environment:
|
|
123
|
+
DATABASE_URL: postgres://mastra:${POSTGRES_PASSWORD}@postgres:5432/mastra
|
|
124
|
+
REDIS_URL: redis://redis:6379
|
|
125
|
+
MASTRA_WORKERS: 'false'
|
|
126
|
+
depends_on:
|
|
127
|
+
postgres:
|
|
128
|
+
condition: service_healthy
|
|
129
|
+
redis:
|
|
130
|
+
condition: service_healthy
|
|
131
|
+
healthcheck:
|
|
132
|
+
test: ['CMD', 'wget', '-qO-', 'http://localhost:4111/api/agents']
|
|
133
|
+
interval: 5s
|
|
134
|
+
timeout: 3s
|
|
135
|
+
retries: 5
|
|
136
|
+
|
|
137
|
+
orchestration-worker:
|
|
138
|
+
build: ./app
|
|
139
|
+
environment:
|
|
140
|
+
DATABASE_URL: postgres://mastra:${POSTGRES_PASSWORD}@postgres:5432/mastra
|
|
141
|
+
REDIS_URL: redis://redis:6379
|
|
142
|
+
MASTRA_WORKERS: orchestration
|
|
143
|
+
MASTRA_STEP_EXECUTION_URL: http://api:4111/api
|
|
144
|
+
depends_on:
|
|
145
|
+
api:
|
|
146
|
+
condition: service_healthy
|
|
147
|
+
|
|
148
|
+
scheduler-worker:
|
|
149
|
+
build: ./app
|
|
150
|
+
environment:
|
|
151
|
+
DATABASE_URL: postgres://mastra:${POSTGRES_PASSWORD}@postgres:5432/mastra
|
|
152
|
+
REDIS_URL: redis://redis:6379
|
|
153
|
+
MASTRA_WORKERS: scheduler
|
|
154
|
+
depends_on:
|
|
155
|
+
api:
|
|
156
|
+
condition: service_healthy
|
|
157
|
+
|
|
158
|
+
background-task-worker:
|
|
159
|
+
build: ./app
|
|
160
|
+
environment:
|
|
161
|
+
DATABASE_URL: postgres://mastra:${POSTGRES_PASSWORD}@postgres:5432/mastra
|
|
162
|
+
REDIS_URL: redis://redis:6379
|
|
163
|
+
MASTRA_WORKERS: backgroundTasks
|
|
164
|
+
depends_on:
|
|
165
|
+
api:
|
|
166
|
+
condition: service_healthy
|
|
167
|
+
|
|
168
|
+
volumes:
|
|
169
|
+
pgdata:
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Create a `.env` file next to your `docker-compose.yml`:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
POSTGRES_PASSWORD=your-secure-password
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
> **Note:** Remember to set any other environment variables your application needs (e.g., your [model provider](https://mastra.ai/models/providers) API key).
|
|
179
|
+
|
|
180
|
+
4. Start the stack and verify the API responds:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
docker compose up -d
|
|
184
|
+
docker compose ps
|
|
185
|
+
curl http://localhost:4111/api/agents
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Step execution URL
|
|
189
|
+
|
|
190
|
+
In a fully split deployment, the orchestration worker runs in a separate container from the API. When it processes a workflow event, it delegates step execution to the API over HTTP.
|
|
191
|
+
|
|
192
|
+
Set `MASTRA_STEP_EXECUTION_URL` to the API's internal URL, including the `/api` prefix:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
MASTRA_STEP_EXECUTION_URL=http://api:4111/api
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The orchestration worker sends a `POST` request to `${MASTRA_STEP_EXECUTION_URL}/workflows/:workflowId/runs/:runId/steps/execute` for each step. The API resolves the workflow and executes the step locally.
|
|
199
|
+
|
|
200
|
+
Without this variable, the orchestration worker attempts to execute steps in-process. That works when the worker runs alongside the API, but fails in split deployments where the worker doesn't have access to the full Mastra runtime.
|
|
201
|
+
|
|
202
|
+
## Scaling
|
|
203
|
+
|
|
204
|
+
The orchestration and background task workers are safe to scale horizontally. PubSub consumer groups distribute events across instances, so each event is processed once:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
docker compose up -d --scale orchestration-worker=3
|
|
208
|
+
docker compose up -d --scale background-task-worker=2
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The API can also scale horizontally behind a load balancer.
|
|
212
|
+
|
|
213
|
+
**Don't scale the scheduler worker.** Run exactly one instance. Multiple schedulers polling the same storage fire duplicate events for the same schedule.
|
|
214
|
+
|
|
215
|
+
## Crash recovery
|
|
216
|
+
|
|
217
|
+
Workers recover from crashes because the distributed PubSub backend persists unacknowledged events:
|
|
218
|
+
|
|
219
|
+
- **Orchestration worker**: Pending events stay in the PubSub backend. When the worker restarts, it picks up where it left off.
|
|
220
|
+
- **Scheduler worker**: No events are missed permanently. The scheduler computes the next fire time from the current time on restart, not from where it left off.
|
|
221
|
+
- **API during step execution**: The orchestration worker's HTTP request fails. The event is nacked and redelivered on the next attempt.
|
|
222
|
+
|
|
223
|
+
> **Warning:** If the API crashes while a step is already executing (e.g., mid-sleep), that step's work is lost. The workflow run may remain stuck in a `running` state. Mastra doesn't yet have automatic timeout-based recovery for this scenario.
|
|
224
|
+
|
|
225
|
+
## Related
|
|
226
|
+
|
|
227
|
+
- [Workers](https://mastra.ai/docs/deployment/workers): What workers are and when to use them
|
|
228
|
+
- [Worker authentication](https://mastra.ai/docs/server/auth/workers): Secure worker-to-API communication
|
|
229
|
+
- [Workers reference](https://mastra.ai/reference/workers/overview): Configuration details for all worker types
|
|
230
|
+
- [CLI reference](https://mastra.ai/reference/cli/mastra): `mastra worker build` and `mastra worker start`
|
|
231
|
+
- [PubSub](https://mastra.ai/docs/server/pubsub): Event delivery backends
|
|
232
|
+
- [Deploy a Mastra server](https://mastra.ai/docs/deployment/mastra-server): Build output and server configuration
|
|
@@ -171,7 +171,7 @@ await worker.run()
|
|
|
171
171
|
|
|
172
172
|
2. Open the Temporal UI at <http://localhost:8080> to inspect namespaces, workflows, and activities.
|
|
173
173
|
|
|
174
|
-
3.
|
|
174
|
+
3. In a new terminal, start the worker by running:
|
|
175
175
|
|
|
176
176
|
```bash
|
|
177
177
|
npx tsx src/mastra/worker.ts
|
|
@@ -84,7 +84,7 @@ export const mastra = new Mastra({
|
|
|
84
84
|
})
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
After deploying, Studio is available at the root URL (`https://<your-project>.vercel.app/`) and the API remains at `/api/*`. Studio automatically connects to the API on the same origin
|
|
87
|
+
After deploying, Studio is available at the root URL (`https://<your-project>.vercel.app/`) and the API remains at `/api/*`. Studio automatically connects to the API on the same origin, so you don't need additional environment variables.
|
|
88
88
|
|
|
89
89
|
> **Warning:** Once Studio is connected to your Mastra server, it has full access to your agents, workflows, and tools. Be sure to secure it properly in production (e.g. behind authentication, VPN, etc.) to prevent unauthorized access.
|
|
90
90
|
|