@mastra/mcp-docs-server 1.2.15-alpha.9 → 1.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agents/agent-approval.md +14 -0
- package/.docs/docs/agents/code-mode.md +17 -2
- package/.docs/docs/agents/networks.md +2 -2
- package/.docs/docs/agents/overview.md +2 -2
- package/.docs/docs/agents/processors.md +3 -3
- package/.docs/docs/agents/using-tools.md +1 -1
- package/.docs/docs/browser/overview.md +8 -8
- package/.docs/docs/browser/recording.md +4 -4
- package/.docs/docs/capabilities/{channels/overview.md → channels.md} +70 -7
- package/.docs/docs/capabilities/subagents.md +6 -3
- package/.docs/docs/datasets/running-experiments.md +49 -0
- package/.docs/docs/deployment/cloud-providers.md +9 -9
- package/.docs/docs/deployment/overview.md +9 -9
- package/.docs/docs/deployment/sandbox.md +3 -3
- package/.docs/docs/deployment/web-framework.md +6 -6
- package/.docs/docs/deployment/workers.md +1 -1
- package/.docs/docs/deployment/workflow-runners.md +2 -2
- package/.docs/docs/getting-started/develop.md +1 -1
- package/.docs/docs/harness/agent-controller.md +45 -4
- package/.docs/docs/harness/overview.md +2 -4
- package/.docs/docs/index.md +8 -8
- package/.docs/docs/long-running-agents/durable-agents.md +3 -3
- package/.docs/docs/long-running-agents/goals.md +1 -1
- package/.docs/docs/long-running-agents/schedules.md +1 -1
- package/.docs/docs/long-running-agents/signal-providers.md +3 -16
- package/.docs/docs/long-running-agents/signals.md +2 -2
- package/.docs/docs/mastra-platform/database.md +2 -2
- package/.docs/docs/mastra-platform/deploy.md +27 -0
- package/.docs/docs/mastra-platform/server.md +1 -1
- package/.docs/docs/mastra-platform/trace-intelligence.md +9 -13
- package/.docs/docs/mcp/overview.md +42 -0
- package/.docs/docs/memory/memory-processors.md +5 -5
- package/.docs/docs/memory/message-history.md +3 -3
- package/.docs/docs/memory/multi-user-threads.md +1 -1
- package/.docs/docs/memory/observational-memory.md +2 -2
- package/.docs/docs/memory/semantic-recall.md +2 -1
- package/.docs/docs/memory/working-memory.md +1 -0
- package/.docs/docs/observability/integrations/exporters/mastra-platform.md +1 -1
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +16 -15
- package/.docs/docs/observability/integrations/overview.md +3 -3
- package/.docs/docs/server/auth/fga.md +1 -1
- package/.docs/docs/server/auth/simple-auth.md +1 -1
- package/.docs/docs/server/auth/workers.md +2 -0
- package/.docs/docs/server/auth.md +10 -8
- package/.docs/docs/server/custom-adapters.md +1 -1
- package/.docs/docs/server/custom-api-routes.md +35 -0
- package/.docs/docs/server/mastra-client.md +2 -2
- package/.docs/docs/server/mastra-server.md +1 -1
- package/.docs/docs/storage/overview.md +14 -12
- package/.docs/docs/studio/observability.md +1 -1
- package/.docs/docs/workflows/dynamic-workflows.md +1 -1
- package/.docs/docs/workflows/overview.md +2 -2
- package/.docs/docs/workflows/snapshots.md +12 -10
- package/.docs/docs/workflows/time-travel.md +2 -0
- package/.docs/docs/workspace/filesystem.md +15 -15
- package/.docs/docs/workspace/sandbox.md +17 -17
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/guides/agent-frameworks/ai-sdk.md +2 -2
- package/.docs/guides/deployment/mastra-workers.md +4 -2
- package/.docs/guides/getting-started/quickstart.md +3 -3
- package/.docs/guides/guide/signal-provider.md +1 -1
- package/.docs/guides/index.md +8 -8
- package/.docs/guides/voice/overview.md +55 -106
- package/.docs/guides/voice/speech-to-text.md +7 -7
- package/.docs/guides/voice/text-to-speech.md +9 -10
- package/.docs/{guides/build-your-ui → integrations/agentic-ui}/ai-sdk-ui.md +5 -5
- package/.docs/{guides/build-your-ui → integrations/agentic-ui}/assistant-ui.md +1 -1
- package/.docs/{guides/build-your-ui/copilotkit/overview.md → integrations/agentic-ui/copilotkit.md} +257 -4
- package/.docs/{docs/server → integrations}/auth/auth0.md +1 -1
- package/.docs/{docs/server → integrations}/auth/clerk.md +2 -2
- package/.docs/{docs/server → integrations}/auth/firebase.md +1 -1
- package/.docs/{docs/server → integrations}/auth/okta.md +24 -4
- package/.docs/{docs/server → integrations}/auth/supabase.md +2 -2
- package/.docs/{docs/server → integrations}/auth/workos.md +1 -1
- package/.docs/{docs/browser → integrations/browsers}/agent-browser.md +2 -2
- package/.docs/{docs/browser → integrations/browsers}/browser-viewer.md +3 -3
- package/.docs/{docs/browser → integrations/browsers}/firecrawl.md +2 -2
- package/.docs/{docs/browser → integrations/browsers}/stagehand.md +1 -1
- package/.docs/{docs/capabilities → integrations}/channels/discord.md +2 -2
- package/.docs/integrations/channels/github.md +103 -0
- package/.docs/{docs/capabilities → integrations}/channels/imessage.md +12 -4
- package/.docs/{docs/capabilities → integrations}/channels/slack.md +4 -4
- package/.docs/{docs/capabilities → integrations}/channels/teams.md +2 -2
- package/.docs/{docs/capabilities → integrations}/channels/telegram.md +2 -2
- package/.docs/{docs/capabilities → integrations}/channels/whatsapp.md +2 -2
- package/.docs/{reference/storage/dsql.md → integrations/databases/aurora-dsql.md} +1 -1
- package/.docs/{reference/storage → integrations/databases}/clickhouse.md +2 -2
- package/.docs/{reference/storage → integrations/databases}/cloudflare-d1.md +1 -1
- package/.docs/{reference/storage/cloudflare.md → integrations/databases/cloudflare-kv.md} +1 -1
- package/.docs/{reference/storage → integrations/databases}/convex.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/duckdb.md +5 -5
- package/.docs/{reference/storage → integrations/databases}/dynamodb.md +1 -1
- package/.docs/{reference/storage/lance.md → integrations/databases/lancedb.md} +1 -1
- package/.docs/{reference/storage → integrations/databases}/libsql.md +2 -2
- package/.docs/{reference/storage → integrations/databases}/mongodb.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/mssql.md +1 -1
- package/.docs/integrations/databases/neon.md +220 -0
- package/.docs/integrations/databases/oracledb.md +239 -0
- package/.docs/{reference/storage → integrations/databases}/postgresql.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/redis.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/spanner.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/upstash.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/amazon-ec2.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/aws-bedrock-agentcore.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/aws-lambda.md +2 -2
- package/.docs/{guides/deployment → integrations/deploy}/azure-app-services.md +2 -2
- package/.docs/{guides/deployment → integrations/deploy}/cloudflare.md +2 -2
- package/.docs/{guides/deployment → integrations/deploy}/digital-ocean.md +3 -3
- package/.docs/{guides/deployment → integrations/deploy}/kubernetes.md +2 -2
- package/.docs/{guides/deployment → integrations/deploy}/netlify.md +3 -3
- package/.docs/{guides/deployment → integrations/deploy}/vercel.md +3 -3
- package/.docs/{reference/workspace/s3-filesystem.md → integrations/file-storage/amazon-s3.md} +5 -5
- package/.docs/{reference/workspace/archil-filesystem.md → integrations/file-storage/archil.md} +3 -3
- package/.docs/{reference/workspace/azure-blob-filesystem.md → integrations/file-storage/azure-blob.md} +2 -2
- package/.docs/{reference/workspace/gcs-filesystem.md → integrations/file-storage/google-cloud-storage.md} +5 -5
- package/.docs/{reference/workspace/mesa-filesystem.md → integrations/file-storage/mesa.md} +2 -2
- package/.docs/{reference/workspace/files-sdk-filesystem.md → integrations/file-storage/vercel-files.md} +5 -5
- package/.docs/{guides/getting-started → integrations/frameworks}/astro.md +1 -1
- package/.docs/{guides/getting-started → integrations/frameworks}/electron.md +3 -3
- package/.docs/{guides/getting-started → integrations/frameworks}/next-js.md +2 -2
- package/.docs/{guides/getting-started → integrations/frameworks}/nuxt.md +1 -1
- package/.docs/{guides/getting-started → integrations/frameworks}/sveltekit.md +1 -1
- package/.docs/{guides/getting-started → integrations/frameworks}/vite-react.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/arize.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/arthur.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/braintrust.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/confident-ai.md +1 -1
- package/.docs/integrations/observability/datadog.md +538 -0
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/laminar.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/langfuse.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/langsmith.md +1 -1
- package/.docs/{docs/observability/integrations/exporters/otel.md → integrations/observability/opentelemetry.md} +278 -46
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/posthog.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/sentry.md +1 -1
- package/.docs/{reference/workspace/apple-container-sandbox.md → integrations/sandboxes/apple-container.md} +1 -1
- package/.docs/{reference/workspace/daytona-sandbox.md → integrations/sandboxes/daytona.md} +23 -2
- package/.docs/{reference/workspace/docker-sandbox.md → integrations/sandboxes/docker.md} +1 -1
- package/.docs/{reference/workspace/e2b-sandbox.md → integrations/sandboxes/e2b.md} +3 -3
- package/.docs/{reference/workspace/modal-sandbox.md → integrations/sandboxes/modal.md} +2 -2
- package/.docs/{reference/workspace/railway-sandbox.md → integrations/sandboxes/railway.md} +8 -0
- package/.docs/{reference/workspace/vercel-sandbox.md → integrations/sandboxes/vercel.md} +141 -12
- package/.docs/{reference → integrations}/tools/brightdata.md +1 -1
- package/.docs/{reference → integrations}/tools/perplexity.md +1 -1
- package/.docs/{reference → integrations}/tools/tavily.md +1 -1
- package/.docs/{reference → integrations}/voice/aws-nova-sonic.md +1 -1
- package/.docs/{reference → integrations}/voice/cloudflare.md +3 -3
- package/.docs/{reference/voice/google-gemini-live.md → integrations/voice/google.md} +305 -30
- package/.docs/{reference/voice/inworld-realtime.md → integrations/voice/inworld.md} +163 -25
- package/.docs/{reference → integrations}/voice/livekit.md +437 -34
- package/.docs/{reference/voice/openai-realtime.md → integrations/voice/openai.md} +117 -20
- package/.docs/integrations.md +147 -0
- package/.docs/models/embeddings.md +3 -3
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/gateways/custom-gateways.md +4 -0
- package/.docs/models/gateways/neon.md +1 -1
- package/.docs/models/gateways/netlify.md +1 -1
- package/.docs/models/gateways/openrouter.md +9 -3
- package/.docs/models/gateways/vercel.md +7 -4
- package/.docs/models/index.md +3 -3
- package/.docs/models/providers/302ai.md +1 -1
- package/.docs/models/providers/abacus.md +1 -1
- package/.docs/models/providers/abliteration-ai.md +1 -1
- package/.docs/models/providers/agentrouter.md +1 -1
- package/.docs/models/providers/ai-router.md +1 -1
- package/.docs/models/providers/aiand.md +1 -1
- package/.docs/models/providers/aki-io.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +1 -1
- package/.docs/models/providers/alibaba-coding-plan-cn.md +1 -1
- package/.docs/models/providers/alibaba-coding-plan.md +1 -1
- package/.docs/models/providers/alibaba-token-plan-cn.md +1 -1
- package/.docs/models/providers/alibaba-token-plan.md +1 -1
- package/.docs/models/providers/alibaba.md +7 -5
- package/.docs/models/providers/ambient.md +2 -2
- package/.docs/models/providers/anyapi.md +1 -1
- package/.docs/models/providers/atomic-chat.md +1 -1
- package/.docs/models/providers/auriko.md +1 -1
- package/.docs/models/providers/bailing.md +1 -1
- package/.docs/models/providers/baseten.md +2 -2
- package/.docs/models/providers/berget.md +1 -1
- package/.docs/models/providers/blueclaw.md +1 -1
- package/.docs/models/providers/chutes.md +1 -1
- package/.docs/models/providers/clarifai.md +1 -1
- package/.docs/models/providers/claudinio.md +1 -1
- package/.docs/models/providers/cline-pass.md +1 -1
- package/.docs/models/providers/cloudferro-sherlock.md +1 -1
- package/.docs/models/providers/cloudflare-workers-ai.md +1 -1
- package/.docs/models/providers/coralbricks.md +75 -0
- package/.docs/models/providers/cortecs.md +3 -5
- package/.docs/models/providers/crof.md +1 -1
- package/.docs/models/providers/crossmodel.md +2 -3
- package/.docs/models/providers/daoxe.md +1 -1
- package/.docs/models/providers/databricks.md +1 -1
- package/.docs/models/providers/deepinfra.md +6 -5
- package/.docs/models/providers/digitalocean.md +5 -5
- package/.docs/models/providers/dinference.md +1 -1
- package/.docs/models/providers/drun.md +1 -1
- package/.docs/models/providers/ebcloud.md +1 -1
- package/.docs/models/providers/empiriolabs.md +3 -2
- package/.docs/models/providers/evroc.md +3 -4
- package/.docs/models/providers/fastrouter.md +1 -1
- package/.docs/models/providers/firepass.md +1 -1
- package/.docs/models/providers/fireworks-ai.md +1 -1
- package/.docs/models/providers/firmware.md +1 -1
- package/.docs/models/providers/freemodel.md +1 -1
- package/.docs/models/providers/friendli.md +1 -1
- package/.docs/models/providers/frogbot.md +1 -1
- package/.docs/models/providers/github-models.md +1 -1
- package/.docs/models/providers/gmicloud.md +1 -1
- package/.docs/models/providers/google.md +1 -1
- package/.docs/models/providers/greenpt.md +1 -1
- package/.docs/models/providers/helicone.md +1 -1
- package/.docs/models/providers/hetzner.md +8 -5
- package/.docs/models/providers/hpc-ai.md +1 -1
- package/.docs/models/providers/huggingface.md +1 -1
- package/.docs/models/providers/hyper.md +7 -7
- package/.docs/models/providers/iflowcn.md +1 -1
- package/.docs/models/providers/impossibl.md +1 -1
- package/.docs/models/providers/inception.md +1 -1
- package/.docs/models/providers/inceptron.md +1 -1
- package/.docs/models/providers/inference.md +1 -1
- package/.docs/models/providers/inferx.md +1 -1
- package/.docs/models/providers/infomaniak.md +1 -1
- package/.docs/models/providers/io-intelligence.md +1 -1
- package/.docs/models/providers/io-net.md +1 -1
- package/.docs/models/providers/jiekou.md +1 -1
- package/.docs/models/providers/kenari.md +1 -1
- package/.docs/models/providers/kilo.md +16 -11
- package/.docs/models/providers/kimi-for-coding.md +1 -1
- package/.docs/models/providers/kiro.md +1 -1
- package/.docs/models/providers/kuae-cloud-coding-plan.md +1 -1
- package/.docs/models/providers/lilac.md +1 -1
- package/.docs/models/providers/llama.md +1 -1
- package/.docs/models/providers/llmgateway.md +2 -7
- package/.docs/models/providers/llmtr.md +1 -1
- package/.docs/models/providers/lmstudio.md +1 -1
- package/.docs/models/providers/longcat.md +1 -1
- package/.docs/models/providers/lucidquery.md +1 -1
- package/.docs/models/providers/lynkr.md +1 -1
- package/.docs/models/providers/meganova.md +1 -1
- package/.docs/models/providers/meta.md +1 -1
- package/.docs/models/providers/minimax-cn-coding-plan.md +1 -1
- package/.docs/models/providers/minimax-cn.md +1 -1
- package/.docs/models/providers/minimax-coding-plan.md +1 -1
- package/.docs/models/providers/minimax.md +1 -1
- package/.docs/models/providers/mixlayer.md +1 -1
- package/.docs/models/providers/moark.md +1 -1
- package/.docs/models/providers/modal.md +1 -1
- package/.docs/models/providers/model-oracle-ai.md +1 -1
- package/.docs/models/providers/modelis.md +1 -1
- package/.docs/models/providers/modelscope.md +1 -1
- package/.docs/models/providers/moonshotai-cn.md +1 -1
- package/.docs/models/providers/moonshotai.md +1 -1
- package/.docs/models/providers/morph.md +1 -1
- package/.docs/models/providers/nano-gpt.md +8 -4
- package/.docs/models/providers/nearai.md +1 -1
- package/.docs/models/providers/nebius.md +3 -2
- package/.docs/models/providers/neuralwatt.md +1 -1
- package/.docs/models/providers/nova.md +1 -1
- package/.docs/models/providers/novita-ai.md +1 -1
- package/.docs/models/providers/nvidia.md +3 -2
- package/.docs/models/providers/ofox.md +4 -3
- package/.docs/models/providers/ollama-cloud.md +1 -1
- package/.docs/models/providers/opencode-go.md +1 -1
- package/.docs/models/providers/opencode.md +65 -64
- package/.docs/models/providers/orcarouter.md +1 -1
- package/.docs/models/providers/ovhcloud.md +1 -1
- package/.docs/models/providers/perplexity-agent.md +1 -1
- package/.docs/models/providers/pioneer.md +1 -1
- package/.docs/models/providers/poe.md +1 -1
- package/.docs/models/providers/poolside.md +1 -1
- package/.docs/models/providers/privatemode-ai.md +12 -10
- package/.docs/models/providers/qihang-ai.md +1 -1
- package/.docs/models/providers/qiniu-ai.md +1 -1
- package/.docs/models/providers/regolo-ai.md +26 -21
- package/.docs/models/providers/requesty.md +3 -3
- package/.docs/models/providers/routing-run.md +1 -1
- package/.docs/models/providers/sakana.md +1 -1
- package/.docs/models/providers/sarvam.md +1 -1
- package/.docs/models/providers/scaleway.md +1 -1
- package/.docs/models/providers/scx.md +1 -1
- package/.docs/models/providers/siliconflow-cn.md +1 -1
- package/.docs/models/providers/siliconflow.md +1 -1
- package/.docs/models/providers/snowflake-cortex.md +6 -2
- package/.docs/models/providers/stackit.md +1 -1
- package/.docs/models/providers/stepfun-ai-step-plan.md +1 -1
- package/.docs/models/providers/stepfun-ai.md +1 -1
- package/.docs/models/providers/stepfun-step-plan.md +1 -1
- package/.docs/models/providers/stepfun.md +1 -1
- package/.docs/models/providers/subconscious.md +1 -1
- package/.docs/models/providers/submodel.md +1 -1
- package/.docs/models/providers/synthetic.md +1 -1
- package/.docs/models/providers/tencent-coding-plan.md +1 -1
- package/.docs/models/providers/tencent-token-plan.md +1 -1
- package/.docs/models/providers/tencent-tokenhub.md +1 -1
- package/.docs/models/providers/tensorx.md +1 -1
- package/.docs/models/providers/the-grid-ai.md +1 -1
- package/.docs/models/providers/thinkingmachines.md +1 -1
- package/.docs/models/providers/tinfoil.md +2 -2
- package/.docs/models/providers/togetherai.md +1 -1
- package/.docs/models/providers/trustedrouter.md +1 -1
- package/.docs/models/providers/umans-ai-coding-plan.md +1 -1
- package/.docs/models/providers/umans-ai.md +1 -1
- package/.docs/models/providers/unorouter.md +1 -1
- package/.docs/models/providers/upstage.md +1 -1
- package/.docs/models/providers/venice.md +1 -1
- package/.docs/models/providers/vivgrid.md +1 -1
- package/.docs/models/providers/vultr.md +1 -1
- package/.docs/models/providers/wafer.ai.md +1 -1
- package/.docs/models/providers/wandb.md +3 -2
- package/.docs/models/providers/xiaomi-token-plan-ams.md +1 -1
- package/.docs/models/providers/xiaomi-token-plan-cn.md +1 -1
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +1 -1
- package/.docs/models/providers/xiaomi.md +1 -1
- package/.docs/models/providers/xpersona.md +1 -1
- package/.docs/models/providers/zai-coding-plan.md +1 -1
- package/.docs/models/providers/zai.md +1 -1
- package/.docs/models/providers/zeldoc.md +8 -8
- package/.docs/models/providers/zenifra.md +1 -1
- package/.docs/models/providers/zenmux.md +1 -16
- package/.docs/models/providers/zhipuai-coding-plan.md +1 -1
- package/.docs/models/providers/zhipuai.md +1 -1
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/agent-controller/agent-controller-class.md +35 -4
- package/.docs/reference/agent-controller/session.md +5 -3
- package/.docs/reference/agents/channels.md +2 -2
- package/.docs/reference/agents/durable-agent.md +2 -0
- package/.docs/reference/agents/generateLegacy.md +2 -2
- package/.docs/reference/agents/getDefaultOptions.md +1 -1
- package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
- package/.docs/reference/agents/inngest-agent.md +3 -1
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/ai-sdk/handle-network-stream.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +1 -1
- package/.docs/reference/auth/auth0.md +1 -1
- package/.docs/reference/auth/better-auth.md +1 -1
- package/.docs/reference/auth/clerk.md +1 -1
- package/.docs/reference/auth/firebase.md +1 -1
- package/.docs/reference/auth/google.md +1 -1
- package/.docs/reference/auth/okta.md +5 -1
- package/.docs/reference/auth/supabase.md +1 -1
- package/.docs/reference/auth/workos.md +1 -1
- package/.docs/reference/browser/agent-browser.md +2 -2
- package/.docs/reference/browser/browser-viewer.md +1 -1
- package/.docs/reference/browser/firecrawl-browser.md +1 -1
- package/.docs/reference/browser/mastra-browser.md +1 -1
- package/.docs/reference/browser/stagehand-browser.md +2 -2
- package/.docs/reference/channels/channel-provider.md +1 -1
- package/.docs/reference/channels/slack-provider.md +2 -2
- package/.docs/reference/cli/mastra.md +6 -6
- package/.docs/reference/client-js/agents.md +2 -1
- package/.docs/reference/client-js/workflows.md +3 -3
- package/.docs/reference/code-sdk/mount-agent-controller.md +1 -1
- package/.docs/reference/configuration.md +21 -27
- package/.docs/reference/core/addDynamicWorkflow.md +2 -2
- package/.docs/reference/core/addDynamicWorkflows.md +2 -2
- package/.docs/reference/core/getStorage.md +1 -1
- package/.docs/reference/core/getVector.md +2 -2
- package/.docs/reference/core/listVectors.md +2 -2
- package/.docs/reference/core/setStorage.md +1 -1
- package/.docs/reference/datasets/startExperiment.md +8 -0
- package/.docs/reference/file-based-agents/config.md +2 -0
- package/.docs/reference/file-based-agents/instructions.md +2 -0
- package/.docs/reference/file-based-agents/logger.md +2 -0
- package/.docs/reference/file-based-agents/memory.md +2 -0
- package/.docs/reference/file-based-agents/observability.md +2 -0
- package/.docs/reference/file-based-agents/processors.md +2 -0
- package/.docs/reference/file-based-agents/schedules.md +2 -0
- package/.docs/reference/file-based-agents/scorers.md +2 -0
- package/.docs/reference/file-based-agents/server.md +2 -0
- package/.docs/reference/file-based-agents/skills.md +2 -0
- package/.docs/reference/file-based-agents/storage.md +3 -1
- package/.docs/reference/file-based-agents/studio.md +3 -1
- package/.docs/reference/file-based-agents/subagents.md +2 -0
- package/.docs/reference/file-based-agents/tools.md +2 -0
- package/.docs/reference/file-based-agents/workflows.md +2 -0
- package/.docs/reference/file-based-agents/workspace.md +2 -0
- package/.docs/reference/index.md +29 -54
- package/.docs/{guides/getting-started → reference}/manual-install.md +2 -2
- package/.docs/{guides → reference}/migrations/ai-sdk-v4-to-v5.md +1 -1
- package/.docs/{guides → reference}/migrations/mastra-cloud.md +2 -2
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/cli.md +1 -1
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/memory.md +1 -1
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/overview.md +41 -41
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/tools.md +1 -1
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/tracing.md +10 -10
- package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
- package/.docs/reference/observability/tracing/bridges/otel.md +2 -2
- package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
- package/.docs/reference/observability/tracing/exporters/arthur.md +1 -1
- package/.docs/reference/observability/tracing/exporters/confident-ai.md +1 -1
- package/.docs/reference/observability/tracing/exporters/datadog.md +1 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +12 -0
- package/.docs/reference/observability/tracing/exporters/otel.md +2 -2
- package/.docs/reference/processors/pii-detector.md +2 -0
- package/.docs/reference/processors/prompt-injection-detector.md +2 -0
- package/.docs/reference/processors/regex-filter-processor.md +20 -0
- package/.docs/reference/processors/response-cache.md +2 -0
- package/.docs/reference/processors/tool-search-processor.md +33 -1
- package/.docs/reference/pubsub/lease-provider.md +1 -1
- package/.docs/{guides → reference}/rag/chunking-and-embedding.md +16 -19
- package/.docs/reference/rag/database-config.md +1 -1
- package/.docs/{guides/rag/graph-rag.md → reference/rag/graph-rag-guide.md} +1 -1
- package/.docs/reference/rag/metadata-filters.md +13 -4
- package/.docs/{guides → reference}/rag/overview.md +2 -2
- package/.docs/{guides → reference}/rag/retrieval.md +18 -1
- package/.docs/{guides → reference}/rag/vector-databases.md +42 -1
- package/.docs/reference/schedules/overview.md +2 -0
- package/.docs/reference/server/create-route.md +27 -1
- package/.docs/reference/server/register-api-route.md +2 -0
- package/.docs/reference/signals/create-notification-inbox-tool.md +2 -0
- package/.docs/reference/signals/signal-provider.md +2 -0
- package/.docs/reference/signals/task-signal-provider.md +2 -0
- package/.docs/reference/signals/webhook-signal-provider.md +2 -0
- package/.docs/reference/storage/composite.md +4 -4
- package/.docs/reference/storage/retention.md +4 -4
- package/.docs/reference/streaming/ChunkType.md +3 -3
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/streaming/agents/streamLegacy.md +3 -3
- package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
- package/.docs/reference/tools/create-code-mode.md +3 -1
- package/.docs/reference/tools/isolated-vm-transport.md +1 -1
- package/.docs/reference/tools/mcp-client.md +51 -0
- package/.docs/reference/tools/mcp-server.md +1 -1
- package/.docs/reference/tools/quickjs-transport.md +92 -0
- package/.docs/reference/vectors/chroma.md +1 -1
- package/.docs/reference/vectors/convex.md +2 -2
- package/.docs/reference/vectors/oracledb.md +347 -0
- package/.docs/reference/workers/overview.md +10 -8
- package/.docs/reference/workflows/dynamic-workflow-definition.md +3 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -0
- package/.docs/reference/workflows/workflow.md +18 -0
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/platform-filesystem.md +3 -3
- package/.docs/reference/workspace/platform-sandbox.md +11 -3
- package/.docs/reference/workspace/process-manager.md +3 -3
- package/.docs/reference/workspace/sandbox.md +10 -0
- package/CHANGELOG.md +90 -0
- package/dist/index.js +1 -1
- package/dist/{src-BZcgzbk9.js → src-D-W-bx5t.js} +2 -2
- package/dist/{src-BZcgzbk9.js.map → src-D-W-bx5t.js.map} +1 -1
- package/dist/stdio.js +1 -1
- package/package.json +6 -6
- package/.docs/docs/capabilities/channels/other-adapters.md +0 -68
- package/.docs/docs/observability/integrations/bridges/datadog.md +0 -219
- package/.docs/docs/observability/integrations/bridges/otel.md +0 -234
- package/.docs/docs/observability/integrations/exporters/datadog.md +0 -321
- package/.docs/guides/build-your-ui/copilotkit/channels.md +0 -86
- package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +0 -174
- package/.docs/guides/guide/chef-michel.md +0 -211
- package/.docs/guides/guide/publishing-mcp-server.md +0 -137
- package/.docs/guides/guide/slack-assistant.md +0 -193
- package/.docs/guides/guide/stock-agent.md +0 -132
- package/.docs/guides/guide/web-search.md +0 -322
- package/.docs/guides/guide/whatsapp-chat-bot.md +0 -407
- package/.docs/guides/voice/realtime-voice.md +0 -430
- package/.docs/reference/voice/google.md +0 -290
- package/.docs/reference/voice/inworld.md +0 -137
- package/.docs/reference/voice/openai.md +0 -96
- package/.docs/reference/voice/playai.md +0 -82
- package/.docs/reference/workspace/vercel-serverless.md +0 -128
- /package/.docs/{guides/concepts → docs/guides}/multi-agent-systems.md +0 -0
- /package/.docs/{guides/concepts → docs/guides}/streaming.md +0 -0
- /package/.docs/{guides/build-your-ui → integrations/agentic-ui}/openui.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/better-auth.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/google.md +0 -0
- /package/.docs/{guides/deployment → integrations/deploy}/inngest.md +0 -0
- /package/.docs/{guides/deployment → integrations/deploy}/temporal.md +0 -0
- /package/.docs/{reference/workspace/agentfs-filesystem.md → integrations/file-storage/agentfs.md} +0 -0
- /package/.docs/{reference/workspace/google-drive-filesystem.md → integrations/file-storage/google-drive.md} +0 -0
- /package/.docs/{guides/getting-started → integrations/frameworks}/express.md +0 -0
- /package/.docs/{guides/getting-started → integrations/frameworks}/hono.md +0 -0
- /package/.docs/{guides/getting-started → integrations/frameworks}/nestjs.md +0 -0
- /package/.docs/{reference/workspace/agentcore-runtime-sandbox.md → integrations/sandboxes/agentcore.md} +0 -0
- /package/.docs/{reference/workspace/blaxel-sandbox.md → integrations/sandboxes/blaxel.md} +0 -0
- /package/.docs/{guides/guide → integrations/tools}/firecrawl.md +0 -0
- /package/.docs/{reference → integrations}/voice/azure.md +0 -0
- /package/.docs/{reference → integrations}/voice/deepgram.md +0 -0
- /package/.docs/{reference → integrations}/voice/elevenlabs.md +0 -0
- /package/.docs/{reference → integrations}/voice/mistral.md +0 -0
- /package/.docs/{reference → integrations}/voice/murf.md +0 -0
- /package/.docs/{reference → integrations}/voice/sarvam.md +0 -0
- /package/.docs/{reference → integrations}/voice/speechify.md +0 -0
- /package/.docs/{reference/voice/xai-realtime.md → integrations/voice/xai.md} +0 -0
- /package/.docs/{guides → reference}/migrations/agentnetwork.md +0 -0
- /package/.docs/{guides → reference}/migrations/network-to-supervisor.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/agent.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/client.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/deployment.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/evals.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/mastra.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/mcp.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/processors.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/rag.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/storage.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/vectors.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/voice.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/workflows.md +0 -0
- /package/.docs/{guides → reference}/migrations/vnext-to-standard-apis.md +0 -0
|
@@ -90,6 +90,20 @@ for await (const chunk of stream.fullStream) {
|
|
|
90
90
|
}
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
+
#### Explaining a decline
|
|
94
|
+
|
|
95
|
+
`declineToolCall()`, `declineToolCallGenerate()`, and `declineNetworkToolCall()` accept an optional `reason`. The reason is returned to the model in place of the tool result, so the model can adjust instead of retrying blindly. It's also stored on the tool call's `approval` metadata, so it's still there when the conversation is recalled.
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
const declined = await agent.declineToolCall({
|
|
99
|
+
runId: stream.runId,
|
|
100
|
+
toolCallId,
|
|
101
|
+
reason: 'Reading other users PII is not allowed, ask the user for their own email instead',
|
|
102
|
+
})
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Without a `reason`, the model receives the default message `Tool call was not approved by the user`.
|
|
106
|
+
|
|
93
107
|
#### Conditional approval with a function
|
|
94
108
|
|
|
95
109
|
Instead of a boolean, `requireToolApproval` accepts a function that decides per tool call. It receives the `toolName`, the `args` the model passed, the `requestContext`, and the `workspace`. Return `true` to require approval for that call, or `false` to allow it. This lets you gate approval at runtime, for example, only for tools whose name matches a pattern:
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Added in:** `@mastra/core@1.38.0`
|
|
6
6
|
|
|
7
|
-
> **Beta:**
|
|
7
|
+
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
8
8
|
|
|
9
9
|
Code mode lets an agent run multi-tool computations in an isolated sandbox and return the result as a single, more accurate response.
|
|
10
10
|
|
|
@@ -134,7 +134,7 @@ The generated code for `sales_code` can't call an inventory tool, and the revers
|
|
|
134
134
|
|
|
135
135
|
## Remote sandboxes
|
|
136
136
|
|
|
137
|
-
By default, code mode uses a transport that writes the program to the host filesystem and runs `node` against it. That works for `LocalSandbox`, which shares the host, but not for remote sandboxes that run in their own micro-VM (such as [E2B](https://mastra.ai/
|
|
137
|
+
By default, code mode uses a transport that writes the program to the host filesystem and runs `node` against it. That works for `LocalSandbox`, which shares the host, but not for remote sandboxes that run in their own micro-VM (such as [E2B](https://mastra.ai/integrations/sandboxes/e2b)), where the host paths don't exist.
|
|
138
138
|
|
|
139
139
|
Remote sandboxes need a transport that writes the program into the sandbox filesystem. For E2B, pass the included `E2BCodeModeTransport` as the second argument to `createCodeMode`:
|
|
140
140
|
|
|
@@ -164,9 +164,24 @@ const { tool, instructions } = createCodeMode(
|
|
|
164
164
|
|
|
165
165
|
`isolated-vm` is a native addon, and on Node.js 20 and later the host process must be started with the `--no-node-snapshot` flag. See the [IsolatedVmCodeModeTransport reference](https://mastra.ai/reference/tools/isolated-vm-transport) for setup details.
|
|
166
166
|
|
|
167
|
+
When the host can't install native addons or set Node.js flags, which is common on serverless platforms, use [`QuickJsCodeModeTransport`](https://mastra.ai/reference/tools/quickjs-transport) from `@mastra/quickjs` instead. It gives the same in-process boundary using a QuickJS runtime compiled to WebAssembly, at the cost of slower execution:
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
import { createCodeMode } from '@mastra/core/tools'
|
|
171
|
+
import { QuickJsCodeModeTransport } from '@mastra/quickjs'
|
|
172
|
+
|
|
173
|
+
const { tool, instructions } = createCodeMode(
|
|
174
|
+
{ tools }, // no sandbox needed
|
|
175
|
+
new QuickJsCodeModeTransport({ memoryLimitMb: 128 }),
|
|
176
|
+
)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
See [Choosing a transport](https://mastra.ai/reference/tools/quickjs-transport) for a side-by-side comparison.
|
|
180
|
+
|
|
167
181
|
## Related
|
|
168
182
|
|
|
169
183
|
- [createCodeMode() reference](https://mastra.ai/reference/tools/create-code-mode)
|
|
170
184
|
- [IsolatedVmCodeModeTransport reference](https://mastra.ai/reference/tools/isolated-vm-transport)
|
|
185
|
+
- [QuickJsCodeModeTransport reference](https://mastra.ai/reference/tools/quickjs-transport)
|
|
171
186
|
- [Tools](https://mastra.ai/docs/agents/using-tools)
|
|
172
187
|
- [Workspace overview](https://mastra.ai/docs/workspace/overview)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> **Deprecated:** Agent networks are deprecated and will be removed in a future major release. [Supervisor agents](https://mastra.ai/docs/capabilities/subagents) using `agent.stream()` or `agent.generate()` are now the recommended approach. It provides the same multi-agent coordination with better control, a simpler API, and easier debugging.
|
|
6
6
|
>
|
|
7
|
-
> See the [migration guide](https://mastra.ai/
|
|
7
|
+
> See the [migration guide](https://mastra.ai/reference/migrations/network-to-supervisor) to upgrade.
|
|
8
8
|
|
|
9
9
|
A **routing agent** uses an LLM to interpret a request and decide which primitives (subagents, workflows, or tools) to call, in what order, and with what data.
|
|
10
10
|
|
|
@@ -181,4 +181,4 @@ Requirements for automatic resumption:
|
|
|
181
181
|
## Related
|
|
182
182
|
|
|
183
183
|
- [Supervisor agents](https://mastra.ai/docs/capabilities/subagents)
|
|
184
|
-
- [Migration: `.network()` to supervisor agents](https://mastra.ai/
|
|
184
|
+
- [Migration: `.network()` to supervisor agents](https://mastra.ai/reference/migrations/network-to-supervisor)
|
|
@@ -211,10 +211,10 @@ Once your agent is running, use this table to find the right page for what you w
|
|
|
211
211
|
| Build agents that correct their work | [Rubric scorer](https://mastra.ai/docs/capabilities/subagents) |
|
|
212
212
|
| Swap instructions or models based on request context | [Dynamic configuration](https://mastra.ai/docs/server/request-context) |
|
|
213
213
|
| Add speech-to-text or text-to-speech | [Voice](https://mastra.ai/guides/voice/overview) |
|
|
214
|
-
| Connect to Slack, Discord, or Telegram | [Channels](https://mastra.ai/docs/capabilities/channels
|
|
214
|
+
| Connect to Slack, Discord, or Telegram | [Channels](https://mastra.ai/docs/capabilities/channels) |
|
|
215
215
|
|
|
216
216
|
## Multi-agent systems
|
|
217
217
|
|
|
218
218
|
A multi-agent system uses multiple agents to solve a task that's too broad or too specialized for a single agent. Instead of building one agent with dozens of tools and a long instruction set, you split responsibilities across focused agents and let a coordinator bring results together.
|
|
219
219
|
|
|
220
|
-
Read the [conceptual overview of multi-agent systems](https://mastra.ai/guides/
|
|
220
|
+
Read the [conceptual overview of multi-agent systems](https://mastra.ai/docs/guides/multi-agent-systems) to learn how you can apply different patterns with Mastra.
|
|
@@ -432,7 +432,7 @@ See the [`ProviderHistoryCompat` reference](https://mastra.ai/reference/processo
|
|
|
432
432
|
|
|
433
433
|
## Response caching
|
|
434
434
|
|
|
435
|
-
> **Beta:**
|
|
435
|
+
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
436
436
|
|
|
437
437
|
Response caching skips the LLM call and replays a previously cached response when an agent receives an identical request. Use it to reduce latency and avoid paying for repeated calls.
|
|
438
438
|
|
|
@@ -544,7 +544,7 @@ This means the cache key is derived from the resolved `LanguageModelV2Prompt` Ma
|
|
|
544
544
|
|
|
545
545
|
When you don't supply `key`, the processor derives one deterministically from the inputs that change the LLM's response at this step: `agentId`, `stepNumber` (so each step in a tool loop has its own cache entry), `scope`, model identity (`provider`, `modelId`, spec version), and the resolved `prompt` (post-memory + post-processors). Any change to these inputs automatically invalidates the cache.
|
|
546
546
|
|
|
547
|
-
Multimodal prompts are included too. Image and file parts reach the key by value: a URL
|
|
547
|
+
Multimodal prompts are included too. Image and file parts reach the key by value: the key includes a URL's full href, and a digest of the bytes for inline binary data (`Uint8Array`, `ArrayBuffer`). Requests that differ only in which image they reference therefore get different cache entries.
|
|
548
548
|
|
|
549
549
|
#### Customize the cache key
|
|
550
550
|
|
|
@@ -664,7 +664,7 @@ export class SteeringReminderProcessor implements Processor {
|
|
|
664
664
|
}
|
|
665
665
|
```
|
|
666
666
|
|
|
667
|
-
A transient signal still
|
|
667
|
+
A transient signal is still in the prompt for the current call, so the model sees it near the latest turn. It's not retained, so re-sending it each turn keeps a single fresh copy in context instead of an accumulating history, and stored thread history never includes it. Because nothing is written, it also keeps a stable prompt cache prefix across turns.
|
|
668
668
|
|
|
669
669
|
### Emit custom stream events
|
|
670
670
|
|
|
@@ -353,7 +353,7 @@ Agent-level and per-execution hooks merge per key: passing only `beforeToolCall`
|
|
|
353
353
|
|
|
354
354
|
Tools support lifecycle hooks that allow you to monitor different stages of tool execution during streaming. These hooks are particularly useful for logging or analytics.
|
|
355
355
|
|
|
356
|
-
For generic `writer` API usage, see [Streaming](https://mastra.ai/guides/
|
|
356
|
+
For generic `writer` API usage, see [Streaming](https://mastra.ai/docs/guides/streaming).
|
|
357
357
|
|
|
358
358
|
### Available Hooks
|
|
359
359
|
|
|
@@ -6,10 +6,10 @@ Browser support enables agents to move through websites, interact with page elem
|
|
|
6
6
|
|
|
7
7
|
Mastra supports three SDK providers and one CLI provider:
|
|
8
8
|
|
|
9
|
-
- [**AgentBrowser**](https://mastra.ai/
|
|
10
|
-
- [**Stagehand**](https://mastra.ai/
|
|
11
|
-
- [**FirecrawlBrowser**](https://mastra.ai/
|
|
12
|
-
- [**BrowserViewer**](https://mastra.ai/
|
|
9
|
+
- [**AgentBrowser**](https://mastra.ai/integrations/browsers/agent-browser): A Playwright-based provider with accessibility-first element targeting. Best for general web automation and scraping.
|
|
10
|
+
- [**Stagehand**](https://mastra.ai/integrations/browsers/stagehand): A Browserbase provider with AI-powered element detection. Best for complex interactions that benefit from natural language selectors.
|
|
11
|
+
- [**FirecrawlBrowser**](https://mastra.ai/integrations/browsers/firecrawl): A Firecrawl Browser Sandbox provider that runs AgentBrowser tools against hosted browser sessions. Best for running automation on hosted browser sessions without managing local browser infrastructure.
|
|
12
|
+
- [**BrowserViewer**](https://mastra.ai/integrations/browsers/browser-viewer): A CLI provider that launches Chrome and injects CDP URLs into CLI tools like agent-browser, browser-use, and browse. Best for workspace agents that drive browsers through shell commands.
|
|
13
13
|
- [**Browser recording (alpha)**](https://mastra.ai/docs/browser/recording): An opt-in tool layer that saves browser sessions as Motion-JPEG AVI videos with optional captions.
|
|
14
14
|
|
|
15
15
|
## When to use browser
|
|
@@ -178,10 +178,10 @@ const browser = new AgentBrowser({
|
|
|
178
178
|
|
|
179
179
|
## Next steps
|
|
180
180
|
|
|
181
|
-
- [AgentBrowser](https://mastra.ai/
|
|
182
|
-
- [Stagehand](https://mastra.ai/
|
|
183
|
-
- [Firecrawl](https://mastra.ai/
|
|
181
|
+
- [AgentBrowser](https://mastra.ai/integrations/browsers/agent-browser)
|
|
182
|
+
- [Stagehand](https://mastra.ai/integrations/browsers/stagehand)
|
|
183
|
+
- [Firecrawl](https://mastra.ai/integrations/browsers/firecrawl)
|
|
184
184
|
- [Browser recording (alpha)](https://mastra.ai/docs/browser/recording)
|
|
185
|
-
- [BrowserViewer](https://mastra.ai/
|
|
185
|
+
- [BrowserViewer](https://mastra.ai/integrations/browsers/browser-viewer)
|
|
186
186
|
- [MastraBrowser reference](https://mastra.ai/reference/browser/mastra-browser)
|
|
187
187
|
- 📹 [Mastra browser capabilities workshop](https://www.youtube.com/watch?v=E9KFsZEnQO8\&t=5s)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
2
|
|
|
3
|
-
# Browser recording
|
|
3
|
+
# Browser recording
|
|
4
4
|
|
|
5
5
|
**Added in:** `@mastra/core@1.43.0`
|
|
6
6
|
|
|
7
7
|
Browser recording adds two opt-in tools that let an agent save a browser session as a Motion-JPEG AVI video. The agent can also add short captions while it works.
|
|
8
8
|
|
|
9
|
-
> **Beta:**
|
|
9
|
+
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
10
10
|
|
|
11
11
|
## When to use browser recording
|
|
12
12
|
|
|
@@ -115,6 +115,6 @@ Use shorter recordings when possible. Long browser sessions produce larger files
|
|
|
115
115
|
|
|
116
116
|
## Next steps
|
|
117
117
|
|
|
118
|
-
- [AgentBrowser](https://mastra.ai/
|
|
119
|
-
- [Stagehand](https://mastra.ai/
|
|
118
|
+
- [AgentBrowser](https://mastra.ai/integrations/browsers/agent-browser)
|
|
119
|
+
- [Stagehand](https://mastra.ai/integrations/browsers/stagehand)
|
|
120
120
|
- [Browser overview](https://mastra.ai/docs/browser/overview)
|
|
@@ -8,14 +8,15 @@ Channels connect agents to messaging and collaboration platforms like Slack, Mic
|
|
|
8
8
|
|
|
9
9
|
Start with the page for your platform:
|
|
10
10
|
|
|
11
|
-
- [Slack](https://mastra.ai/
|
|
12
|
-
- [Microsoft Teams](https://mastra.ai/
|
|
13
|
-
- [Discord](https://mastra.ai/
|
|
14
|
-
- [Telegram](https://mastra.ai/
|
|
15
|
-
- [WhatsApp](https://mastra.ai/
|
|
16
|
-
- [iMessage](https://mastra.ai/
|
|
11
|
+
- [Slack](https://mastra.ai/integrations/channels/slack)
|
|
12
|
+
- [Microsoft Teams](https://mastra.ai/integrations/channels/teams)
|
|
13
|
+
- [Discord](https://mastra.ai/integrations/channels/discord)
|
|
14
|
+
- [Telegram](https://mastra.ai/integrations/channels/telegram)
|
|
15
|
+
- [WhatsApp](https://mastra.ai/integrations/channels/whatsapp)
|
|
16
|
+
- [iMessage](https://mastra.ai/integrations/channels/imessage)
|
|
17
|
+
- [GitHub](https://mastra.ai/integrations/channels/github)
|
|
17
18
|
|
|
18
|
-
[
|
|
19
|
+
[Other adapters](#other-adapters) lists additional platforms. Mastra channels work with compatible [Chat SDK adapters](https://chat-sdk.dev/adapters) beyond the platforms listed here, and the same Mastra configuration pattern applies across adapters.
|
|
19
20
|
|
|
20
21
|
## When to use channels
|
|
21
22
|
|
|
@@ -274,6 +275,68 @@ export const mastra = new Mastra({
|
|
|
274
275
|
|
|
275
276
|
Vercel's managed Redis integration and Upstash Redis both work well. For more on when a distributed pub/sub is needed, see the [PubSub guide](https://mastra.ai/docs/server/pubsub) and the [`RedisStreamsPubSub` reference](https://mastra.ai/reference/pubsub/redis-streams).
|
|
276
277
|
|
|
278
|
+
## Other adapters
|
|
279
|
+
|
|
280
|
+
Mastra channels use Chat SDK adapters, so the platform guides aren't the full list of supported platforms. Use any Chat SDK platform adapter that exports an adapter factory compatible with `channels.adapters`.
|
|
281
|
+
|
|
282
|
+
### Adapter catalog
|
|
283
|
+
|
|
284
|
+
The [Chat SDK adapter catalog](https://chat-sdk.dev/adapters) is the canonical source for available adapters. The list below is a snapshot and may not always be up to date.
|
|
285
|
+
|
|
286
|
+
At the time of writing, Chat SDK lists adapters for:
|
|
287
|
+
|
|
288
|
+
- AgentPhone
|
|
289
|
+
- Baileys WhatsApp
|
|
290
|
+
- Discord
|
|
291
|
+
- GitHub
|
|
292
|
+
- Google Chat
|
|
293
|
+
- iMessage
|
|
294
|
+
- Kapso
|
|
295
|
+
- Lark / Feishu
|
|
296
|
+
- Linear
|
|
297
|
+
- Liveblocks
|
|
298
|
+
- Matrix
|
|
299
|
+
- Mattermost
|
|
300
|
+
- Messenger
|
|
301
|
+
- Novu
|
|
302
|
+
- Resend
|
|
303
|
+
- Sendblue
|
|
304
|
+
- Telegram
|
|
305
|
+
- Twilio
|
|
306
|
+
- Velt
|
|
307
|
+
- Web
|
|
308
|
+
- Webex
|
|
309
|
+
- WeChat
|
|
310
|
+
- WhatsApp Business Cloud
|
|
311
|
+
- X
|
|
312
|
+
- Zalo
|
|
313
|
+
- Zernio
|
|
314
|
+
|
|
315
|
+
Check the adapter's docs for its package name, credential variables, webhook requirements, and platform-specific behavior.
|
|
316
|
+
|
|
317
|
+
### Use the same Mastra wiring
|
|
318
|
+
|
|
319
|
+
The Mastra side of each Chat SDK adapter follows the same setup. Install the adapter package and add its factory to `channels.adapters`. Then configure the platform credentials and point its webhook to the generated Mastra route.
|
|
320
|
+
|
|
321
|
+
Use one of the platform guides as a reference for the Mastra wiring:
|
|
322
|
+
|
|
323
|
+
- [Discord](https://mastra.ai/integrations/channels/discord)
|
|
324
|
+
- [Microsoft Teams](https://mastra.ai/integrations/channels/teams)
|
|
325
|
+
- [Slack](https://mastra.ai/integrations/channels/slack)
|
|
326
|
+
- [Telegram](https://mastra.ai/integrations/channels/telegram)
|
|
327
|
+
- [WhatsApp](https://mastra.ai/integrations/channels/whatsapp)
|
|
328
|
+
|
|
329
|
+
### Check the adapter docs
|
|
330
|
+
|
|
331
|
+
Before wiring a new adapter into Mastra, check the adapter docs for:
|
|
332
|
+
|
|
333
|
+
- Attachment, card, and rich message support.
|
|
334
|
+
- Credential environment variables.
|
|
335
|
+
- Required platform permissions or scopes.
|
|
336
|
+
- Whether regular messages require long-running listeners or polling.
|
|
337
|
+
- Whether the platform needs separate routes for setup, events, or interactions.
|
|
338
|
+
- Webhook verification behavior.
|
|
339
|
+
|
|
277
340
|
## Related
|
|
278
341
|
|
|
279
342
|
- [Channels reference](https://mastra.ai/reference/agents/channels)
|
|
@@ -16,7 +16,7 @@ Common use cases:
|
|
|
16
16
|
- Multi-step tasks that need different expertise at each stage
|
|
17
17
|
- Tasks where you need fine-grained control over delegation behavior
|
|
18
18
|
|
|
19
|
-
> **Note:** A parent agent that coordinates subagents is often called a supervisor. The supervisor pattern is one approach to building multi-agent systems in Mastra. For other patterns, read the [conceptual overview](https://mastra.ai/guides/
|
|
19
|
+
> **Note:** A parent agent that coordinates subagents is often called a supervisor. The supervisor pattern is one approach to building multi-agent systems in Mastra. For other patterns, read the [conceptual overview](https://mastra.ai/docs/guides/multi-agent-systems).
|
|
20
20
|
|
|
21
21
|
## Quickstart
|
|
22
22
|
|
|
@@ -113,7 +113,7 @@ The `context` object includes:
|
|
|
113
113
|
|
|
114
114
|
### Request context at the delegation boundary
|
|
115
115
|
|
|
116
|
-
Each delegation receives a request context whose entries are shallowly copied from the parent run, excluding run-scoped identity keys. Setting or deleting entries during the subagent run
|
|
116
|
+
Each delegation receives a request context whose entries are shallowly copied from the parent run, excluding run-scoped identity keys. Setting or deleting entries during the subagent run doesn't affect the parent's context. Set entries on `context.requestContext` in `onDelegationStart` to pass values to the delegated run:
|
|
117
117
|
|
|
118
118
|
```typescript
|
|
119
119
|
const stream = await parentAgent.stream('Research AI trends', {
|
|
@@ -134,6 +134,9 @@ Called after a delegation finishes. Use it to inspect results or provide feedbac
|
|
|
134
134
|
|
|
135
135
|
- `context.bail()`: Stop the parent agent's loop immediately
|
|
136
136
|
- Return `{ feedback: '...' }`: Add feedback that gets saved to the parent agent's memory and is visible to subsequent iterations
|
|
137
|
+
- Return `{ resultText: '...' }`: Replace the tool result text the parent model sees for this delegation, within the current run
|
|
138
|
+
|
|
139
|
+
Use `resultText` when the subagent's own result would mislead the parent immediately. For example, a subagent that stops on a tool-calls step returns empty text, which the parent model reads as a successful but empty delegation. Unlike `feedback`, which only reaches the model on the next turn, `resultText` changes what the parent reasons on right away.
|
|
137
140
|
|
|
138
141
|
```typescript
|
|
139
142
|
const stream = await parentAgent.stream('Research AI trends', {
|
|
@@ -450,5 +453,5 @@ Version overrides propagate automatically through delegation. See [Subagent vers
|
|
|
450
453
|
- [Agent.generate() reference](https://mastra.ai/reference/agents/generate)
|
|
451
454
|
- [Agent approval](https://mastra.ai/docs/agents/agent-approval)
|
|
452
455
|
- [Memory in multi-agent systems](https://mastra.ai/docs/memory/overview)
|
|
453
|
-
- [Concept: Multi-agent systems](https://mastra.ai/guides/
|
|
456
|
+
- [Concept: Multi-agent systems](https://mastra.ai/docs/guides/multi-agent-systems)
|
|
454
457
|
- 📹 [Mastra supervisor agents workshop](https://www.youtube.com/watch?v=FNb2fL9WhQg\&t=1872s)
|
|
@@ -206,6 +206,55 @@ The `experiment.run.finished` event is awaited before Mastra persists the final
|
|
|
206
206
|
|
|
207
207
|
The exported event types are `ExperimentEvent`, `ExperimentRunStartedEvent`, `ExperimentItemCompletedEvent`, and `ExperimentRunFinishedEvent`. Use the discriminated `type` field to narrow an event before reading event-specific properties.
|
|
208
208
|
|
|
209
|
+
## Lifecycle hooks
|
|
210
|
+
|
|
211
|
+
Use lifecycle hooks to prepare state before a target runs and clean it up afterwards. This is useful when an item can't be evaluated against an empty environment. A run might need a fixture file copied into the agent's workspace, or a sandbox provisioned before the agent can touch it.
|
|
212
|
+
|
|
213
|
+
Hooks run at two levels. `beforeAll` and `afterAll` run once per experiment, and `beforeEach` and `afterEach` run once per item:
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
const summary = await dataset.startExperiment({
|
|
217
|
+
targetType: 'agent',
|
|
218
|
+
targetId: 'document-agent',
|
|
219
|
+
scorers: ['accuracy'],
|
|
220
|
+
beforeAll: async ({ experimentId }) => {
|
|
221
|
+
await createWorkspace(experimentId)
|
|
222
|
+
},
|
|
223
|
+
beforeEach: async ({ item }) => {
|
|
224
|
+
await copyFixture(item.metadata?.fixture)
|
|
225
|
+
},
|
|
226
|
+
afterEach: async ({ item, result }) => {
|
|
227
|
+
await clearWorkspaceFiles(item.id)
|
|
228
|
+
},
|
|
229
|
+
afterAll: async ({ summary }) => {
|
|
230
|
+
await deleteWorkspace(summary.experimentId)
|
|
231
|
+
},
|
|
232
|
+
})
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Every hook can be async. Each one receives the `experimentId`, the `mastra` instance, and the run-level `signal`, so long-running setup can be cancelled along with the experiment. The per-item hooks also receive `item`. The teardown hooks receive the result they follow: `afterEach` receives the item's `result` including scores, and `afterAll` receives the `summary` that's about to be returned.
|
|
236
|
+
|
|
237
|
+
The item passed to hooks exposes `id`, `input`, `groundTruth`, and `metadata`. Fields that control execution, such as tool mocks and scorer selection, aren't exposed, so a hook can't change how the item runs.
|
|
238
|
+
|
|
239
|
+
### Hook failures
|
|
240
|
+
|
|
241
|
+
Each hook has a different consequence when it throws, based on how much of the run depends on it:
|
|
242
|
+
|
|
243
|
+
| Hook | On failure |
|
|
244
|
+
| ------------ | -------------------------------------------------------------------------------- |
|
|
245
|
+
| `beforeAll` | Fails the experiment. No items run. |
|
|
246
|
+
| `beforeEach` | Fails that item with `EXPERIMENT_ITEM_BEFORE_EACH_FAILED`. Other items continue. |
|
|
247
|
+
| `afterEach` | Logged. The item's recorded outcome doesn't change. |
|
|
248
|
+
| `afterAll` | Logged. The returned summary doesn't change. |
|
|
249
|
+
|
|
250
|
+
When `beforeAll` fails, the experiment is marked failed and the `experiment.run.finished` event is still emitted before the error propagates.
|
|
251
|
+
|
|
252
|
+
When `beforeEach` fails, the target and its scorers are skipped for that item, since the item's preconditions were never met. `afterEach` is also skipped for that item, on the basis that setup which didn't finish owns its own cleanup.
|
|
253
|
+
|
|
254
|
+
Teardown failures are logged rather than propagated. By the time `afterEach` runs, the target has already produced a real result, and discarding it because cleanup was untidy would lose the data the experiment was run to collect.
|
|
255
|
+
|
|
256
|
+
`afterAll` runs on every exit path, including when the experiment fails, when `beforeAll` fails, and when an [event observer](#observe-experiment-events) fails, so teardown isn't skipped when something goes wrong. It runs at most once per experiment.
|
|
257
|
+
|
|
209
258
|
## Tool mocks
|
|
210
259
|
|
|
211
260
|
When an experiment runs an agent that calls side-effecting tools, attach static tool mocks to individual dataset items to make the run deterministic. During the experiment, a mocked tool returns its declared output instead of executing. Tools without a mock on the item run live by default.
|
|
@@ -12,12 +12,12 @@ Mastra provides a platform to deploy your server to the cloud. Read the [Mastra
|
|
|
12
12
|
|
|
13
13
|
The following guides show how to deploy Mastra to specific cloud providers:
|
|
14
14
|
|
|
15
|
-
- [Amazon Bedrock AgentCore](https://mastra.ai/
|
|
16
|
-
- [Amazon EC2](https://mastra.ai/
|
|
17
|
-
- [AWS Lambda](https://mastra.ai/
|
|
18
|
-
- [Azure App Services](https://mastra.ai/
|
|
19
|
-
- [Cloudflare](https://mastra.ai/
|
|
20
|
-
- [Digital Ocean](https://mastra.ai/
|
|
21
|
-
- [Kubernetes](https://mastra.ai/
|
|
22
|
-
- [Netlify](https://mastra.ai/
|
|
23
|
-
- [Vercel](https://mastra.ai/
|
|
15
|
+
- [Amazon Bedrock AgentCore](https://mastra.ai/integrations/deploy/aws-bedrock-agentcore)
|
|
16
|
+
- [Amazon EC2](https://mastra.ai/integrations/deploy/amazon-ec2)
|
|
17
|
+
- [AWS Lambda](https://mastra.ai/integrations/deploy/aws-lambda)
|
|
18
|
+
- [Azure App Services](https://mastra.ai/integrations/deploy/azure-app-services)
|
|
19
|
+
- [Cloudflare](https://mastra.ai/integrations/deploy/cloudflare)
|
|
20
|
+
- [Digital Ocean](https://mastra.ai/integrations/deploy/digital-ocean)
|
|
21
|
+
- [Kubernetes](https://mastra.ai/integrations/deploy/kubernetes)
|
|
22
|
+
- [Netlify](https://mastra.ai/integrations/deploy/netlify)
|
|
23
|
+
- [Vercel](https://mastra.ai/integrations/deploy/vercel)
|
|
@@ -43,14 +43,14 @@ Mastra applications can be deployed to cloud providers and serverless platforms.
|
|
|
43
43
|
|
|
44
44
|
Use this option for auto-scaling, minimal infrastructure management, or when you're already using one of these platforms.
|
|
45
45
|
|
|
46
|
-
- [Amazon EC2](https://mastra.ai/
|
|
47
|
-
- [AWS Lambda](https://mastra.ai/
|
|
48
|
-
- [Azure App Services](https://mastra.ai/
|
|
49
|
-
- [Cloudflare](https://mastra.ai/
|
|
50
|
-
- [Digital Ocean](https://mastra.ai/
|
|
51
|
-
- [Kubernetes](https://mastra.ai/
|
|
52
|
-
- [Netlify](https://mastra.ai/
|
|
53
|
-
- [Vercel](https://mastra.ai/
|
|
46
|
+
- [Amazon EC2](https://mastra.ai/integrations/deploy/amazon-ec2)
|
|
47
|
+
- [AWS Lambda](https://mastra.ai/integrations/deploy/aws-lambda)
|
|
48
|
+
- [Azure App Services](https://mastra.ai/integrations/deploy/azure-app-services)
|
|
49
|
+
- [Cloudflare](https://mastra.ai/integrations/deploy/cloudflare)
|
|
50
|
+
- [Digital Ocean](https://mastra.ai/integrations/deploy/digital-ocean)
|
|
51
|
+
- [Kubernetes](https://mastra.ai/integrations/deploy/kubernetes)
|
|
52
|
+
- [Netlify](https://mastra.ai/integrations/deploy/netlify)
|
|
53
|
+
- [Vercel](https://mastra.ai/integrations/deploy/vercel)
|
|
54
54
|
|
|
55
55
|
### Sandbox
|
|
56
56
|
|
|
@@ -72,7 +72,7 @@ Use these guides when adding Mastra to an existing Next.js or Astro application.
|
|
|
72
72
|
|
|
73
73
|
Mastra workflows run using the built-in execution engine by default. For production workloads requiring managed infrastructure, workflows can also be deployed to specialized platforms like [Inngest](https://www.inngest.com) that provide step memoization, automatic retries, and real-time monitoring.
|
|
74
74
|
|
|
75
|
-
Visit the [Workflow Runners guide](https://mastra.ai/docs/deployment/workflow-runners) for execution options and the [Inngest deployment guide](https://mastra.ai/
|
|
75
|
+
Visit the [Workflow Runners guide](https://mastra.ai/docs/deployment/workflow-runners) for execution options and the [Inngest deployment guide](https://mastra.ai/integrations/deploy/inngest) for setup instructions.
|
|
76
76
|
|
|
77
77
|
## Workers
|
|
78
78
|
|
|
@@ -17,9 +17,9 @@ Sandboxes have provider-enforced runtime caps and expire. For production hosting
|
|
|
17
17
|
|
|
18
18
|
The deployer works with any workspace sandbox that supports networking (public port URLs):
|
|
19
19
|
|
|
20
|
-
- [Vercel Sandbox](https://mastra.ai/
|
|
21
|
-
- [E2B](https://mastra.ai/
|
|
22
|
-
- [Daytona](https://mastra.ai/
|
|
20
|
+
- [Vercel Sandbox](https://mastra.ai/integrations/sandboxes/vercel) (`@mastra/vercel`)
|
|
21
|
+
- [E2B](https://mastra.ai/integrations/sandboxes/e2b) (`@mastra/e2b`)
|
|
22
|
+
- [Daytona](https://mastra.ai/integrations/sandboxes/daytona) (`@mastra/daytona`)
|
|
23
23
|
|
|
24
24
|
Provider authors can add support by implementing the optional `networking` capability on [`WorkspaceSandbox`](https://mastra.ai/reference/workspace/sandbox).
|
|
25
25
|
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
When Mastra is integrated with a web framework, it deploys alongside your application using the framework's standard deployment process. Follow the instructions below to ensure your Mastra integration deploys correctly.
|
|
6
6
|
|
|
7
|
-
> **Warning:** If you're deploying to a cloud provider, remove any usage of [LibSQLStore](https://mastra.ai/
|
|
7
|
+
> **Warning:** If you're deploying to a cloud provider, remove any usage of [LibSQLStore](https://mastra.ai/integrations/databases/libsql) from your Mastra configuration. LibSQLStore requires filesystem access and isn't compatible with serverless platforms.
|
|
8
8
|
|
|
9
9
|
Integration guides:
|
|
10
10
|
|
|
11
|
-
- [With Next.js](https://mastra.ai/
|
|
12
|
-
- [With Astro](https://mastra.ai/
|
|
11
|
+
- [With Next.js](https://mastra.ai/integrations/frameworks/next-js)
|
|
12
|
+
- [With Astro](https://mastra.ai/integrations/frameworks/astro)
|
|
13
13
|
|
|
14
14
|
## With Next.js on Vercel
|
|
15
15
|
|
|
16
|
-
If you've integrated Mastra with Next.js [by following our guide](https://mastra.ai/
|
|
16
|
+
If you've integrated Mastra with Next.js [by following our guide](https://mastra.ai/integrations/frameworks/next-js) and plan to deploy to Vercel, add `serverExternalPackages: ["@mastra/*"]` to your `next.config.ts`:
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
19
|
import type { NextConfig } from 'next'
|
|
@@ -27,7 +27,7 @@ export default nextConfig
|
|
|
27
27
|
|
|
28
28
|
## With Astro on Vercel
|
|
29
29
|
|
|
30
|
-
If you've integrated Mastra with Astro [by following our guide](https://mastra.ai/
|
|
30
|
+
If you've integrated Mastra with Astro [by following our guide](https://mastra.ai/integrations/frameworks/astro) and plan to deploy to Vercel, add the Vercel adapter and server output to your `astro.config.mjs`:
|
|
31
31
|
|
|
32
32
|
```javascript
|
|
33
33
|
import { defineConfig } from 'astro/config'
|
|
@@ -41,7 +41,7 @@ export default defineConfig({
|
|
|
41
41
|
|
|
42
42
|
## With Astro on Netlify
|
|
43
43
|
|
|
44
|
-
If you've integrated Mastra with Astro [by following our guide](https://mastra.ai/
|
|
44
|
+
If you've integrated Mastra with Astro [by following our guide](https://mastra.ai/integrations/frameworks/astro) and plan to deploy to Netlify, add the Netlify adapter and server output to your `astro.config.mjs`:
|
|
45
45
|
|
|
46
46
|
```javascript
|
|
47
47
|
import { defineConfig } from 'astro/config'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Workers
|
|
4
4
|
|
|
5
|
-
> **Beta:**
|
|
5
|
+
> **Beta:** Breaking changes may occur without a major version bump until the API is stable. See [known limitations](#known-limitations) for current gaps.
|
|
6
6
|
|
|
7
7
|
Workers handle background processing outside the request-response cycle. Workflow step execution, cron-based scheduling, and long-running tool calls all run in workers, keeping the API responsive.
|
|
8
8
|
|
|
@@ -8,10 +8,10 @@ Mastra [workflows](https://mastra.ai/docs/workflows/overview) can be executed us
|
|
|
8
8
|
|
|
9
9
|
Inngest is a developer platform for running background workflows without managing infrastructure. Mastra workflows can be deployed to Inngest, which provides step memoization, automatic retries, real-time monitoring, and suspend/resume capabilities.
|
|
10
10
|
|
|
11
|
-
Visit the [Inngest deployment guide](https://mastra.ai/
|
|
11
|
+
Visit the [Inngest deployment guide](https://mastra.ai/integrations/deploy/inngest) for setup instructions and the [Inngest workflow example](https://github.com/mastra-ai/mastra/tree/main/examples/inngest) for a complete implementation.
|
|
12
12
|
|
|
13
13
|
## Temporal
|
|
14
14
|
|
|
15
15
|
Temporal is a durable execution platform for orchestrating long-running workflows. Mastra workflows can run on Temporal workers, with each `createStep` mapped to a Temporal activity for automatic retries and durable state.
|
|
16
16
|
|
|
17
|
-
The `@mastra/temporal` package is experimental and not ready for production use. Visit the [Temporal deployment guide](https://mastra.ai/
|
|
17
|
+
The `@mastra/temporal` package is experimental and not ready for production use. Visit the [Temporal deployment guide](https://mastra.ai/integrations/deploy/temporal) for setup instructions.
|
|
@@ -138,7 +138,7 @@ See the [project structure reference](https://mastra.ai/reference/project-struct
|
|
|
138
138
|
|
|
139
139
|
## File-based agents
|
|
140
140
|
|
|
141
|
-
> **Beta:**
|
|
141
|
+
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
142
142
|
>
|
|
143
143
|
> File-based discovery only runs through `mastra dev` or `mastra build`. If your app imports `mastra` directly, including through a web framework or server adapter, file-based agents aren't discovered. Register those agents in code or run Mastra as a separate server.
|
|
144
144
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# AgentController
|
|
4
4
|
|
|
5
|
-
> **Beta:**
|
|
5
|
+
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
6
6
|
|
|
7
7
|
`AgentController` is a shared runtime host for interactive agent applications. It coordinates modes, models, storage, workspaces, tool approvals, subagents, and channels. Each user or active task works through an isolated [`Session`](https://mastra.ai/reference/agent-controller/session).
|
|
8
8
|
|
|
@@ -343,11 +343,52 @@ Point each platform webhook at the controller-specific route:
|
|
|
343
343
|
|
|
344
344
|
Each external chat thread maps to one controller Session and Mastra thread. By default, new sessions use a resource ID derived from the adapter's chat-thread ID, prefixed with `channel:`. Use `resolveResourceId` to map direct messages to an existing application user or choose another memory owner. The callback only affects new threads; an existing thread keeps its stored resource ID.
|
|
345
345
|
|
|
346
|
-
Channel sessions are created by the controller rather than by your code, so `onSessionStart` is where you configure them. It runs once per session, after the session is bound to its mapped thread and before the first message is handled.
|
|
346
|
+
Channel sessions are created by the controller rather than by your code, so `onSessionStart` is where you configure them. It runs once per session, after the session is bound to its mapped thread and before the first message is handled. A channel session starts with controller defaults, so this is where you set its model and memory settings. Later messages in the same thread reuse the session and don't call it again. Errors are logged and swallowed so a session that can't be configured still answers the message.
|
|
347
|
+
|
|
348
|
+
### Authorize and route channel sessions
|
|
349
|
+
|
|
350
|
+
`onSessionStart` runs after the session exists and swallows errors, so it can't refuse a request. Use `resolveSession` when your host decides whether a session may exist. It replaces the built-in session creation and runs before any session exists. Throwing refuses the request before the controller creates a session or calls the model. Mastra logs the refusal and leaves the chat thread silent, so your authorization message never reaches the channel.
|
|
351
|
+
|
|
352
|
+
```typescript
|
|
353
|
+
channels: {
|
|
354
|
+
adapters: { slack: createSlackAdapter() },
|
|
355
|
+
resolveSession: async ({ controller, thread, requestContext }) => {
|
|
356
|
+
const install = await installs.authorize(requestContext.get('teamId'))
|
|
357
|
+
|
|
358
|
+
return controller.createSession({
|
|
359
|
+
resourceId: thread.resourceId,
|
|
360
|
+
scope: install.id,
|
|
361
|
+
ownerId: controller.id,
|
|
362
|
+
requestContext,
|
|
363
|
+
})
|
|
364
|
+
},
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
Create the session under `thread.resourceId`. A session can only bind threads it owns, so use `resolveResourceId` if you want a different owner for the mapped thread. Sessions are get-or-create per `resourceId` and `scope`, so pass `scope` when one thread needs separate sessions per install or principal.
|
|
369
|
+
|
|
370
|
+
Failures that aren't refusals (a storage outage, a bug in your resolver's dependencies) still post an error to the thread, so a broken bot doesn't look like a silent one. If you need to tell them apart in your own code, a refusal is a `ChannelSessionRejectedError` with the original error as its `cause`.
|
|
371
|
+
|
|
372
|
+
`resolveSession` also runs when a user answers an approval card, with that action's request context, so a shared install revalidates the person approving rather than trusting the person who sent the original message.
|
|
373
|
+
|
|
374
|
+
### Handle stale approvals
|
|
375
|
+
|
|
376
|
+
An approval gate lives in memory, so every approval answered after a restart is stale. Mastra never runs the tool for a stale action. Use `onStaleToolApproval` to settle the attempt the user answered, instead of dropping it:
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
channels: {
|
|
380
|
+
adapters: { slack: createSlackAdapter() },
|
|
381
|
+
onStaleToolApproval: async ({ decision, toolCallId, runId, memory }) => {
|
|
382
|
+
await runs.markInterrupted({ runId, toolCallId, decision, threadId: memory.thread })
|
|
383
|
+
},
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
`runId` is the run the approval card was rendered for, which is the attempt the user answered and the one you settle against after a restart. The session's own run is passed separately as `currentRunId`, and is usually `null` or a different run by then.
|
|
347
388
|
|
|
348
389
|
Controller channel sessions and auto-approval state are held in memory, so use a long-lived server. Pending approvals and live Session state don't survive process restarts. Adapters that can't render approval controls automatically run tools without an approval prompt so the run doesn't remain suspended.
|
|
349
390
|
|
|
350
|
-
See [Channels](https://mastra.ai/docs/capabilities/channels
|
|
391
|
+
See [Channels](https://mastra.ai/docs/capabilities/channels) for adapter setup and platform-specific webhook configuration.
|
|
351
392
|
|
|
352
393
|
## Connect a UI
|
|
353
394
|
|
|
@@ -373,4 +414,4 @@ Subscriptions are isolated by Session. Events from another Session on the same c
|
|
|
373
414
|
- [Agents](https://mastra.ai/docs/agents/overview)
|
|
374
415
|
- [Workspace](https://mastra.ai/docs/workspace/overview)
|
|
375
416
|
- [Observational memory](https://mastra.ai/docs/memory/observational-memory)
|
|
376
|
-
- [Channels](https://mastra.ai/docs/capabilities/channels
|
|
417
|
+
- [Channels](https://mastra.ai/docs/capabilities/channels)
|
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
A harness lets an agent pursue long-running, complex goals while keeping its work durable, visible, and steerable. It preserves progress across retries and interruptions, while giving people and other systems a way to inspect progress, add context, approve actions, redirect the agent, or stop it.
|
|
6
6
|
|
|
7
|
-
In Mastra, harness refers to a set of capabilities for managing an agent beyond a single uninterrupted run. You can adopt these capabilities individually or combine them as needed.
|
|
8
|
-
|
|
9
|
-
[`AgentController`](https://mastra.ai/docs/harness/agent-controller) is a harness designed for interactive agent applications. It extends the base [`Agent`](https://mastra.ai/docs/agents/overview) loop with isolated sessions for each user or task, persistent threads and state, switchable modes and models, tool permissions and approvals, subagent orchestration, and streams for events and display state.
|
|
10
|
-
|
|
11
7
|
Agent harnesses are useful wherever work continues over time. Common examples include coding agents that carry changes through CI and review, software factories that coordinate many tasks in parallel, SRE agents that adapt as incidents evolve, and go-to-market agents that respond as accounts, signals, and conversations change.
|
|
12
8
|
|
|
9
|
+
In Mastra, harness refers to a set of capabilities for managing an agent beyond a single uninterrupted run. You can adopt these capabilities individually or combine them as needed.
|
|
10
|
+
|
|
13
11
|
## When to use a harness
|
|
14
12
|
|
|
15
13
|
Choose a starting point based on what the agent needs. You may use one capability or several.
|