@mastra/mcp-docs-server 1.3.6-alpha.1 → 1.3.6-alpha.5

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 (105) hide show
  1. package/.docs/docs/agents/human-in-the-loop.md +5 -3
  2. package/.docs/docs/agents/processors.md +7 -3
  3. package/.docs/docs/agents/tools.md +24 -0
  4. package/.docs/docs/memory/memory-processors.md +2 -5
  5. package/.docs/docs/memory/semantic-recall.md +2 -2
  6. package/.docs/docs/memory/working-memory.md +16 -0
  7. package/.docs/docs/observability/tracing/overview.md +1 -1
  8. package/.docs/docs/subagents.md +10 -8
  9. package/.docs/docs/workflows/control-flow.md +1 -1
  10. package/.docs/docs/workflows/time-travel.md +5 -3
  11. package/.docs/integrations/agentic-ui/ai-sdk-ui.md +60 -0
  12. package/.docs/integrations/deploy/temporal.md +23 -0
  13. package/.docs/models/embeddings.md +1 -1
  14. package/.docs/models/gateways/merge-gateway.md +2 -1
  15. package/.docs/models/gateways/netlify.md +2 -1
  16. package/.docs/models/gateways/openrouter.md +2 -1
  17. package/.docs/models/gateways/vercel.md +3 -5
  18. package/.docs/models/index.md +1 -1
  19. package/.docs/models/providers/alibaba.md +1 -1
  20. package/.docs/models/providers/anthropic.md +4 -3
  21. package/.docs/models/providers/berget.md +1 -1
  22. package/.docs/models/providers/coralbricks.md +1 -2
  23. package/.docs/models/providers/cortecs.md +3 -1
  24. package/.docs/models/providers/crossmodel.md +2 -1
  25. package/.docs/models/providers/edenai.md +5 -3
  26. package/.docs/models/providers/kilo.md +12 -10
  27. package/.docs/models/providers/llmgateway-providers.md +4 -2
  28. package/.docs/models/providers/llmgateway.md +2 -1
  29. package/.docs/models/providers/mistral.md +9 -16
  30. package/.docs/models/providers/nano-gpt.md +29 -29
  31. package/.docs/models/providers/ollama-cloud.md +2 -1
  32. package/.docs/models/providers/opencode-go.md +5 -4
  33. package/.docs/models/providers/opencode.md +2 -1
  34. package/.docs/models/providers/ovhcloud.md +1 -2
  35. package/.docs/models/providers/requesty.md +6 -4
  36. package/.docs/models/providers/vivgrid.md +2 -1
  37. package/.docs/reference/agents/generate.md +1 -1
  38. package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +3 -3
  39. package/.docs/reference/classifier/classifier.md +35 -35
  40. package/.docs/reference/client-js/memory.md +13 -1
  41. package/.docs/reference/configuration.md +2 -2
  42. package/.docs/reference/connect/providers.md +118 -112
  43. package/.docs/reference/core/getClassifier.md +1 -1
  44. package/.docs/reference/datasets/updateItem.md +10 -0
  45. package/.docs/reference/deployer/vercel.md +1 -1
  46. package/.docs/reference/deployer.md +7 -14
  47. package/.docs/reference/editor/blob-store-provider.md +2 -1
  48. package/.docs/reference/editor/browser-provider.md +3 -2
  49. package/.docs/reference/editor/filesystem-provider.md +2 -1
  50. package/.docs/reference/editor/processor-provider.md +2 -2
  51. package/.docs/reference/editor/sandbox-provider.md +2 -1
  52. package/.docs/reference/editor/storage-workspace-ref.md +27 -2
  53. package/.docs/reference/evals/answer-relevancy.md +4 -2
  54. package/.docs/reference/evals/answer-similarity.md +1 -1
  55. package/.docs/reference/evals/bias.md +3 -1
  56. package/.docs/reference/evals/content-similarity.md +1 -1
  57. package/.docs/reference/evals/context-recall.md +1 -1
  58. package/.docs/reference/evals/context-relevance.md +6 -6
  59. package/.docs/reference/evals/create-classifier-scorer.md +5 -5
  60. package/.docs/reference/evals/hallucination.md +7 -8
  61. package/.docs/reference/evals/keyword-coverage.md +4 -4
  62. package/.docs/reference/evals/noise-sensitivity.md +6 -6
  63. package/.docs/reference/evals/prompt-alignment.md +1 -1
  64. package/.docs/reference/evals/run-evals.md +1 -1
  65. package/.docs/reference/evals/scorer-utils.md +8 -8
  66. package/.docs/reference/evals/tone-consistency.md +23 -24
  67. package/.docs/reference/evals/tool-call-accuracy.md +19 -15
  68. package/.docs/reference/evals/toxicity.md +3 -1
  69. package/.docs/reference/logging/pino-logger.md +4 -4
  70. package/.docs/reference/memory/deleteMessages.md +1 -1
  71. package/.docs/reference/memory/memory-class.md +2 -2
  72. package/.docs/reference/memory/summarizeConversation.md +1 -1
  73. package/.docs/reference/migrations/ai-sdk-v4-to-v5.md +2 -2
  74. package/.docs/reference/migrations/upgrade-to-v1/mcp.md +2 -0
  75. package/.docs/reference/migrations/upgrade-to-v1/memory.md +1 -1
  76. package/.docs/reference/migrations/upgrade-to-v1/tools.md +1 -1
  77. package/.docs/reference/observability/tracing/configuration.md +10 -1
  78. package/.docs/reference/observability/tracing/instances.md +1 -1
  79. package/.docs/reference/observability/tracing/interfaces.md +1 -1
  80. package/.docs/reference/processors/batch-parts-processor.md +1 -1
  81. package/.docs/reference/processors/classifier-processor.md +6 -6
  82. package/.docs/reference/processors/message-history-processor.md +3 -2
  83. package/.docs/reference/processors/model-selection-processor.md +11 -11
  84. package/.docs/reference/processors/response-cache.md +1 -1
  85. package/.docs/reference/processors/semantic-recall-processor.md +2 -3
  86. package/.docs/reference/processors/unicode-normalizer.md +1 -1
  87. package/.docs/reference/processors/working-memory-processor.md +3 -2
  88. package/.docs/reference/project-structure.md +11 -13
  89. package/.docs/reference/pubsub/unix-socket-pubsub.md +6 -2
  90. package/.docs/reference/rag/chunk.md +2 -2
  91. package/.docs/reference/rag/chunking-and-embedding.md +1 -1
  92. package/.docs/reference/rag/database-config.md +14 -2
  93. package/.docs/reference/rag/document.md +7 -2
  94. package/.docs/reference/rag/extract-params.md +5 -5
  95. package/.docs/reference/rag/graph-rag-guide.md +1 -1
  96. package/.docs/reference/rag/metadata-filters.md +1 -1
  97. package/.docs/reference/rag/rerank.md +5 -4
  98. package/.docs/reference/rag/rerankWithScorer.md +2 -2
  99. package/.docs/reference/rag/retrieval.md +7 -5
  100. package/.docs/reference/rag/vector-databases.md +1 -1
  101. package/.docs/reference/server/mastra-server.md +2 -2
  102. package/.docs/reference/streaming/agents/stream.md +1 -1
  103. package/.docs/reference/workflows/run-methods/restart.md +6 -0
  104. package/.docs/reference/workflows/step.md +1 -1
  105. package/package.json +6 -6
