@mastra/mcp-docs-server 0.13.24 → 0.13.25-alpha.1

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.
Files changed (128) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +8 -8
  2. package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
  3. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +24 -1
  4. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +22 -0
  5. package/.docs/organized/changelogs/%40mastra%2Fastra.md +19 -19
  6. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +19 -19
  7. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +21 -21
  8. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +46 -46
  9. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +19 -19
  10. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +21 -21
  11. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +21 -21
  12. package/.docs/organized/changelogs/%40mastra%2Fcore.md +104 -104
  13. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +19 -19
  14. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +40 -40
  15. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +33 -33
  16. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +34 -34
  17. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +34 -34
  18. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +59 -59
  19. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +21 -21
  20. package/.docs/organized/changelogs/%40mastra%2Fevals.md +24 -24
  21. package/.docs/organized/changelogs/%40mastra%2Flance.md +21 -21
  22. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +29 -29
  23. package/.docs/organized/changelogs/%40mastra%2Floggers.md +19 -19
  24. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +25 -25
  25. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +19 -19
  26. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +22 -22
  27. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +27 -27
  28. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +21 -21
  29. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +21 -21
  30. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +19 -19
  31. package/.docs/organized/changelogs/%40mastra%2Fpg.md +33 -33
  32. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +19 -19
  33. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +73 -73
  34. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +20 -20
  35. package/.docs/organized/changelogs/%40mastra%2Frag.md +22 -22
  36. package/.docs/organized/changelogs/%40mastra%2Freact.md +17 -0
  37. package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +18 -0
  38. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
  39. package/.docs/organized/changelogs/%40mastra%2Fserver.md +51 -51
  40. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +19 -19
  41. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +24 -24
  42. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +19 -19
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +19 -19
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +19 -19
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +19 -19
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +19 -19
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +20 -3
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +18 -0
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +21 -21
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +20 -20
  51. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +20 -20
  52. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +21 -21
  53. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +19 -19
  54. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +19 -19
  55. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +19 -19
  56. package/.docs/organized/changelogs/create-mastra.md +32 -32
  57. package/.docs/organized/changelogs/mastra.md +64 -64
  58. package/.docs/organized/code-examples/agent.md +0 -4
  59. package/.docs/organized/code-examples/ai-elements.md +47 -0
  60. package/.docs/organized/code-examples/heads-up-game.md +5 -5
  61. package/.docs/raw/auth/clerk.mdx +3 -3
  62. package/.docs/raw/index.mdx +1 -0
  63. package/.docs/raw/observability/ai-tracing/exporters/braintrust.mdx +81 -0
  64. package/.docs/raw/observability/ai-tracing/exporters/cloud.mdx +120 -0
  65. package/.docs/raw/observability/ai-tracing/exporters/default.mdx +168 -0
  66. package/.docs/raw/observability/ai-tracing/exporters/langfuse.mdx +121 -0
  67. package/.docs/raw/observability/ai-tracing/exporters/langsmith.mdx +88 -0
  68. package/.docs/raw/observability/ai-tracing/exporters/otel.mdx +250 -0
  69. package/.docs/raw/observability/ai-tracing/overview.mdx +565 -0
  70. package/.docs/raw/observability/ai-tracing/processors/sensitive-data-filter.mdx +274 -0
  71. package/.docs/raw/observability/{tracing.mdx → otel-tracing.mdx} +2 -2
  72. package/.docs/raw/observability/overview.mdx +66 -0
  73. package/.docs/raw/reference/agents/generate.mdx +39 -1
  74. package/.docs/raw/reference/agents/generateVNext.mdx +34 -2
  75. package/.docs/raw/reference/agents/network.mdx +35 -3
  76. package/.docs/raw/reference/auth/clerk.mdx +1 -1
  77. package/.docs/raw/reference/client-js/agents.mdx +4 -13
  78. package/.docs/raw/reference/client-js/mastra-client.mdx +10 -0
  79. package/.docs/raw/reference/client-js/observability.mdx +76 -0
  80. package/.docs/raw/reference/core/getScorer.mdx +75 -0
  81. package/.docs/raw/reference/core/getScorerByName.mdx +75 -0
  82. package/.docs/raw/reference/core/getScorers.mdx +42 -0
  83. package/.docs/raw/reference/core/mastra-class.mdx +7 -0
  84. package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +182 -0
  85. package/.docs/raw/reference/observability/ai-tracing/configuration.mdx +234 -0
  86. package/.docs/raw/reference/observability/ai-tracing/exporters/braintrust.mdx +112 -0
  87. package/.docs/raw/reference/observability/ai-tracing/exporters/cloud-exporter.mdx +176 -0
  88. package/.docs/raw/reference/observability/ai-tracing/exporters/console-exporter.mdx +148 -0
  89. package/.docs/raw/reference/observability/ai-tracing/exporters/default-exporter.mdx +196 -0
  90. package/.docs/raw/reference/observability/ai-tracing/exporters/langfuse.mdx +116 -0
  91. package/.docs/raw/reference/observability/ai-tracing/exporters/langsmith.mdx +112 -0
  92. package/.docs/raw/reference/observability/ai-tracing/exporters/otel.mdx +355 -0
  93. package/.docs/raw/reference/observability/ai-tracing/interfaces.mdx +651 -0
  94. package/.docs/raw/reference/observability/ai-tracing/processors/sensitive-data-filter.mdx +178 -0
  95. package/.docs/raw/reference/observability/ai-tracing/span.mdx +371 -0
  96. package/.docs/raw/reference/observability/{logger.mdx → logging/pino-logger.mdx} +1 -1
  97. package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/index.mdx +6 -4
  98. package/.docs/raw/reference/scorers/create-scorer.mdx +59 -9
  99. package/.docs/raw/reference/scorers/mastra-scorer.mdx +6 -0
  100. package/.docs/raw/reference/scorers/run-experiment.mdx +216 -0
  101. package/.docs/raw/reference/streaming/ChunkType.mdx +3 -2
  102. package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +1 -1
  103. package/.docs/raw/reference/streaming/agents/stream.mdx +41 -3
  104. package/.docs/raw/reference/streaming/agents/streamVNext.mdx +34 -2
  105. package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +17 -1
  106. package/.docs/raw/reference/streaming/workflows/stream.mdx +39 -1
  107. package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +39 -1
  108. package/.docs/raw/reference/tools/create-tool.mdx +34 -1
  109. package/.docs/raw/reference/workflows/run-methods/resume.mdx +38 -0
  110. package/.docs/raw/reference/workflows/run-methods/start.mdx +38 -0
  111. package/.docs/raw/scorers/custom-scorers.mdx +16 -1
  112. package/.docs/raw/scorers/overview.mdx +28 -0
  113. package/CHANGELOG.md +15 -0
  114. package/package.json +6 -6
  115. package/.docs/raw/observability/ai-tracing.mdx +0 -597
  116. /package/.docs/raw/reference/observability/{otel-config.mdx → otel-tracing/otel-config.mdx} +0 -0
  117. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/arize-ax.mdx +0 -0
  118. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/arize-phoenix.mdx +0 -0
  119. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/braintrust.mdx +0 -0
  120. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/dash0.mdx +0 -0
  121. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/keywordsai.mdx +0 -0
  122. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/laminar.mdx +0 -0
  123. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/langfuse.mdx +0 -0
  124. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/langsmith.mdx +0 -0
  125. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/langwatch.mdx +0 -0
  126. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/new-relic.mdx +0 -0
  127. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/signoz.mdx +0 -0
  128. /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/traceloop.mdx +0 -0
