@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
|
@@ -168,7 +168,7 @@ If you prefer not to use our automatic CLI tool, you can set up your project you
|
|
|
168
168
|
mkdir -p src/mastra/agents && touch src/mastra/agents/weather-agent.ts
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
Use `import { Agent } from "@mastra/core/agent"`. Constructor takes `{ id, name, instructions, model: 'openai/gpt-
|
|
171
|
+
Use `import { Agent } from "@mastra/core/agent"`. Constructor takes `{ id, name, instructions, model: 'openai/gpt-6.1-sol' }`. The model string uses Mastra's model router format, 'provider/model', with / rather than : between the provider and model. Don't install any AI SDK packages.
|
|
172
172
|
|
|
173
173
|
Add the following code:
|
|
174
174
|
|
|
@@ -191,7 +191,7 @@ If you prefer not to use our automatic CLI tool, you can set up your project you
|
|
|
191
191
|
|
|
192
192
|
Use the weatherTool to fetch current weather data.
|
|
193
193
|
`,
|
|
194
|
-
model: 'google/gemini-
|
|
194
|
+
model: 'google/gemini-3.8-flash',
|
|
195
195
|
tools: { weatherTool },
|
|
196
196
|
})
|
|
197
197
|
```
|
|
@@ -16,7 +16,7 @@ export const agent = new Agent({
|
|
|
16
16
|
id: 'test-agent',
|
|
17
17
|
name: 'test-agent',
|
|
18
18
|
instructions: 'You are an agent with memory.',
|
|
19
|
-
model: 'openai/gpt-
|
|
19
|
+
model: 'openai/gpt-6.1-sol',
|
|
20
20
|
memory: new Memory({
|
|
21
21
|
options: {
|
|
22
22
|
workingMemory: {
|
|
@@ -71,7 +71,7 @@ import { LibSQLStore, LibSQLVector } from '@mastra/libsql'
|
|
|
71
71
|
export const agent = new Agent({
|
|
72
72
|
name: 'test-agent',
|
|
73
73
|
instructions: 'You are an agent with memory.',
|
|
74
|
-
model: 'openai/gpt-
|
|
74
|
+
model: 'openai/gpt-6.1-sol',
|
|
75
75
|
memory: new Memory({
|
|
76
76
|
storage: new LibSQLStore({
|
|
77
77
|
id: 'test-agent-storage',
|
|
@@ -108,7 +108,7 @@ import { PostgresStore, PgVector } from '@mastra/pg'
|
|
|
108
108
|
export const agent = new Agent({
|
|
109
109
|
name: 'pg-agent',
|
|
110
110
|
instructions: 'You are an agent with optimized PostgreSQL memory.',
|
|
111
|
-
model: 'openai/gpt-
|
|
111
|
+
model: 'openai/gpt-6.1-sol',
|
|
112
112
|
memory: new Memory({
|
|
113
113
|
storage: new PostgresStore({
|
|
114
114
|
id: 'pg-agent-storage',
|
|
@@ -18,7 +18,7 @@ export const agent = new Agent({
|
|
|
18
18
|
id: 'my-agent',
|
|
19
19
|
name: 'my-agent',
|
|
20
20
|
instructions: 'You are a helpful assistant.',
|
|
21
|
-
model: 'openai/gpt-
|
|
21
|
+
model: 'openai/gpt-6-luna',
|
|
22
22
|
memory: new Memory({
|
|
23
23
|
options: {
|
|
24
24
|
observationalMemory: true,
|
|
@@ -39,7 +39,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
|
|
|
39
39
|
|
|
40
40
|
**model** (`'auto' | string | LanguageModel | DynamicModel | ModelByInputTokens | ModelWithRetries[]`): Model for both the Observer and Reflector agents. Cannot be used together with observation.model or reflection.model. When all model fields are omitted, each role defaults to "auto". Automatic selection prefers google/gemini-2.5-flash when GOOGLE\_GENERATIVE\_AI\_API\_KEY is configured, then a low-cost model for the active provider, then the active main model. Use "default" for the legacy fixed default. (Default: `'auto'`)
|
|
41
41
|
|
|
42
|
-
**autoModels** (`Record<string, string>`): Overrides the model automatic selection picks for a provider, keyed by provider ID. For example, { openai: "\_\_GATEWAY\_OPENAI\_MODEL\
|
|
42
|
+
**autoModels** (`Record<string, string>`): Overrides the model automatic selection picks for a provider, keyed by provider ID. For example, { openai: "\_\_GATEWAY\_OPENAI\_MODEL\_LUNA\_\_" }. Providers not listed use the built-in pick.
|
|
43
43
|
|
|
44
44
|
**resolveModel** (`(modelId: string, context: { requestContext?: RequestContext }) => MastraModelConfig | Promise<MastraModelConfig>`): Creates the model automatic selection picked, so it can use your credentials and routing. Receives only concrete model IDs, never "auto". When omitted, the picked ID goes through Mastra model routing.
|
|
45
45
|
|
|
@@ -158,7 +158,7 @@ import { z } from 'zod'
|
|
|
158
158
|
const memory = new Memory({
|
|
159
159
|
options: {
|
|
160
160
|
observationalMemory: {
|
|
161
|
-
model: 'openai/gpt-
|
|
161
|
+
model: 'openai/gpt-6-luna',
|
|
162
162
|
observation: {
|
|
163
163
|
extract: [
|
|
164
164
|
new Extractor({
|
|
@@ -240,7 +240,7 @@ export const agent = new Agent({
|
|
|
240
240
|
id: 'my-agent',
|
|
241
241
|
name: 'my-agent',
|
|
242
242
|
instructions: 'You are a helpful assistant.',
|
|
243
|
-
model: 'openai/gpt-
|
|
243
|
+
model: 'openai/gpt-6-luna',
|
|
244
244
|
memory: new Memory({
|
|
245
245
|
options: {
|
|
246
246
|
observationalMemory: {
|
|
@@ -269,7 +269,7 @@ export const agent = new Agent({
|
|
|
269
269
|
id: 'my-agent',
|
|
270
270
|
name: 'my-agent',
|
|
271
271
|
instructions: 'You are a helpful assistant.',
|
|
272
|
-
model: 'openai/gpt-
|
|
272
|
+
model: 'openai/gpt-6-luna',
|
|
273
273
|
memory: new Memory({
|
|
274
274
|
options: {
|
|
275
275
|
observationalMemory: {
|
|
@@ -299,11 +299,11 @@ export const agent = new Agent({
|
|
|
299
299
|
id: 'my-agent',
|
|
300
300
|
name: 'my-agent',
|
|
301
301
|
instructions: 'You are a helpful assistant.',
|
|
302
|
-
model: 'openai/gpt-
|
|
302
|
+
model: 'openai/gpt-6.1-sol',
|
|
303
303
|
memory: new Memory({
|
|
304
304
|
options: {
|
|
305
305
|
observationalMemory: {
|
|
306
|
-
model: 'openai/gpt-
|
|
306
|
+
model: 'openai/gpt-6-luna',
|
|
307
307
|
},
|
|
308
308
|
},
|
|
309
309
|
}),
|
|
@@ -320,7 +320,7 @@ export const agent = new Agent({
|
|
|
320
320
|
id: 'my-agent',
|
|
321
321
|
name: 'my-agent',
|
|
322
322
|
instructions: 'You are a helpful assistant.',
|
|
323
|
-
model: 'openai/gpt-
|
|
323
|
+
model: 'openai/gpt-6.1-sol',
|
|
324
324
|
memory: new Memory({
|
|
325
325
|
options: {
|
|
326
326
|
observationalMemory: {
|
|
@@ -328,7 +328,7 @@ export const agent = new Agent({
|
|
|
328
328
|
model: 'google/gemini-2.5-flash',
|
|
329
329
|
},
|
|
330
330
|
reflection: {
|
|
331
|
-
model: 'openai/gpt-
|
|
331
|
+
model: 'openai/gpt-6-luna',
|
|
332
332
|
},
|
|
333
333
|
},
|
|
334
334
|
},
|
|
@@ -348,7 +348,7 @@ export const agent = new Agent({
|
|
|
348
348
|
id: 'health-assistant',
|
|
349
349
|
name: 'health-assistant',
|
|
350
350
|
instructions: 'You are a health and wellness assistant.',
|
|
351
|
-
model: 'openai/gpt-
|
|
351
|
+
model: 'openai/gpt-6.1-sol',
|
|
352
352
|
memory: new Memory({
|
|
353
353
|
options: {
|
|
354
354
|
observationalMemory: {
|
|
@@ -393,7 +393,7 @@ export const agent = new Agent({
|
|
|
393
393
|
id: 'my-agent',
|
|
394
394
|
name: 'my-agent',
|
|
395
395
|
instructions: 'You are a helpful assistant.',
|
|
396
|
-
model: 'openai/gpt-
|
|
396
|
+
model: 'openai/gpt-6-luna',
|
|
397
397
|
memory: new Memory({
|
|
398
398
|
options: {
|
|
399
399
|
observationalMemory: {
|
|
@@ -748,7 +748,7 @@ const memory = new Memory({ storage })
|
|
|
748
748
|
const om = new ObservationalMemory({
|
|
749
749
|
storage: storage.stores.memory!,
|
|
750
750
|
memory,
|
|
751
|
-
model: 'google/gemini-
|
|
751
|
+
model: 'google/gemini-3.8-flash',
|
|
752
752
|
observation: {
|
|
753
753
|
messageTokens: 20_000,
|
|
754
754
|
},
|
|
@@ -763,7 +763,7 @@ export const agent = new Agent({
|
|
|
763
763
|
id: 'my-agent',
|
|
764
764
|
name: 'my-agent',
|
|
765
765
|
instructions: 'You are a helpful assistant.',
|
|
766
|
-
model: 'openai/gpt-
|
|
766
|
+
model: 'openai/gpt-6-luna',
|
|
767
767
|
inputProcessors: [omProcessor],
|
|
768
768
|
outputProcessors: [omProcessor],
|
|
769
769
|
})
|
|
@@ -920,8 +920,8 @@ import { ModelByInputTokens } from '@mastra/memory'
|
|
|
920
920
|
const selector = new ModelByInputTokens({
|
|
921
921
|
upTo: {
|
|
922
922
|
10_000: 'google/gemini-2.5-flash', // Fast for small inputs
|
|
923
|
-
40_000: 'openai/gpt-
|
|
924
|
-
1_000_000: 'openai/gpt-
|
|
923
|
+
40_000: 'openai/gpt-6-luna', // Stronger for medium inputs
|
|
924
|
+
1_000_000: 'openai/gpt-6.1-sol', // Most capable for large inputs
|
|
925
925
|
},
|
|
926
926
|
})
|
|
927
927
|
```
|
|
@@ -950,7 +950,7 @@ import { skillResultRedactor } from '@mastra/memory/hooks'
|
|
|
950
950
|
const memory = new Memory({
|
|
951
951
|
options: {
|
|
952
952
|
observationalMemory: {
|
|
953
|
-
model: 'google/gemini-
|
|
953
|
+
model: 'google/gemini-3.8-flash',
|
|
954
954
|
hooks: {
|
|
955
955
|
beforeObservation: skillResultRedactor(),
|
|
956
956
|
},
|
|
@@ -16,7 +16,7 @@ Use this when you already have the messages in hand and want explicit control ov
|
|
|
16
16
|
import { summarizeConversation } from '@mastra/memory'
|
|
17
17
|
|
|
18
18
|
const result = await summarizeConversation({
|
|
19
|
-
model: 'openai/gpt-
|
|
19
|
+
model: 'openai/gpt-6-luna',
|
|
20
20
|
messages,
|
|
21
21
|
instructions: 'Summarize this voicemail call for the business owner.',
|
|
22
22
|
})
|
|
@@ -24,7 +24,7 @@ const result = await summarizeConversation({
|
|
|
24
24
|
|
|
25
25
|
## Parameters
|
|
26
26
|
|
|
27
|
-
**model** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model that runs the summarization, such as a router string like '\_\_GATEWAY\_OPENAI\_MODEL\
|
|
27
|
+
**model** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model that runs the summarization, such as a router string like '\_\_GATEWAY\_OPENAI\_MODEL\_LUNA\_\_'. Pass an array of { model, maxRetries } entries to fall back to the next model when one fails.
|
|
28
28
|
|
|
29
29
|
**messages** (`MastraDBMessage[]`): The conversation to summarize. When empty, the function returns an empty result without calling the model.
|
|
30
30
|
|
|
@@ -80,7 +80,7 @@ const sessionSummary = new Extractor({
|
|
|
80
80
|
|
|
81
81
|
export async function onSessionEnd(messages: MastraDBMessage[]) {
|
|
82
82
|
const { summary, extracted, extractionFailures } = await summarizeConversation({
|
|
83
|
-
model: 'openai/gpt-
|
|
83
|
+
model: 'openai/gpt-6-luna',
|
|
84
84
|
messages,
|
|
85
85
|
instructions: 'Summarize this support session for the account manager.',
|
|
86
86
|
extract: [sessionSummary],
|
|
@@ -16,7 +16,7 @@ Use this when a session ends and you want a summary or structured extraction of
|
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
18
|
const result = await memory.summarizeThread({
|
|
19
|
-
model: 'openai/gpt-
|
|
19
|
+
model: 'openai/gpt-6-luna',
|
|
20
20
|
threadId: 'thread-123',
|
|
21
21
|
instructions: 'Summarize this voicemail call for the business owner.',
|
|
22
22
|
})
|
|
@@ -26,7 +26,7 @@ const result = await memory.summarizeThread({
|
|
|
26
26
|
|
|
27
27
|
**threadId** (`string`): The unique identifier of the thread to summarize.
|
|
28
28
|
|
|
29
|
-
**model** (`string | LanguageModel | DynamicModel`): Model that runs the summarization, such as a router string like '\_\_GATEWAY\_OPENAI\_MODEL\
|
|
29
|
+
**model** (`string | LanguageModel | DynamicModel`): Model that runs the summarization, such as a router string like '\_\_GATEWAY\_OPENAI\_MODEL\_LUNA\_\_'.
|
|
30
30
|
|
|
31
31
|
**resourceId** (`string`): ID of the resource that owns the thread. If provided, validates thread ownership. Also passed to extractor contexts.
|
|
32
32
|
|
|
@@ -78,7 +78,7 @@ const callSummary = new Extractor({
|
|
|
78
78
|
|
|
79
79
|
export async function onCallEnd(threadId: string, resourceId: string) {
|
|
80
80
|
await memory.summarizeThread({
|
|
81
|
-
model: 'openai/gpt-
|
|
81
|
+
model: 'openai/gpt-6-luna',
|
|
82
82
|
threadId,
|
|
83
83
|
resourceId,
|
|
84
84
|
instructions: 'Summarize this voicemail call for the business owner.',
|
|
@@ -31,7 +31,7 @@ const agent = new AgentNetwork({
|
|
|
31
31
|
name: 'agent-network',
|
|
32
32
|
agents: [agent1, agent2],
|
|
33
33
|
tools: { tool1, tool2 },
|
|
34
|
-
model: 'openai/gpt-
|
|
34
|
+
model: 'openai/gpt-6.1-sol',
|
|
35
35
|
instructions: 'You are a network agent that can help users with a variety of tasks.',
|
|
36
36
|
})
|
|
37
37
|
|
|
@@ -51,7 +51,7 @@ const agent = new Agent({
|
|
|
51
51
|
name: 'agent-network',
|
|
52
52
|
agents: { agent1, agent2 },
|
|
53
53
|
tools: { tool1, tool2 },
|
|
54
|
-
model: 'openai/gpt-
|
|
54
|
+
model: 'openai/gpt-6.1-sol',
|
|
55
55
|
instructions: 'You are a network agent that can help users with a variety of tasks.',
|
|
56
56
|
memory,
|
|
57
57
|
})
|
|
@@ -72,7 +72,7 @@ const agent = new NewAgentNetwork({
|
|
|
72
72
|
agents: { agent1, agent2 },
|
|
73
73
|
workflows: { workflow1 },
|
|
74
74
|
tools: { tool1, tool2 },
|
|
75
|
-
model: 'openai/gpt-
|
|
75
|
+
model: 'openai/gpt-6.1-sol',
|
|
76
76
|
instructions: 'You are a network agent that can help users with a variety of tasks.',
|
|
77
77
|
})
|
|
78
78
|
|
|
@@ -93,7 +93,7 @@ const agent = new Agent({
|
|
|
93
93
|
agents: { agent1, agent2 },
|
|
94
94
|
workflows: { workflow1 },
|
|
95
95
|
tools: { tool1, tool2 },
|
|
96
|
-
model: 'openai/gpt-
|
|
96
|
+
model: 'openai/gpt-6.1-sol',
|
|
97
97
|
instructions: 'You are a network agent that can help users with a variety of tasks.',
|
|
98
98
|
memory,
|
|
99
99
|
})
|
|
@@ -204,7 +204,7 @@ await server.startHTTP({
|
|
|
204
204
|
|
|
205
205
|
### Server `protocolVersion` option
|
|
206
206
|
|
|
207
|
-
Servers accepted `protocolVersion` (`'2025-11-25'`, `'2026-07-28'` or `'auto'`). Only `2026-07-28` is served now, exposed as the `MCP_PROTOCOL_VERSION` constant. Remove the option; a client that doesn't offer `2026-07-28` fails with an explicit negotiation error instead of a downgrade.
|
|
207
|
+
Servers accepted `protocolVersion` (`'2025-11-25'`, `'2026-07-28'` or `'auto'`). Only `2026-07-28` is served now, exposed as the `MCP_PROTOCOL_VERSION` constant. Remove the option; a client that doesn't offer `2026-07-28` fails with an explicit negotiation error instead of a downgrade. To keep serving clients that still open with `initialize` over HTTP, set `legacy: 'stateless'` on the server. Each of their requests is then answered without a session.
|
|
208
208
|
|
|
209
209
|
```diff
|
|
210
210
|
const server = new MCPServer({
|
|
@@ -163,7 +163,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
163
163
|
name: z.string(),
|
|
164
164
|
age: z.number(),
|
|
165
165
|
}),
|
|
166
|
-
model: 'openai/gpt-
|
|
166
|
+
model: 'openai/gpt-6.1-sol', // Optional model override for structuring
|
|
167
167
|
errorStrategy: 'fallback',
|
|
168
168
|
fallbackValue: { name: 'unknown', age: 0 },
|
|
169
169
|
instructions: 'Extract user information', // Override default structuring instructions
|
|
@@ -301,7 +301,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
301
301
|
schema: z.object({
|
|
302
302
|
summary: z.string(),
|
|
303
303
|
}),
|
|
304
|
-
model: 'openai/gpt-
|
|
304
|
+
model: 'openai/gpt-6.1-sol',
|
|
305
305
|
},
|
|
306
306
|
})
|
|
307
307
|
```
|
|
@@ -10,8 +10,9 @@ Advanced trace queries select completed traces with a structured time range and
|
|
|
10
10
|
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ------------------------------------------ |
|
|
11
11
|
| Query traces | List matching traces, paginate through them, and poll for new ones. | `queryTraces()` | `POST /api/observability/traces/query` |
|
|
12
12
|
| Aggregate traces | Count matching traces and compute measures, such as error rate, latency percentiles, tokens, and cost, optionally grouped by dimensions and time buckets. | `aggregateTraces()` | `POST /api/observability/traces/aggregate` |
|
|
13
|
+
| Aggregate spans | Compute the same measures over individual spans, such as every agent run including nested ones, grouped by span dimensions. | `aggregateSpans()` | `POST /api/observability/spans/aggregate` |
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
The trace APIs accept the same [trace selection](#select-traces). The filters, operators, and limits on this page apply to each. Use the aggregate API to find the group that needs attention, such as an agent with a high error rate, then send the same predicate plus the group's dimensions to the query API to list the traces behind it. Each query result represents a trace. Use its `traceId` to [retrieve the full trace](https://mastra.ai/reference/client-js/observability).
|
|
15
16
|
|
|
16
17
|
The endpoints use the same authentication as other observability routes and require the `observability:read` permission. Every request requires a time range.
|
|
17
18
|
|
|
@@ -25,6 +26,7 @@ The configured observability store must support each API. Call `getObservability
|
|
|
25
26
|
| -------------------------------- | -------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
26
27
|
| `traceQuery` | `trace-query` | `queryTraces()` |
|
|
27
28
|
| `traceAggregate` | `trace-aggregate` | `aggregateTraces()` |
|
|
29
|
+
| `spanAggregate` | `span-aggregate` | `aggregateSpans()` |
|
|
28
30
|
| `traceQueryRootDuration` | `trace-query-root-duration` | Trace-scope `durationMs` predicates |
|
|
29
31
|
| `traceQueryTimeToFirstChunk` | `trace-query-time-to-first-chunk` | `timeToFirstChunkMs` predicates and results |
|
|
30
32
|
| `traceQueryTimeToFirstChunkSort` | `trace-query-time-to-first-chunk-sort` | `orderBy` on `timeToFirstChunkMs` |
|
|
@@ -34,7 +36,7 @@ The configured observability store must support each API. Call `getObservability
|
|
|
34
36
|
| `traceQueryDiscovery` | `trace-query-discovery` | [Field and value discovery](#discover-fields-and-values) |
|
|
35
37
|
| `traceQueryTenantScope` | `trace-query-tenant-scope` | [Trusted tenant scope](#trusted-tenant-scope) |
|
|
36
38
|
|
|
37
|
-
A missing `traceAggregate` value means the server doesn't support aggregation. Servers without the aggregate route return `404`, and stores without the feature return `501 TRACE_AGGREGATE_UNSUPPORTED`. Against a store without a sub-feature, a request that uses a gated field returns `501` before storage runs. Root span `name`, `spanType`, and `entityId` are the exception and return `422` with a `field_not_allowed` issue.
|
|
39
|
+
A missing `traceAggregate` value means the server doesn't support aggregation. Servers without the aggregate route return `404`, and stores without the feature return `501 TRACE_AGGREGATE_UNSUPPORTED`. A missing `spanAggregate` value means the same for span aggregation, and stores without the feature return `501 SPAN_AGGREGATE_UNSUPPORTED`. Against a store without a sub-feature, a request that uses a gated field returns `501` before storage runs. Root span `name`, `spanType`, and `entityId` are the exception and return `422` with a `field_not_allowed` issue.
|
|
38
40
|
|
|
39
41
|
## Select traces
|
|
40
42
|
|
|
@@ -212,7 +214,7 @@ const selectedModel = {
|
|
|
212
214
|
{
|
|
213
215
|
op: 'eq',
|
|
214
216
|
left: { path: 'model' },
|
|
215
|
-
right: { literal: 'claude-sonnet-
|
|
217
|
+
right: { literal: 'claude-sonnet-5-5' },
|
|
216
218
|
},
|
|
217
219
|
{ op: 'eq', left: { path: 'provider' }, right: { literal: 'anthropic' } },
|
|
218
220
|
],
|
|
@@ -700,14 +702,14 @@ Token and cost measures read the model usage metrics recorded for each trace, so
|
|
|
700
702
|
|
|
701
703
|
A trace that recorded at least one usage metric is usage-bearing. `tokens.<kind>.sum` adds the tokens of a group's usage-bearing traces, and `tokens.<kind>.avg` divides that sum by the number of usage-bearing traces, not by `count`. Both are `null` when the group has no usage-bearing traces.
|
|
702
704
|
|
|
703
|
-
Cost comes from estimated cost recorded on total input and total output token metrics. `cost.sum` adds the cost of traces with at least one priced metric, and `cost.avg` divides by the number of those traces. A
|
|
705
|
+
Cost comes from estimated cost recorded on total input and total output token metrics. `cost.sum` adds the cost of traces with at least one priced metric, and `cost.avg` divides by the number of those traces. A partly priced call, where Mastra could price some token types but not others, adds the cost of the priced token types. A metric with any other pricing failure adds no cost.
|
|
704
706
|
|
|
705
707
|
When you request any `cost.*` measure, every row also includes a `cost` object:
|
|
706
708
|
|
|
707
|
-
| Field | Description
|
|
708
|
-
| ---------- |
|
|
709
|
-
| `coverage` | Fraction of usage-bearing traces whose usage was fully priced, from 0 to 1. `null` when the group has no usage-bearing traces. |
|
|
710
|
-
| `unit` | Cost unit of the priced metrics, such as `USD`. `'mixed'` when they use more than one unit, and `null` when none are priced.
|
|
709
|
+
| Field | Description |
|
|
710
|
+
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
711
|
+
| `coverage` | Fraction of usage-bearing traces whose usage was fully priced, from 0 to 1. A trace with a partly priced call isn't fully priced, so it lowers coverage even though its known cost is in `cost.sum`. `null` when the group has no usage-bearing traces. |
|
|
712
|
+
| `unit` | Cost unit of the priced metrics, such as `USD`. `'mixed'` when they use more than one unit, and `null` when none are priced. |
|
|
711
713
|
|
|
712
714
|
`cost.sum` and `cost.avg` are `null` when the group has no priced traces or `unit` is `'mixed'`. A coverage below 1 means the cost understates the group's spend. The `cost` object isn't a measure, so `having` and `orderBy` can't reference it.
|
|
713
715
|
|
|
@@ -803,11 +805,90 @@ PostgreSQL and ClickHouse stop aggregations after the same `traceQueryTimeoutMs`
|
|
|
803
805
|
| `501` | The installed Core or configured observability store doesn't support aggregation or a requested field. Returns `TRACE_AGGREGATE_UNSUPPORTED`. |
|
|
804
806
|
| `504` | A PostgreSQL or ClickHouse aggregation exceeded its execution timeout. Returns `TRACE_QUERY_EXECUTION_TIMEOUT` without partial results. |
|
|
805
807
|
|
|
808
|
+
## Aggregate spans
|
|
809
|
+
|
|
810
|
+
Use `aggregateSpans()` or `POST /api/observability/spans/aggregate` to compute measures over individual spans instead of traces. Trace aggregation only sees each trace's root span, so an agent run nested inside a workflow isn't counted. Span aggregation counts every span that matches, at any depth.
|
|
811
|
+
|
|
812
|
+
The request has the same shape as [`aggregateTraces()`](#aggregate-request-fields), with the same measures, `having`, `orderBy`, `interval`, limits, and errors. The differences are in which records are selected and which dimensions are available.
|
|
813
|
+
|
|
814
|
+
### Aggregate spans with the client SDK
|
|
815
|
+
|
|
816
|
+
This request counts agent runs by status per day, including nested runs:
|
|
817
|
+
|
|
818
|
+
```typescript
|
|
819
|
+
const { capabilities } = await mastraClient.getObservabilityCapabilities()
|
|
820
|
+
|
|
821
|
+
if (capabilities.spanAggregate) {
|
|
822
|
+
const { rows } = await mastraClient.aggregateSpans({
|
|
823
|
+
timeRange: {
|
|
824
|
+
from: '2026-08-01T00:00:00.000Z',
|
|
825
|
+
to: '2026-08-08T00:00:00.000Z',
|
|
826
|
+
},
|
|
827
|
+
where: { op: 'eq', left: { path: 'spanType' }, right: { literal: 'agent_run' } },
|
|
828
|
+
groupBy: ['status'],
|
|
829
|
+
interval: '1d',
|
|
830
|
+
measures: ['count', 'duration.p95'],
|
|
831
|
+
})
|
|
832
|
+
}
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
Send the same body to `POST /api/observability/spans/aggregate` to use HTTP directly.
|
|
836
|
+
|
|
837
|
+
### Span selection
|
|
838
|
+
|
|
839
|
+
Aggregation selects the spans that [`querySpans()`](https://mastra.ai/reference/client-js/observability) would return for the same `timeRange` and `where`:
|
|
840
|
+
|
|
841
|
+
- `timeRange` bounds each span's `startedAt`, and can span up to 365 days.
|
|
842
|
+
- `where` accepts the `querySpans()` fields and operators, such as `spanType`, `name`, `status`, `durationMs`, entity and parent/root entity fields, and context identifiers.
|
|
843
|
+
- Only completed spans count. When a span was exported more than once, only its latest copy counts.
|
|
844
|
+
|
|
845
|
+
`count` equals the number of spans `querySpans()` pages through for the same request. Buckets use each span's `startedAt`. `duration.*` measures read the span's own duration, and `errorCount` and `errorRate` read whether the span itself recorded an error.
|
|
846
|
+
|
|
847
|
+
On ClickHouse, a request whose `where` limits `spanType` to agent, workflow, processor, or scorer runs, RAG ingestion, or tool calls reads the smaller branch table instead of every span. That path can differ from `querySpans()`:
|
|
848
|
+
|
|
849
|
+
- Spans written before an upgrade from `@mastra/clickhouse` 1.4, 1.5, or 1.6 aren't in the branch table, so older windows can count fewer spans.
|
|
850
|
+
- After ClickHouse merges the copies of a span exported more than once, the branch table keeps the copy written last, not the one that ended last. Counts don't change, but the `status` and duration of a retried span can.
|
|
851
|
+
|
|
852
|
+
### Span dimensions
|
|
853
|
+
|
|
854
|
+
| Dimension | Notes |
|
|
855
|
+
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
856
|
+
| `name`, `spanType`, `status` | The span's own name, type, and status. `status` is `error` when the span recorded an error and `success` otherwise. |
|
|
857
|
+
| `entityType`, `entityId`, `entityName` | The entity that produced the span. |
|
|
858
|
+
| `parentEntityType`, `parentEntityName`, `rootEntityType`, `rootEntityName` | The calling entity and the trace's root entity, such as the agent that made a model call. |
|
|
859
|
+
| `environment`, `serviceName`, `executionSource` | Deployment attributes recorded on the span. |
|
|
860
|
+
| `threadId`, `resourceId`, `userId`, `sessionId`, `organizationId`, `experimentId` | Context identifiers recorded on the span. |
|
|
861
|
+
|
|
862
|
+
`countDistinct.<field>` accepts these dimensions and `traceId`, so `countDistinct.traceId` counts the traces the selected spans belong to. Span aggregation can't group by `metadata.<key>`, identity fields such as `traceId`, `spanId`, or `runId`, or by model and provider.
|
|
863
|
+
|
|
864
|
+
### Span tokens and cost
|
|
865
|
+
|
|
866
|
+
Token and cost measures use the usage metrics recorded by each span, matched by `traceId` and `spanId`. The [trace token rules](#token-and-cost-measures) apply per span: metrics from `timeRange.from` on count, retried exports count once, and averages divide by usage-bearing spans.
|
|
867
|
+
|
|
868
|
+
Usage isn't added up to parent spans. Model calls record usage on `model_generation` spans, so an `agent_run` span has no tokens of its own unless a model call under it wasn't exported. When a `model_generation` span isn't exported, its usage is recorded on the nearest exported ancestor instead. For token totals per agent, select `model_generation` spans and group by the calling agent:
|
|
869
|
+
|
|
870
|
+
```typescript
|
|
871
|
+
const tokensByAgent = await mastraClient.aggregateSpans({
|
|
872
|
+
timeRange: {
|
|
873
|
+
from: '2026-08-01T00:00:00.000Z',
|
|
874
|
+
to: '2026-08-08T00:00:00.000Z',
|
|
875
|
+
},
|
|
876
|
+
where: { op: 'eq', left: { path: 'spanType' }, right: { literal: 'model_generation' } },
|
|
877
|
+
groupBy: ['parentEntityName'],
|
|
878
|
+
measures: ['tokens.total.sum', 'cost.sum'],
|
|
879
|
+
orderBy: { field: 'cost.sum', direction: 'desc' },
|
|
880
|
+
})
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
### List the spans behind a group
|
|
884
|
+
|
|
885
|
+
Aggregation never returns span records. To inspect a group, send the same `timeRange` and `where` to `querySpans()`, and add the group's dimension values as `eq` conditions. For example, add `{ op: 'eq', left: { path: 'status' }, right: { literal: 'error' } }` to list the failed agent runs from the first example.
|
|
886
|
+
|
|
806
887
|
## Trusted tenant scope
|
|
807
888
|
|
|
808
|
-
Hosts that serve more than one tenant supply a trusted scope outside the query document. The server reads the reserved `organizationId` request-context key, which only server-side authentication can set, and passes `{ organizationId }` to the planner. The scope is carried on the trusted plan and ANDed into every scan: current roots, related spans, the usage metrics read by token and cost measures, and both discovery routes. A related record from another tenant that shares a `traceId` never qualifies a trace.
|
|
889
|
+
Hosts that serve more than one tenant supply a trusted scope outside the query document. The server reads the reserved `organizationId` request-context key, which only server-side authentication can set, and passes `{ organizationId }` to the planner. The scope is carried on the trusted plan and ANDed into every scan: current roots, related spans, the usage metrics read by token and cost measures, span aggregation, and both discovery routes. A related record from another tenant that shares a `traceId` never qualifies a trace.
|
|
809
890
|
|
|
810
|
-
Hosts that call storage directly can pass a fuller scope to `planTraceQuery()`, `planTraceAggregate()`, `planTraceQueryObservedFields()`, and `planTraceQueryValues()`:
|
|
891
|
+
Hosts that call storage directly can pass a fuller scope to `planTraceQuery()`, `planTraceAggregate()`, `planSpanAggregate()`, `planTraceQueryObservedFields()`, and `planTraceQueryValues()`:
|
|
811
892
|
|
|
812
893
|
```typescript
|
|
813
894
|
const plan = planTraceQuery(parseTraceQueryRequest(request), {
|
|
@@ -938,7 +1019,7 @@ Both routes require `observability:read` and use the configured observability st
|
|
|
938
1019
|
|
|
939
1020
|
## Limitations
|
|
940
1021
|
|
|
941
|
-
|
|
1022
|
+
The query and aggregate APIs consider completed traces and spans only, not running ones. Trace queries can't return custom projections, embedded evidence, or summaries, and numbered trace pages include a total count. Trace aggregation can't group by span fields other than the root span's `name`, `spanType`, and `entityId`, or by `traceId` or `attributes.*`. Aggregation can't compute numeric measures over metadata, paginate groups, or zero-fill empty buckets. Span aggregation can't group by `model` or `provider`, and it attributes tokens only to the span that recorded them. The CLI's `mastra api trace aggregate` covers trace aggregation, and `mastra api span query` and `mastra api span aggregate` cover span queries and span aggregation.
|
|
942
1023
|
|
|
943
1024
|
## Related
|
|
944
1025
|
|
|
@@ -56,7 +56,7 @@ If no `LoggerProvider` is registered globally, emission is a silent no-op.
|
|
|
56
56
|
async flush(): Promise<void>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Force flushes the tracer provider and logger provider if they support `forceFlush`. The global providers are resolved at flush time, so a `LoggerProvider` registered after the bridge was constructed is flushed too. Useful in serverless environments where you need to drain telemetry before the runtime terminates.
|
|
59
|
+
Force flushes the tracer provider and logger provider if they support `forceFlush`. The global providers are resolved at flush time, so a `LoggerProvider` registered after the bridge was constructed is flushed too. Useful in serverless environments where you need to drain telemetry before the runtime terminates. Call `sdk.shutdown()` as well before the process exits to wait for any batch your OTEL SDK has already started exporting. Neither this method nor the provider's own `forceFlush()` waits for that batch.
|
|
60
60
|
|
|
61
61
|
### `shutdown`
|
|
62
62
|
|
|
@@ -111,7 +111,7 @@ const agent = new Agent({
|
|
|
111
111
|
id: 'support-agent',
|
|
112
112
|
name: 'support-agent',
|
|
113
113
|
instructions: prompt.compile(),
|
|
114
|
-
model: 'openai/gpt-
|
|
114
|
+
model: 'openai/gpt-6.1-sol',
|
|
115
115
|
defaultGenerateOptions: {
|
|
116
116
|
tracingOptions: buildTracingOptions(
|
|
117
117
|
withLangfusePrompt({ name: prompt.name, version: prompt.version }),
|
|
@@ -733,6 +733,8 @@ interface ToolCallAttributes {
|
|
|
733
733
|
toolDescription?: string
|
|
734
734
|
toolCallId?: string
|
|
735
735
|
success?: boolean
|
|
736
|
+
/** True when a dataset experiment tool mock intercepted the call (served, mismatched, exhausted or denied) and the tool never ran */
|
|
737
|
+
mocked?: boolean
|
|
736
738
|
}
|
|
737
739
|
```
|
|
738
740
|
|
|
@@ -48,7 +48,7 @@ export const agent = new Agent({
|
|
|
48
48
|
id: 'batched-agent',
|
|
49
49
|
name: 'batched-agent',
|
|
50
50
|
instructions: 'You are a helpful assistant',
|
|
51
|
-
model: 'openai/gpt-
|
|
51
|
+
model: 'openai/gpt-6.1-sol',
|
|
52
52
|
outputProcessors: [
|
|
53
53
|
new BatchPartsProcessor({
|
|
54
54
|
batchSize: 5,
|
|
@@ -117,7 +117,7 @@ export const agent = new Agent({
|
|
|
117
117
|
id: 'support-agent',
|
|
118
118
|
name: 'support-agent',
|
|
119
119
|
instructions: 'You help customers with billing and account questions.',
|
|
120
|
-
model: 'openai/gpt-
|
|
120
|
+
model: 'openai/gpt-6.1-sol',
|
|
121
121
|
inputProcessors: [
|
|
122
122
|
new ClassifierProcessor({
|
|
123
123
|
classifier: topic,
|
|
@@ -156,7 +156,7 @@ export const agent = new Agent({
|
|
|
156
156
|
id: 'quality-gated-agent',
|
|
157
157
|
name: 'quality-gated-agent',
|
|
158
158
|
instructions: 'You are a helpful assistant',
|
|
159
|
-
model: 'openai/gpt-
|
|
159
|
+
model: 'openai/gpt-6.1-sol',
|
|
160
160
|
outputProcessors: [
|
|
161
161
|
new ClassifierProcessor({
|
|
162
162
|
classifier: quality,
|
|
@@ -41,7 +41,7 @@ export const agent = new Agent({
|
|
|
41
41
|
id: 'coding-agent',
|
|
42
42
|
name: 'Coding Agent',
|
|
43
43
|
instructions: 'You are a coding agent.',
|
|
44
|
-
model: 'openai/gpt-
|
|
44
|
+
model: 'openai/gpt-6.1-sol',
|
|
45
45
|
errorProcessors: [new CyberRefusalHandler(), new StreamErrorRetryProcessor()],
|
|
46
46
|
outputProcessors: [new CyberRefusalHandler()],
|
|
47
47
|
maxProcessorRetries: 3,
|
|
@@ -27,7 +27,7 @@ export const agent = new Agent({
|
|
|
27
27
|
id: 'file-agent',
|
|
28
28
|
name: 'file-agent',
|
|
29
29
|
instructions: 'Work on the files the user uploads to the sandbox.',
|
|
30
|
-
model: 'openai/gpt-
|
|
30
|
+
model: 'openai/gpt-6-luna',
|
|
31
31
|
workspace,
|
|
32
32
|
inputProcessors: [
|
|
33
33
|
new FileUploadProcessor({
|
|
@@ -121,7 +121,7 @@ The processor looks at the files of every user message the model receives, the t
|
|
|
121
121
|
Files sent inline, as binary, base64, or a data URL, are uploaded. The processor never downloads anything itself, so a request made by the server can't be pointed at an internal address:
|
|
122
122
|
|
|
123
123
|
- A link the model fetches itself, or a provider file ID, stays in the prompt, and `filter` isn't called for it.
|
|
124
|
-
- A link the model can't fetch is downloaded by Mastra before the model call. The
|
|
124
|
+
- A link the model can't fetch is downloaded by Mastra before the model call. The processor handles the downloaded bytes like any other file the model would receive.
|
|
125
125
|
|
|
126
126
|
## Upload location
|
|
127
127
|
|
|
@@ -170,7 +170,7 @@ The constructor throws a `MastraError` with the ID `FILE_UPLOAD_PROCESSOR_NO_SAN
|
|
|
170
170
|
|
|
171
171
|
The files of the current turn are checked as they were sent, before anything is written. A file that can't be uploaded stops the turn, and nothing is uploaded.
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
For a file in thread history that's too large or can't be decoded, the processor substitutes a note explaining the problem and lets the turn continue. This prevents a stored file from blocking every subsequent turn:
|
|
174
174
|
|
|
175
175
|
```text
|
|
176
176
|
[File not uploaded]
|
|
@@ -178,7 +178,7 @@ name: report.pdf
|
|
|
178
178
|
reason: File "report.pdf" is 31457280 bytes, over the 10485760 byte limit.
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
-
When the sandbox can't take the files, because there is no sandbox, it can't write, or a write fails, a file of the current turn stops the turn. A file of the thread history gets a note with the reason instead, and the turn goes on. A `filter` or `maxFileSize` that fails stops the turn, whichever file it affects.
|
|
181
|
+
When the sandbox can't take the files, because there is no sandbox, it can't write, or a write fails, a file of the current turn stops the turn. A file of the thread history gets a note with the reason instead, and the turn goes on. A `filter` or `maxFileSize` that fails stops the turn, whichever file it affects. Storage remains unchanged, allowing the thread to work again once the setup is fixed. A turn without a file to upload checks nothing, so scorers, agent networks, and calls without a thread keep working.
|
|
182
182
|
|
|
183
183
|
The processor stops a turn by calling `abort()` with `retry: false`. The model isn't called. `agent.generate()` resolves with `result.tripwire` set instead of rejecting, and `agent.stream()` emits a `tripwire` chunk.
|
|
184
184
|
|
|
@@ -220,7 +220,7 @@ The processor handles files sent with `agent.sendMessage()` and `agent.sendSigna
|
|
|
220
220
|
|
|
221
221
|
- A signal that wakes an idle agent is processed like the input of `agent.stream()`.
|
|
222
222
|
- A signal delivered to an active run is checked and uploaded before the next model call of that run.
|
|
223
|
-
-
|
|
223
|
+
- Signals that arrive on a durable agent before a run's first model call join the prompt after the turn's checks. Their files are uploaded like files in thread history.
|
|
224
224
|
|
|
225
225
|
## Limitations
|
|
226
226
|
|
|
@@ -66,7 +66,7 @@ export const agent = new Agent({
|
|
|
66
66
|
id: 'multilingual-agent',
|
|
67
67
|
name: 'multilingual-agent',
|
|
68
68
|
instructions: 'You are a helpful assistant',
|
|
69
|
-
model: 'openai/gpt-
|
|
69
|
+
model: 'openai/gpt-6.1-sol',
|
|
70
70
|
inputProcessors: [
|
|
71
71
|
new LanguageDetector({
|
|
72
72
|
model: 'openrouter/openai/gpt-oss-safeguard-20b',
|
|
@@ -23,7 +23,7 @@ const processor = new MessageHistory({
|
|
|
23
23
|
|
|
24
24
|
**options.storage** (`MemoryStorage`): Storage instance for retrieving and persisting messages
|
|
25
25
|
|
|
26
|
-
**options.lastMessages** (`number`): Maximum number of historical messages to retrieve.
|
|
26
|
+
**options.lastMessages** (`number | false`): Maximum number of historical messages to retrieve. Set to false to retrieve all messages. If omitted, the storage adapter's default page size applies (40 messages for built-in adapters)
|
|
27
27
|
|
|
28
28
|
## Returns
|
|
29
29
|
|
|
@@ -51,7 +51,7 @@ export const agent = new Agent({
|
|
|
51
51
|
id: 'memory-agent',
|
|
52
52
|
name: 'memory-agent',
|
|
53
53
|
instructions: 'You are a helpful assistant with conversation memory',
|
|
54
|
-
model: 'openai/gpt-
|
|
54
|
+
model: 'openai/gpt-6.1-sol',
|
|
55
55
|
inputProcessors: [
|
|
56
56
|
new MessageHistory({
|
|
57
57
|
storage,
|