@@ -4,11 +4,13 @@
4
4
 
5
5
  # Tone consistency scorer
6
6
 
7
- The `createToneScorer()` function evaluates the text's emotional tone and sentiment consistency. It can operate in two modes: comparing tone between input/output pairs or analyzing tone stability within a single text.
7
+ The `createToneScorer()` function evaluates the text's emotional tone and sentiment consistency. It can operate in two modes: comparing the agent output's sentiment against a configured `referenceTone`, or analyzing tone stability across the sentences of the agent output.
8
8
 
9
9
  ## Parameters
10
10
 
11
- The `createToneScorer()` function doesn't take any options.
11
+ The `createToneScorer()` function accepts an optional config object with the following properties:
12
+
13
+ **referenceTone** (`string`): Reference text whose sentiment the agent output is compared against. When omitted, the scorer measures sentiment stability across the output's sentences instead.
12
14
 
13
15
  This function returns an instance of the MastraScorer class. See the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer) for details on the `.run()` method and its input/output.
14
16
 
@@ -16,7 +18,7 @@ This function returns an instance of the MastraScorer class. See the [MastraScor
16
18
 
17
19
  **runId** (`string`): The id of the run (optional).
18
20
 
19
- **analyzeStepResult** (`object`): Object with tone metrics: { responseSentiment: number, referenceSentiment: number, difference: number } (for comparison mode) OR { avgSentiment: number, sentimentVariance: number } (for stability mode)
21
+ **preprocessStepResult** (`object`): Object with tone metrics: { score: number, responseSentiment: number, referenceSentiment: number, difference: number } (for comparison mode) OR { score: number, avgSentiment: number, sentimentVariance: number } (for stability mode)
20
22
 
21
23
  **score** (`number`): Tone consistency/stability score (0-1).
22
24
 
@@ -25,7 +27,8 @@ This function returns an instance of the MastraScorer class. See the [MastraScor
25
27
  ```typescript
26
28
  {
27
29
  runId: string,
28
- analyzeStepResult: {
30
+ preprocessStepResult: {
31
+ score: number,
29
32
  responseSentiment?: number,
30
33
  referenceSentiment?: number,
31
34
  difference?: number,
@@ -48,20 +51,20 @@ The scorer evaluates sentiment consistency through tone pattern analysis and mod
48
51
  - Computes sentiment scores
49
52
  - Measures tone variations
50
53
 
51
- 2. Calculates mode-specific score: **Tone Consistency** (input and output):
54
+ 2. Calculates mode-specific score: **Tone Consistency** (`referenceTone` set):
52
55
 
53
- - Compares sentiment between texts
54
- - Calculates sentiment difference
55
- - Score = 1 - (sentiment\_difference / max\_difference) **Tone Stability** (single input):
56
- - Analyzes sentiment across sentences
56
+ - Compares the output's sentiment with the `referenceTone` sentiment
57
+ - Calculates the absolute sentiment difference
58
+ - Score = max(0, 1 - sentiment\_difference) **Tone Stability** (no `referenceTone`):
59
+ - Analyzes sentiment across the output's sentences
57
60
  - Calculates sentiment variance
58
- - Score = 1 - (sentiment\_variance / max\_variance)
61
+ - Score = max(0, 1 - sentiment\_variance)
59
62
 
60
- Final score: `mode_specific_score * scale`
63
+ Final score: `mode_specific_score`
61
64
 
62
65
  ### Score interpretation
63
66
 
64
- (0 to scale, default 0-1)
67
+ (0-1)
65
68
 
66
69
  - 1.0: Perfect tone consistency/stability
67
70
  - 0.7-0.9: Strong consistency with minor variations
@@ -69,37 +72,33 @@ Final score: `mode_specific_score * scale`
69
72
  - 0.1-0.3: Poor consistency with major tone changes
70
73
  - 0.0: No consistency - completely different tones
71
74
 
72
- ### `analyzeStepResult`
75
+ ### `preprocessStepResult`
73
76
 
74
77
  Object with tone metrics:
75
78
 
76
79
  - **responseSentiment**: Sentiment score for the response (comparison mode).
77
- - **referenceSentiment**: Sentiment score for the input/reference (comparison mode).
80
+ - **referenceSentiment**: Sentiment score for the `referenceTone` (comparison mode).
78
81
  - **difference**: Absolute difference between sentiment scores (comparison mode).
79
82
  - **avgSentiment**: Average sentiment across sentences (stability mode).
80
83
  - **sentimentVariance**: Variance of sentiment across sentences (stability mode).
81
84
 
82
85
  ## Example
83
86
 
84
- Evaluate tone consistency between related agent responses:
87
+ Evaluate whether agent responses match a positive reference tone:
85
88
 
86
89
  ```typescript
87
90
  import { runEvals } from '@mastra/core/evals'
88
91
  import { createToneScorer } from '@mastra/evals/scorers/prebuilt'
89
92
  import { myAgent } from './agent'
90
93
 
91
- const scorer = createToneScorer()
94
+ const scorer = createToneScorer({
95
+ referenceTone: 'We are happy to help and glad you had a great experience!',
96
+ })
92
97
 
93
98
  const result = await runEvals({
94
99
  data: [
95
- {
96
- input: 'How was your experience with our service?',
97
- groundTruth: 'The service was excellent and exceeded expectations!',
98
- },
99
- {
100
- input: 'Tell me about the customer support',
101
- groundTruth: 'The support team was friendly and very helpful.',
102
- },
100
+ { input: 'How was your experience with our service?' },
101
+ { input: 'Tell me about the customer support' },
103
102
  ],
104
103
  scorers: [scorer],
105
104
  target: myAgent,
@@ -94,7 +94,7 @@ const strictOrderScorer = createCodeScorer({
94
94
  {
95
95
  runId: string,
96
96
  preprocessStepResult: {
97
- expectedTool: string,
97
+ expectedTool?: string, // undefined when only expectedToolOrder is configured
98
98
  actualTools: string[],
99
99
  strictMode: boolean,
100
100
  expectedToolOrder?: string[],
@@ -283,7 +283,7 @@ The `createToolCallAccuracyScorerLLM()` function from `@mastra/evals/scorers/pre
283
283
 
284
284
  **model** (`MastraModelConfig`): The LLM model to use for evaluating tool appropriateness
285
285
 
286
- **availableTools** (`Array<{name: string, description: string}>`): List of available tools with their descriptions for context
286
+ **availableTools** (`Tool[]`): Tools available to the agent, for example created with createTool(). Each tool's id and description are passed to the judge as context.
287
287
 
288
288
  ### Features
289
289
 
@@ -315,8 +315,8 @@ The LLM-based scorer provides:
315
315
  const basicLLMScorer = createLLMScorer({
316
316
  model: 'openai/gpt-5.6-sol',
317
317
  availableTools: [
318
- { name: 'tool1', description: 'Description 1' },
319
- { name: 'tool2', description: 'Description 2' }
318
+ createTool({ id: 'tool1', description: 'Description 1' }),
319
+ createTool({ id: 'tool2', description: 'Description 2' })
320
320
  ]
321
321
  });
322
322
 
@@ -352,21 +352,24 @@ The LLM-based scorer uses AI to evaluate whether tool selections are appropriate
352
352
  ### Basic LLM evaluation
353
353
 
354
354
  ```typescript
355
+ import { createTool } from '@mastra/core/tools'
356
+ import { createToolCallAccuracyScorerLLM } from '@mastra/evals/scorers/prebuilt'
357
+
355
358
  const llmScorer = createToolCallAccuracyScorerLLM({
356
359
  model: 'openai/gpt-5.6-sol',
357
360
  availableTools: [
358
- {
359
- name: 'weather-tool',
361
+ createTool({
362
+ id: 'weather-tool',
360
363
  description: 'Get current weather information for any location',
361
- },
362
- {
363
- name: 'calendar-tool',
364
+ }),
365
+ createTool({
366
+ id: 'calendar-tool',
364
367
  description: 'Check calendar events and scheduling',
365
- },
366
- {
367
- name: 'search-tool',
368
+ }),
369
+ createTool({
370
+ id: 'search-tool',
368
371
  description: 'Search the web for general information',
369
- },
372
+ }),
370
373
  ],
371
374
  })
372
375
 
@@ -474,6 +477,7 @@ console.log(result.reason); // "The agent appropriately asked for clarification
474
477
  Here's an example using both scorers on the same data:
475
478
 
476
479
  ```typescript
480
+ import { createTool } from '@mastra/core/tools'
477
481
  import {
478
482
  createToolCallAccuracyScorerCode as createCodeScorer,
479
483
  createToolCallAccuracyScorerLLM as createLLMScorer,
@@ -488,8 +492,8 @@ const codeScorer = createCodeScorer({
488
492
  const llmScorer = createLLMScorer({
489
493
  model: 'openai/gpt-5.6-sol',
490
494
  availableTools: [
491
- { name: 'weather-tool', description: 'Get weather information' },
492
- { name: 'search-tool', description: 'Search the web' },
495
+ createTool({ id: 'weather-tool', description: 'Get weather information' }),
496
+ createTool({ id: 'search-tool', description: 'Search the web' }),
493
497
  ],
494
498
  })
495
499
 
@@ -12,7 +12,9 @@ The `createToxicityScorer()` function accepts a single options object with the f
12
12
 
13
13
  **model** (`LanguageModel`): Configuration for the model used to evaluate toxicity.
14
14
 
15
- **scale** (`number`): Maximum score value (default is 1). (Default: `1`)
15
+ **options** (`ToxicityMetricOptions`): Configuration options.
16
+
17
+ **options.scale** (`number`): Maximum score value.
16
18
 
17
19
  This function returns an instance of the MastraScorer class. The `.run()` method accepts the same input as other scorers (see the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer)), but the return value includes LLM-specific fields as documented below.
18
20
 
@@ -98,7 +98,7 @@ Writes structured logs to a file using the `FileTransport`. The logger accepts a
98
98
 
99
99
  ```typescript
100
100
  import { FileTransport } from '@mastra/loggers/file'
101
- import { PinoLogger } from '@mastra/loggers/pino'
101
+ import { PinoLogger } from '@mastra/loggers'
102
102
 
103
103
  export const fileLogger = new PinoLogger({
104
104
  name: 'Mastra',
@@ -122,7 +122,7 @@ Streams structured logs to a remote Redis list using the `UpstashTransport`. The
122
122
 
123
123
  ```typescript
124
124
  import { UpstashTransport } from '@mastra/loggers/upstash'
125
- import { PinoLogger } from '@mastra/loggers/pino'
125
+ import { PinoLogger } from '@mastra/loggers'
126
126
 
127
127
  export const upstashLogger = new PinoLogger({
128
128
  name: 'Mastra',
@@ -156,8 +156,8 @@ You can create custom transports using the `createCustomTransport` utility to in
156
156
  Creates a custom transport using `createCustomTransport` and integrates it with a third-party logging stream such as `pino-sentry-transport`. The custom transport forwards logs to an external system such as Sentry for advanced monitoring and observability.
157
157
 
158
158
  ```typescript
159
- import { createCustomTransport } from '@mastra/core/loggers'
160
- import { PinoLogger } from '@mastra/loggers/pino'
159
+ import { createCustomTransport } from '@mastra/core/logger'
160
+ import { PinoLogger } from '@mastra/loggers'
161
161
  import pinoSentry from 'pino-sentry-transport'
162
162
 
163
163
  const sentryStream = await pinoSentry({
@@ -24,7 +24,7 @@ await memory?.deleteMessages(['671ae63f-3a91-4082-a907-fe7de78e10ec'])
24
24
 
25
25
  ```typescript
26
26
  import { mastra } from './mastra'
27
- import { MastraDBMessage } from '@mastra/core'
27
+ import type { MastraDBMessage } from '@mastra/core/agent'
28
28
 
29
29
  const agent = mastra.getAgent('agent')
30
30
  const memory = await agent.getMemory()
@@ -101,14 +101,14 @@ export const agent = new Agent({
101
101
  import { Memory } from '@mastra/memory'
102
102
  import { Agent } from '@mastra/core/agent'
103
103
  import { ModelRouterEmbeddingModel } from '@mastra/core/llm'
104
- import { PgStore, PgVector } from '@mastra/pg'
104
+ import { PostgresStore, PgVector } from '@mastra/pg'
105
105
 
106
106
  export const agent = new Agent({
107
107
  name: 'pg-agent',
108
108
  instructions: 'You are an agent with optimized PostgreSQL memory.',
109
109
  model: 'openai/gpt-5.6-sol',
110
110
  memory: new Memory({
111
- storage: new PgStore({
111
+ storage: new PostgresStore({
112
112
  id: 'pg-agent-storage',
113
113
  connectionString: process.env.DATABASE_URL,
114
114
  }),
@@ -24,7 +24,7 @@ const result = await summarizeConversation({
24
24
 
25
25
  ## Parameters
26
26
 
27
- **model** (`string | LanguageModel | DynamicModel`): Model that runs the summarization, such as a router string like '\_\_GATEWAY\_OPENAI\_MODEL\_MINI\_\_'.
27
+ **model** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model that runs the summarization, such as a router string like '\_\_GATEWAY\_OPENAI\_MODEL\_MINI\_\_'. Pass an array of { model, maxRetries } entries to fall back to the next model when one fails.
28
28
 
29
29
  **messages** (`MastraDBMessage[]`): The conversation to summarize. When empty, the function returns an empty result without calling the model.
30
30
 
@@ -28,10 +28,10 @@ import { convertMessages } from '@mastra/core/agent'
28
28
  const aiv5Messages = convertMessages(aiv4Messages).to('AIV5.UI')
29
29
 
30
30
  // Convert Mastra messages to AI SDK v5
31
- const aiv5Messages = convertMessages(mastraMessages).to('AIV5.Core')
31
+ const aiv5ModelMessages = convertMessages(mastraMessages).to('AIV5.Model')
32
32
 
33
33
  // Supported output formats:
34
- // 'Mastra.V2', 'AIV4.UI', 'AIV5.UI', 'AIV5.Core', 'AIV5.Model'
34
+ // 'Mastra.V2', 'AIV4.UI', 'AIV4.Core', 'AIV5.UI', 'AIV5.Model', 'AIV6.UI'
35
35
  ```
36
36
 
37
37
  This utility is helpful when you want to fetch messages directly from your storage DB and convert them for use in AI SDK.
@@ -83,6 +83,8 @@ createTool({
83
83
  });
84
84
  ```
85
85
 
86
+ > **Note:** `context.mcp.elicitation.sendRequest()` is deprecated. It throws on servers running `@mastra/mcp` 2.x, which serve the MCP `2026-07-28` revision. On those servers, call `context.suspend(payload)` and read the caller's answer from `context.resumeData` when the tool runs again. See [Tools that ask the caller for input suspend and resume](https://mastra.ai/reference/migrations/mcp-v2).
87
+
86
88
  ## Removed
87
89
 
88
90
  ### Deprecated MCP client classes
@@ -177,7 +177,7 @@ To migrate, replace all instances of `MastraMessageV2` with `MastraDBMessage`.
177
177
  ```diff
178
178
  - import { MastraMessageV2 } from '@mastra/core';
179
179
  - function yourCustomFunction(input: MastraMessageV2) {}
180
- + import { MastraDBMessage } from '@mastra/core';
180
+ + import type { MastraDBMessage } from '@mastra/core/agent';
181
181
  + function yourCustomFunction(input: MastraDBMessage) {}
182
182
  ```
183
183
 
@@ -117,7 +117,7 @@ This applies to all tool executions, whether called directly or through agents a
117
117
 
118
118
  Tools with an `outputSchema` now validate their return values at runtime. Previously, `outputSchema` was only used for type inference - the output was never validated.
119
119
 
120
- If your tool returns data that doesn't match its `outputSchema`, it will now return a `ValidationError` instead of the invalid data.
120
+ If your tool returns data that doesn't match its `outputSchema`, it will now return a `ValidationError` instead of the invalid data. This is the default `outputValidation: 'strict'` behavior. With [`outputValidation: 'warn'`](https://mastra.ai/reference/tools/create-tool), Mastra logs the mismatch and returns the original output unchanged.
121
121
 
122
122
  To fix validation errors, ensure the tool's output matches the schema definition:
123
123
 
@@ -82,7 +82,16 @@ type SamplingStrategy =
82
82
  | { type: 'always' }
83
83
  | { type: 'never' }
84
84
  | { type: 'ratio'; probability: number }
85
- | { type: 'custom'; sampler: (options?: TracingOptions) => boolean }
85
+ | { type: 'custom'; sampler: (options?: CustomSamplerOptions) => boolean }
86
+ ```
87
+
88
+ ## `CustomSamplerOptions`
89
+
90
+ ```typescript
91
+ interface CustomSamplerOptions {
92
+ requestContext?: RequestContext
93
+ metadata?: Record<string, any>
94
+ }
86
95
  ```
87
96
 
88
97
  ## `ConfigSelector`
@@ -29,7 +29,7 @@ Base class for custom ObservabilityInstance implementations.
29
29
  #### `getConfig`
30
30
 
31
31
  ```typescript
32
- getConfig(): Readonly<Required<ObservabilityInstanceConfig>>
32
+ getConfig(): Readonly<ObservabilityInstanceConfig>
33
33
  ```
34
34
 
35
35
  Returns the current observability configuration.
@@ -13,7 +13,7 @@ Primary interface for observability.
13
13
  ```typescript
14
14
  interface ObservabilityInstance {
15
15
  /** Get current configuration */
16
- getConfig(): Readonly<Required<ObservabilityInstanceConfig>>
16
+ getConfig(): Readonly<ObservabilityInstanceConfig>
17
17
 
18
18
  /** Get all exporters */
19
19
  getExporters(): readonly ObservabilityExporter[]
@@ -32,7 +32,7 @@ const processor = new BatchPartsProcessor({
32
32
 
33
33
  **id** (`string`): Processor identifier set to 'batch-parts'
34
34
 
35
- **name** (`string`): Optional processor display name
35
+ **name** (`string`): Processor display name. Always Batch Parts.
36
36
 
37
37
  **processOutputStream** (`(args: { part: ChunkType; streamParts: ChunkType[]; state: Record<string, any>; abort: (reason?: string) => never }) => Promise<ChunkType | null>`): Processes streaming output parts to batch them together
38
38
 
@@ -17,7 +17,7 @@ import { ClassifierProcessor } from '@mastra/core/processors'
17
17
 
18
18
  const safety = new Classifier({
19
19
  id: 'safety',
20
- model: typeSafeAi.evaluationModel('jev-latest'),
20
+ model: typeSafeAi.decisionModel('jev-latest'),
21
21
  questions: {
22
22
  unsafe: {
23
23
  type: 'boolean',
@@ -66,7 +66,7 @@ inputProcessors: [
66
66
 
67
67
  **options.id** (`string`): Processor identifier. Use a unique ID for each ClassifierProcessor in the same phase because instances with the same ID share per-run processor state.
68
68
 
69
- **options.errorStrategy** (`'warn' | 'strict'`): How to handle evaluation model failures. 'strict' is fail-closed: it aborts the request, including during streaming. 'warn' is fail-open: it logs the failure and lets the content through. Classifier configuration errors always throw.
69
+ **options.errorStrategy** (`'warn' | 'strict'`): How to handle decision model failures. 'strict' is fail-closed: it aborts the request, including during streaming. 'warn' is fail-open: it logs the failure and lets the content through. Classifier configuration errors always throw.
70
70
 
71
71
  **options.lastMessageOnly** (`boolean`): When true, only the last message is classified in the input and output phases.
72
72
 
@@ -74,7 +74,7 @@ inputProcessors: [
74
74
 
75
75
  **options.maxInputLength** (`number`): Non-negative integer maximum number of characters sent to the classifier. Longer text is truncated.
76
76
 
77
- **options.providerOptions** (`SharedV4ProviderOptions`): Provider-specific options forwarded to the evaluation model.
77
+ **options.providerOptions** (`SharedV4ProviderOptions`): Provider-specific options forwarded to the decision model.
78
78
 
79
79
  ## Behavior by phase
80
80
 
@@ -98,7 +98,7 @@ import { ClassifierProcessor } from '@mastra/core/processors'
98
98
 
99
99
  const topic = new Classifier({
100
100
  id: 'topic',
101
- model: typeSafeAi.evaluationModel('jev-latest'),
101
+ model: typeSafeAi.decisionModel('jev-latest'),
102
102
  questions: {
103
103
  topic: {
104
104
  type: 'choice',
@@ -140,7 +140,7 @@ import { ClassifierProcessor } from '@mastra/core/processors'
140
140
 
141
141
  const quality = new Classifier({
142
142
  id: 'quality',
143
- model: typeSafeAi.evaluationModel('jev-latest'),
143
+ model: typeSafeAi.decisionModel('jev-latest'),
144
144
  questions: {
145
145
  quality: {
146
146
  type: 'score',
@@ -179,7 +179,7 @@ export const mastra = new Mastra({
179
179
  classifiers: {
180
180
  safety: new Classifier({
181
181
  id: 'safety',
182
- model: typeSafeAi.evaluationModel('jev-latest'),
182
+ model: typeSafeAi.decisionModel('jev-latest'),
183
183
  questions: {/* ... */},
184
184
  }),
185
185
  },
@@ -40,9 +40,10 @@ const processor = new MessageHistory({
40
40
  ```typescript
41
41
  import { Agent } from '@mastra/core/agent'
42
42
  import { MessageHistory } from '@mastra/core/processors'
43
- import { PostgresStorage } from '@mastra/pg'
43
+ import { PostgresStore } from '@mastra/pg'
44
44
 
45
- const storage = new PostgresStorage({
45
+ const storage = new PostgresStore({
46
+ id: 'pg-storage',
46
47
  connectionString: process.env.DATABASE_URL,
47
48
  })
48
49
 
@@ -4,11 +4,11 @@
4
4
 
5
5
  # ModelSelectionProcessor
6
6
 
7
- `ModelSelectionProcessor` classifies the incoming request once, then overrides which model serves the run. It's intended for cost routing: keep a capable model as the agent's configured default and let the processor downgrade to a cheaper model when an evaluation model is confident the cheaper model can handle the request.
7
+ `ModelSelectionProcessor` classifies the incoming request once, then overrides which model serves the run. It's intended for cost routing: keep a capable model as the agent's configured default and let the processor downgrade to a cheaper model when a decision model is confident the cheaper model can handle the request.
8
8
 
9
9
  > **Warning:** Routing can cost more than it saves. Provider prompt caches aren't shared between models. Each switch pays full price for the conversation again, and a cheaper model can take more steps to finish a task. Measure cost and quality on your own traffic before enabling it. See [Cost tradeoffs](#cost-tradeoffs).
10
10
 
11
- Describe each model alongside the kind of request it should handle. The processor builds the [Classifier](https://mastra.ai/reference/classifier/classifier) for you. The processor's own `model` option takes an evaluation model (`EvaluationModelV4 | MastraEvaluationModel`), the same type `Classifier` accepts. A `'provider/model'` string isn't supported for this option. See [Evaluation models](https://mastra.ai/reference/classifier/classifier) for provider setup:
11
+ Describe each model alongside the kind of request it should handle. The processor builds the [Classifier](https://mastra.ai/reference/classifier/classifier) for you. The processor's own `model` option takes a decision model (`DecisionModelV4 | EvaluationModelV4 | MastraDecisionModel`), the same type `Classifier` accepts. A `'provider/model'` string isn't supported for this option. See [Decision models](https://mastra.ai/reference/classifier/classifier) for provider setup:
12
12
 
13
13
  ```typescript
14
14
  import { Agent } from '@mastra/core/agent'
@@ -21,7 +21,7 @@ export const agent = new Agent({
21
21
  model: 'openai/gpt-5.6-sol',
22
22
  inputProcessors: [
23
23
  new ModelSelectionProcessor({
24
- model: typeSafeAi.evaluationModel('jev-latest'),
24
+ model: typeSafeAi.decisionModel('jev-latest'),
25
25
  choices: [
26
26
  {
27
27
  model: 'openai/gpt-5-mini',
@@ -55,7 +55,7 @@ By default the decision applies to every step of the run. Set `scope: 'first-ste
55
55
 
56
56
  **choices.name** (`string`): Name reported in onDecision. Defaults to the model ID. Set it when the same model appears in two choices.
57
57
 
58
- **model** (`EvaluationModelV4 | MastraEvaluationModel`): The evaluation model used to make the routing decision, the same type as the Classifier model option. A provider/model string is not supported. Required with choices, and unrelated to the models being routed to.
58
+ **model** (`DecisionModelV4 | EvaluationModelV4 | MastraDecisionModel`): The decision model used to make the routing decision, the same type as the Classifier model option. A provider/model string is not supported. Required with choices, and unrelated to the models being routed to.
59
59
 
60
60
  **instructions** (`string`): The objective the processor optimizes for, used with choices. Defaults to choosing the least capable model that can handle the request correctly. Set it to state a different objective, such as favoring accuracy over cost.
61
61
 
@@ -71,7 +71,7 @@ By default the decision applies to every step of the run. Set `scope: 'first-ste
71
71
 
72
72
  **scope** (`'run' | 'first-step'`): Which model calls the decision applies to. 'run' routes every step. 'first-step' routes only the opening call, which captures far less saving because context accumulates across a run. (Default: `'run'`)
73
73
 
74
- **providerOptions** (`SharedV4ProviderOptions`): Provider-specific options forwarded to Classifier.evaluate().
74
+ **providerOptions** (`SharedV4ProviderOptions`): Provider-specific options forwarded to Classifier.decide().
75
75
 
76
76
  ## Decision callback
77
77
 
@@ -85,7 +85,7 @@ import { PinoLogger } from '@mastra/loggers'
85
85
  const logger = new PinoLogger({ name: 'model-selection' })
86
86
 
87
87
  new ModelSelectionProcessor({
88
- model: typeSafeAi.evaluationModel('jev-latest'),
88
+ model: typeSafeAi.decisionModel('jev-latest'),
89
89
  choices: [
90
90
  { model: 'openai/gpt-5-mini', criteria: 'Simple lookups' },
91
91
  { model: 'openai/gpt-5.6-sol', criteria: 'Multi-step reasoning' },
@@ -102,7 +102,7 @@ The decision carries the model that was applied, the criterion that was chosen,
102
102
 
103
103
  **choice** (`string`): The choice the classifier selected. Absent when the processor abstained and with select.
104
104
 
105
- **probability** (`number`): Confidence in the selected choice, taken from the answer distribution. Absent when the evaluation model returns no distribution.
105
+ **probability** (`number`): Confidence in the selected choice, taken from the answer distribution. Absent when the decision model returns no distribution.
106
106
 
107
107
  **abstained** (`'below-threshold' | 'no-model-for-choice' | 'no-text' | 'error'`): Why no model was applied. Absent on a successful routing decision and when select returns undefined.
108
108
 
@@ -116,7 +116,7 @@ import { typeSafeAi } from '@ai-sdk/typesafe-ai'
116
116
 
117
117
  const triage = new Classifier({
118
118
  id: 'triage',
119
- model: typeSafeAi.evaluationModel('jev-latest'),
119
+ model: typeSafeAi.decisionModel('jev-latest'),
120
120
  questions: {
121
121
  complexity: {
122
122
  type: 'choice',
@@ -158,7 +158,7 @@ import { ModelSelectionProcessor } from '@mastra/core/processors'
158
158
 
159
159
  const triage = new Classifier({
160
160
  id: 'triage',
161
- model: typeSafeAi.evaluationModel('jev-latest'),
161
+ model: typeSafeAi.decisionModel('jev-latest'),
162
162
  questions: {
163
163
  complexity: {
164
164
  type: 'choice',
@@ -189,14 +189,14 @@ new ModelSelectionProcessor({
189
189
 
190
190
  ## Probabilities and `minProbability`
191
191
 
192
- A choice answer carries a distribution over the criteria, and the confidence in a routing decision is the mass on the criterion that was actually selected. Not every evaluation model reports that distribution.
192
+ A choice answer carries a distribution over the criteria, and the confidence in a routing decision is the mass on the criterion that was actually selected. Not every decision model reports that distribution.
193
193
 
194
194
  This is why `minProbability` has no default. Each setting behaves explicitly:
195
195
 
196
196
  - **Omitted**: route on the selected choice. The classifier's answer is the decision.
197
197
  - **Set**: require a probability at or above the threshold. If the model returns no distribution at all, the processor **abstains**, because a threshold that can't be evaluated must not pass.
198
198
 
199
- If your evaluation model doesn't report choice distributions, the processor abstains on every request once `minProbability` is set. Log `onDecision` to check: an `abstained` value of `below-threshold` with no `probability` means the distribution is missing rather than the confidence being low.
199
+ If your decision model doesn't report choice distributions, the processor abstains on every request once `minProbability` is set. Log `onDecision` to check: an `abstained` value of `below-threshold` with no `probability` means the distribution is missing rather than the confidence being low.
200
200
 
201
201
  ## Failure behavior
202
202
 
@@ -45,7 +45,7 @@ See [Response caching](https://mastra.ai/docs/agents/processors) for the concept
45
45
 
46
46
  ## Constructor parameters
47
47
 
48
- **cache** (`MastraServerCache`): The cache backend. Required. Pass any MastraServerCache implementation — InMemoryServerCache for local development, RedisCache from @mastra/redis for production, or your own subclass for a custom backend.
48
+ **cache** (`MastraServerCache`): The cache backend. Required. Pass any MastraServerCache implementation — InMemoryServerCache for local development, RedisServerCache from @mastra/redis for production, or your own subclass for a custom backend.
49
49
 
50
50
  **ttl** (`number`): Time-to-live (seconds) for entries written by this processor. Defaults to 300 seconds (5 minutes), matching OpenRouter's reference implementation. (Default: `300`)
51
51
 
@@ -59,11 +59,10 @@ const processor = new SemanticRecall({
59
59
  ```typescript
60
60
  import { Agent } from '@mastra/core/agent'
61
61
  import { SemanticRecall, MessageHistory } from '@mastra/core/processors'
62
- import { PostgresStorage } from '@mastra/pg'
63
- import { PgVector } from '@mastra/pg'
62
+ import { PostgresStore, PgVector } from '@mastra/pg'
64
63
  import { openai } from '@ai-sdk/openai'
65
64
 
66
- const storage = new PostgresStorage({
65
+ const storage = new PostgresStore({
67
66
  id: 'pg-storage',
68
67
  connectionString: process.env.DATABASE_URL,
69
68
  })
@@ -33,7 +33,7 @@ const processor = new UnicodeNormalizer({
33
33
 
34
34
  **id** (`string`): Processor identifier set to 'unicode-normalizer'
35
35
 
36
- **name** (`string`): Optional processor display name
36
+ **name** (`string`): Processor display name. Always Unicode Normalizer.
37
37
 
38
38
  **processInput** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never }) => MastraDBMessage[]`): Processes input messages to normalize Unicode text
39
39
 
@@ -62,9 +62,10 @@ const processor = new WorkingMemory({
62
62
  ```typescript
63
63
  import { Agent } from '@mastra/core/agent'
64
64
  import { WorkingMemory, MessageHistory } from '@mastra/core/processors'
65
- import { PostgresStorage } from '@mastra/pg'
65
+ import { PostgresStore } from '@mastra/pg'
66
66
 
67
- const storage = new PostgresStorage({
67
+ const storage = new PostgresStore({
68
+ id: 'pg-storage',
68
69
  connectionString: process.env.DATABASE_URL,
69
70
  })
70
71
 
@@ -13,23 +13,20 @@ Mastra is a framework, but it's mostly **unopinionated** about how you organize
13
13
  A project created with the `create mastra` command looks like this:
14
14
 
15
15
  ```bash
16
- src/
17
- ├── mastra/
18
- │ ├── agents/
19
- │ │ └── weather-agent.ts
20
- │ ├── tools/
21
- │ │ └── weather-tool.ts
22
- │ ├── workflows/
23
- │ │ └── weather-workflow.ts
24
- │ ├── scorers/
25
- │ │ └── weather-scorer.ts
26
- │ └── index.ts
16
+ ├── src/
17
+ │ └── mastra/
18
+ │ ├── agents/
19
+ │ │ └── agent.ts
20
+ │ ├── tools/
21
+ │ │ └── schedule-tools.ts
22
+ │ └── index.ts
27
23
  ├── .env.example
24
+ ├── AGENTS.md
28
25
  ├── package.json
29
26
  └── tsconfig.json
30
27
  ```
31
28
 
32
- Use the predefined files as templates. Duplicate and adapt them to quickly create your own agents, tools, workflows, etc.
29
+ The default project is based on the [Agent Harness template](https://github.com/mastra-ai/template-agent-harness). Use the predefined files as templates. Duplicate and adapt them to quickly create your own agents, tools, workflows, etc.
33
30
 
34
31
  ### Folders
35
32
 
@@ -47,7 +44,7 @@ Mastra recommends organizing your code into the following folders:
47
44
  Mastra has two special folder conventions:
48
45
 
49
46
  - `src/mastra/agents/<name>`: You can define an agent by file convention instead of constructing it in code. Learn more in the [File-based Agents](https://mastra.ai/docs/develop) docs.
50
- - `src/mastra/public`: Contents are copied into the `.build/output` directory during the build process, making them available for serving at runtime.
47
+ - `src/mastra/public`: Contents are copied into the `.mastra/output` directory during the build process, making them available for serving at runtime.
51
48
 
52
49
  ### Top-level files
53
50
 
@@ -57,5 +54,6 @@ Top-level files define how your Mastra project is configured, built, and connect
57
54
  | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
58
55
  | `src/mastra/index.ts` | Central entry point where you configure and initialize Mastra. |
59
56
  | `.env.example` | Template for environment variables - copy and rename to `.env` to add your secret [model provider](https://mastra.ai/models) keys. |
57
+ | `AGENTS.md` | Instructions for coding agents working in the project. |
60
58
  | `package.json` | Defines project metadata, dependencies, and available npm scripts. |
61
59
  | `tsconfig.json` | Configures TypeScript options such as path aliases, compiler settings, and build output. |