@mastra/mcp-docs-server 1.3.9 → 1.3.10-alpha.2
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/code-mode.md +2 -2
- package/.docs/docs/agents/guardrails.md +5 -5
- package/.docs/docs/agents/human-in-the-loop.md +18 -5
- package/.docs/docs/agents/networks.md +1 -1
- package/.docs/docs/agents/overview.md +7 -7
- package/.docs/docs/agents/processors.md +66 -20
- package/.docs/docs/agents/structured-output.md +6 -6
- package/.docs/docs/agents/tools.md +10 -10
- package/.docs/docs/browser.md +13 -1
- package/.docs/docs/channels.md +33 -6
- package/.docs/docs/connections/a2a.md +1 -1
- package/.docs/docs/connections/acp.md +2 -2
- package/.docs/docs/connections/mcp.md +159 -50
- package/.docs/docs/connections/overview.md +1 -1
- package/.docs/docs/connections/sdk-agents.md +8 -8
- package/.docs/docs/develop.md +1 -1
- package/.docs/docs/evals/custom-scorers.md +5 -5
- package/.docs/docs/evals/experiments.md +2 -2
- package/.docs/docs/evals/multi-turn.md +2 -2
- package/.docs/docs/evals/overview.md +4 -4
- package/.docs/docs/evals/quick-checks.md +2 -2
- package/.docs/docs/guides/build-an-eval-loop.md +3 -3
- package/.docs/docs/guides/context-engineering.md +13 -6
- package/.docs/docs/guides/mcp-authentication-authorization.md +2 -2
- package/.docs/docs/guides/streaming.md +1 -1
- package/.docs/docs/harness/agent-controller.md +7 -7
- package/.docs/docs/harness/background-tasks.md +3 -3
- package/.docs/docs/harness/durable-agents.md +5 -5
- package/.docs/docs/harness/goals.md +5 -5
- package/.docs/docs/harness/overview.md +2 -2
- package/.docs/docs/harness/schedules.md +5 -5
- package/.docs/docs/index.md +6 -6
- package/.docs/docs/mastra-platform/connect/channels.md +1 -1
- package/.docs/docs/mastra-platform/connect/tools.md +4 -4
- package/.docs/docs/mastra-platform/observability.md +1 -1
- package/.docs/docs/memory/memory-processors.md +7 -7
- package/.docs/docs/memory/message-history.md +5 -5
- package/.docs/docs/memory/multi-user-threads.md +1 -1
- package/.docs/docs/memory/observational-memory.md +14 -14
- package/.docs/docs/memory/semantic-recall.md +2 -2
- package/.docs/docs/memory/working-memory.md +2 -2
- package/.docs/docs/observability/logging.md +5 -5
- package/.docs/docs/observability/tracing/overview.md +1 -0
- package/.docs/docs/sandbox/filesystem.md +1 -0
- package/.docs/docs/sandbox/overview.md +1 -1
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/middleware.md +1 -1
- package/.docs/docs/server/request-context.md +3 -3
- package/.docs/docs/server/server-adapters.md +12 -204
- package/.docs/docs/signals/notifications.md +233 -0
- package/.docs/docs/signals/overview.md +94 -0
- package/.docs/docs/signals/running-across-processes.md +132 -0
- package/.docs/docs/signals/sending-signals.md +166 -0
- package/.docs/docs/signals/signal-providers.md +278 -0
- package/.docs/docs/signals/state-signals.md +103 -0
- package/.docs/docs/signals/thread-streams.md +94 -0
- package/.docs/docs/skills.md +4 -4
- package/.docs/docs/storage.md +1 -1
- package/.docs/docs/studio/editor.md +39 -23
- package/.docs/docs/subagents.md +6 -6
- package/.docs/integrations/agentic-ui/ai-sdk-ui.md +1 -1
- package/.docs/integrations/agentic-ui/copilotkit.md +1 -1
- package/.docs/integrations/agentic-ui/openui.md +1 -1
- package/.docs/integrations/browsers/agent-browser.md +1 -1
- package/.docs/integrations/browsers/browser-viewer.md +1 -1
- package/.docs/integrations/browsers/firecrawl.md +1 -1
- package/.docs/integrations/browsers/stagehand.md +6 -6
- package/.docs/integrations/channels/discord.md +1 -1
- package/.docs/integrations/channels/github.md +2 -2
- package/.docs/integrations/channels/imessage.md +2 -50
- package/.docs/integrations/channels/slack.md +1 -1
- package/.docs/integrations/channels/teams.md +1 -1
- package/.docs/integrations/channels/telegram.md +1 -1
- package/.docs/integrations/channels/whatsapp.md +1 -1
- package/.docs/integrations/databases/aurora-dsql.md +1 -1
- package/.docs/integrations/databases/cloudflare-kv.md +4 -0
- package/.docs/integrations/databases/elasticsearch.md +1 -1
- package/.docs/integrations/databases/mongodb.md +1 -1
- package/.docs/integrations/databases/oracledb.md +1 -1
- package/.docs/integrations/databases/postgresql.md +1 -1
- package/.docs/integrations/databases/redis.md +1 -1
- package/.docs/integrations/databases/upstash.md +1 -1
- package/.docs/integrations/deploy/kubernetes.md +1 -1
- package/.docs/integrations/deploy/neon.md +2 -1
- package/.docs/integrations/deploy/render.md +2 -2
- package/.docs/integrations/file-storage/agentfs.md +1 -1
- package/.docs/integrations/file-storage/amazon-s3.md +20 -3
- package/.docs/integrations/file-storage/archil.md +1 -1
- package/.docs/integrations/file-storage/azure-blob.md +1 -1
- package/.docs/integrations/file-storage/google-cloud-storage.md +1 -1
- package/.docs/integrations/file-storage/google-drive.md +1 -1
- package/.docs/integrations/file-storage/mesa.md +1 -1
- package/.docs/integrations/file-storage/neon.md +210 -0
- package/.docs/integrations/file-storage/vercel-files.md +5 -1
- package/.docs/integrations/frameworks/express.md +0 -64
- package/.docs/integrations/observability/langfuse.md +1 -1
- package/.docs/integrations/observability/langsmith.md +2 -2
- package/.docs/integrations/observability/opentelemetry.md +5 -5
- package/.docs/integrations/sandboxes/apple-container.md +1 -1
- package/.docs/integrations/sandboxes/blaxel.md +1 -1
- package/.docs/integrations/sandboxes/daytona.md +1 -1
- package/.docs/integrations/sandboxes/docker.md +1 -1
- package/.docs/integrations/sandboxes/e2b-desktop.md +1 -1
- package/.docs/integrations/sandboxes/e2b.md +4 -2
- package/.docs/integrations/sandboxes/modal.md +1 -1
- package/.docs/integrations/sandboxes/railway.md +1 -1
- package/.docs/integrations/sandboxes/sprites.md +1 -1
- package/.docs/integrations/sandboxes/vercel.md +2 -2
- package/.docs/integrations/tools/brightdata.md +1 -1
- package/.docs/integrations/tools/firecrawl.md +1 -1
- package/.docs/integrations/tools/parallel.md +1 -1
- package/.docs/integrations/tools/perplexity.md +1 -1
- package/.docs/integrations/tools/tavily.md +1 -1
- package/.docs/integrations/voice/livekit.md +2 -2
- package/.docs/integrations.md +1 -0
- package/.docs/models/environment-variables.md +0 -2
- package/.docs/models/gateways/custom-gateways.md +3 -3
- package/.docs/models/gateways/merge-gateway.md +2 -14
- package/.docs/models/gateways/netlify.md +2 -1
- package/.docs/models/gateways/openrouter.md +3 -2
- package/.docs/models/gateways/vercel.md +3 -9
- package/.docs/models/index.md +13 -15
- package/.docs/models/providers/302ai.md +3 -3
- package/.docs/models/providers/abacus.md +70 -110
- package/.docs/models/providers/aimlapi.md +171 -171
- package/.docs/models/providers/aki-io.md +5 -6
- package/.docs/models/providers/alibaba-cn.md +2 -2
- package/.docs/models/providers/alibaba.md +2 -2
- package/.docs/models/providers/ambient.md +1 -1
- package/.docs/models/providers/auriko.md +2 -2
- package/.docs/models/providers/baseten.md +4 -4
- package/.docs/models/providers/berget.md +3 -4
- package/.docs/models/providers/bothub.md +4 -4
- package/.docs/models/providers/boundless.md +0 -4
- package/.docs/models/providers/cline-pass.md +2 -8
- package/.docs/models/providers/commandcode.md +0 -1
- package/.docs/models/providers/coralbricks.md +1 -1
- package/.docs/models/providers/cortecs.md +3 -3
- package/.docs/models/providers/crossmodel.md +1 -3
- package/.docs/models/providers/crusoe.md +1 -7
- package/.docs/models/providers/daoxe.md +1 -1
- package/.docs/models/providers/deepinfra.md +2 -2
- package/.docs/models/providers/digitalocean.md +6 -10
- package/.docs/models/providers/dinference.md +0 -3
- package/.docs/models/providers/edenai.md +12 -2
- package/.docs/models/providers/empiriolabs.md +0 -1
- package/.docs/models/providers/engy.md +2 -2
- package/.docs/models/providers/evroc.md +2 -2
- package/.docs/models/providers/fastrouter.md +41 -50
- package/.docs/models/providers/fireworks-ai.md +28 -23
- package/.docs/models/providers/friendli.md +4 -5
- package/.docs/models/providers/frogbot.md +2 -7
- package/.docs/models/providers/google.md +2 -5
- package/.docs/models/providers/greenpt.md +14 -20
- package/.docs/models/providers/groq.md +1 -1
- package/.docs/models/providers/huggingface.md +3 -1
- package/.docs/models/providers/iflowcn.md +2 -18
- package/.docs/models/providers/impossibl.md +2 -9
- package/.docs/models/providers/inceptron.md +8 -6
- package/.docs/models/providers/inco.md +1 -1
- package/.docs/models/providers/inference.md +5 -11
- package/.docs/models/providers/infomaniak.md +10 -12
- package/.docs/models/providers/io-net.md +11 -17
- package/.docs/models/providers/iteracompute.md +3 -3
- package/.docs/models/providers/jalapeno.md +14 -19
- package/.docs/models/providers/jiekou.md +53 -63
- package/.docs/models/providers/kenari.md +34 -53
- package/.docs/models/providers/kilo.md +12 -11
- package/.docs/models/providers/lilac.md +2 -8
- package/.docs/models/providers/llama.md +2 -11
- package/.docs/models/providers/llmgateway-providers.md +8 -16
- package/.docs/models/providers/llmgateway.md +9 -8
- package/.docs/models/providers/llmtr.md +1 -6
- package/.docs/models/providers/lowrouter.md +1 -1
- package/.docs/models/providers/lucidquery.md +2 -2
- package/.docs/models/providers/meganova.md +6 -7
- package/.docs/models/providers/melious.md +2 -7
- package/.docs/models/providers/mistral.md +4 -3
- package/.docs/models/providers/moark.md +0 -2
- package/.docs/models/providers/nan.md +1 -1
- package/.docs/models/providers/nano-gpt.md +16 -8
- package/.docs/models/providers/nearai.md +2 -1
- package/.docs/models/providers/neuralwatt.md +1 -4
- package/.docs/models/providers/novita-ai.md +2 -1
- package/.docs/models/providers/nvidia.md +15 -35
- package/.docs/models/providers/oci.md +0 -1
- package/.docs/models/providers/ofox.md +1 -1
- package/.docs/models/providers/ollama-cloud.md +2 -2
- package/.docs/models/providers/opencode-go.md +2 -3
- package/.docs/models/providers/opencode.md +85 -88
- package/.docs/models/providers/opper.md +1 -4
- package/.docs/models/providers/orcarouter.md +14 -16
- package/.docs/models/providers/pareto.md +1 -1
- package/.docs/models/providers/perplexity-agent.md +2 -12
- package/.docs/models/providers/pioneer.md +7 -7
- package/.docs/models/providers/poe.md +16 -70
- package/.docs/models/providers/prime.md +2 -1
- package/.docs/models/providers/qihang-ai.md +7 -11
- package/.docs/models/providers/qiniu-ai.md +9 -94
- package/.docs/models/providers/regolo-ai.md +5 -7
- package/.docs/models/providers/runinfra.md +1 -4
- package/.docs/models/providers/sarvam.md +1 -2
- package/.docs/models/providers/scaleway.md +12 -11
- package/.docs/models/providers/siliconflow-cn.md +35 -41
- package/.docs/models/providers/siliconflow.md +3 -6
- package/.docs/models/providers/stackit.md +2 -4
- package/.docs/models/providers/stepfun-ai.md +4 -4
- package/.docs/models/providers/stepfun.md +4 -4
- package/.docs/models/providers/submodel.md +1 -1
- package/.docs/models/providers/synthetic.md +0 -4
- package/.docs/models/providers/tempr.md +1 -4
- package/.docs/models/providers/tencent-coding-plan.md +3 -10
- package/.docs/models/providers/tensorx.md +0 -13
- package/.docs/models/providers/the-grid-ai.md +2 -1
- package/.docs/models/providers/tokengo.md +1 -1
- package/.docs/models/providers/umans-ai-coding-plan.md +12 -11
- package/.docs/models/providers/umans-ai.md +11 -10
- package/.docs/models/providers/unorouter.md +0 -13
- package/.docs/models/providers/vancine.md +0 -1
- package/.docs/models/providers/vivgrid.md +3 -3
- package/.docs/models/providers/volcengine-coding-plan.md +8 -12
- package/.docs/models/providers/volcengine.md +12 -18
- package/.docs/models/providers/vultr.md +0 -2
- package/.docs/models/providers/wafer.ai.md +3 -7
- package/.docs/models/providers/xai.md +19 -3
- package/.docs/models/providers/xiaomi-token-plan-ams.md +4 -4
- package/.docs/models/providers/xiaomi-token-plan-cn.md +4 -4
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +4 -4
- package/.docs/models/providers/xiaomi.md +4 -4
- package/.docs/models/providers/xpersona.md +0 -1
- package/.docs/models/providers/zenmux.md +105 -125
- package/.docs/models/providers.md +0 -2
- package/.docs/reference/acp/acp-agent.md +4 -4
- package/.docs/reference/acp/create-acp-tool.md +1 -1
- package/.docs/reference/agent-controller/agent-controller-class.md +2 -2
- package/.docs/reference/agent-controller/session.md +10 -10
- package/.docs/reference/agents/agent.md +23 -47
- package/.docs/reference/agents/channels.md +13 -11
- package/.docs/reference/agents/durable-agent.md +13 -13
- package/.docs/reference/agents/generate.md +57 -3
- package/.docs/reference/agents/generateLegacy.md +2 -2
- 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/network.md +1 -1
- package/.docs/reference/browser/agent-browser.md +1 -1
- 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 +4 -4
- package/.docs/reference/channels/slack-provider.md +3 -0
- package/.docs/reference/cli/mastra.md +26 -0
- package/.docs/reference/client-js/agent-controller.md +2 -2
- package/.docs/reference/client-js/agents.md +18 -2
- package/.docs/reference/client-js/datasets.md +1 -1
- package/.docs/reference/client-js/observability.md +26 -1
- package/.docs/reference/coding-agent/build-base-prompt.md +1 -1
- package/.docs/reference/coding-agent/create-coding-agent.md +8 -8
- package/.docs/reference/configuration.md +4 -4
- package/.docs/reference/connect/channels.md +1 -1
- package/.docs/reference/connect/credential.md +1 -1
- package/.docs/reference/connect/tools.md +8 -10
- package/.docs/reference/core/getAgentById.md +1 -1
- package/.docs/reference/core/mastra-class.md +3 -3
- package/.docs/reference/core/mastra-model-gateway.md +1 -1
- package/.docs/reference/datasets/startExperiment.md +15 -0
- package/.docs/reference/editor/mastra-editor.md +2 -2
- package/.docs/reference/evals/answer-relevancy.md +1 -1
- package/.docs/reference/evals/answer-similarity.md +1 -1
- package/.docs/reference/evals/bias.md +1 -1
- package/.docs/reference/evals/checks.md +1 -1
- package/.docs/reference/evals/context-precision.md +3 -3
- package/.docs/reference/evals/context-recall.md +3 -3
- package/.docs/reference/evals/context-relevance.md +11 -11
- package/.docs/reference/evals/faithfulness.md +1 -1
- package/.docs/reference/evals/hallucination.md +5 -5
- package/.docs/reference/evals/multi-turn-judge.md +2 -2
- package/.docs/reference/evals/noise-sensitivity.md +12 -12
- package/.docs/reference/evals/not-scorable.md +1 -1
- package/.docs/reference/evals/prompt-alignment.md +16 -16
- package/.docs/reference/evals/rubric.md +6 -6
- package/.docs/reference/evals/run-evals.md +1 -1
- package/.docs/reference/evals/summarization.md +4 -4
- package/.docs/reference/evals/tool-call-accuracy.md +4 -4
- package/.docs/reference/evals/toxicity.md +1 -1
- package/.docs/reference/file-based-agents/config.md +3 -3
- package/.docs/reference/file-based-agents/schedules.md +1 -1
- package/.docs/reference/file-based-agents/subagents.md +4 -4
- package/.docs/reference/file-based-agents/workspace.md +1 -1
- package/.docs/reference/index.md +2 -1
- package/.docs/reference/manual-install.md +2 -2
- package/.docs/reference/memory/memory-class.md +3 -3
- package/.docs/reference/memory/observational-memory.md +16 -16
- package/.docs/reference/memory/summarizeConversation.md +3 -3
- package/.docs/reference/memory/summarizeThread.md +3 -3
- package/.docs/reference/migrations/agentnetwork.md +4 -4
- package/.docs/reference/migrations/mcp-v2.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/agent.md +1 -1
- package/.docs/reference/migrations/vnext-to-standard-apis.md +2 -2
- package/.docs/reference/observability/tracing/advanced-queries.md +92 -11
- package/.docs/reference/observability/tracing/bridges/otel.md +1 -1
- package/.docs/reference/observability/tracing/exporters/langfuse.md +1 -1
- package/.docs/reference/observability/tracing/interfaces.md +2 -0
- package/.docs/reference/processors/batch-parts-processor.md +1 -1
- package/.docs/reference/processors/classifier-processor.md +2 -2
- package/.docs/reference/processors/cyber-refusal-handler.md +1 -1
- package/.docs/reference/processors/file-upload-processor.md +5 -5
- package/.docs/reference/processors/language-detector.md +1 -1
- package/.docs/reference/processors/message-history-processor.md +2 -2
- package/.docs/reference/processors/model-selection-processor.md +7 -7
- package/.docs/reference/processors/moderation-processor.md +3 -3
- package/.docs/reference/processors/pii-detector.md +2 -2
- package/.docs/reference/processors/prefill-error-handler.md +2 -2
- package/.docs/reference/processors/processor-interface.md +66 -10
- package/.docs/reference/processors/prompt-injection-detector.md +1 -1
- package/.docs/reference/processors/provider-history-compat.md +2 -2
- package/.docs/reference/processors/regex-filter-processor.md +1 -1
- package/.docs/reference/processors/response-cache.md +1 -1
- package/.docs/reference/processors/semantic-recall-processor.md +2 -2
- package/.docs/reference/processors/skill-search-processor.md +1 -1
- package/.docs/reference/processors/stream-error-retry-processor.md +3 -3
- package/.docs/reference/processors/system-prompt-scrubber.md +2 -2
- package/.docs/reference/processors/token-cost-control.md +1 -1
- package/.docs/reference/processors/token-limiter-processor.md +4 -4
- package/.docs/reference/processors/tool-call-filter.md +3 -3
- package/.docs/reference/processors/tool-search-processor.md +4 -4
- package/.docs/reference/processors/unicode-normalizer.md +1 -1
- package/.docs/reference/processors/working-memory-processor.md +2 -2
- package/.docs/reference/pubsub/lease-provider.md +2 -2
- package/.docs/reference/pubsub/redis-streams.md +11 -1
- package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
- package/.docs/reference/rag/chunking-and-embedding.md +1 -1
- package/.docs/reference/rag/graph-rag-guide.md +2 -2
- package/.docs/reference/rag/metadata-filters.md +1 -1
- package/.docs/reference/rag/rerank.md +1 -1
- package/.docs/reference/rag/retrieval.md +13 -13
- package/.docs/reference/server/nestjs-adapter.md +1 -1
- package/.docs/reference/signals/create-notification-inbox-tool.md +4 -4
- package/.docs/reference/signals/notifications.md +249 -0
- package/.docs/reference/signals/task-signal-provider.md +2 -2
- package/.docs/reference/signals/thread-events.md +69 -0
- package/.docs/reference/storage/retention.md +1 -1
- package/.docs/reference/streaming/ChunkType.md +68 -0
- package/.docs/reference/streaming/agents/stream.md +4 -4
- package/.docs/reference/tools/create-code-mode.md +1 -1
- package/.docs/reference/tools/create-tool.md +19 -2
- package/.docs/reference/tools/mcp-client.md +202 -11
- package/.docs/reference/tools/mcp-server.md +7 -5
- package/.docs/reference/tools/task-tools.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +1 -1
- package/.docs/reference/vectors/libsql.md +1 -1
- package/.docs/reference/vectors/mongodb.md +2 -2
- package/.docs/reference/vectors/oracledb.md +2 -2
- package/.docs/reference/vectors/pg.md +1 -1
- package/.docs/reference/vectors/turbopuffer.md +1 -1
- package/.docs/reference/vectors/upstash.md +1 -1
- package/.docs/reference/voice/overview.md +24 -24
- package/.docs/reference/voice/speech-to-speech.md +6 -6
- package/.docs/reference/voice/speech-to-text.md +1 -1
- package/.docs/reference/voice/text-to-speech.md +1 -1
- package/.docs/reference/voice/voice.addInstructions.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workspace/local-filesystem.md +1 -1
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/platform-filesystem.md +1 -1
- package/.docs/reference/workspace/platform-sandbox.md +21 -2
- package/.docs/reference/workspace/process-manager.md +13 -2
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +12 -12
- package/package.json +11 -11
- package/.docs/docs/guides/mcp-events.md +0 -306
- package/.docs/docs/harness/signal-providers.md +0 -212
- package/.docs/docs/harness/signals.md +0 -546
- package/.docs/docs/mastra-platform/connect/end-user-connections.md +0 -116
- package/.docs/reference/connect/user-connect-routes.md +0 -68
|
@@ -20,7 +20,7 @@ export const agent = new Agent({
|
|
|
20
20
|
id: 'test-agent',
|
|
21
21
|
name: 'Test Agent',
|
|
22
22
|
instructions: 'You are a helpful assistant that provides concise answers.',
|
|
23
|
-
model: 'openai/gpt-
|
|
23
|
+
model: 'openai/gpt-6.1-sol',
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
// System message object
|
|
@@ -31,7 +31,7 @@ export const agent2 = new Agent({
|
|
|
31
31
|
role: 'system',
|
|
32
32
|
content: 'You are an expert programmer',
|
|
33
33
|
},
|
|
34
|
-
model: 'openai/gpt-
|
|
34
|
+
model: 'openai/gpt-6.1-sol',
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
// Array of system messages
|
|
@@ -42,7 +42,7 @@ export const agent3 = new Agent({
|
|
|
42
42
|
{ role: 'system', content: 'You are a helpful assistant' },
|
|
43
43
|
{ role: 'system', content: 'You have expertise in TypeScript' },
|
|
44
44
|
],
|
|
45
|
-
model: 'openai/gpt-
|
|
45
|
+
model: 'openai/gpt-6.1-sol',
|
|
46
46
|
})
|
|
47
47
|
```
|
|
48
48
|
|
|
@@ -65,7 +65,7 @@ export const agent = new Agent({
|
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
|
-
model: 'openai/gpt-
|
|
68
|
+
model: 'openai/gpt-6.1-sol',
|
|
69
69
|
})
|
|
70
70
|
```
|
|
71
71
|
|
|
@@ -94,7 +94,7 @@ export const agent = new Agent({
|
|
|
94
94
|
},
|
|
95
95
|
},
|
|
96
96
|
],
|
|
97
|
-
model: 'anthropic/claude-sonnet-
|
|
97
|
+
model: 'anthropic/claude-sonnet-5-5',
|
|
98
98
|
})
|
|
99
99
|
```
|
|
100
100
|
|
|
@@ -104,9 +104,9 @@ For the simplest setup, pass `model` as a string in `provider/model` format. Sep
|
|
|
104
104
|
|
|
105
105
|
Popular provider strings and credentials:
|
|
106
106
|
|
|
107
|
-
- **OpenAI**: `openai/gpt-
|
|
108
|
-
- **Anthropic**: `anthropic/claude-sonnet-
|
|
109
|
-
- **Google**: `google/gemini-
|
|
107
|
+
- **OpenAI**: `openai/gpt-6.1-sol` uses `OPENAI_API_KEY`.
|
|
108
|
+
- **Anthropic**: `anthropic/claude-sonnet-5-5` uses `ANTHROPIC_API_KEY`.
|
|
109
|
+
- **Google**: `google/gemini-3.8-flash` uses `GOOGLE_API_KEY` or `GOOGLE_GENERATIVE_AI_API_KEY`.
|
|
110
110
|
|
|
111
111
|
See [models](https://mastra.ai/models) for supported model IDs and [environment variables](https://mastra.ai/models/environment-variables) for the complete provider list.
|
|
112
112
|
|
|
@@ -246,39 +246,11 @@ agent.queueMessage('Also check whether the tests need updates.', {
|
|
|
246
246
|
|
|
247
247
|
`queueMessage()` accepts the same `message` and `options` shape as `sendMessage()` and returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void> }`, with the same `accepted` semantics as `sendMessage()`. Pass an optional `queueOwnerId` to group local queued messages for observation and cancellation. The owner ID is local metadata: it's neither serialized with the message nor an authorization mechanism.
|
|
248
248
|
|
|
249
|
-
Use `subscribeThreadEvents({ resourceId, threadId }, listener)` to observe
|
|
250
|
-
|
|
251
|
-
```typescript
|
|
252
|
-
const scope = {
|
|
253
|
-
resourceId: 'user-123',
|
|
254
|
-
threadId: 'thread-abc',
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const unsubscribe = agent.subscribeThreadEvents(scope, event => {
|
|
258
|
-
if (event.type === 'queue-count-changed') {
|
|
259
|
-
console.log(`${event.count} messages are pending`)
|
|
260
|
-
}
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
agent.queueMessage('Review the failing test.', {
|
|
264
|
-
...scope,
|
|
265
|
-
ifIdle: { streamOptions: { maxSteps: 3 } },
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
unsubscribe()
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
`subscribeThreadEvents()` is distinct from `subscribeToThread()`, which streams agent output. It doesn't currently emit composite thread state, individual message lifecycle events, run events, or approval events. Mastra may add those as separate event types in the future.
|
|
272
|
-
|
|
273
|
-
AgentController Sessions observe the shared thread count when they subscribe, even before submitting a follow-up. `session.steer()` aborts the current run before sending the new input, without clearing queued follow-ups. Session cleanup stops observation and cancels unfinished local preparation, but leaves submitted messages in the Agent queue.
|
|
274
|
-
|
|
275
|
-
The count includes messages waiting in the local FIFO and a non-cancelled message while it acquires or transfers its lease. It drops at cancellation, execution handoff, forwarding to another owner, or failure, not when model generation completes. An idle `queueMessage()` handoff is immediate and isn't represented as a cancellable pending slot.
|
|
276
|
-
|
|
277
|
-
Use [`cancelQueuedMessages()`](#cancelqueuedmessagesoptions) to cancel selected pending input or an owner group. Queue-count events count only entries in the queue shared by `queueMessage()` and `queueSignal()`, not signals waiting for delivery into an active run. Owner-scoped observation and cancellation match the calling Agent, its local runtime, resource, thread, and owner ID.
|
|
249
|
+
Use [`subscribeThreadEvents({ resourceId, threadId }, listener)`](https://mastra.ai/reference/signals/thread-events) to observe locally pending messages on the shared thread. The listener currently receives only `queue-count-changed` events. For subscription options, count semantics, unsubscribe behavior, and owner-scoped observation, see the [Thread events reference](https://mastra.ai/reference/signals/thread-events).
|
|
278
250
|
|
|
279
251
|
### `queueSignal(signal, options)`
|
|
280
252
|
|
|
281
|
-
Queues a typed signal for the next turn on a thread. It behaves like `queueMessage()`, but accepts any signal input
|
|
253
|
+
Queues a typed signal for the next turn on a thread. It behaves like `queueMessage()`, but accepts any signal input and preserves its `type`, `tagName`, and `attributes` for the queued run.
|
|
282
254
|
|
|
283
255
|
```typescript
|
|
284
256
|
agent.queueSignal(
|
|
@@ -325,7 +297,7 @@ For `signalIds`, Mastra publishes all requested IDs through PubSub, even when no
|
|
|
325
297
|
|
|
326
298
|
Sends a signal to an active run or memory thread.
|
|
327
299
|
|
|
328
|
-
**signal** (`{ type: 'user' | 'state' | 'reactive' | 'notification' | 'user-message' | 'system-reminder'; tagName?: string; contents: string | Array<TextPart | FilePart>; attributes?: Record<string, JSONValue>; metadata?: Record<string, unknown>; providerOptions?: ProviderMetadata }`): Signal context to send to the thread. type is the semantic signal category. tagName controls the XML tag the model sees. For example, { type: 'notification', tagName: 'github-review' } renders as \<github-review>...\</github-review>. Legacy user-message and system-reminder payloads are still accepted and normalized. Unknown type values are rejected; use tagName for custom XML tags.
|
|
300
|
+
**signal** (`{ type: 'user' | 'state' | 'reactive' | 'notification' | 'user-message' | 'system-reminder'; tagName?: string; contents: string | Array<TextPart | FilePart>; attributes?: Record<string, JSONValue>; metadata?: Record<string, unknown>; providerOptions?: ProviderMetadata; transient?: boolean }`): Signal context to send to the thread. type is the semantic signal category. tagName controls the XML tag the model sees. For example, { type: 'notification', tagName: 'github-review' } renders as \<github-review>...\</github-review>. tagName and attribute names must be XML-safe: letters, numbers, periods, hyphens, and underscores, starting with a letter or underscore. Set transient: true to deliver the signal to the current model request without storing it; transient signals are never stored, state signals cannot be transient, and combining transient with a persist behavior discards the signal. Legacy user-message and system-reminder payloads are still accepted and normalized. Unknown type values are rejected; use tagName for custom XML tags.
|
|
329
301
|
|
|
330
302
|
**options** (`object`): Targeting and delivery behavior for the signal.
|
|
331
303
|
|
|
@@ -414,7 +386,7 @@ Returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSigna
|
|
|
414
386
|
|
|
415
387
|
### `sendNotificationSignal(notification, options)`
|
|
416
388
|
|
|
417
|
-
Creates or coalesces a notification inbox record and resolves the notification delivery policy. It sends a notification signal when the decision is immediate.
|
|
389
|
+
Creates or coalesces a notification inbox record and resolves the notification delivery policy. It sends a notification signal when the decision is immediate. For record fields, statuses, priorities, policy evaluation, and dispatch configuration, see the [Notifications reference](https://mastra.ai/reference/signals/notifications).
|
|
418
390
|
|
|
419
391
|
```typescript
|
|
420
392
|
const result = await agent.sendNotificationSignal(
|
|
@@ -464,7 +436,7 @@ const result = await agent.sendNotificationSignal(
|
|
|
464
436
|
|
|
465
437
|
Returns `{ record: NotificationRecord, decision: NotificationDeliveryDecision, runId?: string, signal?: CreatedAgentSignal, persisted?: Promise<void>, accepted?: Promise<SendAgentSignalAccepted> }`. `record` is the stored inbox record. `decision` is the delivery-policy result. `signal` and `runId` are present when ingress emits a signal immediately, including the immediate summary emitted for active high-priority notifications. `persisted` is present when the emitted signal is persisted without waking an idle thread. `accepted` is present when a signal is emitted and resolves at decision-time, once Mastra decides what to do with it: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run, or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` on the accepted result is present only on `wake` and `deliver`. On the `wake` action, `output` is the agent stream for in-process consumption.
|
|
466
438
|
|
|
467
|
-
Default delivery is priority-aware. `urgent` notifications deliver immediately. `high` notifications deliver immediately when the thread is idle. When the thread is active, Mastra emits a summary immediately and keeps `deliverAt` for later full delivery when the thread is idle. `medium` notifications deliver immediately when idle and batch into summaries when active. `low` notifications batch into summaries in both active and idle threads. Idle low-priority summaries reach subscribers without waking the model loop. For the full flow, visit [Signals](https://mastra.ai/docs/
|
|
439
|
+
Default delivery is priority-aware. `urgent` notifications deliver immediately. `high` notifications deliver immediately when the thread is idle. When the thread is active, Mastra emits a summary immediately and keeps `deliverAt` for later full delivery when the thread is idle. `medium` notifications deliver immediately when idle and batch into summaries when active. `low` notifications batch into summaries in both active and idle threads. Idle low-priority summaries reach subscribers without waking the model loop. For the full flow, visit [Signals](https://mastra.ai/docs/signals/notifications).
|
|
468
440
|
|
|
469
441
|
Configure `notifications.deliveryPolicy` on the agent when some notifications should wait for a different dispatch window or summary rollup:
|
|
470
442
|
|
|
@@ -473,7 +445,7 @@ export const supportAgent = new Agent({
|
|
|
473
445
|
id: 'support-agent',
|
|
474
446
|
name: 'Support Agent',
|
|
475
447
|
instructions: 'Help the user triage updates.',
|
|
476
|
-
model: 'openai/gpt-
|
|
448
|
+
model: 'openai/gpt-6.1-sol',
|
|
477
449
|
notifications: {
|
|
478
450
|
deliveryPolicy: {
|
|
479
451
|
priorities: {
|
|
@@ -528,7 +500,7 @@ Subscribes to raw stream chunks for a memory thread. Use this before calling `se
|
|
|
528
500
|
|
|
529
501
|
**options.hideSignals** (`boolean | AgentSignalType[]`): Use true to hide all recognized signals, false to show all, or an array to hide selected types from this subscription, including live, idle-persisted, and replayed signals. Other subscribers and the initiating stream keep their own policies.
|
|
530
502
|
|
|
531
|
-
**options.withInitialHistory** (`boolean | { perPage?: number }`): Emit the stored thread messages as one thread-history chunk first, then only retained parts newer than that history, then live parts. Completed runs already in storage aren't replayed; pending tool approvals are still emitted. perPage limits how many recent messages are loaded (default 40).
|
|
503
|
+
**options.withInitialHistory** (`boolean | { perPage?: number }`): Emit the stored thread messages as one thread-history chunk first, then only retained parts newer than that history, then live parts. Completed runs already in storage aren't replayed; pending tool approvals are still emitted. perPage limits how many recent messages are loaded (default 40). Without agent memory, or when the thread has no stored messages yet, the history chunk is emitted with an empty messages array.
|
|
532
504
|
|
|
533
505
|
By default, subscriptions include every signal type, including reactive reminders. To hide reminders for one subscriber without affecting another:
|
|
534
506
|
|
|
@@ -553,6 +525,8 @@ for await (const chunk of subscription.stream) {
|
|
|
553
525
|
}
|
|
554
526
|
```
|
|
555
527
|
|
|
528
|
+
The `thread-history` chunk carries the newest `perPage` messages and a `hasMore` flag. See [Thread subscription chunks](https://mastra.ai/reference/streaming/ChunkType) for its shape.
|
|
529
|
+
|
|
556
530
|
`hideSignals: true` hides all recognized signal types. Set it to `false` to show all signals. An array accepts `user`, `state`, `reactive`, `notification`, `user-message`, and `system-reminder`. Matching normalizes `system-reminder` to `reactive` and `user-message` to `user`. An omitted option, `false`, or `[]` excludes nothing. Each subscriber filters its own live and replayed chunks, including remote pubsub events and idle-persisted signals. Filtering preserves non-signal chunks, unknown or malformed signal chunks, ordering, and completion/error events, even when every signal type is excluded.
|
|
557
531
|
|
|
558
532
|
Exclusions don't change model context, storage, shared broadcasts, or another caller's output. They aren't a security boundary and don't replace `ifActive`/`ifIdle` delivery policies or `transient` persistence behavior. This option is supported by the in-process core API, not HTTP or client-js subscription requests. See [stream signal visibility](https://mastra.ai/reference/streaming/agents/stream) for transform ordering and the distinction from recall's exact stored-type matching and reminder-hidden history default.
|
|
@@ -611,7 +585,7 @@ Returns an `AgentThreadSubscription` object with these members:
|
|
|
611
585
|
|
|
612
586
|
**notifications** (`object`): Notification delivery configuration for durable notification signals.
|
|
613
587
|
|
|
614
|
-
**notifications.deliveryPolicy** (`NotificationDeliveryPolicyConfig`): Controls how notification records are delivered. Configure a default decision, per-priority decisions, per-source decisions, or a custom decide() function.
|
|
588
|
+
**notifications.deliveryPolicy** (`NotificationDeliveryPolicyConfig`): Controls how notification records are delivered. Configure a default decision, per-priority decisions, per-source decisions, or a custom decide() function. See Notifications for policy types and evaluation order.
|
|
615
589
|
|
|
616
590
|
**voice** (`CompositeVoice`): Voice settings for speech input and output.
|
|
617
591
|
|
|
@@ -664,7 +638,7 @@ export const agent = new Agent({
|
|
|
664
638
|
id: 'support-agent',
|
|
665
639
|
name: 'support-agent',
|
|
666
640
|
instructions: 'Help users with their questions.',
|
|
667
|
-
model: 'openai/gpt-
|
|
641
|
+
model: 'openai/gpt-6.1-sol',
|
|
668
642
|
hooks: {
|
|
669
643
|
beforeToolCall: ({ toolName, input }) => {
|
|
670
644
|
console.log(`Running ${toolName}`, input)
|
|
@@ -694,9 +668,11 @@ The hook context `metadata` includes `agentId` and `agentName`. Per-execution ho
|
|
|
694
668
|
|
|
695
669
|
## Editor overrides
|
|
696
670
|
|
|
697
|
-
When you register the [`MastraEditor`](https://mastra.ai/reference/editor/mastra-editor), the `editor` field controls which parts of
|
|
671
|
+
When you register the [`MastraEditor`](https://mastra.ai/reference/editor/mastra-editor), the `editor` field controls which parts of an agent are defined in code and which are owned by Studio. Fields owned by code are read-only in Studio and are stripped from saved overrides. Fields owned by Studio must be omitted from code. The agent reads these fields from stored overrides and fails closed when they're missing.
|
|
672
|
+
|
|
673
|
+
**editor** (`false | { instructions?: boolean; tools?: boolean | { description?: boolean } }`): Omit to allow editing instructions and tools, using values in code as defaults. Set to false to lock the agent. Set instructions: true to make Studio own the instructions; omit instructions from code. Set tools: true to make Studio own tool membership and descriptions; omit tools from code. Set tools: { description: true } to keep tool membership in code and allow only description edits.
|
|
698
674
|
|
|
699
|
-
|
|
675
|
+
When a field is owned by Studio, TypeScript rejects it in code: `instructions` with `editor: { instructions: true }` and `tools` with `editor: { tools: true }` are type errors. An agent whose instructions are owned by Studio fails closed until a stored version with instructions is published.
|
|
700
676
|
|
|
701
677
|
The agent's `id`, `name`, and `model` always come from code and can't be overridden through Editor. See [Editor](https://mastra.ai/docs/studio/editor) for usage.
|
|
702
678
|
|
|
@@ -19,7 +19,7 @@ export const supportAgent = new Agent({
|
|
|
19
19
|
id: 'support-agent',
|
|
20
20
|
name: 'Support Agent',
|
|
21
21
|
instructions: 'You are a helpful support assistant.',
|
|
22
|
-
model: 'openai/gpt-
|
|
22
|
+
model: 'openai/gpt-6.1-sol',
|
|
23
23
|
channels: {
|
|
24
24
|
adapters: {
|
|
25
25
|
slack: createSlackAdapter(),
|
|
@@ -41,7 +41,7 @@ The `channels` property accepts a `ChannelConfig` object with the following fiel
|
|
|
41
41
|
|
|
42
42
|
**inlineLinks** (`InlineLinkEntry[]`): Promote URLs found in message text to file parts so the model can process linked content. Each entry matches a domain. Disabled by default.
|
|
43
43
|
|
|
44
|
-
**tools** (`boolean`): Whether getTools() returns the channel-specific tools (add\_reaction, remove\_reaction). Set to false for models that do not support function calling. Channel tools are never added to the agent automatically — pass them explicitly via tools: { ...channels.getTools() }. (Default: `true`)
|
|
44
|
+
**tools** (`boolean`): Whether getTools() returns the channel-specific tools (add\_reaction, remove\_reaction). Set to false for models that do not support function calling. Channel tools are never added to the agent automatically — pass them explicitly via tools: { ...channels.getTools() }. They work on any run in a channel-backed thread, including runs that did not start from a chat message, such as a schedule or a Studio prompt. (Default: `true`)
|
|
45
45
|
|
|
46
46
|
**state** (`StateAdapter`): State adapter for subscriptions and deduplication. Defaults to MastraStateAdapter backed by the Mastra instance storage. Channels require storage to be configured. (Default: `MastraStateAdapter (from Mastra storage)`)
|
|
47
47
|
|
|
@@ -72,7 +72,7 @@ const agent = new Agent({
|
|
|
72
72
|
id: 'example',
|
|
73
73
|
name: 'Example',
|
|
74
74
|
instructions: '...',
|
|
75
|
-
model: 'openai/gpt-
|
|
75
|
+
model: 'openai/gpt-6.1-sol',
|
|
76
76
|
channels: {
|
|
77
77
|
adapters: {
|
|
78
78
|
discord: {
|
|
@@ -106,6 +106,8 @@ const agent = new Agent({
|
|
|
106
106
|
|
|
107
107
|
**textFormat** (`'markdown' | 'plain'`): Dialect for the agent's final reply text. 'markdown' (the default) posts replies as markdown: adapters with native markdown rendering (Slack) render it directly, others convert it to their platform format. 'plain' posts replies as literal plain text, restoring the pre-markdown behavior for agents prompted to emit a platform dialect such as Slack mrkdwn. Applies to final reply text only; tool cards, error messages, and tripwire notices are unaffected. Native streaming is always markdown regardless of this setting. (Default: `'markdown'`)
|
|
108
108
|
|
|
109
|
+
**textDisplay** (`'show' | 'hidden'`): Whether the agent's reply text is posted to the channel. 'hidden' never posts reply text, so the agent's own messages reach the channel only through tools you give it, such as a reply tool. Tool display, approval prompts, error messages, and typing status are unaffected, and the text still reaches the agent's stream and memory. (Default: `'show'`)
|
|
110
|
+
|
|
109
111
|
**toolDisplay** (`'cards' | 'text' | 'timeline' | 'grouped' | 'hidden' | ToolDisplayFn`): How tool calls are rendered in the channel. "cards" posts per-tool running/result cards as rich Block Kit. "text" posts the same lifecycle as plain text (no Block Kit). "timeline" and "grouped" stream tool state as inline task\_update chunks (requires streaming: true; Slack only today — other adapters may render a placeholder). "hidden" executes tools silently. Pass a function to render tool events yourself; return { kind: "post", message } for a discrete post/edit, { kind: "stream", chunk } to push into the streaming widget, or undefined to skip rendering that event. Add openIfEmpty: false to a stream result when its chunk should only apply to an active streaming session. Approve/deny prompts render as a separate built-in card in every string mode; a toolDisplay function receives the approval event and may replace the card by returning { kind: "post", message }. (Default: `'cards' ('grouped' for Slack)`)
|
|
110
112
|
|
|
111
113
|
**typingStatus** (`boolean | ((chunk: AgentChunkType, ctx: TypingStatusContext) => string | false | null | undefined | void)`): Control the platform typing indicator. true uses built-in defaults (is typing… on text, is calling {tool}… on tool-call, is waiting for approval… on tool-call-approval). false suppresses typing entirely — useful when a live streaming widget (e.g. toolDisplay: "grouped" in Slack) already conveys progress. Pass a function to set custom status copy per chunk; return a string to set the status, or false/null/undefined to leave it unchanged. Compose with defaultTypingStatus (exported from @mastra/core/channels) to fall back to defaults for chunks you don't handle. (Default: `true`)
|
|
@@ -120,7 +122,7 @@ const agent = new Agent({
|
|
|
120
122
|
|
|
121
123
|
Pass a function to `toolDisplay` for fully custom rendering. The function receives a `ToolDisplayEvent` (`running` / `result` / `error` / `approval` / `approved` / `denied`) and a `ToolDisplayContext` (`{ mode, platform }`); return `{ kind: 'post', message }` for a discrete post/edit, `{ kind: 'stream', chunk }` to push into the active streaming widget, or `undefined` to skip rendering that event.
|
|
122
124
|
|
|
123
|
-
After a user
|
|
125
|
+
After a user selects Approve or Deny, Mastra sends an `approved` or `denied` event. Both include `byUser`, the name of the user who responded, which is undefined in DMs. A `post` result replaces the approval card in place. If the function returns nothing, a blank message, or throws, Mastra shows the default "Approved" or "Denied" card, which names the user outside DMs.
|
|
124
126
|
|
|
125
127
|
By default, a stream result opens a streaming session when none is active. Set `openIfEmpty: false` when the chunk only applies to an existing session. Mastra skips the chunk when no session is active. Static channels ignore this option and keep their existing plain-text fallback behavior.
|
|
126
128
|
|
|
@@ -141,7 +143,7 @@ toolDisplay: event => {
|
|
|
141
143
|
}
|
|
142
144
|
```
|
|
143
145
|
|
|
144
|
-
Approve/deny prompts (`requireApproval`) render as a separate built-in card in every string mode, because inline task entries can't carry interactive buttons. With a `toolDisplay` function, the `approval` event is passed to your function in both streaming and static modes; return a non-blank `{ kind: 'post', message }` to replace the built-in card with your own message (for example, a localized one). Returning `undefined`, a blank message, or `{ kind: 'stream' }` falls back to the built-in card so the
|
|
146
|
+
Approve/deny prompts (`requireApproval`) render as a separate built-in card in every string mode, because inline task entries can't carry interactive buttons. With a `toolDisplay` function, the `approval` event is passed to your function in both streaming and static modes; return a non-blank `{ kind: 'post', message }` to replace the built-in card with your own message (for example, a localized one). Returning `undefined`, a blank message, or `{ kind: 'stream' }` falls back to the built-in card so the user can still approve or deny the request.
|
|
145
147
|
|
|
146
148
|
```typescript
|
|
147
149
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -151,7 +153,7 @@ const agent = new Agent({
|
|
|
151
153
|
id: 'streaming-agent',
|
|
152
154
|
name: 'Streaming Agent',
|
|
153
155
|
instructions: '...',
|
|
154
|
-
model: 'openai/gpt-
|
|
156
|
+
model: 'openai/gpt-6.1-sol',
|
|
155
157
|
channels: {
|
|
156
158
|
adapters: {
|
|
157
159
|
slack: {
|
|
@@ -179,7 +181,7 @@ const agent = new Agent({
|
|
|
179
181
|
id: 'custom-typing-agent',
|
|
180
182
|
name: 'Custom Typing Agent',
|
|
181
183
|
instructions: '...',
|
|
182
|
-
model: 'openai/gpt-
|
|
184
|
+
model: 'openai/gpt-6.1-sol',
|
|
183
185
|
channels: {
|
|
184
186
|
adapters: {
|
|
185
187
|
discord: {
|
|
@@ -213,7 +215,7 @@ const agent = new Agent({
|
|
|
213
215
|
id: 'custom-handler-agent',
|
|
214
216
|
name: 'Custom Handler Agent',
|
|
215
217
|
instructions: '...',
|
|
216
|
-
model: 'openai/gpt-
|
|
218
|
+
model: 'openai/gpt-6.1-sol',
|
|
217
219
|
channels: {
|
|
218
220
|
adapters: {
|
|
219
221
|
slack: createSlackAdapter(),
|
|
@@ -273,7 +275,7 @@ onDirectMessage: async (thread, message, defaultHandler, ctx) => {
|
|
|
273
275
|
|
|
274
276
|
Anything the run reads from its request context can be decided per message this way, such as which user a platform sender maps to.
|
|
275
277
|
|
|
276
|
-
`ctx.signalMetadata` is the metadata attached to this message's Agent Signal, built fresh for every message. Add JSON-serializable, non-sensitive values before calling `defaultHandler`. Mastra may persist signal metadata and publish it through PubSub. Unlike `ctx.requestContext`, it follows the message whether it starts a new run or is delivered to one that
|
|
278
|
+
`ctx.signalMetadata` is the metadata attached to this message's Agent Signal, built fresh for every message. Add JSON-serializable, non-sensitive values before calling `defaultHandler`. Mastra may persist signal metadata and publish it through PubSub. Unlike `ctx.requestContext`, it follows the message whether it starts a new run or is delivered to one that's already active.
|
|
277
279
|
|
|
278
280
|
`ctx.skipped` lists earlier messages from the same sender that the Chat SDK batched into this turn when a `chatOptions.concurrency` strategy such as `burst`, `debounce`, or `queue` is set, oldest first. It's empty when nothing was batched.
|
|
279
281
|
|
|
@@ -291,7 +293,7 @@ const agent = new Agent({
|
|
|
291
293
|
id: 'sso-agent',
|
|
292
294
|
name: 'SSO Agent',
|
|
293
295
|
instructions: '...',
|
|
294
|
-
model: 'openai/gpt-
|
|
296
|
+
model: 'openai/gpt-6.1-sol',
|
|
295
297
|
channels: {
|
|
296
298
|
adapters: {
|
|
297
299
|
slack: createSlackAdapter(),
|
|
@@ -334,7 +336,7 @@ const agent = new Agent({
|
|
|
334
336
|
id: 'session-agent',
|
|
335
337
|
name: 'Session Agent',
|
|
336
338
|
instructions: '...',
|
|
337
|
-
model: 'openai/gpt-
|
|
339
|
+
model: 'openai/gpt-6.1-sol',
|
|
338
340
|
channels: {
|
|
339
341
|
adapters: {
|
|
340
342
|
slack: createSlackAdapter(),
|
|
@@ -21,7 +21,7 @@ const agent = new Agent({
|
|
|
21
21
|
id: 'my-agent',
|
|
22
22
|
name: 'My Agent',
|
|
23
23
|
instructions: 'You are a helpful assistant',
|
|
24
|
-
model: 'openai/gpt-
|
|
24
|
+
model: 'openai/gpt-6.1-sol',
|
|
25
25
|
})
|
|
26
26
|
|
|
27
27
|
const durableAgent = createDurableAgent({ agent })
|
|
@@ -53,7 +53,7 @@ const myAgent = new Agent({
|
|
|
53
53
|
id: 'my-agent',
|
|
54
54
|
name: 'My Agent',
|
|
55
55
|
instructions: 'You are a helpful assistant',
|
|
56
|
-
model: 'openai/gpt-
|
|
56
|
+
model: 'openai/gpt-6.1-sol',
|
|
57
57
|
durable: true, // or: { maxSteps: 10, cleanupTimeoutMs: 60_000 }
|
|
58
58
|
})
|
|
59
59
|
|
|
@@ -96,7 +96,7 @@ Returns: `DurableAgent`
|
|
|
96
96
|
|
|
97
97
|
## `createEventedAgent(options)`
|
|
98
98
|
|
|
99
|
-
Wraps an `Agent` with fire-and-forget durable execution on the built-in evented workflow engine. Like `createDurableAgent`, it returns a result you stream from, but the run is started without being awaited:
|
|
99
|
+
Wraps an `Agent` with fire-and-forget durable execution on the built-in evented workflow engine. Like `createDurableAgent`, it returns a result you stream from, but the run is started without being awaited: events on the Mastra instance's PubSub drive execution independently of the caller. Register the agent on a `Mastra` instance with storage to get evented execution; without one, the agent falls back to the default in-process engine and logs a warning. It doesn't accept `id` or `name` overrides.
|
|
100
100
|
|
|
101
101
|
```typescript
|
|
102
102
|
import { createEventedAgent } from '@mastra/core/agent/durable'
|
|
@@ -195,7 +195,7 @@ const { output } = await durableAgent.observe(runId, {
|
|
|
195
195
|
await output.text
|
|
196
196
|
```
|
|
197
197
|
|
|
198
|
-
The `offset` option is an inclusive, zero-based PubSub event index. It counts every cached event published to the run topic, including lifecycle events,
|
|
198
|
+
The `offset` option is an inclusive, zero-based PubSub event index. It counts every cached event published to the run topic, including lifecycle events, rather than counting chunks. This transport index is unavailable through public stream chunks and callbacks. Only pass an offset when another integration already tracks the transport position.
|
|
199
199
|
|
|
200
200
|
A non-zero offset can skip earlier events. Aggregated values are built only from chunks delivered to that observer. If the offset skips earlier text deltas, `output.text` is partial and structured output may be incomplete or fail validation or parsing.
|
|
201
201
|
|
|
@@ -255,7 +255,7 @@ const { runId } = await durableAgent.stream('Summarize the document')
|
|
|
255
255
|
durableAgent.abortRunStream(runId)
|
|
256
256
|
```
|
|
257
257
|
|
|
258
|
-
|
|
258
|
+
Publishing the abort request over PubSub requires a shared backend in a multi-process deployment, such as [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams). The default `EventEmitterPubSub` only reaches runs in the same process. `InngestAgent` doesn't implement this method. Cancel an Inngest run with the `abort()` returned by its `stream()`.
|
|
259
259
|
|
|
260
260
|
Stopping a durable run through `abortRunStream()` or `abortThreadStream()` requires `@mastra/core@1.62.0` or later. Earlier versions record the abort without stopping the run.
|
|
261
261
|
|
|
@@ -330,7 +330,7 @@ interface DurableAgentListActiveRunsResult {
|
|
|
330
330
|
|
|
331
331
|
Discovers runs stuck in `running` status for this agent and re-drives them from the last persisted snapshot. Accepts the same filters and pagination as `listActiveRuns()`, plus `runId`. Returns the outcome for each run.
|
|
332
332
|
|
|
333
|
-
Up to five run waits proceed concurrently, with results returned in discovery order. Each attempt has a single 30-second wait budget covering both `recover()` setup and settlement of the whole recovered workflow. When the budget expires, another run can use the slot. The
|
|
333
|
+
Up to five run waits proceed concurrently, with results returned in discovery order. Each attempt has a single 30-second wait budget covering both `recover()` setup and settlement of the whole recovered workflow. When the budget expires, another run can use the slot. The timeout returns `status: 'skipped'` with `reason: 'recovery-timeout'` and `retryAt` set 30 seconds ahead, without canceling setup or execution, releasing a live claim, or counting as success or failure. The attempt continues in the background, and its eventual outcome doesn't change the returned results. The concurrency limit bounds waiting, not live executions.
|
|
334
334
|
|
|
335
335
|
[`mastra.recoverAllDurableAgents()`](https://mastra.ai/reference/core/mastra-class) schedules timeout re-checks automatically. Direct callers of `recoverActiveRuns()` must schedule their own calls after `retryAt`. While the original bulk attempt remains pending, re-checks defer with another `recovery-timeout` and a future `retryAt`, without invoking `recover()` again. Once it settles, recovery checks the persisted snapshot and ownership before retrying. Finished or suspended runs aren't restarted.
|
|
336
336
|
|
|
@@ -354,14 +354,14 @@ Pass a `runId` to recover a single known run:
|
|
|
354
354
|
await durableAgent.recoverActiveRuns({ runId: 'run-abc-123' })
|
|
355
355
|
```
|
|
356
356
|
|
|
357
|
-
|
|
357
|
+
For a run that another execution still drives, `recoverActiveRuns()` returns `status: 'skipped'` and a `reason`, leaving that execution in control. Checking the run again requires a separate call. For a run held by another process, `retryAt` is the time after which that claim lapses unless renewed. Call `recoverActiveRuns({ runId })` after it to recover the run if its process crashed. [`mastra.recoverAllDurableAgents()`](https://mastra.ai/reference/core/mastra-class) schedules these re-checks itself.
|
|
358
358
|
|
|
359
|
-
| `reason` | Meaning
|
|
360
|
-
| --------------------- |
|
|
361
|
-
| `run-active` | Another execution, possibly in another process, holds the run. Sets `retryAt`.
|
|
362
|
-
| `run-active-locally` | This process is executing the run.
|
|
363
|
-
| `already-in-progress` | This process is already recovering the run.
|
|
364
|
-
| `recovery-timeout` | The wait expired or an earlier bulk recovery attempt is still pending. Sets `retryAt
|
|
359
|
+
| `reason` | Meaning |
|
|
360
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
361
|
+
| `run-active` | Another execution, possibly in another process, holds the run. Sets `retryAt`. |
|
|
362
|
+
| `run-active-locally` | This process is executing the run. |
|
|
363
|
+
| `already-in-progress` | This process is already recovering the run. |
|
|
364
|
+
| `recovery-timeout` | The wait expired or an earlier bulk recovery attempt is still pending. Sets `retryAt` without duplicating the pending attempt on re-checks. |
|
|
365
365
|
|
|
366
366
|
Returns:
|
|
367
367
|
|
|
@@ -328,7 +328,7 @@ For the streaming version of the same chunk shape, see the [ChunkType reference]
|
|
|
328
328
|
|
|
329
329
|
**steps.response** (`object`): Response metadata for this step.
|
|
330
330
|
|
|
331
|
-
**finishReason** (`string`): The reason generation finished. Values include 'stop' (normal completion), 'tool-calls' (ended with tool calls), 'suspended' (
|
|
331
|
+
**finishReason** (`string`): The reason generation finished. Values include 'stop' (normal completion), 'tool-calls' (ended with tool calls), 'suspended' (paused for tool approval or because a tool called suspend()), or 'error' (error occurred).
|
|
332
332
|
|
|
333
333
|
**response** (`object`): Response metadata from the model provider. Useful for accessing rate limit headers and request IDs.
|
|
334
334
|
|
|
@@ -360,7 +360,7 @@ For the streaming version of the same chunk shape, see the [ChunkType reference]
|
|
|
360
360
|
|
|
361
361
|
**files** (`FileChunk[]`): Files generated by the model.
|
|
362
362
|
|
|
363
|
-
**suspendPayload** (`object`): Present when finishReason is 'suspended'. Contains tool call
|
|
363
|
+
**suspendPayload** (`object`): Present when finishReason is 'suspended'. Contains details about the pending tool call. For tool approval, use toolCallId with approveToolCallGenerate() or declineToolCallGenerate(). For a tool that called suspend(), suspendPayload holds the data the tool passed to suspend(), and you resume with resumeGenerate().
|
|
364
364
|
|
|
365
365
|
**suspendPayload.toolCallId** (`string`): Unique identifier for the pending tool call.
|
|
366
366
|
|
|
@@ -368,7 +368,13 @@ For the streaming version of the same chunk shape, see the [ChunkType reference]
|
|
|
368
368
|
|
|
369
369
|
**suspendPayload.args** (`Record<string, any>`): Arguments that will be passed to the tool.
|
|
370
370
|
|
|
371
|
-
**
|
|
371
|
+
**suspendPayload.suspendPayload** (`any`): Only when a tool called suspend(). Contains the data the tool passed to suspend(), matching the tool's suspendSchema.
|
|
372
|
+
|
|
373
|
+
**suspendPayload.resumeSchema** (`string`): JSON Schema, serialized as a string, describing the data resumeGenerate() or resumeStream() expects.
|
|
374
|
+
|
|
375
|
+
**resumeSchema** (`string`): JSON Schema, serialized as a string, describing the data resumeGenerate() or resumeStream() expects. Present when finishReason is suspended; the same value also appears inside suspendPayload.
|
|
376
|
+
|
|
377
|
+
**runId** (`string`): Unique identifier for this execution run. Required when resuming a suspended execution with approveToolCallGenerate(), declineToolCallGenerate(), resumeGenerate(), or their streaming equivalents.
|
|
372
378
|
|
|
373
379
|
**traceId** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
374
380
|
|
|
@@ -386,6 +392,54 @@ For the streaming version of the same chunk shape, see the [ChunkType reference]
|
|
|
386
392
|
|
|
387
393
|
## More examples
|
|
388
394
|
|
|
395
|
+
### Resuming a runtime-suspended generation
|
|
396
|
+
|
|
397
|
+
`generate()` returns `finishReason: 'suspended'` in two cases: a tool requires approval (see [`requireToolApproval`](#parameters)), or a tool's `execute` function calls `suspend()`.
|
|
398
|
+
|
|
399
|
+
This example covers a tool that calls `suspend()`. The tool declares a `suspendSchema` for the data it passes to `suspend()` and a `resumeSchema` for the data it needs to continue:
|
|
400
|
+
|
|
401
|
+
```typescript
|
|
402
|
+
const weatherTool = createTool({
|
|
403
|
+
id: 'get-weather',
|
|
404
|
+
inputSchema: z.object({ location: z.string().optional() }),
|
|
405
|
+
suspendSchema: z.object({ question: z.string() }),
|
|
406
|
+
resumeSchema: z.object({ location: z.string() }),
|
|
407
|
+
execute: async ({ location }, context) => {
|
|
408
|
+
if (!location) {
|
|
409
|
+
return await context?.agent?.suspend({
|
|
410
|
+
question: 'Which city would you like the weather for?',
|
|
411
|
+
})
|
|
412
|
+
}
|
|
413
|
+
return await fetchWeather(location)
|
|
414
|
+
},
|
|
415
|
+
})
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
In the suspended result, `suspendPayload.suspendPayload` contains the data the tool passed to `suspend()`. Resume the run with `resumeGenerate()`, passing data that matches the tool's `resumeSchema` and the suspended `runId`:
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
const output = await agent.generate("What's the weather in London?")
|
|
422
|
+
|
|
423
|
+
if (output.finishReason === 'suspended') {
|
|
424
|
+
console.log(output.suspendPayload.toolCallId)
|
|
425
|
+
console.log(output.suspendPayload.suspendPayload) // { question: 'Which city would you like the weather for?' }
|
|
426
|
+
|
|
427
|
+
const resumed = await agent.resumeGenerate(
|
|
428
|
+
{ location: 'London' },
|
|
429
|
+
{
|
|
430
|
+
runId: output.runId!,
|
|
431
|
+
// Pass per-call options again, for example requestContext or onStepFinish.
|
|
432
|
+
},
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
console.log(resumed.text)
|
|
436
|
+
}
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
If the resume data doesn't match the tool's `resumeSchema`, `resumeGenerate()` throws an error with the id `AGENT_RESUME_INVALID_DATA` and the run stays suspended, so you can retry with corrected data. When more than one tool call is suspended, pass `toolCallId` to resume a specific one.
|
|
440
|
+
|
|
441
|
+
For tool approval, use `approveToolCallGenerate()` and `declineToolCallGenerate()` instead, as shown in [human-in-the-loop](https://mastra.ai/docs/agents/human-in-the-loop). To resume from a stream, use `resumeStream()` with the same data.
|
|
442
|
+
|
|
389
443
|
### With model settings
|
|
390
444
|
|
|
391
445
|
Example of limiting output tokens and setting temperature:
|
|
@@ -207,12 +207,12 @@ await agent.generateLegacy(
|
|
|
207
207
|
sentiment: z.enum(['positive', 'negative', 'neutral']),
|
|
208
208
|
confidence: z.number(),
|
|
209
209
|
}),
|
|
210
|
-
model: 'openai/gpt-
|
|
210
|
+
model: 'openai/gpt-6.1-sol',
|
|
211
211
|
errorStrategy: 'warn',
|
|
212
212
|
},
|
|
213
213
|
// Output processors for response validation
|
|
214
214
|
outputProcessors: [
|
|
215
|
-
new ModerationProcessor({ model: 'openai/gpt-
|
|
215
|
+
new ModerationProcessor({ model: 'openai/gpt-6-luna' }),
|
|
216
216
|
new TokenLimiterProcessor({ maxTokens: 1000 }),
|
|
217
217
|
],
|
|
218
218
|
},
|
|
@@ -14,7 +14,7 @@ await agent.getLLM()
|
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
16
|
await agent.getLLM({
|
|
17
|
-
model: 'openai/gpt-
|
|
17
|
+
model: 'openai/gpt-6.1-sol',
|
|
18
18
|
})
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -35,7 +35,7 @@ await agent.getLLM({
|
|
|
35
35
|
```typescript
|
|
36
36
|
await agent.getLLM({
|
|
37
37
|
requestContext: new RequestContext(),
|
|
38
|
-
model: 'openai/gpt-
|
|
38
|
+
model: 'openai/gpt-6.1-sol',
|
|
39
39
|
})
|
|
40
40
|
```
|
|
41
41
|
|
|
@@ -33,7 +33,7 @@ export const supportAgent = new Agent({
|
|
|
33
33
|
id: 'support-agent',
|
|
34
34
|
name: 'Support Agent',
|
|
35
35
|
instructions: 'You help customers with support requests.',
|
|
36
|
-
model: 'openai/gpt-
|
|
36
|
+
model: 'openai/gpt-6.1-sol',
|
|
37
37
|
metadata: { type: 'support' },
|
|
38
38
|
})
|
|
39
39
|
|
|
@@ -49,7 +49,7 @@ export const supportAgent = new Agent({
|
|
|
49
49
|
id: 'support-agent',
|
|
50
50
|
name: 'Support Agent',
|
|
51
51
|
instructions: 'You help customers with support requests.',
|
|
52
|
-
model: 'openai/gpt-
|
|
52
|
+
model: 'openai/gpt-6.1-sol',
|
|
53
53
|
metadata: ({ requestContext }) => ({
|
|
54
54
|
type: 'support',
|
|
55
55
|
tenant: requestContext.get('tenant'),
|
|
@@ -20,7 +20,7 @@ const agent = new Agent({
|
|
|
20
20
|
id: 'network-agent',
|
|
21
21
|
name: 'Network Agent',
|
|
22
22
|
instructions: 'You are a network agent that can help users with a variety of tasks.',
|
|
23
|
-
model: 'openai/gpt-
|
|
23
|
+
model: 'openai/gpt-6.1-sol',
|
|
24
24
|
agents: {
|
|
25
25
|
agent1,
|
|
26
26
|
agent2,
|
|
@@ -25,7 +25,7 @@ export const browserAgent = new Agent({
|
|
|
25
25
|
name: 'Browser Agent',
|
|
26
26
|
instructions: `You can browse the web. Use browser_snapshot to see the page structure,
|
|
27
27
|
then interact with elements using their refs (e.g., @e5).`,
|
|
28
|
-
model: 'openai/gpt-
|
|
28
|
+
model: 'openai/gpt-6.1-sol',
|
|
29
29
|
browser,
|
|
30
30
|
})
|
|
31
31
|
```
|
|
@@ -26,7 +26,7 @@ export const browserAgent = new Agent({
|
|
|
26
26
|
name: 'Browser Agent',
|
|
27
27
|
instructions: `You can browse the web. Use browser_snapshot to see the page structure,
|
|
28
28
|
then interact with elements using their refs (e.g., @e5).`,
|
|
29
|
-
model: 'openai/gpt-
|
|
29
|
+
model: 'openai/gpt-6.1-sol',
|
|
30
30
|
browser,
|
|
31
31
|
})
|
|
32
32
|
```
|
|
@@ -16,7 +16,7 @@ import { StagehandBrowser } from '@mastra/stagehand'
|
|
|
16
16
|
|
|
17
17
|
const browser = new StagehandBrowser({
|
|
18
18
|
headless: true,
|
|
19
|
-
model: 'openai/gpt-
|
|
19
|
+
model: 'openai/gpt-6.1-sol',
|
|
20
20
|
selfHeal: true,
|
|
21
21
|
})
|
|
22
22
|
|
|
@@ -26,7 +26,7 @@ export const browserAgent = new Agent({
|
|
|
26
26
|
instructions: `You can browse the web using natural language.
|
|
27
27
|
Use stagehand_act to perform actions like "click the login button".
|
|
28
28
|
Use stagehand_extract to get data from pages.`,
|
|
29
|
-
model: 'openai/gpt-
|
|
29
|
+
model: 'openai/gpt-6.1-sol',
|
|
30
30
|
browser,
|
|
31
31
|
})
|
|
32
32
|
```
|
|
@@ -278,7 +278,7 @@ const browser = new StagehandBrowser({
|
|
|
278
278
|
env: 'BROWSERBASE',
|
|
279
279
|
apiKey: process.env.BROWSERBASE_API_KEY,
|
|
280
280
|
projectId: process.env.BROWSERBASE_PROJECT_ID,
|
|
281
|
-
model: 'openai/gpt-
|
|
281
|
+
model: 'openai/gpt-6.1-sol',
|
|
282
282
|
})
|
|
283
283
|
```
|
|
284
284
|
|
|
@@ -289,7 +289,7 @@ Configure the AI model for Stagehand operations:
|
|
|
289
289
|
```typescript
|
|
290
290
|
// String format: "provider/model"
|
|
291
291
|
const browser = new StagehandBrowser({
|
|
292
|
-
model: 'openai/gpt-
|
|
292
|
+
model: 'openai/gpt-6.1-sol',
|
|
293
293
|
})
|
|
294
294
|
|
|
295
295
|
// Object format for custom configuration
|