@mastra/mcp-docs-server 1.3.7-alpha.1 → 1.3.7-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 (142) hide show
  1. package/.docs/docs/agents/guardrails.md +2 -2
  2. package/.docs/docs/auth/fga.md +0 -1
  3. package/.docs/docs/deployment/workers.md +1 -1
  4. package/.docs/docs/evals/datasets.md +5 -6
  5. package/.docs/docs/evals/gates-and-verdicts.md +3 -3
  6. package/.docs/docs/mastra-platform/deploy.md +8 -1
  7. package/.docs/docs/mastra-platform/observability.md +25 -19
  8. package/.docs/docs/mastra-platform/system-environment-variables.md +1 -1
  9. package/.docs/docs/mastra-platform/trace-intelligence.md +1 -1
  10. package/.docs/docs/mastra-platform/workspaces.md +2 -2
  11. package/.docs/docs/memory/multi-user-threads.md +1 -1
  12. package/.docs/docs/observability/metrics/overview.md +1 -1
  13. package/.docs/docs/observability/tracing/overview.md +6 -0
  14. package/.docs/docs/sandbox/computer.md +13 -13
  15. package/.docs/docs/sandbox/overview.md +5 -5
  16. package/.docs/docs/server/custom-adapters.md +1 -1
  17. package/.docs/docs/server/server-adapters.md +1 -1
  18. package/.docs/docs/studio/auth.md +1 -1
  19. package/.docs/docs/workflows/control-flow.md +28 -0
  20. package/.docs/docs/workflows/time-travel.md +1 -1
  21. package/.docs/integrations/databases/clickhouse.md +13 -0
  22. package/.docs/integrations/observability/langfuse.md +8 -0
  23. package/.docs/integrations/observability/opentelemetry.md +2 -0
  24. package/.docs/models/environment-variables.md +2 -1
  25. package/.docs/models/gateways/merge-gateway.md +2 -1
  26. package/.docs/models/gateways/netlify.md +5 -1
  27. package/.docs/models/gateways/openrouter.md +2 -1
  28. package/.docs/models/gateways/vercel.md +3 -10
  29. package/.docs/models/index.md +3 -2
  30. package/.docs/models/providers/aixy.md +14 -8
  31. package/.docs/models/providers/chutes.md +4 -4
  32. package/.docs/models/providers/cloudferro-sherlock.md +2 -2
  33. package/.docs/models/providers/edenai.md +10 -4
  34. package/.docs/models/providers/kenari.md +5 -1
  35. package/.docs/models/providers/kilo.md +10 -9
  36. package/.docs/models/providers/llmgateway-providers.md +7 -7
  37. package/.docs/models/providers/llmgateway.md +6 -5
  38. package/.docs/models/providers/lowrouter.md +16 -12
  39. package/.docs/models/providers/meta.md +3 -2
  40. package/.docs/models/providers/nano-gpt.md +21 -21
  41. package/.docs/models/providers/opencode-go.md +3 -3
  42. package/.docs/models/providers/opencode.md +5 -5
  43. package/.docs/models/providers/prime.md +136 -0
  44. package/.docs/models/providers.md +2 -1
  45. package/.docs/reference/agent-controller/session.md +30 -8
  46. package/.docs/reference/auth/better-auth.md +1 -1
  47. package/.docs/reference/auth/clerk.md +1 -1
  48. package/.docs/reference/auth/neon.md +2 -2
  49. package/.docs/reference/cli/mastra.md +15 -15
  50. package/.docs/reference/datasets/compareExperiments.md +18 -9
  51. package/.docs/reference/datasets/dataset.md +3 -1
  52. package/.docs/reference/datasets/finalizeExperiment.md +2 -2
  53. package/.docs/reference/datasets/listExperiments.md +2 -2
  54. package/.docs/reference/datasets/submitExperimentResult.md +1 -1
  55. package/.docs/reference/editor/tools.md +11 -3
  56. package/.docs/reference/evals/completeness.md +3 -3
  57. package/.docs/reference/evals/context-precision.md +1 -1
  58. package/.docs/reference/evals/create-scorer.md +3 -7
  59. package/.docs/reference/evals/faithfulness.md +6 -4
  60. package/.docs/reference/evals/filter-run.md +2 -2
  61. package/.docs/reference/evals/trajectory-accuracy.md +3 -2
  62. package/.docs/reference/index.md +0 -1
  63. package/.docs/reference/memory/listThreads.md +1 -1
  64. package/.docs/reference/migrations/mcp-v2.md +2 -2
  65. package/.docs/reference/migrations/upgrade-to-v1/agent.md +1 -1
  66. package/.docs/reference/migrations/vnext-to-standard-apis.md +1 -1
  67. package/.docs/reference/observability/feedback.md +1 -1
  68. package/.docs/reference/observability/metrics/automatic-metrics.md +11 -1
  69. package/.docs/reference/observability/tracing/interfaces.md +26 -0
  70. package/.docs/reference/observability/tracing/spans.md +2 -0
  71. package/.docs/reference/processors/moderation-processor.md +1 -1
  72. package/.docs/reference/processors/prompt-injection-detector.md +2 -2
  73. package/.docs/reference/processors/provider-history-compat.md +12 -8
  74. package/.docs/reference/processors/regex-filter-processor.md +1 -1
  75. package/.docs/reference/processors/system-prompt-scrubber.md +3 -3
  76. package/.docs/reference/processors/token-limiter-processor.md +2 -2
  77. package/.docs/reference/rag/graph-rag.md +1 -1
  78. package/.docs/reference/server/create-route.md +1 -1
  79. package/.docs/reference/server/elysia-adapter.md +1 -1
  80. package/.docs/reference/server/express-adapter.md +1 -1
  81. package/.docs/reference/server/fastify-adapter.md +1 -1
  82. package/.docs/reference/server/hono-adapter.md +2 -2
  83. package/.docs/reference/server/koa-adapter.md +1 -1
  84. package/.docs/reference/server/nestjs-adapter.md +1 -1
  85. package/.docs/reference/server/routes.md +1 -1
  86. package/.docs/reference/storage/composite.md +34 -0
  87. package/.docs/reference/storage/overview.md +3 -3
  88. package/.docs/reference/streaming/agents/MastraModelOutput.md +1 -1
  89. package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
  90. package/.docs/reference/streaming/workflows/timeTravelStream.md +6 -4
  91. package/.docs/reference/tools/document-chunker-tool.md +8 -8
  92. package/.docs/reference/tools/mcp-client.md +1 -1
  93. package/.docs/reference/tools/mcp-server.md +17 -0
  94. package/.docs/reference/tools/submit-plan-tool.md +2 -0
  95. package/.docs/reference/tools/vector-query-tool.md +4 -4
  96. package/.docs/reference/vectors/astra.md +1 -1
  97. package/.docs/reference/vectors/azure-ai-search.md +1 -0
  98. package/.docs/reference/vectors/chroma.md +9 -5
  99. package/.docs/reference/vectors/convex.md +1 -3
  100. package/.docs/reference/vectors/couchbase.md +4 -9
  101. package/.docs/reference/vectors/duckdb.md +1 -1
  102. package/.docs/reference/vectors/libsql.md +1 -1
  103. package/.docs/reference/vectors/mongodb.md +2 -1
  104. package/.docs/reference/vectors/pg.md +16 -11
  105. package/.docs/reference/vectors/pinecone.md +8 -4
  106. package/.docs/reference/vectors/qdrant.md +8 -4
  107. package/.docs/reference/vectors/s3vectors.md +8 -4
  108. package/.docs/reference/vectors/turbopuffer.md +12 -6
  109. package/.docs/reference/vectors/upstash.md +10 -4
  110. package/.docs/reference/vectors/vectorize.md +7 -3
  111. package/.docs/reference/vectors/weaviate.md +1 -1
  112. package/.docs/reference/voice/composite-voice.md +15 -15
  113. package/.docs/reference/voice/mastra-voice.md +15 -11
  114. package/.docs/reference/voice/voice.addInstructions.md +1 -1
  115. package/.docs/reference/voice/voice.addTools.md +1 -1
  116. package/.docs/reference/voice/voice.answer.md +1 -1
  117. package/.docs/reference/voice/voice.close.md +1 -1
  118. package/.docs/reference/voice/voice.events.md +2 -2
  119. package/.docs/reference/voice/voice.listen.md +1 -1
  120. package/.docs/reference/voice/voice.off.md +1 -1
  121. package/.docs/reference/voice/voice.on.md +1 -1
  122. package/.docs/reference/voice/voice.send.md +2 -2
  123. package/.docs/reference/voice/voice.updateConfig.md +1 -1
  124. package/.docs/reference/workflows/dynamic-workflow-definition.md +3 -2
  125. package/.docs/reference/workflows/run-methods/cancel.md +1 -2
  126. package/.docs/reference/workflows/run-methods/resume.md +2 -0
  127. package/.docs/reference/workflows/run-methods/timeTravel.md +27 -0
  128. package/.docs/reference/workflows/run.md +14 -0
  129. package/.docs/reference/workflows/workflow-methods/agent.md +1 -1
  130. package/.docs/reference/workflows/workflow-methods/branch.md +4 -4
  131. package/.docs/reference/workflows/workflow-methods/classifier.md +1 -1
  132. package/.docs/reference/workflows/workflow-methods/create-run.md +2 -2
  133. package/.docs/reference/workflows/workflow-methods/dountil.md +1 -1
  134. package/.docs/reference/workflows/workflow-methods/dowhile.md +1 -1
  135. package/.docs/reference/workflows/workflow-methods/sleepUntil.md +1 -1
  136. package/.docs/reference/workspace/filesystem.md +10 -13
  137. package/.docs/reference/workspace/local-filesystem.md +5 -5
  138. package/.docs/reference/workspace/local-sandbox.md +1 -1
  139. package/.docs/reference/workspace/process-manager.md +2 -2
  140. package/.docs/reference/workspace/workspace-class.md +4 -4
  141. package/package.json +5 -5
  142. package/.docs/reference/agents/getTools.md +0 -31