@@ -0,0 +1,178 @@
1
+ ---
2
+ title: "SensitiveDataFilter | Processors | AI Tracing | Reference"
3
+ description: API reference for the SensitiveDataFilter processor
4
+ ---
5
+
6
+ import { PropertiesTable } from "@/components/properties-table";
7
+
8
+ # SensitiveDataFilter
9
+
10
+ An AISpanProcessor that redacts sensitive information from span fields.
11
+
12
+ ## Constructor
13
+
14
+ ```typescript
15
+ new SensitiveDataFilter(options?: SensitiveDataFilterOptions)
16
+ ```
17
+
18
+ ## SensitiveDataFilterOptions
19
+
20
+ ```typescript
21
+ interface SensitiveDataFilterOptions {
22
+ /**
23
+ * List of sensitive field names to redact.
24
+ * Matching is case-insensitive and normalizes separators
25
+ * (api-key, api_key, Api Key → apikey).
26
+ * Defaults include: password, token, secret, key, apikey, auth,
27
+ * authorization, bearer, bearertoken, jwt, credential,
28
+ * clientsecret, privatekey, refresh, ssn.
29
+ */
30
+ sensitiveFields?: string[];
31
+
32
+ /**
33
+ * The token used for full redaction.
34
+ * Default: "[REDACTED]"
35
+ */
36
+ redactionToken?: string;
37
+
38
+ /**
39
+ * Style of redaction to use:
40
+ * - "full": always replace with redactionToken
41
+ * - "partial": show 3 characters from the start and end, redact the middle
42
+ * Default: "full"
43
+ */
44
+ redactionStyle?: RedactionStyle;
45
+ }
46
+ ```
47
+
48
+ <PropertiesTable
49
+ props={[
50
+ {
51
+ name: "sensitiveFields",
52
+ type: "string[]",
53
+ description: "Field names to redact (case-insensitive, separator-agnostic)",
54
+ required: false,
55
+ },
56
+ {
57
+ name: "redactionToken",
58
+ type: "string",
59
+ description: "Replacement token for full redaction",
60
+ required: false,
61
+ },
62
+ {
63
+ name: "redactionStyle",
64
+ type: "'full' | 'partial'",
65
+ description: "Redaction style",
66
+ required: false,
67
+ },
68
+ ]}
69
+ />
70
+
71
+ ## RedactionStyle
72
+
73
+ ```typescript
74
+ type RedactionStyle = 'full' | 'partial';
75
+ ```
76
+
77
+ ## Methods
78
+
79
+ ### process
80
+
81
+ ```typescript
82
+ process(span: AnyAISpan): AnyAISpan
83
+ ```
84
+
85
+ Process a span by filtering sensitive data across its key fields: attributes, metadata, input, output, and errorInfo.
86
+
87
+ <PropertiesTable
88
+ props={[
89
+ {
90
+ name: "span",
91
+ type: "AnyAISpan",
92
+ description: "The input span to filter",
93
+ required: true,
94
+ },
95
+ ]}
96
+ />
97
+
98
+ **Returns:** A new span with sensitive values redacted.
99
+
100
+ ### shutdown
101
+
102
+ ```typescript
103
+ async shutdown(): Promise<void>
104
+ ```
105
+
106
+ No cleanup needed for this processor.
107
+
108
+ ## Properties
109
+
110
+ ```typescript
111
+ readonly name = 'sensitive-data-filter';
112
+ ```
113
+
114
+ ## Default Sensitive Fields
115
+
116
+ When no custom fields are provided:
117
+
118
+ ```typescript
119
+ [
120
+ 'password',
121
+ 'token',
122
+ 'secret',
123
+ 'key',
124
+ 'apikey',
125
+ 'auth',
126
+ 'authorization',
127
+ 'bearer',
128
+ 'bearertoken',
129
+ 'jwt',
130
+ 'credential',
131
+ 'clientsecret',
132
+ 'privatekey',
133
+ 'refresh',
134
+ 'ssn'
135
+ ]
136
+ ```
137
+
138
+ ## Processing Behavior
139
+
140
+ ### Field Matching
141
+
142
+ - **Case-insensitive**: `APIKey`, `apikey`, `ApiKey` all match
143
+ - **Separator-agnostic**: `api-key`, `api_key`, `apiKey` are treated identically
144
+ - **Exact matching**: After normalization, fields must match exactly
145
+ - `token` matches `token`, `Token`, `TOKEN`
146
+ - `token` does NOT match `promptTokens` or `tokenCount`
147
+
148
+ ### Redaction Styles
149
+
150
+ #### Full Redaction (default)
151
+
152
+ All matched values replaced with redactionToken.
153
+
154
+ #### Partial Redaction
155
+
156
+ - Shows first 3 and last 3 characters
157
+ - Values ≤ 6 characters are fully redacted
158
+ - Non-string values are converted to strings before partial redaction
159
+
160
+ ### Error Handling
161
+
162
+ If filtering a field fails, the field is replaced with:
163
+
164
+ ```typescript
165
+ { error: { processor: "sensitive-data-filter" } }
166
+ ```
167
+
168
+ ### Processed Fields
169
+
170
+ The filter recursively processes:
171
+
172
+ - `span.attributes` - Span metadata and properties
173
+ - `span.metadata` - Custom metadata
174
+ - `span.input` - Input data
175
+ - `span.output` - Output data
176
+ - `span.errorInfo` - Error information
177
+
178
+ Handles nested objects, arrays, and circular references safely.
@@ -0,0 +1,371 @@
1
+ ---
2
+ title: "Span | AI Tracing | Reference"
3
+ description: Span interfaces, methods, and lifecycle events
4
+ ---
5
+
6
+ import { PropertiesTable } from "@/components/properties-table";
7
+
8
+ # Span
9
+
10
+ ## BaseSpan
11
+
12
+ Base interface for all span types.
13
+
14
+ ```typescript
15
+ interface BaseSpan<TType extends AISpanType> {
16
+ /** Unique span identifier */
17
+ id: string;
18
+
19
+ /** OpenTelemetry-compatible trace ID (32 hex chars) */
20
+ traceId: string;
21
+
22
+ /** Name of the span */
23
+ name: string;
24
+
25
+ /** Type of the span */
26
+ type: TType;
27
+
28
+ /** When span started */
29
+ startTime: Date;
30
+
31
+ /** When span ended */
32
+ endTime?: Date;
33
+
34
+ /** Type-specific attributes */
35
+ attributes?: AISpanTypeMap[TType];
36
+
37
+ /** User-defined metadata */
38
+ metadata?: Record<string, any>;
39
+
40
+ /** Input passed at the start of the span */
41
+ input?: any;
42
+
43
+ /** Output generated at the end of the span */
44
+ output?: any;
45
+
46
+ /** Error information if span failed */
47
+ errorInfo?: {
48
+ message: string;
49
+ id?: string;
50
+ domain?: string;
51
+ category?: string;
52
+ details?: Record<string, any>;
53
+ };
54
+
55
+ /** Is an event span? (occurs at startTime, has no endTime) */
56
+ isEvent: boolean;
57
+ }
58
+ ```
59
+
60
+ ## AISpan
61
+
62
+ AI Span interface, used internally for tracing. Extends BaseSpan with lifecycle methods and properties.
63
+
64
+ ```typescript
65
+ interface AISpan<TType extends AISpanType> extends BaseSpan<TType> {
66
+ /** Is an internal span? (spans internal to the operation of mastra) */
67
+ isInternal: boolean;
68
+
69
+ /** Parent span reference (undefined for root spans) */
70
+ parent?: AnyAISpan;
71
+
72
+ /** Pointer to the AITracing instance */
73
+ aiTracing: AITracing;
74
+ }
75
+ ```
76
+
77
+ ### Properties
78
+
79
+ ```typescript
80
+ /** Returns TRUE if the span is the root span of a trace */
81
+ get isRootSpan(): boolean
82
+
83
+ /** Returns TRUE if the span is a valid span (not a NO-OP Span) */
84
+ get isValid(): boolean
85
+
86
+ /** Get the closest parent spanId that isn't an internal span */
87
+ getParentSpanId(includeInternalSpans?: boolean): string | undefined
88
+
89
+ /** Returns a lightweight span ready for export */
90
+ exportSpan(includeInternalSpans?: boolean): ExportedAISpan<TType> | undefined
91
+ ```
92
+
93
+ ### Methods
94
+
95
+ #### end
96
+
97
+ ```typescript
98
+ end(options?: EndSpanOptions<TType>): void
99
+ ```
100
+
101
+ Ends the span and triggers export to configured exporters. Sets the `endTime` and optionally updates `output`, `metadata`, and `attributes`.
102
+
103
+ <PropertiesTable
104
+ props={[
105
+ {
106
+ name: "output",
107
+ type: "any",
108
+ description: "Final output data from the operation",
109
+ required: false,
110
+ },
111
+ {
112
+ name: "metadata",
113
+ type: "Record<string, any>",
114
+ description: "Additional metadata to merge",
115
+ required: false,
116
+ },
117
+ {
118
+ name: "attributes",
119
+ type: "Partial<AISpanTypeMap[TType]>",
120
+ description: "Type-specific attributes to update",
121
+ required: false,
122
+ },
123
+ ]}
124
+ />
125
+
126
+ #### error
127
+
128
+ ```typescript
129
+ error(options: ErrorSpanOptions<TType>): void
130
+ ```
131
+
132
+ Records an error on the span. Sets the `errorInfo` field and can optionally end the span.
133
+
134
+ <PropertiesTable
135
+ props={[
136
+ {
137
+ name: "error",
138
+ type: "Error",
139
+ description: "The error that occurred",
140
+ required: true,
141
+ },
142
+ {
143
+ name: "endSpan",
144
+ type: "boolean",
145
+ description: "Whether to end the span after recording the error",
146
+ required: false,
147
+ },
148
+ {
149
+ name: "metadata",
150
+ type: "Record<string, any>",
151
+ description: "Additional error context metadata",
152
+ required: false,
153
+ },
154
+ {
155
+ name: "attributes",
156
+ type: "Partial<AISpanTypeMap[TType]>",
157
+ description: "Type-specific attributes to update",
158
+ required: false,
159
+ },
160
+ ]}
161
+ />
162
+
163
+ #### update
164
+
165
+ ```typescript
166
+ update(options: UpdateSpanOptions<TType>): void
167
+ ```
168
+
169
+ Updates span data while it's still active. Can modify `input`, `output`, `metadata`, and `attributes`.
170
+
171
+ <PropertiesTable
172
+ props={[
173
+ {
174
+ name: "input",
175
+ type: "any",
176
+ description: "Update or set input data",
177
+ required: false,
178
+ },
179
+ {
180
+ name: "output",
181
+ type: "any",
182
+ description: "Update or set output data",
183
+ required: false,
184
+ },
185
+ {
186
+ name: "metadata",
187
+ type: "Record<string, any>",
188
+ description: "Metadata to merge with existing",
189
+ required: false,
190
+ },
191
+ {
192
+ name: "attributes",
193
+ type: "Partial<AISpanTypeMap[TType]>",
194
+ description: "Type-specific attributes to update",
195
+ required: false,
196
+ },
197
+ ]}
198
+ />
199
+
200
+ #### createChildSpan
201
+
202
+ ```typescript
203
+ createChildSpan<TChildType extends AISpanType>(
204
+ options: ChildSpanOptions<TChildType>
205
+ ): AISpan<TChildType>
206
+ ```
207
+
208
+ Creates a child span under this span. Child spans track sub-operations and inherit the trace context.
209
+
210
+ <PropertiesTable
211
+ props={[
212
+ {
213
+ name: "type",
214
+ type: "TChildType",
215
+ description: "Type of the child span",
216
+ required: true,
217
+ },
218
+ {
219
+ name: "name",
220
+ type: "string",
221
+ description: "Name of the child span",
222
+ required: true,
223
+ },
224
+ {
225
+ name: "attributes",
226
+ type: "AISpanTypeMap[TChildType]",
227
+ description: "Type-specific attributes",
228
+ required: false,
229
+ },
230
+ {
231
+ name: "metadata",
232
+ type: "Record<string, any>",
233
+ description: "Initial metadata",
234
+ required: false,
235
+ },
236
+ {
237
+ name: "input",
238
+ type: "any",
239
+ description: "Initial input data",
240
+ required: false,
241
+ },
242
+ ]}
243
+ />
244
+
245
+ #### createEventSpan
246
+
247
+ ```typescript
248
+ createEventSpan<TChildType extends AISpanType>(
249
+ options: ChildEventOptions<TChildType>
250
+ ): AISpan<TChildType>
251
+ ```
252
+
253
+ Creates an event span under this span. Event spans represent point-in-time occurrences with no duration.
254
+
255
+ <PropertiesTable
256
+ props={[
257
+ {
258
+ name: "type",
259
+ type: "TChildType",
260
+ description: "Type of the event span",
261
+ required: true,
262
+ },
263
+ {
264
+ name: "name",
265
+ type: "string",
266
+ description: "Name of the event",
267
+ required: true,
268
+ },
269
+ {
270
+ name: "attributes",
271
+ type: "AISpanTypeMap[TChildType]",
272
+ description: "Type-specific attributes",
273
+ required: false,
274
+ },
275
+ {
276
+ name: "metadata",
277
+ type: "Record<string, any>",
278
+ description: "Event metadata",
279
+ required: false,
280
+ },
281
+ {
282
+ name: "input",
283
+ type: "any",
284
+ description: "Event input data",
285
+ required: false,
286
+ },
287
+ {
288
+ name: "output",
289
+ type: "any",
290
+ description: "Event output data",
291
+ required: false,
292
+ },
293
+ ]}
294
+ />
295
+
296
+ ## ExportedAISpan
297
+
298
+ Exported AI Span interface, used for tracing exporters. A lightweight version of AISpan without methods or circular references.
299
+
300
+ ```typescript
301
+ interface ExportedAISpan<TType extends AISpanType> extends BaseSpan<TType> {
302
+ /** Parent span id reference (undefined for root spans) */
303
+ parentSpanId?: string;
304
+
305
+ /** TRUE if the span is the root span of a trace */
306
+ isRootSpan: boolean;
307
+ }
308
+ ```
309
+
310
+ ## Span Lifecycle Events
311
+
312
+ Events emitted during the span lifecycle.
313
+
314
+ ### AITracingEventType
315
+
316
+ ```typescript
317
+ enum AITracingEventType {
318
+ /** Emitted when a span is created and started */
319
+ SPAN_STARTED = 'span_started',
320
+
321
+ /** Emitted when a span is updated via update() */
322
+ SPAN_UPDATED = 'span_updated',
323
+
324
+ /** Emitted when a span is ended via end() or error() */
325
+ SPAN_ENDED = 'span_ended',
326
+ }
327
+ ```
328
+
329
+ ### AITracingEvent
330
+
331
+ ```typescript
332
+ type AITracingEvent =
333
+ | { type: 'span_started'; exportedSpan: AnyExportedAISpan }
334
+ | { type: 'span_updated'; exportedSpan: AnyExportedAISpan }
335
+ | { type: 'span_ended'; exportedSpan: AnyExportedAISpan };
336
+ ```
337
+
338
+ Exporters receive these events to process and send trace data to observability platforms.
339
+
340
+ ## Union Types
341
+
342
+ ### AnyAISpan
343
+
344
+ ```typescript
345
+ type AnyAISpan = AISpan<keyof AISpanTypeMap>;
346
+ ```
347
+
348
+ Union type for cases that need to handle any span type.
349
+
350
+ ### AnyExportedAISpan
351
+
352
+ ```typescript
353
+ type AnyExportedAISpan = ExportedAISpan<keyof AISpanTypeMap>;
354
+ ```
355
+
356
+ Union type for cases that need to handle any exported span type.
357
+
358
+ ## See Also
359
+
360
+ ### Documentation
361
+ - [AI Tracing Overview](/docs/observability/ai-tracing/overview) - Concepts and usage
362
+ - [Creating Child Spans](/docs/observability/ai-tracing/overview#creating-child-spans) - Practical examples
363
+ - [Retrieving Trace IDs](/docs/observability/ai-tracing/overview#retrieving-trace-ids) - Using trace IDs
364
+
365
+ ### Reference
366
+ - [AITracing Classes](/reference/observability/ai-tracing/ai-tracing) - Core tracing classes
367
+ - [Interfaces](/reference/observability/ai-tracing/interfaces) - Complete type reference
368
+ - [Configuration](/reference/observability/ai-tracing/configuration) - Configuration options
369
+
370
+ ### Examples
371
+ - [Basic AI Tracing](/examples/observability/basic-ai-tracing) - Working with spans
@@ -7,7 +7,7 @@ description: Documentation for PinoLogger, which provides methods to record even
7
7
 
8
8
  A Logger instance is created using `new PinoLogger()` and provides methods to record events at various severity levels.
9
9
 
10
- When deploying to Mastra Cloud, logs are displayed on the [Logs](../../docs/mastra-cloud/dashboard.mdx#logs) page. In self-hosted or custom environments, logs can be directed to files or external services depending on the configured transports.
10
+ When deploying to Mastra Cloud, logs are displayed on the [Logs](../../../docs/mastra-cloud/dashboard.mdx#logs) page. In self-hosted or custom environments, logs can be directed to files or external services depending on the configured transports.
11
11
 
12
12
  ## Usage example
13
13
 
@@ -1,11 +1,13 @@
1
1
  ---
2
- title: "Reference: Provider List | Observability | Mastra Docs"
3
- description: Overview of observability providers supported by Mastra, including Arize AX, Arize Phoenix, Dash0, SigNoz, Braintrust, Langfuse, and more.
2
+ title: "OTLP Providers | Observability | Mastra Docs"
3
+ description: Overview of OTLP observability providers.
4
4
  ---
5
5
 
6
- # Observability Providers
6
+ import { Callout } from "nextra/components";
7
7
 
8
- Observability providers include:
8
+ # OTLP Providers
9
+
10
+ These providers are supported with OTLP-based tracing:
9
11
 
10
12
  - [Arize AX](./providers/arize-ax.mdx)
11
13
  - [Arize Phoenix](./providers/arize-phoenix.mdx)
@@ -15,6 +15,7 @@ Use the `createScorer` factory to define your scorer with a name, description, a
15
15
  const scorer = createScorer({
16
16
  name: "My Custom Scorer",
17
17
  description: "Evaluates responses based on custom criteria",
18
+ type: "agent", // Optional: for agent evaluation with automatic typing
18
19
  judge: {
19
20
  model: myModel,
20
21
  instructions: "You are an expert evaluator..."
@@ -50,6 +51,12 @@ const scorer = createScorer({
50
51
  required: false,
51
52
  description: "Optional judge configuration for LLM-based steps. See Judge Object section below.",
52
53
  },
54
+ {
55
+ name: "type",
56
+ type: "string",
57
+ required: false,
58
+ description: "Type specification for input/output. Use 'agent' for automatic agent types. For custom types, use the generic approach instead.",
59
+ },
53
60
  ]}
54
61
  />
55
62
 
@@ -76,28 +83,40 @@ This function returns a scorer builder that you can chain step methods onto. See
76
83
 
77
84
  ## Type Safety
78
85
 
79
- For better type inference and IntelliSense support, you can specify input/output types when creating scorers:
86
+ You can specify input/output types when creating scorers for better type inference and IntelliSense support:
87
+
88
+ ### Agent Type Shortcut
89
+
90
+ For evaluating agents, use `type: 'agent'` to automatically get the correct types for agent input/output:
80
91
 
81
92
  ```typescript
82
- import { createScorer, ScorerRunInputForAgent, ScorerRunOutputForAgent } from '@mastra/core/scorers';
93
+ import { createScorer } from '@mastra/core/scorers';
83
94
 
84
- // For agent evaluation with full type safety
85
- const agentScorer = createScorer<ScorerRunInputForAgent, ScorerRunOutputForAgent>({
95
+ // Agent scorer with automatic typing
96
+ const agentScorer = createScorer({
86
97
  name: 'Agent Response Quality',
87
- description: 'Evaluates agent responses'
98
+ description: 'Evaluates agent responses',
99
+ type: 'agent' // Automatically provides ScorerRunInputForAgent/ScorerRunOutputForAgent
88
100
  })
89
101
  .preprocess(({ run }) => {
90
- // run.input is typed as ScorerRunInputForAgent
102
+ // run.input is automatically typed as ScorerRunInputForAgent
91
103
  const userMessage = run.input.inputMessages[0]?.content;
92
104
  return { userMessage };
93
105
  })
94
106
  .generateScore(({ run, results }) => {
95
- // run.output is typed as ScorerRunOutputForAgent
107
+ // run.output is automatically typed as ScorerRunOutputForAgent
96
108
  const response = run.output[0]?.content;
97
109
  return response.length > 10 ? 1.0 : 0.5;
98
110
  });
111
+ ```
112
+
113
+ ### Custom Types with Generics
114
+
115
+ For custom input/output types, use the generic approach:
116
+
117
+ ```typescript
118
+ import { createScorer } from '@mastra/core/scorers';
99
119
 
100
- // For custom input/output types
101
120
  type CustomInput = { query: string; context: string[] };
102
121
  type CustomOutput = { answer: string; confidence: number };
103
122
 
@@ -105,7 +124,11 @@ const customScorer = createScorer<CustomInput, CustomOutput>({
105
124
  name: 'Custom Scorer',
106
125
  description: 'Evaluates custom data'
107
126
  })
108
- .generateScore(({ run }) => run.output.confidence);
127
+ .generateScore(({ run }) => {
128
+ // run.input is typed as CustomInput
129
+ // run.output is typed as CustomOutput
130
+ return run.output.confidence;
131
+ });
109
132
  ```
110
133
 
111
134
  ### Built-in Agent Types
@@ -115,6 +138,33 @@ const customScorer = createScorer<CustomInput, CustomOutput>({
115
138
 
116
139
  Using these types provides autocomplete, compile-time validation, and better documentation for your scoring logic.
117
140
 
141
+ ## Trace Scoring with Agent Types
142
+
143
+ When you use `type: 'agent'`, your scorer is compatible for both adding directly to agents and scoring traces from agent interactions. The scorer automatically transforms trace data into the proper agent input/output format:
144
+
145
+ ```typescript
146
+ const agentTraceScorer = createScorer({
147
+ name: 'Agent Trace Length',
148
+ description: 'Evaluates agent response length',
149
+ type: 'agent'
150
+ })
151
+ .generateScore(({ run }) => {
152
+ // Trace data is automatically transformed to agent format
153
+ const userMessages = run.input.inputMessages;
154
+ const agentResponse = run.output[0]?.content;
155
+
156
+ // Score based on response length
157
+ return agentResponse?.length > 50 ? 0 : 1;
158
+ });
159
+
160
+ // Register with Mastra for trace scoring
161
+ const mastra = new Mastra({
162
+ scorers: {
163
+ agentTraceScorer
164
+ }
165
+ });
166
+ ```
167
+
118
168
  ## Step Method Signatures
119
169
 
120
170
  ### preprocess
@@ -67,6 +67,12 @@ const result = await scorer.run({
67
67
  required: false,
68
68
  description: "Optional runtime context from the agent or workflow step being evaluated.",
69
69
  },
70
+ {
71
+ name: "groundTruth",
72
+ type: "any",
73
+ required: false,
74
+ description: "Optional expected or reference output for comparison during scoring. Automatically passed when using runExperiment.",
75
+ },
70
76
  ]}
71
77
  />
72
78