@mastra/mcp-docs-server 1.3.9 → 1.3.10-alpha.0
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 -4
- 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 +1 -1
- 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 +11 -10
- 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 +13 -7
- 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 +1 -1
- package/.docs/reference/agent-controller/session.md +5 -5
- package/.docs/reference/agents/agent.md +22 -46
- package/.docs/reference/agents/channels.md +10 -8
- package/.docs/reference/agents/durable-agent.md +2 -2
- 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 +1 -1
- package/.docs/reference/client-js/agents.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 +3 -3
- package/.docs/reference/connect/credential.md +1 -1
- package/.docs/reference/connect/tools.md +1 -3
- package/.docs/reference/core/getAgentById.md +1 -1
- package/.docs/reference/core/mastra-model-gateway.md +1 -1
- 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 +5 -5
- 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/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 +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +1 -1
- package/.docs/reference/processors/token-cost-control.md +1 -1
- package/.docs/reference/processors/token-limiter-processor.md +3 -3
- package/.docs/reference/processors/tool-call-filter.md +2 -2
- package/.docs/reference/processors/tool-search-processor.md +3 -3
- 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 +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/streaming/ChunkType.md +68 -0
- package/.docs/reference/streaming/agents/stream.md +2 -2
- package/.docs/reference/tools/create-code-mode.md +1 -1
- package/.docs/reference/tools/create-tool.md +17 -0
- package/.docs/reference/tools/mcp-client.md +202 -11
- package/.docs/reference/tools/mcp-server.md +5 -3
- 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/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/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/package.json +7 -7
- 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
|
@@ -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
|
|
|
@@ -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({
|
|
@@ -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,
|
|
@@ -18,18 +18,18 @@ import { typeSafeAi } from '@ai-sdk/typesafe-ai'
|
|
|
18
18
|
export const agent = new Agent({
|
|
19
19
|
name: 'support-agent',
|
|
20
20
|
instructions: 'Answer the user concisely.',
|
|
21
|
-
model: 'openai/gpt-
|
|
21
|
+
model: 'openai/gpt-6.1-sol',
|
|
22
22
|
inputProcessors: [
|
|
23
23
|
new ModelSelectionProcessor({
|
|
24
24
|
model: typeSafeAi.decisionModel('jev-latest'),
|
|
25
25
|
choices: [
|
|
26
26
|
{
|
|
27
|
-
model: 'openai/gpt-
|
|
27
|
+
model: 'openai/gpt-6-luna',
|
|
28
28
|
criteria:
|
|
29
29
|
'Answerable in one or two sentences from general knowledge, with no reasoning steps',
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
model: 'openai/gpt-
|
|
32
|
+
model: 'openai/gpt-6.1-sol',
|
|
33
33
|
criteria:
|
|
34
34
|
'Requires multi-step reasoning, planning, weighing trade-offs, or careful judgment',
|
|
35
35
|
},
|
|
@@ -87,8 +87,8 @@ const logger = new PinoLogger({ name: 'model-selection' })
|
|
|
87
87
|
new ModelSelectionProcessor({
|
|
88
88
|
model: typeSafeAi.decisionModel('jev-latest'),
|
|
89
89
|
choices: [
|
|
90
|
-
{ model: 'openai/gpt-
|
|
91
|
-
{ model: 'openai/gpt-
|
|
90
|
+
{ model: 'openai/gpt-6-luna', criteria: 'Simple lookups' },
|
|
91
|
+
{ model: 'openai/gpt-6.1-sol', criteria: 'Multi-step reasoning' },
|
|
92
92
|
],
|
|
93
93
|
onDecision: decision => {
|
|
94
94
|
logger.info('model routing', decision)
|
|
@@ -131,7 +131,7 @@ const triage = new Classifier({
|
|
|
131
131
|
new ModelSelectionProcessor({
|
|
132
132
|
classifier: triage,
|
|
133
133
|
select: ({ complexity }) =>
|
|
134
|
-
complexity.choice === 'trivial' ? 'openai/gpt-
|
|
134
|
+
complexity.choice === 'trivial' ? 'openai/gpt-6-luna' : undefined,
|
|
135
135
|
})
|
|
136
136
|
```
|
|
137
137
|
|
|
@@ -182,7 +182,7 @@ new ModelSelectionProcessor({
|
|
|
182
182
|
select: ({ complexity, sensitive }) => {
|
|
183
183
|
// Never downgrade a sensitive request, however simple it looks.
|
|
184
184
|
if (sensitive.probability >= 0.3) return undefined
|
|
185
|
-
return complexity.choice === 'trivial' ? 'openai/gpt-
|
|
185
|
+
return complexity.choice === 'trivial' ? 'openai/gpt-6-luna' : undefined
|
|
186
186
|
},
|
|
187
187
|
})
|
|
188
188
|
```
|
|
@@ -68,7 +68,7 @@ export const agent = new Agent({
|
|
|
68
68
|
id: 'moderated-agent',
|
|
69
69
|
name: 'moderated-agent',
|
|
70
70
|
instructions: 'You are a helpful assistant',
|
|
71
|
-
model: 'openai/gpt-
|
|
71
|
+
model: 'openai/gpt-6.1-sol',
|
|
72
72
|
inputProcessors: [
|
|
73
73
|
new ModerationProcessor({
|
|
74
74
|
model: 'openrouter/openai/gpt-oss-safeguard-20b',
|
|
@@ -96,7 +96,7 @@ export const agent = new Agent({
|
|
|
96
96
|
id: 'output-moderated-agent',
|
|
97
97
|
name: 'output-moderated-agent',
|
|
98
98
|
instructions: 'You are a helpful assistant',
|
|
99
|
-
model: 'openai/gpt-
|
|
99
|
+
model: 'openai/gpt-6.1-sol',
|
|
100
100
|
outputProcessors: [
|
|
101
101
|
// Batch stream parts first to reduce LLM calls
|
|
102
102
|
new BatchPartsProcessor({
|
|
@@ -70,7 +70,7 @@ export const agent = new Agent({
|
|
|
70
70
|
id: 'private-agent',
|
|
71
71
|
name: 'private-agent',
|
|
72
72
|
instructions: 'You are a helpful assistant',
|
|
73
|
-
model: 'openai/gpt-
|
|
73
|
+
model: 'openai/gpt-6.1-sol',
|
|
74
74
|
inputProcessors: [
|
|
75
75
|
new PIIDetector({
|
|
76
76
|
model: 'openrouter/openai/gpt-oss-safeguard-20b',
|
|
@@ -99,7 +99,7 @@ export const agent = new Agent({
|
|
|
99
99
|
id: 'output-pii-agent',
|
|
100
100
|
name: 'output-pii-agent',
|
|
101
101
|
instructions: 'You are a helpful assistant',
|
|
102
|
-
model: 'openai/gpt-
|
|
102
|
+
model: 'openai/gpt-6.1-sol',
|
|
103
103
|
outputProcessors: [
|
|
104
104
|
// Batch stream parts first to reduce LLM calls
|
|
105
105
|
new BatchPartsProcessor({
|
|
@@ -31,7 +31,7 @@ export const agent = new Agent({
|
|
|
31
31
|
id: 'my-agent',
|
|
32
32
|
name: 'my-agent',
|
|
33
33
|
instructions: 'You are a helpful assistant.',
|
|
34
|
-
model: 'anthropic/claude-opus-
|
|
34
|
+
model: 'anthropic/claude-opus-5-5',
|
|
35
35
|
errorProcessors: [new PrefillErrorHandler()],
|
|
36
36
|
})
|
|
37
37
|
```
|
|
@@ -53,7 +53,7 @@ export const agent = new Agent({
|
|
|
53
53
|
id: 'my-agent',
|
|
54
54
|
name: 'my-agent',
|
|
55
55
|
instructions: 'You are a helpful assistant.',
|
|
56
|
-
model: 'anthropic/claude-opus-
|
|
56
|
+
model: 'anthropic/claude-opus-5-5',
|
|
57
57
|
errorProcessors: [customErrorHandler],
|
|
58
58
|
})
|
|
59
59
|
```
|
|
@@ -68,6 +68,13 @@ interface Processor<TId extends string = string, TTripwireMetadata = unknown> {
|
|
|
68
68
|
| void
|
|
69
69
|
| undefined
|
|
70
70
|
|
|
71
|
+
/** State lane id for `computeStateSignal`. Defaults to the processor id. */
|
|
72
|
+
stateId?: string
|
|
73
|
+
|
|
74
|
+
computeStateSignal?(
|
|
75
|
+
args: ComputeStateSignalArgs<TTripwireMetadata>,
|
|
76
|
+
): Promise<ComputeStateSignalResult> | ComputeStateSignalResult
|
|
77
|
+
|
|
71
78
|
processLLMRequest?(
|
|
72
79
|
args: ProcessLLMRequestArgs<TTripwireMetadata>,
|
|
73
80
|
): Promise<ProcessLLMRequestResult> | ProcessLLMRequestResult
|
|
@@ -267,13 +274,14 @@ processInputStep?<TTripwireMetadata = unknown>(
|
|
|
267
274
|
1. `processInput` (once at start)
|
|
268
275
|
2. `processInputStep` from inputProcessors (at each step, before LLM call)
|
|
269
276
|
3. `prepareStep` callback (runs as part of the processInputStep pipeline, after inputProcessors)
|
|
270
|
-
4. `
|
|
271
|
-
5.
|
|
272
|
-
6.
|
|
273
|
-
7. `
|
|
274
|
-
8. `
|
|
275
|
-
9.
|
|
276
|
-
10.
|
|
277
|
+
4. `computeStateSignal` from inputProcessors (after `processInputStep`, before the LLM request)
|
|
278
|
+
5. `processLLMRequest` from inputProcessors (after prompt conversion, before the provider call)
|
|
279
|
+
6. LLM execution
|
|
280
|
+
7. `processOutputStream` from outputProcessors (on each streaming chunk)
|
|
281
|
+
8. `processLLMResponse` from inputProcessors (after stream completes, pairs with `processLLMRequest`)
|
|
282
|
+
9. `processOutputStep` from outputProcessors (after LLM response, before tool execution)
|
|
283
|
+
10. Tool execution (if needed)
|
|
284
|
+
11. Repeat from step 2 if tools were called
|
|
277
285
|
|
|
278
286
|
#### `ProcessInputStepArgs`
|
|
279
287
|
|
|
@@ -369,6 +377,54 @@ System messages are **reset to their original values** at the start of each step
|
|
|
369
377
|
|
|
370
378
|
***
|
|
371
379
|
|
|
380
|
+
### `computeStateSignal`
|
|
381
|
+
|
|
382
|
+
Computes a thread-scoped state signal once per model input step, after `processInputStep()` and before the LLM request is finalized. This method requires an agent with memory and an active `resourceId` and `threadId`.
|
|
383
|
+
|
|
384
|
+
```typescript
|
|
385
|
+
computeStateSignal?(
|
|
386
|
+
args: ComputeStateSignalArgs,
|
|
387
|
+
): Promise<ProcessorStateSignal | undefined | void> | ProcessorStateSignal | undefined | void;
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Return a state signal to store it, or `undefined` or `void` when nothing changed. The returned `id` defaults to the processor's `stateId`, which itself defaults to the processor `id`. `mode` defaults to `snapshot`.
|
|
391
|
+
|
|
392
|
+
#### `ComputeStateSignalArgs`
|
|
393
|
+
|
|
394
|
+
**stepNumber** (`number`): Current step number (0-indexed).
|
|
395
|
+
|
|
396
|
+
**steps** (`StepResult[]`): Results from previous steps.
|
|
397
|
+
|
|
398
|
+
**state** (`Record<string, unknown>`): Per-processor state that persists across method calls within the request.
|
|
399
|
+
|
|
400
|
+
**resourceId** (`string`): Memory resource ID for the active thread.
|
|
401
|
+
|
|
402
|
+
**threadId** (`string`): Memory thread ID that scopes the state lane.
|
|
403
|
+
|
|
404
|
+
**activeStateSignals** (`ProcessorActiveStateSignal[]`): Active state signals for this processor and thread that the runtime currently knows about.
|
|
405
|
+
|
|
406
|
+
**contextWindow** (`{ hasSnapshot: boolean }`): Whether the active message window already contains a snapshot for this lane.
|
|
407
|
+
|
|
408
|
+
**lastSnapshot** (`ProcessorActiveStateSignal | undefined`): Latest snapshot for this lane, resolved from message history when the current message list does not contain it.
|
|
409
|
+
|
|
410
|
+
**deltasSinceSnapshot** (`ProcessorActiveStateSignal[]`): Delta signals accepted after the latest snapshot.
|
|
411
|
+
|
|
412
|
+
**tracking** (`ProcessorStateSignalTracking | undefined`): Last persisted tracking metadata for this lane, including the current cache key, mode, version, and active copies.
|
|
413
|
+
|
|
414
|
+
**sendStateSignal** (`(signal: AgentStateSignalInput) => Promise<CreatedAgentSignal | ApplyStateSignalResult>`): Adds another state signal from inside the method. Returns a skip result when the same cache key and mode are already current.
|
|
415
|
+
|
|
416
|
+
#### Deduplication
|
|
417
|
+
|
|
418
|
+
Mastra stores tracking metadata under `metadata.mastra.stateSignals[stateId]` on the thread. When a returned state signal has the same `cacheKey` and mode as the current state and a copy is still in the active message window, Mastra skips it instead of storing a duplicate. If the matching copy has left the active window, Mastra stores it again so the model keeps seeing the state. State signals can't be transient because this tracking is rebuilt from persisted history.
|
|
419
|
+
|
|
420
|
+
#### Use cases
|
|
421
|
+
|
|
422
|
+
- Sync browser, editor, or background-watcher state into a lane the model can see
|
|
423
|
+
- Emit a fresh snapshot after older state messages leave the context window
|
|
424
|
+
- Keep working memory or goal state outside the system prompt
|
|
425
|
+
|
|
426
|
+
***
|
|
427
|
+
|
|
372
428
|
### `processLLMRequest`
|
|
373
429
|
|
|
374
430
|
Processes the final LLM request after Mastra converts the `MessageList` into `LanguageModelV2Prompt` and before the provider call. Use this method for transient, model-aware rewrites that should affect only the current outbound request.
|
|
@@ -894,12 +950,12 @@ export class DynamicModelProcessor implements Processor {
|
|
|
894
950
|
}: ProcessInputStepArgs): Promise<ProcessInputStepResult> {
|
|
895
951
|
// Use a fast model for initial response
|
|
896
952
|
if (stepNumber === 0) {
|
|
897
|
-
return { model: 'openai/gpt-
|
|
953
|
+
return { model: 'openai/gpt-6-luna' }
|
|
898
954
|
}
|
|
899
955
|
|
|
900
956
|
// Switch to powerful model after tool calls
|
|
901
957
|
if (steps.length > 0 && steps[steps.length - 1].toolCalls?.length) {
|
|
902
|
-
return { model: 'openai/gpt-
|
|
958
|
+
return { model: 'openai/gpt-6.1-sol' }
|
|
903
959
|
}
|
|
904
960
|
|
|
905
961
|
// Disable tools after 5 steps to force completion
|
|
@@ -1120,7 +1176,7 @@ import { PrefillErrorHandler } from '@mastra/core/processors'
|
|
|
1120
1176
|
const agent = new Agent({
|
|
1121
1177
|
id: 'support-agent',
|
|
1122
1178
|
name: 'support-agent',
|
|
1123
|
-
model: 'openai/gpt-5',
|
|
1179
|
+
model: 'openai/gpt-5.6',
|
|
1124
1180
|
instructions: '...',
|
|
1125
1181
|
inputProcessors: [new ContentFilter(['secret'])],
|
|
1126
1182
|
outputProcessors: [new WordCounter()],
|
|
@@ -62,7 +62,7 @@ export const agent = new Agent({
|
|
|
62
62
|
id: 'secure-agent',
|
|
63
63
|
name: 'secure-agent',
|
|
64
64
|
instructions: 'You are a helpful assistant',
|
|
65
|
-
model: 'openai/gpt-
|
|
65
|
+
model: 'openai/gpt-6.1-sol',
|
|
66
66
|
inputProcessors: [
|
|
67
67
|
new PromptInjectionDetector({
|
|
68
68
|
model: 'openrouter/openai/gpt-oss-safeguard-20b',
|
|
@@ -61,7 +61,7 @@ Registering in `errorProcessors` alone, as the example above does, covers both h
|
|
|
61
61
|
| `cerebras-strip-reasoning-content` | Cerebras | Preemptive prompt rewrite | Removes assistant `reasoning` parts from the outbound prompt so they're not serialized as unsupported `reasoning_content` fields. |
|
|
62
62
|
| `anthropic-strip-empty-signed-reasoning-content` | Anthropic | Preemptive prompt rewrite | Removes assistant `reasoning` parts that carry an Anthropic signature but have empty text, which legacy records can contain. Anthropic signs the exact thinking text, so the mismatched pair would be rejected. |
|
|
63
63
|
| `anthropic-strip-foreign-reasoning-content` | Anthropic | Preemptive prompt rewrite | Removes non-Anthropic assistant `reasoning` parts from the outbound prompt. Anthropic-native thinking history is preserved. |
|
|
64
|
-
| `anthropic-strip-foreign-signed-reasoning` | Anthropic-compatible | Preemptive prompt rewrite | Drops signed thinking from the outbound prompt when its origin turn was stamped with a different provider (for example Kimi For Coding ↔ `anthropic/claude-sonnet-
|
|
64
|
+
| `anthropic-strip-foreign-signed-reasoning` | Anthropic-compatible | Preemptive prompt rewrite | Drops signed thinking from the outbound prompt when its origin turn was stamped with a different provider (for example Kimi For Coding ↔ `anthropic/claude-sonnet-5-5`), since the receiving provider can't verify another provider's signature. Turns emptied of all content by the drop are removed from the prompt. Unstamped history is left untouched. |
|
|
65
65
|
| `azure-system-reminder-transform` | Azure OpenAI | Preemptive prompt rewrite | Renames `<system-reminder>` wrappers in user text and system instructions to `<memory-context>` for the outbound request. Stored history remains unchanged. |
|
|
66
66
|
| `openai-orphan-item-id` | OpenAI, Azure OpenAI (Responses) | Reactive API error recovery | Recovers history that OpenAI rejects with `Item 'msg_…' of type 'message' was provided without its required 'reasoning' item`. Drops the Responses `itemId` from every item-bearing part of an assistant message that carries one but has no `reasoning` part, and retries. The message then replays by value instead of as an unsatisfiable `item_reference`. The repair is applied to the in-memory list for the current turn. |
|
|
67
67
|
| `anthropic-orphaned-thinking-step` | Anthropic | Reactive API error recovery | Recovers history that Anthropic rejects because `thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. Removes steps that contain only reasoning when more assistant content follows them, and retries. Covers history saved by older `@mastra/memory` releases ([#22798](https://github.com/mastra-ai/mastra/issues/22798)). |
|
|
@@ -72,7 +72,7 @@ import { RegexFilterProcessor } from '@mastra/core/processors'
|
|
|
72
72
|
const agent = new Agent({
|
|
73
73
|
id: 'my-agent',
|
|
74
74
|
name: 'my-agent',
|
|
75
|
-
model: 'openai/gpt-
|
|
75
|
+
model: 'openai/gpt-6-luna',
|
|
76
76
|
inputProcessors: [
|
|
77
77
|
new RegexFilterProcessor({
|
|
78
78
|
presets: ['pii', 'secrets'],
|
|
@@ -30,7 +30,7 @@ const processor = new SemanticRecall({
|
|
|
30
30
|
|
|
31
31
|
**options.vector** (`MastraVector`): Vector store for semantic search
|
|
32
32
|
|
|
33
|
-
**options.embedder** (`MastraEmbeddingModel<string>`): Embedder for generating query embeddings
|
|
33
|
+
**options.embedder** (`MastraEmbeddingModel<string>`): Embedder for generating query embeddings. Required unless the vector store embeds text itself (self-embedding)
|
|
34
34
|
|
|
35
35
|
**options.topK** (`number`): Number of most similar messages to retrieve
|
|
36
36
|
|
|
@@ -86,7 +86,7 @@ export const agent = new Agent({
|
|
|
86
86
|
id: 'semantic-memory-agent',
|
|
87
87
|
name: 'semantic-memory-agent',
|
|
88
88
|
instructions: 'You are a helpful assistant with semantic memory recall',
|
|
89
|
-
model: 'openai/gpt-
|
|
89
|
+
model: 'openai/gpt-6.1-sol',
|
|
90
90
|
inputProcessors: [semanticRecall, new MessageHistory({ storage, lastMessages: 50 })],
|
|
91
91
|
outputProcessors: [semanticRecall, new MessageHistory({ storage })],
|
|
92
92
|
})
|
|
@@ -81,7 +81,7 @@ const agent = new Agent({
|
|
|
81
81
|
name: 'skill-agent',
|
|
82
82
|
instructions:
|
|
83
83
|
'You are a helpful assistant. Use search_skills to find relevant skills, then load_skill to load their instructions.',
|
|
84
|
-
model: 'openai/gpt-
|
|
84
|
+
model: 'openai/gpt-6.1-sol',
|
|
85
85
|
workspace,
|
|
86
86
|
inputProcessors: [skillSearch],
|
|
87
87
|
})
|
|
@@ -20,7 +20,7 @@ export const agent = new Agent({
|
|
|
20
20
|
id: 'openai-agent',
|
|
21
21
|
name: 'openai-agent',
|
|
22
22
|
instructions: 'You are a helpful assistant.',
|
|
23
|
-
model: 'openai/gpt-5',
|
|
23
|
+
model: 'openai/gpt-5.6',
|
|
24
24
|
errorProcessors: [new StreamErrorRetryProcessor({ maxRetries: 5 })],
|
|
25
25
|
maxProcessorRetries: 5,
|
|
26
26
|
})
|
|
@@ -66,7 +66,7 @@ export const agent = new Agent({
|
|
|
66
66
|
id: 'resilient-agent',
|
|
67
67
|
name: 'Resilient agent',
|
|
68
68
|
instructions: 'You are a helpful assistant.',
|
|
69
|
-
model: 'openai/gpt-5',
|
|
69
|
+
model: 'openai/gpt-5.6',
|
|
70
70
|
errorProcessors: [
|
|
71
71
|
new StreamErrorRetryProcessor({
|
|
72
72
|
retryUnknownErrors: true,
|
|
@@ -99,7 +99,7 @@ export const agent = new Agent({
|
|
|
99
99
|
id: 'resilient-agent',
|
|
100
100
|
name: 'resilient-agent',
|
|
101
101
|
instructions: 'You are a helpful assistant.',
|
|
102
|
-
model: 'openai/gpt-5',
|
|
102
|
+
model: 'openai/gpt-5.6',
|
|
103
103
|
errorProcessors: [
|
|
104
104
|
new StreamErrorRetryProcessor({
|
|
105
105
|
maxRetries: 2,
|
|
@@ -68,7 +68,7 @@ export const agent = new Agent({
|
|
|
68
68
|
id: 'scrubbed-agent',
|
|
69
69
|
name: 'scrubbed-agent',
|
|
70
70
|
instructions: 'You are a helpful assistant',
|
|
71
|
-
model: 'openai/gpt-
|
|
71
|
+
model: 'openai/gpt-6.1-sol',
|
|
72
72
|
outputProcessors: [
|
|
73
73
|
// Batch stream parts first to reduce LLM calls
|
|
74
74
|
new BatchPartsProcessor({
|