@@ -28,11 +28,13 @@ The TurbopufferVector class provides vector search using [Turbopuffer](https://t
28
28
 
29
29
  ### `createIndex()`
30
30
 
31
+ Turbopuffer has no explicit create-index operation. `createIndex()` validates the arguments and records the dimension and metric locally; the namespace is created in Turbopuffer on the first `upsert()`.
32
+
31
33
  **indexName** (`string`): Name of the index to create
32
34
 
33
35
  **dimension** (`number`): Vector dimension (must match your embedding model)
34
36
 
35
- **metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (Default: `cosine`)
37
+ **metric** (`'cosine' | 'euclidean'`): Distance metric for similarity search. 'dotproduct' isn't supported and throws an error. (Default: `cosine`)
36
38
 
37
39
  ### `upsert()`
38
40
 
@@ -80,7 +82,7 @@ interface IndexStats {
80
82
 
81
83
  ### `updateVector()`
82
84
 
83
- Update a single vector by ID or by metadata filter. Either `id` or `filter` must be provided, but not both.
85
+ Update a single vector by ID, or every vector that matches a metadata filter. Either `id` or `filter` must be provided, but not both.
84
86
 
85
87
  **indexName** (`string`): Name of the index containing the vector
86
88
 
@@ -114,7 +116,7 @@ Query results are returned in this format:
114
116
  interface QueryResult {
115
117
  id: string
116
118
  score: number
117
- metadata: Record<string, any>
119
+ metadata?: Record<string, any>
118
120
  vector?: number[] // Only included if includeVector is true
119
121
  }
120
122
  ```
@@ -144,17 +146,21 @@ schemaConfigForIndex: (indexName: string) => {
144
146
 
145
147
  ## Error handling
146
148
 
147
- The store throws typed errors that can be caught:
149
+ The store throws `MastraError` instances from `@mastra/core/error`:
148
150
 
149
151
  ```typescript
152
+ import { MastraError } from '@mastra/core/error'
153
+
150
154
  try {
151
155
  await store.query({
152
156
  indexName: 'index_name',
153
157
  queryVector: queryVector,
154
158
  })
155
159
  } catch (error) {
156
- if (error instanceof VectorStoreError) {
157
- console.log(error.code) // 'connection_failed' | 'invalid_dimension' | etc
160
+ if (error instanceof MastraError) {
161
+ console.log(error.id) // 'MASTRA_VECTOR_TURBOPUFFER_QUERY_FAILED'
162
+ console.log(error.domain) // 'STORAGE'
163
+ console.log(error.category) // 'USER' | 'THIRD_PARTY'
158
164
  console.log(error.details) // Additional error context
159
165
  }
160
166
  }
@@ -8,6 +8,8 @@ The UpstashVector class provides vector search using [Upstash Vector](https://up
8
8
 
9
9
  ## Constructor options
10
10
 
11
+ **id** (`string`): Unique identifier for this vector store instance
12
+
11
13
  **url** (`string`): Upstash Vector database URL
12
14
 
13
15
  **token** (`string`): Upstash Vector API token
@@ -194,24 +196,28 @@ Query results are returned in this format:
194
196
  interface QueryResult {
195
197
  id: string
196
198
  score: number
197
- metadata: Record<string, any>
199
+ metadata?: Record<string, any>
198
200
  vector?: number[] // Only included if includeVector is true
199
201
  }
200
202
  ```
201
203
 
202
204
  ## Error handling
203
205
 
204
- The store throws typed errors that can be caught:
206
+ The store throws `MastraError` instances from `@mastra/core/error`:
205
207
 
206
208
  ```typescript
209
+ import { MastraError } from '@mastra/core/error'
210
+
207
211
  try {
208
212
  await store.query({
209
213
  indexName: 'index_name',
210
214
  queryVector: queryVector,
211
215
  })
212
216
  } catch (error) {
213
- if (error instanceof VectorStoreError) {
214
- console.log(error.code) // 'connection_failed' | 'invalid_dimension' | etc
217
+ if (error instanceof MastraError) {
218
+ console.log(error.id) // 'MASTRA_VECTOR_UPSTASH_QUERY_FAILED'
219
+ console.log(error.domain) // 'STORAGE'
220
+ console.log(error.category) // 'USER' | 'THIRD_PARTY'
215
221
  console.log(error.details) // Additional error context
216
222
  }
217
223
  }
@@ -133,17 +133,21 @@ interface QueryResult {
133
133
 
134
134
  ## Error handling
135
135
 
136
- The store throws typed errors that can be caught:
136
+ The store throws `MastraError` instances from `@mastra/core/error`:
137
137
 
138
138
  ```typescript
139
+ import { MastraError } from '@mastra/core/error'
140
+
139
141
  try {
140
142
  await store.query({
141
143
  indexName: 'index_name',
142
144
  queryVector: queryVector,
143
145
  })
144
146
  } catch (error) {
145
- if (error instanceof VectorStoreError) {
146
- console.log(error.code) // 'connection_failed' | 'invalid_dimension' | etc
147
+ if (error instanceof MastraError) {
148
+ console.log(error.id) // 'MASTRA_VECTOR_VECTORIZE_QUERY_FAILED'
149
+ console.log(error.domain) // 'STORAGE'
150
+ console.log(error.category) // 'USER' | 'THIRD_PARTY'
147
151
  console.log(error.details) // Additional error context
148
152
  }
149
153
  }
@@ -50,7 +50,7 @@ The `WeaviateVector` class provides vector search using [Weaviate](https://weavi
50
50
 
51
51
  **indexName** (`string`): Name of the index to query.
52
52
 
53
- **queryVector** (`number[]`): Query vector to find similar vectors for.
53
+ **queryVector** (`number[]`): Query vector to find similar vectors for. At least one of queryVector or filter must be provided.
54
54
 
55
55
  **topK** (`number`): Number of results to return. (Default: `10`)
56
56
 
@@ -10,13 +10,11 @@ CompositeVoice supports both Mastra voice providers and AI SDK model providers
10
10
 
11
11
  ## Constructor parameters
12
12
 
13
- **config** (`object`): Configuration object for the composite voice service
13
+ **input** (`MastraVoice | TranscriptionModel`): Voice provider or AI SDK transcription model to use for speech-to-text operations. AI SDK models are automatically wrapped.
14
14
 
15
- **config.input** (`MastraVoice | TranscriptionModel`): Voice provider or AI SDK transcription model to use for speech-to-text operations. AI SDK models are automatically wrapped.
15
+ **output** (`MastraVoice | SpeechModel`): Voice provider or AI SDK speech model to use for text-to-speech operations. AI SDK models are automatically wrapped.
16
16
 
17
- **config.output** (`MastraVoice | SpeechModel`): Voice provider or AI SDK speech model to use for text-to-speech operations. AI SDK models are automatically wrapped.
18
-
19
- **config.realtime** (`MastraVoice`): Voice provider to use for real-time speech-to-speech operations
17
+ **realtime** (`MastraVoice`): Voice provider to use for real-time speech-to-speech operations
20
18
 
21
19
  ## Methods
22
20
 
@@ -30,9 +28,10 @@ Converts text to speech using the configured speaking provider.
30
28
 
31
29
  Notes:
32
30
 
33
- - If no speaking provider is configured, this method will throw an error
34
- - Options are passed through to the configured speaking provider
35
- - Returns a stream of audio data
31
+ - If a realtime provider is configured, it handles the call; otherwise the speaking provider is used
32
+ - Throws a `MastraError` only when neither a realtime nor a speaking provider is configured
33
+ - Options are passed through to the provider that handles the call
34
+ - Returns a stream of audio data, or `void` when a realtime provider handles the call
36
35
 
37
36
  ### `listen()`
38
37
 
@@ -44,13 +43,14 @@ Converts speech to text using the configured listening provider.
44
43
 
45
44
  Notes:
46
45
 
47
- - If no listening provider is configured, this method will throw an error
48
- - Options are passed through to the configured listening provider
49
- - Returns either a string or a stream of transcribed text, depending on the provider
46
+ - If a realtime provider is configured, it handles the call; otherwise the listening provider is used
47
+ - Throws a `MastraError` only when neither a realtime nor a listening provider is configured
48
+ - Options are passed through to the provider that handles the call
49
+ - Returns a string or a stream of transcribed text, depending on the provider, or `void` when a realtime provider emits results through events
50
50
 
51
51
  ### `getSpeakers()`
52
52
 
53
- Returns a list of available voices from the speaking provider, where each node contains:
53
+ Returns a list of available voices from the realtime provider, or from the speaking provider when no realtime provider is configured, where each node contains:
54
54
 
55
55
  **voiceId** (`string`): Unique identifier for the voice
56
56
 
@@ -58,10 +58,10 @@ Returns a list of available voices from the speaking provider, where each node c
58
58
 
59
59
  Notes:
60
60
 
61
- - Returns voices from the speaking provider only
62
- - If no speaking provider is configured, returns an empty array
61
+ - Returns voices from the realtime provider when one is configured, otherwise from the speaking provider
62
+ - Throws a `MastraError` when neither a realtime nor a speaking provider is configured
63
63
  - Each voice object will have at least a voiceId property
64
- - Additional voice properties depend on the speaking provider
64
+ - Additional voice properties depend on the provider
65
65
 
66
66
  ## Usage examples
67
67
 
@@ -141,7 +141,7 @@ Converts speech to text using the configured listening model.
141
141
 
142
142
  ```typescript
143
143
  abstract listen(
144
- audioStream: NodeJS.ReadableStream,
144
+ audioStream: NodeJS.ReadableStream | unknown,
145
145
  options?: {
146
146
  [key: string]: unknown;
147
147
  }
@@ -150,31 +150,32 @@ abstract listen(
150
150
 
151
151
  Purpose:
152
152
 
153
- - Takes an audio stream and converts it to text using the provider's speech-to-text service
153
+ - Takes an audio stream (or another provider-specific audio input) and converts it to text using the provider's speech-to-text service
154
154
  - Supports provider-specific options for transcription configuration
155
155
  - Can return either a complete text transcription or a stream of transcribed text
156
156
  - Not all providers support this functionality (e.g., PlayAI, Speechify)
157
157
  - May return void if the transcription is handled by emitting 'writing' event
158
158
 
159
+ ## Optional methods
160
+
161
+ These methods have default implementations but can be overridden by voice providers that support speech-to-speech capabilities.
162
+
159
163
  ### `getSpeakers()`
160
164
 
161
165
  Returns a list of available voices supported by the provider.
162
166
 
163
167
  ```typescript
164
- abstract getSpeakers(): Promise<Array<{ voiceId: string; [key: string]: unknown }>>
168
+ getSpeakers(): Promise<Array<{ voiceId: string; [key: string]: unknown }>>
165
169
  ```
166
170
 
167
171
  Purpose:
168
172
 
169
173
  - Retrieves the list of available voices/speakers from the provider
174
+ - The default implementation returns an empty array; providers override it to list their voices
170
175
  - Each voice must have at least a voiceId property
171
176
  - Providers can include additional metadata about each voice
172
177
  - Used to discover available voices for text-to-speech conversion
173
178
 
174
- ## Optional methods
175
-
176
- These methods have default implementations but can be overridden by voice providers that support speech-to-speech capabilities.
177
-
178
179
  ### `connect()`
179
180
 
180
181
  Establishes a WebSocket or WebRTC connection for communication.
@@ -210,12 +211,13 @@ Purpose:
210
211
  Triggers the voice provider to generate a response.
211
212
 
212
213
  ```typescript
213
- answer(): Promise<void>
214
+ answer(options?: Record<string, unknown>): Promise<void>
214
215
  ```
215
216
 
216
217
  Purpose:
217
218
 
218
219
  - Sends a signal to the voice provider to generate a response
220
+ - Accepts optional provider-specific options
219
221
  - Used in real-time conversations to prompt the AI to respond
220
222
  - Response will be emitted through the event system (e.g., 'speaking' event)
221
223
 
@@ -285,9 +287,11 @@ Purpose:
285
287
 
286
288
  The MastraVoice class includes an event system for real-time communication. Standard event types include:
287
289
 
288
- **speaking** (`{ text: string; audioStream?: NodeJS.ReadableStream; audio?: Int16Array }`): Emitted when the voice provider is speaking, contains audio data
290
+ **speaker** (`NodeJS.ReadableStream`): Emitted with an audio stream for each new response the voice provider speaks
291
+
292
+ **speaking** (`{ audio?: string }`): Emitted when the voice provider is speaking, contains audio data
289
293
 
290
- **writing** (`{ text: string, role: string }`): Emitted when text is transcribed from speech
294
+ **writing** (`{ text: string; role: 'assistant' | 'user' }`): Emitted when text is transcribed from speech
291
295
 
292
296
  **error** (`{ message: string; code?: string; details?: unknown }`): Emitted when an error occurs
293
297
 
@@ -308,7 +312,7 @@ MastraVoice includes built-in telemetry support through the `traced` method, whi
308
312
  ## Notes
309
313
 
310
314
  - MastraVoice is an abstract class and can't be instantiated directly
311
- - Implementations must provide concrete implementations for all abstract methods
315
+ - Implementations must provide concrete implementations of the abstract `speak()` and `listen()` methods
312
316
  - The class provides a consistent interface across different voice service providers
313
317
  - Speech-to-speech capabilities are optional and provider-specific
314
318
  - The event system enables asynchronous communication for real-time interactions
@@ -54,7 +54,7 @@ This method doesn't return a value.
54
54
 
55
55
  - Instructions are most effective when they're clear, specific, and relevant to the voice interaction
56
56
  - This method is primarily used with real-time voice providers that maintain conversation context
57
- - If called on a voice provider that doesn't support instructions, it will log a warning and do nothing
57
+ - If called on a voice provider that doesn't support instructions, it will do nothing
58
58
  - Instructions added with this method are typically combined with any instructions provided by an associated Agent
59
59
  - For best results, add instructions before starting a conversation (before calling `connect()`)
60
60
  - Multiple calls to `addInstructions()` may either replace or append to existing instructions, depending on the provider implementation
@@ -64,7 +64,7 @@ This method doesn't return a value.
64
64
 
65
65
  - Tools must follow the Mastra tool format with name, description, input schema, and execute function
66
66
  - This method is primarily used with real-time voice providers that support function calling
67
- - If called on a voice provider that doesn't support tools, it will log a warning and do nothing
67
+ - If called on a voice provider that doesn't support tools, it will do nothing
68
68
  - Tools added with this method are typically combined with any tools provided by an associated Agent
69
69
  - For best results, add tools before starting a conversation (before calling `connect()`)
70
70
  - The voice provider will automatically handle the invocation of tool handlers when the model decides to use them
@@ -52,7 +52,7 @@ Returns a `Promise<void>` that resolves when the response has been triggered.
52
52
  ## Notes
53
53
 
54
54
  - This method is only implemented by real-time voice providers that support speech-to-speech capabilities
55
- - If called on a voice provider that doesn't support this functionality, it will log a warning and resolve immediately
55
+ - If called on a voice provider that doesn't support this functionality, it will log a debug message and resolve immediately
56
56
  - The response audio will typically be emitted through the 'speaking' event rather than returned directly
57
57
  - For providers that support it, you can use this method to send a specific response instead of having the AI generate one
58
58
  - This method is commonly used in conjunction with `send()` to create a conversational flow
@@ -51,5 +51,5 @@ This method doesn't return a value.
51
51
  - Always call `close()` when you're done with a real-time voice session to free up resources
52
52
  - After calling `close()`, you'll need to call `connect()` again if you want to start a new session
53
53
  - This method is primarily used with real-time voice providers that maintain persistent connections
54
- - If called on a voice provider that doesn't support real-time connections, it will log a warning and do nothing
54
+ - If called on a voice provider that doesn't support real-time connections, it will log a debug message and do nothing
55
55
  - Failing to close connections can lead to resource leaks and potential billing issues with voice service providers
@@ -10,7 +10,7 @@ Voice providers emit events during real-time voice interactions. These events ca
10
10
 
11
11
  These events are commonly implemented across real-time voice providers:
12
12
 
13
- **error** (`Error`): Emitted when an error occurs during voice processing or when audio data format is unsupported
13
+ **error** (`{ message: string; code?: string; details?: unknown }`): Emitted when an error occurs during voice processing or when audio data format is unsupported
14
14
 
15
15
  **session.created** (`object`): Emitted when a new session is created with the OpenAI service
16
16
 
@@ -20,7 +20,7 @@ These events are commonly implemented across real-time voice providers:
20
20
 
21
21
  **response.done** (`object`): Emitted when the AI assistant has completed its response
22
22
 
23
- **speaker** (`StreamWithId`): Emitted with a new audio stream that can be piped to an audio output
23
+ **speaker** (`NodeJS.ReadableStream`): Emitted with a new audio stream that can be piped to an audio output. Some realtime providers attach an id property to the stream
24
24
 
25
25
  **writing** (`object`): Emitted when text is being transcribed (user) or generated (assistant)
26
26
 
@@ -8,7 +8,7 @@ The `listen()` method is a core function available in all Mastra voice providers
8
8
 
9
9
  ## Parameters
10
10
 
11
- **audioStream** (`NodeJS.ReadableStream`): Audio stream to transcribe. This can be a file stream or a microphone stream.
11
+ **audioStream** (`NodeJS.ReadableStream | unknown`): Audio to transcribe. This is usually a file stream or a microphone stream; some realtime providers accept other audio input types.
12
12
 
13
13
  **options** (`object`): Provider-specific options for speech recognition
14
14
 
@@ -54,5 +54,5 @@ This method doesn't return a value.
54
54
  - The callback passed to `off()` must be the same function reference that was passed to `on()`
55
55
  - If the callback isn't found, the method will have no effect
56
56
  - This method is primarily used with real-time voice providers that support event-based communication
57
- - If called on a voice provider that doesn't support events, it will log a warning and do nothing
57
+ - If called on a voice provider that doesn't support events, it will log a debug message and do nothing
58
58
  - Removing event listeners is important for preventing memory leaks in long-running applications
@@ -107,7 +107,7 @@ voice.on('speaker', stream => {
107
107
  ## Notes
108
108
 
109
109
  - This method is primarily used with real-time voice providers that support event-based communication
110
- - If called on a voice provider that doesn't support events, it will log a warning and do nothing
110
+ - If called on a voice provider that doesn't support events, it will log a debug message and do nothing
111
111
  - Event listeners should be registered before calling methods that might emit events
112
112
  - To remove an event listener, use the [voice.off()](https://mastra.ai/reference/voice/voice.off) method with the same event name and callback function
113
113
  - Multiple listeners can be registered for the same event
@@ -56,12 +56,12 @@ await voice.send(audioBuffer)
56
56
 
57
57
  ## Return value
58
58
 
59
- Returns a `Promise<void>` that resolves when the audio data has been accepted by the voice provider.
59
+ Returns a `Promise<void>`. For providers that support real-time audio, it resolves when the provider has accepted the audio data. The default implementation sends nothing and resolves immediately.
60
60
 
61
61
  ## Notes
62
62
 
63
63
  - This method is only implemented by real-time voice providers that support speech-to-speech capabilities
64
- - If called on a voice provider that doesn't support this functionality, it will log a warning and resolve immediately
64
+ - If called on a voice provider that doesn't support this functionality, it will log a debug message and resolve immediately
65
65
  - You must call `connect()` before using `send()` to establish the WebSocket connection
66
66
  - The audio format requirements depend on the specific voice provider
67
67
  - For continuous conversation, you typically call `send()` to transmit user audio, then `answer()` to trigger the AI response
@@ -57,7 +57,7 @@ Different voice providers support different configuration options:
57
57
 
58
58
  ## Notes
59
59
 
60
- - The default implementation logs a warning if the provider doesn't support this method
60
+ - The default implementation logs a debug message if the provider doesn't support this method
61
61
  - Configuration updates are typically applied to subsequent operations, not ongoing ones
62
62
  - Not all properties that can be set in the constructor can be updated at runtime
63
63
  - The specific behavior depends on the voice provider implementation
@@ -128,18 +128,19 @@ Add an `outputSchema` to request structured output from the agent:
128
128
 
129
129
  Use a `mapping` entry before an agent to build its `{ prompt }` input from workflow data.
130
130
 
131
- Agent entries accept an optional `description` and an `options` object:
131
+ Agent entries accept an `options` object:
132
132
 
133
133
  ```json
134
134
  {
135
135
  "type": "agent",
136
136
  "id": "summarize",
137
137
  "agentId": "support-agent",
138
- "description": "Summarize the incoming request",
139
138
  "options": { "retries": 2, "metadata": { "team": "support" } }
140
139
  }
141
140
  ```
142
141
 
142
+ The step description comes from the registered agent. A `description` set on the agent entry is ignored when the workflow is rehydrated.
143
+
143
144
  Only `retries` and `metadata` persist. Function-valued options such as `onFinish` and function-valued `toolChoice` are rejected when a code-defined workflow is stored. Other agent call options don't persist.
144
145
 
145
146
  ### Classifier steps
@@ -14,7 +14,6 @@ This method aborts any running steps and updates the workflow status to 'cancele
14
14
  const run = await workflow.createRun()
15
15
 
16
16
  await run.cancel()
17
- // Returns: { message: 'Workflow run canceled' }
18
17
  ```
19
18
 
20
19
  ## Parameters
@@ -23,7 +22,7 @@ await run.cancel()
23
22
 
24
23
  ## Returns
25
24
 
26
- **result** (`Promise<{ message: string }>`): A promise that resolves with { message: 'Workflow run canceled' } when cancellation succeeds
25
+ **result** (`Promise<void>`): A promise that resolves once cancellation is requested and, if storage is configured, the status update to canceled has been attempted. It does not wait for running steps to stop. Calling cancel() on a run that already finished leaves its status unchanged, except with the Inngest engine.
27
26
 
28
27
  ## How cancellation works
29
28
 
@@ -118,6 +118,8 @@ try {
118
118
 
119
119
  Over HTTP, a losing resume returns `409 Conflict`.
120
120
 
121
+ This claim only applies to `resume()`. [`timeTravel()`](https://mastra.ai/reference/workflows/run-methods/timeTravel) doesn't claim the run, so concurrent time travel calls aren't rejected.
122
+
121
123
  > **Note:** The claim is enforced atomically by storage adapters that report `supportsConcurrentUpdates()`. Adapters without atomic read-modify-write support (such as ClickHouse, Cloudflare D1, Cloudflare KV, Cloudflare Durable Objects, LanceDB, and Redis) can't enforce it, and the claim is also skipped when `shouldPersistSnapshot` excludes the `running` status.
122
124
 
123
125
  ## Related
@@ -150,6 +150,33 @@ const result = await run.timeTravel({
150
150
  })
151
151
  ```
152
152
 
153
+ ## Concurrent time travel calls
154
+
155
+ `timeTravel()` doesn't claim the run before it executes. It only rejects runs whose stored status is `running`. If two `timeTravel()` calls target the same run at the same time, both can proceed, and the target step and every step after it run once per call.
156
+
157
+ This matters whenever time travel can be triggered more than once for the same run, such as a "retry from step" button pressed twice or a retried API request. Make sure only one call proceeds per run in your application, for example with a per-run lock or an idempotency key:
158
+
159
+ ```typescript
160
+ const inFlight = new Set<string>()
161
+
162
+ async function retryFromStep(runId: string, step: string) {
163
+ if (inFlight.has(runId)) {
164
+ throw new Error(`Time travel already in progress for run ${runId}`)
165
+ }
166
+ inFlight.add(runId)
167
+ try {
168
+ const run = await workflow.createRun({ runId })
169
+ return await run.timeTravel({ step })
170
+ } finally {
171
+ inFlight.delete(runId)
172
+ }
173
+ }
174
+ ```
175
+
176
+ The in-memory set above only protects a single process. If several server instances can handle the same run, use a shared lock instead, such as a database row lock.
177
+
178
+ Unlike [`resume()`](https://mastra.ai/reference/workflows/run-methods/resume), `timeTravel()` has no `WORKFLOW_RESUME_ALREADY_CLAIMED` equivalent, and the HTTP endpoint doesn't return `409 Conflict` for concurrent calls.
179
+
153
180
  ## Notes
154
181
 
155
182
  - Time travel requires storage to be configured since it relies on persisted workflow snapshots
@@ -44,14 +44,28 @@ if (result.status === 'suspended') {
44
44
 
45
45
  A workflow run's `status` indicates its current execution state. The possible values are:
46
46
 
47
+ **pending** (`string`): The run was created but hasn't started executing yet
48
+
49
+ **running** (`string`): Workflow execution is in progress
50
+
51
+ **waiting** (`string`): Workflow execution was interrupted before finishing, for example when the executor was aborted
52
+
47
53
  **success** (`string`): All steps finished executing successfully, with a valid result output
48
54
 
49
55
  **failed** (`string`): Workflow execution encountered an error during execution, with error details available
50
56
 
57
+ **tripwire** (`string`): A processor tripwire stopped workflow execution, with tripwire details available
58
+
51
59
  **suspended** (`string`): Workflow execution is paused waiting for resume, with suspended step information
52
60
 
61
+ **paused** (`string`): Workflow execution stopped after a single step because the run uses per-step execution
62
+
53
63
  **canceled** (`string`): Workflow execution was canceled via the cancel() method, stopping any running steps and preventing subsequent steps from executing
54
64
 
65
+ **bailed** (`string`): A step called bail() to end the workflow early. The run itself completes with a success status and the bail payload as its result
66
+
67
+ **skipped** (`string`): Execution was skipped, for example a branch whose condition didn't match. Mainly reported for individual steps
68
+
55
69
  ## Related
56
70
 
57
71
  - [Run.start()](https://mastra.ai/reference/workflows/run-methods/start)
@@ -55,7 +55,7 @@ workflow.agent('test-agent', { maxSteps: 3 }).commit()
55
55
 
56
56
  ## Persisting agent steps
57
57
 
58
- Workflows built with `.agent()` serialize to the same declarative entries that [dynamic workflows](https://mastra.ai/docs/workflows/dynamic-workflows) use. Only `retries` and `metadata` round-trip through storage. Options that hold functions, such as `onFinish` or a function-valued `toolChoice`, throw an error when the workflow is stored.
58
+ Workflows built with `.agent()` serialize to the same declarative entries that [dynamic workflows](https://mastra.ai/docs/workflows/dynamic-workflows) use. Only `structuredOutput.schema` (stored as JSON Schema), `retries`, and `metadata` round-trip through storage. Options that hold functions, such as `onFinish` or a function-valued `toolChoice`, throw an error when the workflow is stored.
59
59
 
60
60
  ## Related
61
61
 
@@ -10,20 +10,20 @@ The `.branch()` method creates conditional branches between workflow steps, allo
10
10
 
11
11
  ```typescript
12
12
  workflow.branch([
13
- [async ({ context }) => true, step1],
14
- [async ({ context }) => false, step2],
13
+ [async () => true, step1],
14
+ [async () => false, step2],
15
15
  ])
16
16
  ```
17
17
 
18
18
  ## Parameters
19
19
 
20
- **steps** (`[() => boolean, Step]`): An array of tuples, each containing a condition function and a step to execute if the condition is true
20
+ **steps** (`[ConditionFunction | { predicate: Predicate }, Step][]`): An array of tuples, each containing a condition (a function returning a boolean, or a declarative { predicate } object) and a step to execute if the condition is true
21
21
 
22
22
  **options** (`StepFlowEntryOptions`): Optional identity and display metadata for this graph entry. Preserved through serialization and storage; has no effect on execution.
23
23
 
24
24
  ## Returns
25
25
 
26
- **workflow** (`NewWorkflow`): The workflow instance for method chaining
26
+ **workflow** (`Workflow`): The workflow instance for method chaining
27
27
 
28
28
  ## Related
29
29
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Workflow\.classifier()
6
6
 
7
- The `.classifier()` method adds a configured [`Classifier`](https://mastra.ai/reference/classifier/classifier) as a declarative workflow step. It returns a JSON-safe `{ answers, usage }` object that can be consumed by later steps and existing control-flow methods such as [`.branch()`](https://mastra.ai/reference/workflows/workflow-methods/branch).
7
+ The `.classifier()` method adds a configured [`Classifier`](https://mastra.ai/reference/classifier/classifier) as a declarative workflow step and returns the workflow for chaining. The step outputs a JSON-safe `{ answers, usage }` object that can be consumed by later steps and existing control-flow methods such as [`.branch()`](https://mastra.ai/reference/workflows/workflow-methods/branch).
8
8
 
9
9
  ## Usage example
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Workflow\.createRun()
6
6
 
7
- The `.createRun()` method creates a new workflow run instance, allowing you to execute the workflow with specific input data. This is the current API that returns a `Run` instance.
7
+ The `.createRun()` method creates a new workflow run instance, allowing you to execute the workflow with specific input data. It returns a promise that resolves to a `Run` instance.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -22,7 +22,7 @@ await workflow.createRun()
22
22
 
23
23
  ## Returns
24
24
 
25
- **run** (`Run`): A new workflow run instance that can be used to execute the workflow
25
+ **run** (`Promise<Run>`): A promise that resolves to a new workflow run instance that can be used to execute the workflow
26
26
 
27
27
  ## Extended usage example
28
28
 
@@ -16,7 +16,7 @@ workflow.dountil(step1, async ({ inputData }) => true)
16
16
 
17
17
  **step** (`Step`): The step instance to execute in the loop
18
18
 
19
- **condition** (`(params : ExecuteParams & { iterationCount: number }) => Promise<boolean>`): A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters and the iteration count.
19
+ **condition** (`((params: ConditionFunctionParams & { iterationCount: number }) => Promise<boolean>) | { predicate: Predicate }`): A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters (excluding setState and suspend) and the iteration count. A declarative { predicate } object is also accepted.
20
20
 
21
21
  **options** (`StepFlowEntryOptions`): Optional identity and display metadata for this graph entry. Preserved through serialization and storage; has no effect on execution.
22
22
 
@@ -16,7 +16,7 @@ workflow.dowhile(step1, async ({ inputData }) => true)
16
16
 
17
17
  **step** (`Step`): The step instance to execute in the loop
18
18
 
19
- **condition** (`(params : ExecuteParams & { iterationCount: number }) => Promise<boolean>`): A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters and the iteration count.
19
+ **condition** (`((params: ConditionFunctionParams & { iterationCount: number }) => Promise<boolean>) | { predicate: Predicate }`): A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters (excluding setState and suspend) and the iteration count. A declarative { predicate } object is also accepted.
20
20
 
21
21
  **options** (`StepFlowEntryOptions`): Optional identity and display metadata for this graph entry. Preserved through serialization and storage; has no effect on execution.
22
22
 
@@ -14,7 +14,7 @@ workflow.sleepUntil(new Date(Date.now() + 5000))
14
14
 
15
15
  ## Parameters
16
16
 
17
- **dateOrCallback** (`Date | ((params: ExecuteFunctionParams) => Promise<Date>)`): Either a Date object or a callback function that returns a Date. The callback receives execution context and can compute the target time dynamically based on input data.
17
+ **dateOrCallback** (`Date | ExecuteFunction<TState, TPrevSchema, Date, any, any, TEngineType>`): Either a Date object or a step-style execute function that returns a Date. The callback receives the execution context typed to the workflow state and the previous step output, and can compute the target time dynamically based on input data.
18
18
 
19
19
  **options** (`StepFlowEntryOptions`): Optional identity and display metadata for this graph entry. Preserved through serialization and storage; has no effect on execution.
20
20