@mastra/mcp-docs-server 0.0.0-studio-deploy-20260404182525 → 0.0.0-studio-cli-20260504022012
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/adding-voice.md +18 -17
- package/.docs/docs/agents/background-tasks.md +242 -0
- package/.docs/docs/agents/channels.md +2 -1
- package/.docs/docs/agents/overview.md +4 -0
- package/.docs/docs/agents/processors.md +177 -5
- package/.docs/docs/agents/structured-output.md +66 -1
- package/.docs/docs/agents/supervisor-agents.md +65 -0
- package/.docs/docs/agents/using-tools.md +73 -0
- package/.docs/docs/browser/agent-browser.md +78 -0
- package/.docs/docs/browser/browser-viewer.md +144 -0
- package/.docs/docs/browser/overview.md +168 -0
- package/.docs/docs/browser/stagehand.md +129 -0
- package/.docs/docs/deployment/cloud-providers.md +5 -1
- package/.docs/docs/deployment/mastra-server.md +4 -4
- package/.docs/docs/deployment/monorepo.md +3 -3
- package/.docs/docs/deployment/overview.md +11 -8
- package/.docs/docs/editor/overview.md +290 -0
- package/.docs/docs/editor/prompts.md +134 -0
- package/.docs/docs/editor/tools.md +152 -0
- package/.docs/docs/evals/custom-scorers.md +63 -3
- package/.docs/docs/evals/datasets/overview.md +1 -1
- package/.docs/docs/index.md +2 -2
- package/.docs/docs/mastra-platform/configuration.md +36 -0
- package/.docs/docs/mastra-platform/overview.md +78 -0
- package/.docs/docs/mcp/overview.md +17 -0
- package/.docs/docs/memory/memory-processors.md +3 -3
- package/.docs/docs/memory/message-history.md +8 -2
- package/.docs/docs/memory/observational-memory.md +65 -8
- package/.docs/docs/memory/storage.md +1 -2
- package/.docs/docs/memory/working-memory.md +2 -2
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/metrics/overview.md +2 -2
- package/.docs/docs/observability/overview.md +1 -1
- package/.docs/docs/observability/tracing/bridges/datadog.md +217 -0
- package/.docs/docs/observability/tracing/bridges/otel.md +2 -2
- package/.docs/docs/observability/tracing/exporters/arthur.md +163 -0
- package/.docs/docs/observability/tracing/exporters/cloud.md +135 -63
- package/.docs/docs/observability/tracing/exporters/datadog.md +3 -1
- package/.docs/docs/observability/tracing/exporters/default.md +5 -5
- package/.docs/docs/observability/tracing/exporters/laminar.md +22 -14
- package/.docs/docs/observability/tracing/exporters/langfuse.md +50 -33
- package/.docs/docs/observability/tracing/overview.md +87 -20
- package/.docs/docs/server/custom-adapters.md +5 -5
- package/.docs/docs/server/custom-api-routes.md +3 -3
- package/.docs/docs/server/mastra-client.md +2 -2
- package/.docs/docs/server/mastra-server.md +1 -1
- package/.docs/docs/server/middleware.md +46 -42
- package/.docs/docs/server/request-context.md +13 -2
- package/.docs/docs/server/server-adapters.md +91 -8
- package/.docs/docs/streaming/background-task-streaming.md +80 -0
- package/.docs/docs/streaming/overview.md +3 -0
- package/.docs/docs/studio/deployment.md +24 -6
- package/.docs/docs/studio/observability.md +1 -1
- package/.docs/docs/studio/overview.md +4 -4
- package/.docs/docs/voice/overview.md +74 -5
- package/.docs/docs/voice/speech-to-speech.md +45 -1
- package/.docs/docs/voice/speech-to-text.md +7 -7
- package/.docs/docs/voice/text-to-speech.md +10 -10
- package/.docs/docs/workflows/agents-and-tools.md +1 -1
- package/.docs/docs/workflows/overview.md +105 -4
- package/.docs/docs/workflows/scheduled-workflows.md +181 -0
- package/.docs/docs/workspace/filesystem.md +64 -6
- package/.docs/docs/workspace/lsp.md +76 -4
- package/.docs/docs/workspace/overview.md +62 -15
- package/.docs/docs/workspace/sandbox.md +3 -1
- package/.docs/docs/workspace/search.md +41 -2
- package/.docs/docs/workspace/skills.md +19 -19
- package/.docs/guides/agent-frameworks/ai-sdk.md +4 -4
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +56 -9
- package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
- package/.docs/guides/deployment/mastra-platform.md +191 -0
- package/.docs/guides/deployment/netlify.md +16 -1
- package/.docs/guides/getting-started/nestjs.md +238 -0
- package/.docs/guides/getting-started/next-js.md +0 -4
- package/.docs/guides/guide/code-review-bot.md +2 -2
- package/.docs/guides/guide/dev-assistant.md +4 -4
- package/.docs/{docs/mcp → guides/guide}/publishing-mcp-server.md +21 -1
- package/.docs/guides/guide/slack-assistant.md +191 -0
- package/.docs/guides/migrations/mastra-cloud.md +368 -0
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +1 -1
- package/.docs/models/embeddings.md +3 -3
- package/.docs/models/gateways/azure-openai.md +74 -35
- package/.docs/models/gateways/mastra.md +64 -0
- package/.docs/models/gateways/netlify.md +7 -3
- package/.docs/models/gateways/openrouter.md +28 -12
- package/.docs/models/gateways/vercel.md +22 -2
- package/.docs/models/gateways.md +1 -0
- package/.docs/models/index.md +43 -8
- package/.docs/models/providers/302ai.md +37 -4
- package/.docs/models/providers/abliteration-ai.md +71 -0
- package/.docs/models/providers/alibaba-cn.md +8 -2
- package/.docs/models/providers/alibaba-coding-plan-cn.md +3 -2
- package/.docs/models/providers/alibaba-coding-plan.md +3 -2
- package/.docs/models/providers/alibaba.md +8 -1
- package/.docs/models/providers/anthropic.md +18 -5
- package/.docs/models/providers/baseten.md +3 -1
- package/.docs/models/providers/berget.md +10 -12
- package/.docs/models/providers/chutes.md +4 -2
- package/.docs/models/providers/cloudflare-workers-ai.md +14 -48
- package/.docs/models/providers/cortecs.md +22 -2
- package/.docs/models/providers/deepinfra.md +8 -2
- package/.docs/models/providers/deepseek.md +6 -4
- package/.docs/models/providers/digitalocean.md +133 -0
- package/.docs/models/providers/fireworks-ai.md +6 -1
- package/.docs/models/providers/firmware.md +12 -10
- package/.docs/models/providers/friendli.md +6 -7
- package/.docs/models/providers/google.md +9 -3
- package/.docs/models/providers/helicone.md +1 -2
- package/.docs/models/providers/hpc-ai.md +73 -0
- package/.docs/models/providers/huggingface.md +6 -2
- package/.docs/models/providers/inception.md +9 -11
- package/.docs/models/providers/kilo.md +359 -339
- package/.docs/models/providers/kimi-for-coding.md +2 -1
- package/.docs/models/providers/llmgateway.md +67 -77
- package/.docs/models/providers/mistral.md +3 -2
- package/.docs/models/providers/mixlayer.md +75 -0
- package/.docs/models/providers/moonshotai-cn.md +3 -2
- package/.docs/models/providers/moonshotai.md +3 -2
- package/.docs/models/providers/nano-gpt.md +8 -2
- package/.docs/models/providers/neuralwatt.md +84 -0
- package/.docs/models/providers/novita-ai.md +19 -4
- package/.docs/models/providers/nvidia.md +8 -1
- package/.docs/models/providers/ollama-cloud.md +7 -2
- package/.docs/models/providers/openai.md +7 -2
- package/.docs/models/providers/opencode-go.md +21 -13
- package/.docs/models/providers/opencode.md +11 -4
- package/.docs/models/providers/ovhcloud.md +6 -8
- package/.docs/models/providers/poe.md +10 -15
- package/.docs/models/providers/regolo-ai.md +83 -0
- package/.docs/models/providers/siliconflow-cn.md +5 -2
- package/.docs/models/providers/siliconflow.md +6 -3
- package/.docs/models/providers/stepfun.md +8 -7
- package/.docs/models/providers/synthetic.md +5 -2
- package/.docs/models/providers/tencent-token-plan.md +71 -0
- package/.docs/models/providers/tencent-tokenhub.md +71 -0
- package/.docs/models/providers/togetherai.md +8 -7
- package/.docs/models/providers/vivgrid.md +7 -3
- package/.docs/models/providers/vultr.md +7 -6
- package/.docs/models/providers/wafer.ai.md +73 -0
- package/.docs/models/providers/wandb.md +3 -2
- package/.docs/models/providers/xai.md +6 -1
- package/.docs/models/providers/xiaomi-token-plan-ams.md +75 -0
- package/.docs/models/providers/xiaomi-token-plan-cn.md +75 -0
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +75 -0
- package/.docs/models/providers/xiaomi.md +4 -2
- package/.docs/models/providers/zai-coding-plan.md +11 -19
- package/.docs/models/providers/zai.md +2 -1
- package/.docs/models/providers/zenmux.md +17 -6
- package/.docs/models/providers/zhipuai-coding-plan.md +11 -21
- package/.docs/models/providers/zhipuai.md +2 -1
- package/.docs/models/providers.md +11 -0
- package/.docs/reference/agents/agent.md +1 -1
- package/.docs/reference/agents/channels.md +3 -3
- package/.docs/reference/agents/generate.md +88 -6
- package/.docs/reference/agents/generateLegacy.md +1 -1
- package/.docs/reference/ai-sdk/chat-route.md +2 -0
- package/.docs/reference/ai-sdk/handle-chat-stream.md +19 -0
- package/.docs/reference/ai-sdk/handle-network-stream.md +2 -0
- package/.docs/reference/ai-sdk/network-route.md +2 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +95 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +15 -0
- package/.docs/reference/browser/agent-browser.md +375 -0
- package/.docs/reference/browser/browser-viewer.md +228 -0
- package/.docs/reference/browser/mastra-browser.md +286 -0
- package/.docs/reference/browser/stagehand-browser.md +286 -0
- package/.docs/reference/cli/mastra.md +703 -0
- package/.docs/reference/client-js/agents.md +166 -0
- package/.docs/reference/client-js/conversations.md +1 -1
- package/.docs/reference/client-js/mastra-client.md +23 -0
- package/.docs/reference/client-js/observability.md +2 -2
- package/.docs/reference/client-js/responses.md +1 -1
- package/.docs/reference/client-js/workflows.md +62 -1
- package/.docs/reference/configuration.md +67 -1
- package/.docs/reference/core/addGateway.md +5 -5
- package/.docs/reference/core/getEditor.md +35 -0
- package/.docs/reference/core/getGateway.md +5 -5
- package/.docs/reference/core/getGatewayById.md +5 -5
- package/.docs/reference/core/getMCPServer.md +2 -2
- package/.docs/reference/core/getMCPServerById.md +2 -2
- package/.docs/reference/core/getScorer.md +3 -3
- package/.docs/reference/core/getScorerById.md +3 -3
- package/.docs/reference/core/listGateways.md +5 -5
- package/.docs/reference/core/listMCPServers.md +2 -2
- package/.docs/reference/core/listScorers.md +3 -3
- package/.docs/reference/core/mastra-class.md +11 -1
- package/.docs/reference/core/mastra-model-gateway.md +5 -5
- package/.docs/reference/datasets/create.md +4 -4
- package/.docs/reference/datasets/startExperiment.md +28 -2
- package/.docs/reference/datasets/update.md +4 -4
- package/.docs/reference/deployer/cloudflare.md +14 -1
- package/.docs/reference/deployer/netlify.md +50 -2
- package/.docs/reference/editor/mastra-editor.md +168 -0
- package/.docs/reference/editor/tool-provider.md +85 -0
- package/.docs/reference/evals/context-precision.md +3 -3
- package/.docs/reference/evals/context-relevance.md +3 -3
- package/.docs/reference/evals/create-scorer.md +5 -3
- package/.docs/reference/evals/filter-run.md +117 -0
- package/.docs/reference/evals/mastra-scorer.md +4 -4
- package/.docs/reference/evals/noise-sensitivity.md +6 -6
- package/.docs/reference/evals/prompt-alignment.md +12 -12
- package/.docs/reference/evals/run-evals.md +6 -6
- package/.docs/reference/evals/scorer-utils.md +3 -3
- package/.docs/reference/evals/trajectory-accuracy.md +3 -3
- package/.docs/reference/harness/harness-class.md +152 -53
- package/.docs/reference/index.md +25 -0
- package/.docs/reference/logging/pino-logger.md +0 -2
- package/.docs/reference/mastra-platform/api.md +108 -0
- package/.docs/reference/memory/clone-utilities.md +4 -2
- package/.docs/reference/memory/cloneThread.md +4 -2
- package/.docs/reference/memory/observational-memory.md +4 -0
- package/.docs/reference/observability/metrics/automatic-metrics.md +3 -3
- package/.docs/reference/observability/tracing/bridges/datadog.md +211 -0
- package/.docs/reference/observability/tracing/bridges/otel.md +3 -3
- package/.docs/reference/observability/tracing/configuration.md +18 -11
- package/.docs/reference/observability/tracing/exporters/arthur.md +122 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +102 -21
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +8 -8
- package/.docs/reference/observability/tracing/exporters/datadog.md +3 -1
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +8 -8
- package/.docs/reference/observability/tracing/exporters/langfuse.md +25 -32
- package/.docs/reference/observability/tracing/exporters/otel.md +3 -3
- package/.docs/reference/observability/tracing/instances.md +7 -7
- package/.docs/reference/observability/tracing/interfaces.md +23 -6
- package/.docs/reference/observability/tracing/span-filtering.md +95 -0
- package/.docs/reference/observability/tracing/spans.md +6 -6
- package/.docs/reference/processors/prefill-error-handler.md +70 -0
- package/.docs/reference/processors/processor-interface.md +400 -40
- package/.docs/reference/processors/skill-search-processor.md +20 -1
- package/.docs/reference/processors/stream-error-retry-processor.md +54 -0
- package/.docs/reference/processors/tool-call-filter.md +23 -0
- package/.docs/reference/server/create-route.md +3 -3
- package/.docs/reference/server/express-adapter.md +4 -4
- package/.docs/reference/server/fastify-adapter.md +4 -4
- package/.docs/reference/server/hono-adapter.md +4 -4
- package/.docs/reference/server/koa-adapter.md +4 -4
- package/.docs/reference/server/mastra-server.md +3 -3
- package/.docs/reference/server/nestjs-adapter.md +169 -0
- package/.docs/reference/server/register-api-route.md +4 -4
- package/.docs/reference/server/routes.md +11 -10
- package/.docs/reference/storage/clickhouse.md +300 -0
- package/.docs/reference/storage/cloudflare-d1.md +42 -42
- package/.docs/reference/storage/composite.md +5 -3
- package/.docs/reference/storage/duckdb.md +150 -0
- package/.docs/reference/storage/overview.md +1 -1
- package/.docs/reference/storage/redis.md +266 -0
- package/.docs/reference/streaming/ChunkType.md +143 -3
- package/.docs/reference/streaming/agents/MastraModelOutput.md +2 -2
- package/.docs/reference/streaming/agents/stream.md +10 -2
- package/.docs/reference/streaming/agents/streamUntilIdle.md +94 -0
- package/.docs/reference/streaming/workflows/resumeStream.md +2 -0
- package/.docs/reference/templates/overview.md +88 -14
- package/.docs/reference/tools/create-tool.md +107 -5
- package/.docs/reference/tools/mcp-client.md +45 -0
- package/.docs/reference/tools/mcp-server.md +1 -3
- package/.docs/reference/tools/perplexity.md +155 -0
- package/.docs/reference/tools/tavily.md +307 -0
- package/.docs/reference/vectors/mongodb.md +0 -2
- package/.docs/reference/voice/aws-nova-sonic.md +247 -0
- package/.docs/reference/voice/cloudflare.md +3 -3
- package/.docs/reference/voice/sarvam.md +29 -23
- package/.docs/reference/voice/voice.connect.md +4 -4
- package/.docs/reference/voice/voice.listen.md +3 -3
- package/.docs/reference/workflows/run-methods/resume.md +24 -0
- package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
- package/.docs/reference/workflows/step.md +88 -7
- package/.docs/reference/workflows/workflow-methods/foreach.md +14 -1
- package/.docs/reference/workflows/workflow.md +88 -4
- package/.docs/reference/workspace/azure-blob-filesystem.md +219 -0
- package/.docs/reference/workspace/docker-sandbox.md +196 -0
- package/.docs/reference/workspace/gcs-filesystem.md +1 -0
- package/.docs/reference/workspace/google-drive-filesystem.md +185 -0
- package/.docs/reference/workspace/modal-sandbox.md +168 -0
- package/.docs/reference/workspace/process-manager.md +1 -1
- package/.docs/reference/workspace/s3-filesystem.md +80 -5
- package/.docs/reference/workspace/vercel.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +37 -6
- package/CHANGELOG.md +500 -4
- package/dist/stdio.js.map +1 -1
- package/dist/utils.d.ts +1 -4
- package/dist/utils.d.ts.map +1 -1
- package/package.json +11 -11
- package/.docs/docs/mastra-cloud/deployment.md +0 -77
- package/.docs/docs/mastra-cloud/observability.md +0 -38
- package/.docs/docs/mastra-cloud/overview.md +0 -23
- package/.docs/docs/mastra-cloud/setup.md +0 -42
|
@@ -119,17 +119,17 @@ const exporterWithLogger = new ConsoleExporter({
|
|
|
119
119
|
|
|
120
120
|
### Documentation
|
|
121
121
|
|
|
122
|
-
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview)
|
|
123
|
-
- [Exporters](https://mastra.ai/docs/observability/tracing/overview)
|
|
122
|
+
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview): Complete guide
|
|
123
|
+
- [Exporters](https://mastra.ai/docs/observability/tracing/overview): Exporter concepts
|
|
124
124
|
|
|
125
125
|
### Other Exporters
|
|
126
126
|
|
|
127
|
-
- [DefaultExporter](https://mastra.ai/reference/observability/tracing/exporters/default-exporter)
|
|
128
|
-
- [CloudExporter](https://mastra.ai/reference/observability/tracing/exporters/cloud-exporter)
|
|
129
|
-
- [Langfuse](https://mastra.ai/reference/observability/tracing/exporters/langfuse)
|
|
130
|
-
- [Braintrust](https://mastra.ai/reference/observability/tracing/exporters/braintrust)
|
|
127
|
+
- [DefaultExporter](https://mastra.ai/reference/observability/tracing/exporters/default-exporter): Storage persistence
|
|
128
|
+
- [CloudExporter](https://mastra.ai/reference/observability/tracing/exporters/cloud-exporter): Mastra platform
|
|
129
|
+
- [Langfuse](https://mastra.ai/reference/observability/tracing/exporters/langfuse): Langfuse integration
|
|
130
|
+
- [Braintrust](https://mastra.ai/reference/observability/tracing/exporters/braintrust): Braintrust integration
|
|
131
131
|
|
|
132
132
|
### Reference
|
|
133
133
|
|
|
134
|
-
- [Configuration](https://mastra.ai/reference/observability/tracing/configuration)
|
|
135
|
-
- [Interfaces](https://mastra.ai/reference/observability/tracing/interfaces)
|
|
134
|
+
- [Configuration](https://mastra.ai/reference/observability/tracing/configuration): Configuration options
|
|
135
|
+
- [Interfaces](https://mastra.ai/reference/observability/tracing/interfaces): Type definitions
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Sends Tracing data to Datadog's LLM Observability product for monitoring and analytics.
|
|
4
4
|
|
|
5
|
+
> **Info:** If you also use `dd-trace` APM auto-instrumentation and need it correctly parented under Mastra spans, use the [DatadogBridge](https://mastra.ai/reference/observability/tracing/bridges/datadog) instead. The exporter sends LLM Observability data after execution completes, so it doesn't participate in `dd-trace`'s live scope.
|
|
6
|
+
|
|
5
7
|
## Constructor
|
|
6
8
|
|
|
7
9
|
```typescript
|
|
@@ -89,7 +91,7 @@ const exporter = new DatadogExporter({
|
|
|
89
91
|
|
|
90
92
|
## Span mapping
|
|
91
93
|
|
|
92
|
-
Mastra span types are mapped to Datadog
|
|
94
|
+
Mastra span types are mapped to Datadog LLM Observability span kinds:
|
|
93
95
|
|
|
94
96
|
| Mastra SpanType | Datadog Kind |
|
|
95
97
|
| ------------------ | ------------ |
|
|
@@ -158,17 +158,17 @@ const customExporter = new DefaultExporter({
|
|
|
158
158
|
|
|
159
159
|
### Documentation
|
|
160
160
|
|
|
161
|
-
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview)
|
|
162
|
-
- [Exporters](https://mastra.ai/docs/observability/tracing/overview)
|
|
161
|
+
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview): Complete guide
|
|
162
|
+
- [Exporters](https://mastra.ai/docs/observability/tracing/overview): Exporter concepts
|
|
163
163
|
|
|
164
164
|
### Other Exporters
|
|
165
165
|
|
|
166
|
-
- [CloudExporter](https://mastra.ai/reference/observability/tracing/exporters/cloud-exporter)
|
|
167
|
-
- [ConsoleExporter](https://mastra.ai/reference/observability/tracing/exporters/console-exporter)
|
|
168
|
-
- [Langfuse](https://mastra.ai/reference/observability/tracing/exporters/langfuse)
|
|
169
|
-
- [Braintrust](https://mastra.ai/reference/observability/tracing/exporters/braintrust)
|
|
166
|
+
- [CloudExporter](https://mastra.ai/reference/observability/tracing/exporters/cloud-exporter): Mastra platform
|
|
167
|
+
- [ConsoleExporter](https://mastra.ai/reference/observability/tracing/exporters/console-exporter): Debug output
|
|
168
|
+
- [Langfuse](https://mastra.ai/reference/observability/tracing/exporters/langfuse): Langfuse integration
|
|
169
|
+
- [Braintrust](https://mastra.ai/reference/observability/tracing/exporters/braintrust): Braintrust integration
|
|
170
170
|
|
|
171
171
|
### Reference
|
|
172
172
|
|
|
173
|
-
- [Configuration](https://mastra.ai/reference/observability/tracing/configuration)
|
|
174
|
-
- [Interfaces](https://mastra.ai/reference/observability/tracing/interfaces)
|
|
173
|
+
- [Configuration](https://mastra.ai/reference/observability/tracing/configuration): Configuration options
|
|
174
|
+
- [Interfaces](https://mastra.ai/reference/observability/tracing/interfaces): Type definitions
|
|
@@ -16,7 +16,10 @@ interface LangfuseExporterConfig extends BaseExporterConfig {
|
|
|
16
16
|
secretKey?: string
|
|
17
17
|
baseUrl?: string
|
|
18
18
|
realtime?: boolean
|
|
19
|
-
|
|
19
|
+
flushAt?: number
|
|
20
|
+
flushInterval?: number
|
|
21
|
+
environment?: string
|
|
22
|
+
release?: string
|
|
20
23
|
}
|
|
21
24
|
```
|
|
22
25
|
|
|
@@ -25,23 +28,17 @@ Extends `BaseExporterConfig`, which includes:
|
|
|
25
28
|
- `logger?: IMastraLogger` - Logger instance
|
|
26
29
|
- `logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error'` - Log level (default: INFO)
|
|
27
30
|
|
|
28
|
-
##
|
|
31
|
+
## Properties
|
|
29
32
|
|
|
30
|
-
### `
|
|
33
|
+
### `client`
|
|
31
34
|
|
|
32
35
|
```typescript
|
|
33
|
-
|
|
36
|
+
get client(): LangfuseClient | undefined
|
|
34
37
|
```
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### export
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
async export(spans: ReadOnlySpan[]): Promise<void>
|
|
42
|
-
```
|
|
39
|
+
The `LangfuseClient` instance for advanced Langfuse features. Returns `undefined` when the exporter is disabled (missing credentials). Use this for prompt management, evaluations, datasets, and direct API access.
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
## Methods
|
|
45
42
|
|
|
46
43
|
### flush
|
|
47
44
|
|
|
@@ -49,7 +46,7 @@ Batch exports spans to Langfuse.
|
|
|
49
46
|
async flush(): Promise<void>
|
|
50
47
|
```
|
|
51
48
|
|
|
52
|
-
Force flushes any buffered spans to Langfuse without shutting down
|
|
49
|
+
Force flushes any buffered spans and scores to Langfuse without shutting down. Useful in serverless environments where you need to ensure data is exported before the runtime terminates.
|
|
53
50
|
|
|
54
51
|
### shutdown
|
|
55
52
|
|
|
@@ -57,7 +54,7 @@ Force flushes any buffered spans to Langfuse without shutting down the exporter.
|
|
|
57
54
|
async shutdown(): Promise<void>
|
|
58
55
|
```
|
|
59
56
|
|
|
60
|
-
Flushes pending data and shuts down the client.
|
|
57
|
+
Flushes pending data and shuts down both the span processor and the client.
|
|
61
58
|
|
|
62
59
|
## Usage
|
|
63
60
|
|
|
@@ -85,10 +82,11 @@ const exporter = new LangfuseExporter({
|
|
|
85
82
|
|
|
86
83
|
## Span mapping
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
Mastra spans are converted to OTel format and sent to Langfuse via `LangfuseSpanProcessor`. Langfuse automatically maps spans based on their `gen_ai.*` attributes:
|
|
86
|
+
|
|
87
|
+
- Spans with a `model` attribute → Langfuse generations
|
|
90
88
|
- All other spans → Langfuse spans
|
|
91
|
-
-
|
|
89
|
+
- Parent-child relationships are preserved via OTel trace/span IDs
|
|
92
90
|
|
|
93
91
|
## Prompt linking
|
|
94
92
|
|
|
@@ -96,22 +94,21 @@ Link LLM generations to [Langfuse Prompt Management](https://langfuse.com/docs/p
|
|
|
96
94
|
|
|
97
95
|
```typescript
|
|
98
96
|
import { buildTracingOptions } from '@mastra/observability'
|
|
99
|
-
import { withLangfusePrompt } from '@mastra/langfuse'
|
|
100
|
-
import { Langfuse } from 'langfuse'
|
|
97
|
+
import { LangfuseExporter, withLangfusePrompt } from '@mastra/langfuse'
|
|
101
98
|
|
|
102
|
-
const
|
|
103
|
-
publicKey: process.env.LANGFUSE_PUBLIC_KEY!,
|
|
104
|
-
secretKey: process.env.LANGFUSE_SECRET_KEY!,
|
|
105
|
-
})
|
|
99
|
+
const exporter = new LangfuseExporter()
|
|
106
100
|
|
|
107
|
-
|
|
101
|
+
// Fetch prompt via the Langfuse client
|
|
102
|
+
const prompt = await exporter.client.prompt.get('customer-support', { type: 'text' })
|
|
108
103
|
|
|
109
104
|
const agent = new Agent({
|
|
110
105
|
name: 'support-agent',
|
|
111
|
-
instructions: prompt.
|
|
106
|
+
instructions: prompt.compile(),
|
|
112
107
|
model: 'openai/gpt-5.4',
|
|
113
108
|
defaultGenerateOptions: {
|
|
114
|
-
tracingOptions: buildTracingOptions(
|
|
109
|
+
tracingOptions: buildTracingOptions(
|
|
110
|
+
withLangfusePrompt({ name: prompt.name, version: prompt.version }),
|
|
111
|
+
),
|
|
115
112
|
},
|
|
116
113
|
})
|
|
117
114
|
```
|
|
@@ -123,12 +120,8 @@ const agent = new Agent({
|
|
|
123
120
|
Adds Langfuse prompt metadata to tracing options.
|
|
124
121
|
|
|
125
122
|
```typescript
|
|
126
|
-
//
|
|
127
|
-
withLangfusePrompt(prompt)
|
|
128
|
-
|
|
129
|
-
// With manual fields
|
|
123
|
+
// Link by name and version (required for Langfuse v5)
|
|
130
124
|
withLangfusePrompt({ name: 'my-prompt', version: 1 })
|
|
131
|
-
withLangfusePrompt({ id: 'prompt-uuid' })
|
|
132
125
|
```
|
|
133
126
|
|
|
134
|
-
|
|
127
|
+
The prompt metadata is passed through as span attributes and Langfuse links the generation to the corresponding prompt.
|
|
@@ -194,6 +194,6 @@ Tags are stored as a JSON-stringified array in the `mastra.tags` span attribute
|
|
|
194
194
|
|
|
195
195
|
## Related
|
|
196
196
|
|
|
197
|
-
- [OtelExporter Guide](https://mastra.ai/docs/observability/tracing/exporters/otel)
|
|
198
|
-
- [OtelBridge](https://mastra.ai/docs/observability/tracing/bridges/otel)
|
|
199
|
-
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview)
|
|
197
|
+
- [OtelExporter Guide](https://mastra.ai/docs/observability/tracing/exporters/otel): Setup guide with provider configurations
|
|
198
|
+
- [OtelBridge](https://mastra.ai/docs/observability/tracing/bridges/otel): For bidirectional OTEL context integration
|
|
199
|
+
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview): General tracing concepts
|
|
@@ -95,13 +95,13 @@ class CustomObservabilityInstance extends BaseObservabilityInstance {
|
|
|
95
95
|
|
|
96
96
|
### Documentation
|
|
97
97
|
|
|
98
|
-
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview)
|
|
99
|
-
- [Configuration Reference](https://mastra.ai/reference/observability/tracing/configuration)
|
|
100
|
-
- [Interfaces Reference](https://mastra.ai/reference/observability/tracing/interfaces)
|
|
101
|
-
- [Spans Reference](https://mastra.ai/reference/observability/tracing/spans)
|
|
98
|
+
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview): Concepts and usage guide
|
|
99
|
+
- [Configuration Reference](https://mastra.ai/reference/observability/tracing/configuration): Configuration options
|
|
100
|
+
- [Interfaces Reference](https://mastra.ai/reference/observability/tracing/interfaces): Type definitions
|
|
101
|
+
- [Spans Reference](https://mastra.ai/reference/observability/tracing/spans): Span lifecycle and methods
|
|
102
102
|
|
|
103
103
|
### Exporters
|
|
104
104
|
|
|
105
|
-
- [DefaultExporter](https://mastra.ai/reference/observability/tracing/exporters/default-exporter)
|
|
106
|
-
- [CloudExporter](https://mastra.ai/reference/observability/tracing/exporters/cloud-exporter)
|
|
107
|
-
- [ConsoleExporter](https://mastra.ai/reference/observability/tracing/exporters/console-exporter)
|
|
105
|
+
- [DefaultExporter](https://mastra.ai/reference/observability/tracing/exporters/default-exporter): Storage persistence
|
|
106
|
+
- [CloudExporter](https://mastra.ai/reference/observability/tracing/exporters/cloud-exporter): Mastra platform integration
|
|
107
|
+
- [ConsoleExporter](https://mastra.ai/reference/observability/tracing/exporters/console-exporter): Debug output
|
|
@@ -126,6 +126,21 @@ interface ObservabilityExporter {
|
|
|
126
126
|
/** Initialize exporter with tracing configuration and/or access to Mastra */
|
|
127
127
|
init?(options: InitExporterOptions): void
|
|
128
128
|
|
|
129
|
+
/** Handle tracing events */
|
|
130
|
+
onTracingEvent?(event: TracingEvent): void | Promise<void>
|
|
131
|
+
|
|
132
|
+
/** Handle log events */
|
|
133
|
+
onLogEvent?(event: LogEvent): void | Promise<void>
|
|
134
|
+
|
|
135
|
+
/** Handle metric events */
|
|
136
|
+
onMetricEvent?(event: MetricEvent): void | Promise<void>
|
|
137
|
+
|
|
138
|
+
/** Handle score events */
|
|
139
|
+
onScoreEvent?(event: ScoreEvent): void | Promise<void>
|
|
140
|
+
|
|
141
|
+
/** Handle feedback events */
|
|
142
|
+
onFeedbackEvent?(event: FeedbackEvent): void | Promise<void>
|
|
143
|
+
|
|
129
144
|
/** Export tracing events */
|
|
130
145
|
exportTracingEvent(event: TracingEvent): Promise<void>
|
|
131
146
|
|
|
@@ -154,6 +169,8 @@ interface ObservabilityExporter {
|
|
|
154
169
|
}
|
|
155
170
|
```
|
|
156
171
|
|
|
172
|
+
Event callback payloads use observability event bus envelopes: `TracingEvent` carries span lifecycle events with `exportedSpan`, `LogEvent` wraps `ExportedLog` in `log`, `MetricEvent` wraps `ExportedMetric` in `metric`, `ScoreEvent` wraps `ExportedScore` in `score`, and `FeedbackEvent` wraps `ExportedFeedback` in `feedback`. For Cloud exporter behavior for these callbacks, see [CloudExporter](https://mastra.ai/reference/observability/tracing/exporters/cloud-exporter).
|
|
173
|
+
|
|
157
174
|
### `SpanOutputProcessor`
|
|
158
175
|
|
|
159
176
|
Interface for span output processors.
|
|
@@ -735,12 +752,12 @@ enum InternalSpans {
|
|
|
735
752
|
|
|
736
753
|
### Documentation
|
|
737
754
|
|
|
738
|
-
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview)
|
|
739
|
-
- [Creating Child Spans](https://mastra.ai/docs/observability/tracing/overview)
|
|
740
|
-
- [Adding Custom Metadata](https://mastra.ai/docs/observability/tracing/overview)
|
|
755
|
+
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview): Complete guide to Tracing
|
|
756
|
+
- [Creating Child Spans](https://mastra.ai/docs/observability/tracing/overview): Working with span hierarchies
|
|
757
|
+
- [Adding Custom Metadata](https://mastra.ai/docs/observability/tracing/overview): Enriching traces
|
|
741
758
|
|
|
742
759
|
### Reference
|
|
743
760
|
|
|
744
|
-
- [Configuration](https://mastra.ai/reference/observability/tracing/configuration)
|
|
745
|
-
- [Tracing Classes](https://mastra.ai/reference/observability/tracing/instances)
|
|
746
|
-
- [Spans Reference](https://mastra.ai/reference/observability/tracing/spans)
|
|
761
|
+
- [Configuration](https://mastra.ai/reference/observability/tracing/configuration): Registry and configuration
|
|
762
|
+
- [Tracing Classes](https://mastra.ai/reference/observability/tracing/instances): Core implementations
|
|
763
|
+
- [Spans Reference](https://mastra.ai/reference/observability/tracing/spans): Span lifecycle methods
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Span filtering
|
|
2
|
+
|
|
3
|
+
Span filtering controls which spans are exported from an observability config. Use it to reduce noise, lower per-span costs, or keep only the spans that matter for a specific exporter or environment.
|
|
4
|
+
|
|
5
|
+
For a shorter overview of tracing configuration, see [Tracing](https://mastra.ai/docs/observability/tracing/overview).
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
The following example demonstrates how to combine `excludeSpanTypes` and `spanFilter` in one observability config:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Mastra } from '@mastra/core'
|
|
13
|
+
import { SpanType } from '@mastra/core/observability'
|
|
14
|
+
import { Observability, DefaultExporter } from '@mastra/observability'
|
|
15
|
+
import { LangfuseExporter } from '@mastra/langfuse'
|
|
16
|
+
|
|
17
|
+
export const mastra = new Mastra({
|
|
18
|
+
observability: new Observability({
|
|
19
|
+
configs: {
|
|
20
|
+
default: {
|
|
21
|
+
serviceName: 'my-app',
|
|
22
|
+
exporters: [new DefaultExporter(), new LangfuseExporter()],
|
|
23
|
+
excludeSpanTypes: [SpanType.MODEL_CHUNK, SpanType.MODEL_STEP],
|
|
24
|
+
spanFilter: span => {
|
|
25
|
+
if (span.type === SpanType.TOOL_CALL && span.attributes?.success) {
|
|
26
|
+
return false
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return true
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Configuration options
|
|
38
|
+
|
|
39
|
+
**excludeSpanTypes** (`SpanType[]`): Drops spans by type before processors and spanFilter run. Use this for broad, low-overhead filtering.
|
|
40
|
+
|
|
41
|
+
**spanFilter** (`(span: AnyExportedSpan) => boolean`): Receives the exported span and returns true to keep it or false to drop it. Use this when filtering depends on attributes, metadata, timing, or entity identifiers.
|
|
42
|
+
|
|
43
|
+
### `excludeSpanTypes`
|
|
44
|
+
|
|
45
|
+
Use `excludeSpanTypes` when you want to suppress whole categories of spans with minimal configuration.
|
|
46
|
+
|
|
47
|
+
For the current set of supported values, see the [`SpanType` enum](https://github.com/mastra-ai/mastra/blob/main/packages/core/src/observability/types/tracing.ts).
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { SpanType } from '@mastra/core/observability'
|
|
51
|
+
|
|
52
|
+
excludeSpanTypes: [SpanType.MODEL_CHUNK, SpanType.MODEL_STEP, SpanType.WORKFLOW_SLEEP]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### `spanFilter`
|
|
56
|
+
|
|
57
|
+
When filtering depends on the exported span contents, use `spanFilter`.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { SpanType } from '@mastra/core/observability'
|
|
61
|
+
|
|
62
|
+
spanFilter: span => {
|
|
63
|
+
if (span.type === SpanType.MODEL_CHUNK) return false
|
|
64
|
+
if (span.type === SpanType.TOOL_CALL && span.attributes?.success) return false
|
|
65
|
+
|
|
66
|
+
return true
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Additional examples:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
// Only export spans from production
|
|
74
|
+
spanFilter: span => span.metadata?.environment === 'production'
|
|
75
|
+
|
|
76
|
+
// Exclude spans from a specific entity
|
|
77
|
+
spanFilter: span => span.entityId !== 'noisy-agent'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Processing order
|
|
81
|
+
|
|
82
|
+
Span filtering happens at export time in this order:
|
|
83
|
+
|
|
84
|
+
1. Internal spans are dropped unless `includeInternalSpans` is `true`.
|
|
85
|
+
2. `excludeSpanTypes` removes matching span types.
|
|
86
|
+
3. `spanOutputProcessors` transform the remaining spans.
|
|
87
|
+
4. `spanFilter` decides whether to keep the final exported span.
|
|
88
|
+
|
|
89
|
+
If `spanFilter` throws an error, Mastra keeps the span and logs the error to avoid silent data loss.
|
|
90
|
+
|
|
91
|
+
## Related
|
|
92
|
+
|
|
93
|
+
- [Tracing overview](https://mastra.ai/docs/observability/tracing/overview) for setup and concepts
|
|
94
|
+
- [Configuration API](https://mastra.ai/reference/observability/tracing/configuration) for `ObservabilityInstanceConfig`
|
|
95
|
+
- [Sensitive data filter](https://mastra.ai/docs/observability/tracing/processors/sensitive-data-filter) for redacting span data
|
|
@@ -215,12 +215,12 @@ A span that performs no operations. All methods are no-ops:
|
|
|
215
215
|
|
|
216
216
|
### Documentation
|
|
217
217
|
|
|
218
|
-
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview)
|
|
219
|
-
- [Creating Child Spans](https://mastra.ai/docs/observability/tracing/overview)
|
|
220
|
-
- [Retrieving Trace IDs](https://mastra.ai/docs/observability/tracing/overview)
|
|
218
|
+
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview): Concepts and usage
|
|
219
|
+
- [Creating Child Spans](https://mastra.ai/docs/observability/tracing/overview): Practical examples
|
|
220
|
+
- [Retrieving Trace IDs](https://mastra.ai/docs/observability/tracing/overview): Using trace IDs
|
|
221
221
|
|
|
222
222
|
### Reference
|
|
223
223
|
|
|
224
|
-
- [Tracing Classes](https://mastra.ai/reference/observability/tracing/instances)
|
|
225
|
-
- [Interfaces](https://mastra.ai/reference/observability/tracing/interfaces)
|
|
226
|
-
- [Configuration](https://mastra.ai/reference/observability/tracing/configuration)
|
|
224
|
+
- [Tracing Classes](https://mastra.ai/reference/observability/tracing/instances): Core tracing classes
|
|
225
|
+
- [Interfaces](https://mastra.ai/reference/observability/tracing/interfaces): Complete type reference
|
|
226
|
+
- [Configuration](https://mastra.ai/reference/observability/tracing/configuration): Configuration options
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# PrefillErrorHandler
|
|
2
|
+
|
|
3
|
+
The `PrefillErrorHandler` is an **error processor** that handles assistant-response prefill errors. This error occurs when a conversation ends with an assistant message and the model rejects the request because it interprets it as prefilling the assistant response.
|
|
4
|
+
|
|
5
|
+
When the error is detected, the processor appends a hidden `<system-reminder>continue</system-reminder>` user message to the conversation and signals a retry. The reminder is persisted with `metadata.systemReminder = { type: 'anthropic-prefill-processor-retry' }`, which keeps it available for retry reconstruction and raw history while standard UI-facing message conversions hide it.
|
|
6
|
+
|
|
7
|
+
Add this processor to `errorProcessors` when you want Mastra to recover from assistant prefill rejections (for example Anthropic's "assistant message prefill" and Qwen/llama.cpp's "assistant response prefill is incompatible with `enable_thinking`" errors).
|
|
8
|
+
|
|
9
|
+
## How it works
|
|
10
|
+
|
|
11
|
+
1. The LLM API call fails with a known assistant-prefill rejection message
|
|
12
|
+
2. `PrefillErrorHandler` checks that this is the first retry attempt
|
|
13
|
+
3. It appends a hidden `<system-reminder>continue</system-reminder>` user message to the `messageList`
|
|
14
|
+
4. It returns `{ retry: true }` to signal the LLM call should be retried with the modified messages
|
|
15
|
+
|
|
16
|
+
The processor now reacts to the API rejection itself instead of re-checking whether the conversation currently ends with an assistant message. This makes it resilient to cases where the provider rejects the request for prefill semantics even if the trailing message shape has already been transformed upstream.
|
|
17
|
+
|
|
18
|
+
## Usage example
|
|
19
|
+
|
|
20
|
+
Add `PrefillErrorHandler` to `errorProcessors` for any agent that should retry assistant-prefill failures:
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { Agent } from '@mastra/core/agent'
|
|
24
|
+
import { PrefillErrorHandler } from '@mastra/core/processors'
|
|
25
|
+
|
|
26
|
+
export const agent = new Agent({
|
|
27
|
+
name: 'my-agent',
|
|
28
|
+
instructions: 'You are a helpful assistant.',
|
|
29
|
+
model: 'anthropic/claude-opus-4-6',
|
|
30
|
+
errorProcessors: [new PrefillErrorHandler()],
|
|
31
|
+
})
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If you want custom recovery behavior, provide your own error processor with a `processAPIError` method:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { Agent } from '@mastra/core/agent'
|
|
38
|
+
import type { Processor } from '@mastra/core/processors'
|
|
39
|
+
|
|
40
|
+
const customErrorHandler: Processor = {
|
|
41
|
+
id: 'custom-prefill-error-handler',
|
|
42
|
+
processAPIError({ error, messageList, retryCount }) {
|
|
43
|
+
// Your custom logic here
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const agent = new Agent({
|
|
48
|
+
name: 'my-agent',
|
|
49
|
+
instructions: 'You are a helpful assistant.',
|
|
50
|
+
model: 'anthropic/claude-opus-4-6',
|
|
51
|
+
errorProcessors: [customErrorHandler],
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Constructor parameters
|
|
56
|
+
|
|
57
|
+
The `PrefillErrorHandler` takes no constructor parameters.
|
|
58
|
+
|
|
59
|
+
## Properties
|
|
60
|
+
|
|
61
|
+
**id** (`'prefill-error-handler'`): Processor identifier.
|
|
62
|
+
|
|
63
|
+
**name** (`'Prefill Error Handler'`): Processor display name.
|
|
64
|
+
|
|
65
|
+
**processAPIError** (`(args: ProcessAPIErrorArgs) => ProcessAPIErrorResult | void`): Handles known assistant-prefill errors by appending a hidden system reminder continue message and signaling retry. Only triggers on the first retry attempt.
|
|
66
|
+
|
|
67
|
+
## Related
|
|
68
|
+
|
|
69
|
+
- [Processor interface](https://mastra.ai/reference/processors/processor-interface)
|
|
70
|
+
- [Guardrails](https://mastra.ai/docs/agents/guardrails)
|