@mastra/mcp-docs-server 1.3.10-alpha.7 → 1.3.10-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/channels.md +15 -0
- package/.docs/docs/harness/schedules.md +2 -0
- package/.docs/docs/mastra-platform/server.md +10 -6
- package/.docs/docs/mastra-platform/studio.md +1 -1
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +2 -1
- package/.docs/docs/workflows/agents-and-tools.md +6 -1
- package/.docs/docs/workflows/scheduled-workflows.md +6 -2
- package/.docs/integrations/voice/speechify.md +23 -10
- package/.docs/models/gateways/merge-gateway.md +2 -1
- package/.docs/models/gateways/neon.md +2 -1
- package/.docs/models/gateways/netlify.md +1 -2
- package/.docs/models/gateways/openrouter.md +2 -2
- package/.docs/models/gateways/vercel.md +3 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/aimlapi.md +2 -1
- package/.docs/models/providers/commandcode.md +2 -1
- package/.docs/models/providers/edenai.md +3 -1
- package/.docs/models/providers/empiriolabs.md +4 -4
- package/.docs/models/providers/huggingface.md +2 -1
- package/.docs/models/providers/inceptron.md +4 -4
- package/.docs/models/providers/kilo.md +15 -15
- package/.docs/models/providers/llmgateway-providers.md +4 -3
- package/.docs/models/providers/llmgateway.md +3 -2
- package/.docs/models/providers/lowrouter.md +2 -1
- package/.docs/models/providers/nano-gpt.md +21 -18
- package/.docs/models/providers/nearai.md +2 -1
- package/.docs/models/providers/openai.md +2 -1
- package/.docs/models/providers/requesty.md +3 -1
- package/.docs/models/providers/wandb.md +2 -2
- package/.docs/reference/agents/channels.md +3 -1
- package/.docs/reference/channels/slack-provider.md +2 -0
- package/.docs/reference/client-js/observability.md +13 -14
- package/.docs/reference/code-sdk/mount-agent-controller.md +1 -1
- package/.docs/reference/core/mastra-model-gateway.md +5 -0
- package/.docs/reference/observability/metrics/automatic-metrics.md +10 -8
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +4 -0
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +4 -0
- package/.docs/reference/observability/tracing/interfaces.md +21 -1
- package/.docs/reference/processors/classifier-processor.md +1 -1
- package/.docs/reference/processors/processor-interface.md +1 -1
- package/.docs/reference/processors/stream-error-retry-processor.md +9 -5
- package/.docs/reference/schedules/overview.md +16 -0
- package/.docs/reference/storage/overview.md +26 -9
- package/.docs/reference/streaming/agents/streamLegacy.md +1 -1
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/tools/document-chunker-tool.md +1 -1
- package/.docs/reference/vectors/astra.md +2 -0
- package/.docs/reference/vectors/azure-ai-search.md +1 -1
- package/.docs/reference/vectors/convex.md +1 -1
- package/.docs/reference/vectors/couchbase.md +12 -5
- package/.docs/reference/vectors/duckdb.md +5 -5
- package/.docs/reference/vectors/mongodb.md +5 -5
- package/.docs/reference/vectors/pinecone.md +1 -1
- package/.docs/reference/vectors/qdrant.md +1 -1
- package/.docs/reference/vectors/s3vectors.md +3 -0
- package/.docs/reference/vectors/upstash.md +8 -4
- package/.docs/reference/vectors/vectorize.md +4 -2
- package/.docs/reference/vectors/weaviate.md +1 -1
- package/.docs/reference/voice/voice.send.md +1 -1
- package/.docs/reference/workflows/run-methods/restart.md +1 -1
- package/.docs/reference/workflows/run-methods/resume.md +1 -1
- package/.docs/reference/workflows/run-methods/start.md +1 -1
- package/.docs/reference/workflows/run.md +2 -2
- package/.docs/reference/workflows/workflow-methods/dountil.md +1 -1
- package/.docs/reference/workspace/local-sandbox.md +3 -3
- package/.docs/reference/workspace/platform-sandbox.md +4 -2
- package/.docs/reference/workspace/workspace-class.md +11 -11
- package/package.json +5 -5
|
@@ -362,7 +362,7 @@ Structured event emitted when the exporter pipeline drops observability events.
|
|
|
362
362
|
```typescript
|
|
363
363
|
type ObservabilityDropSignal = 'tracing' | 'log' | 'metric' | 'score' | 'feedback'
|
|
364
364
|
|
|
365
|
-
type ObservabilityDropReason = 'unsupported-storage' | 'retry-exhausted'
|
|
365
|
+
type ObservabilityDropReason = 'unsupported-storage' | 'retry-exhausted' | 'span-not-updatable'
|
|
366
366
|
|
|
367
367
|
interface ObservabilityDropEvent {
|
|
368
368
|
type: 'drop'
|
|
@@ -543,6 +543,16 @@ interface AgentRunAttributes {
|
|
|
543
543
|
/** Maximum steps allowed */
|
|
544
544
|
maxSteps?: number
|
|
545
545
|
|
|
546
|
+
/**
|
|
547
|
+
* Model the run was configured with, resolved at run preparation (call-time
|
|
548
|
+
* override, then agent config). The first enabled candidate of a fallback list.
|
|
549
|
+
* Never updated by later steps; see MODEL_STEP `model` for what each step ran.
|
|
550
|
+
*/
|
|
551
|
+
model?: string
|
|
552
|
+
|
|
553
|
+
/** Provider of `model`, taken from the same model object */
|
|
554
|
+
provider?: string
|
|
555
|
+
|
|
546
556
|
/** When the run's model streamed its first chunk, copied from the agent's own first generation */
|
|
547
557
|
completionStartTime?: Date
|
|
548
558
|
}
|
|
@@ -631,6 +641,16 @@ interface ModelStepAttributes {
|
|
|
631
641
|
/** Index of this step in the generation (0, 1, 2, ...) */
|
|
632
642
|
stepIndex?: number
|
|
633
643
|
|
|
644
|
+
/**
|
|
645
|
+
* Model actually invoked for this step, after per-step overrides (input
|
|
646
|
+
* processors, fallback). Recorded at invocation, so a failed provider call
|
|
647
|
+
* still carries it. Absent when no model was invoked, e.g. a cached response.
|
|
648
|
+
*/
|
|
649
|
+
model?: string
|
|
650
|
+
|
|
651
|
+
/** Provider of `model`, taken from the same model object */
|
|
652
|
+
provider?: string
|
|
653
|
+
|
|
634
654
|
/** Token usage statistics */
|
|
635
655
|
usage?: UsageStats
|
|
636
656
|
|
|
@@ -72,7 +72,7 @@ inputProcessors: [
|
|
|
72
72
|
|
|
73
73
|
**options.lastMessageOnly** (`boolean`): When true, only the last message is classified in the input and output phases.
|
|
74
74
|
|
|
75
|
-
**options.chunkWindow** (`number`): Non-negative integer number of trailing stream chunks to classify together, including the current text-delta chunk. A value of 0 classifies only the current chunk. Each text chunk triggers a classifier call, so larger windows increase cost.
|
|
75
|
+
**options.chunkWindow** (`number`): Non-negative integer number of trailing stream chunks to classify together, including the current text-delta chunk. A value of 0 classifies only the current chunk. Each text chunk triggers a classifier call unless the windowed text is whitespace-only, so larger windows increase cost.
|
|
76
76
|
|
|
77
77
|
**options.maxInputLength** (`number`): Non-negative integer maximum number of characters sent to the classifier. Longer text is truncated.
|
|
78
78
|
|
|
@@ -1212,7 +1212,7 @@ await agent.stream('Summarize this', {
|
|
|
1212
1212
|
})
|
|
1213
1213
|
```
|
|
1214
1214
|
|
|
1215
|
-
`maxProcessorRetries` passed on the call overrides the agent default. If neither is set,
|
|
1215
|
+
`maxProcessorRetries` passed on the call overrides the agent default. If neither is set, retries requested by input and output processors are treated as aborts, while error processors (such as [`StreamErrorRetryProcessor`](https://mastra.ai/reference/processors/stream-error-retry-processor)) are capped at 3 retries.
|
|
1216
1216
|
|
|
1217
1217
|
## Related
|
|
1218
1218
|
|
|
@@ -32,14 +32,18 @@ To run only the processors you configure, with none of the defaults merged in, s
|
|
|
32
32
|
|
|
33
33
|
## How it works
|
|
34
34
|
|
|
35
|
-
The processor checks the error and its cause chain for:
|
|
35
|
+
The processor checks the error and its cause chain, in this order, for:
|
|
36
36
|
|
|
37
|
-
- Provider retry metadata: `isRetryable === true`
|
|
38
|
-
- Built-in OpenAI Responses stream error matching
|
|
39
37
|
- Matcher results: Any configured matcher that returns `true`
|
|
38
|
+
- Built-in OpenAI Responses stream error matching
|
|
39
|
+
- Provider retry metadata: `isRetryable === true`
|
|
40
|
+
|
|
41
|
+
The first match decides the retry policy, so a configured matcher's `maxRetries`, `delayMs` and `onRetry` apply even when the built-in matcher would also match.
|
|
40
42
|
|
|
41
43
|
When the error is retryable, the processor returns `{ retry: true }`. It doesn't mutate messages.
|
|
42
44
|
|
|
45
|
+
Unless one of your own matchers matches it, the processor never retries a credential or quota refusal, even when provider metadata marks it retryable. The AI SDK marks every `429` retryable, including an exhausted quota.
|
|
46
|
+
|
|
43
47
|
When `delayMs` is set, the processor waits before signaling a retry. This is useful for transient network errors like `ECONNRESET` where immediately retrying is likely to fail again. The delay can be a fixed number of milliseconds or a function evaluated with the error args (for example, to implement exponential backoff).
|
|
44
48
|
|
|
45
49
|
### Retry limits
|
|
@@ -56,7 +60,7 @@ For retryable errors with a `Retry-After` response header, the processor reads c
|
|
|
56
60
|
|
|
57
61
|
## Retry unknown errors
|
|
58
62
|
|
|
59
|
-
Set `retryUnknownErrors` to retry errors that don't match provider metadata or the built-in OpenAI matcher, including a custom matcher. Unknown-error retries use the processor-level `maxRetries` and `delayMs` values. Known
|
|
63
|
+
Set `retryUnknownErrors` to retry errors that don't match provider metadata or the built-in OpenAI matcher, including a custom matcher. Unknown-error retries use the processor-level `maxRetries` and `delayMs` values. Known credential and quota refusals, including HTTP `401` and `403` responses, aren't retried:
|
|
60
64
|
|
|
61
65
|
```typescript
|
|
62
66
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -112,7 +116,7 @@ export const agent = new Agent({
|
|
|
112
116
|
|
|
113
117
|
## Default OpenAI Responses matcher
|
|
114
118
|
|
|
115
|
-
`isRetryableOpenAIResponsesStreamError` matches OpenAI Responses stream error chunks with `type: 'error'` or `type: 'response.failed'`. It
|
|
119
|
+
`isRetryableOpenAIResponsesStreamError` matches OpenAI Responses stream error chunks with `type: 'error'` or `type: 'response.failed'`. It reads each chunk with the shared provider-failure reader from `@mastra/core/error` and retries chunks that report a rate limit, a provider outage, or a timeout. As a fallback, it retries errors with explicit retry guidance such as `You can retry your request`. It never retries a credential or quota refusal.
|
|
116
120
|
|
|
117
121
|
`StreamErrorRetryProcessor` includes this matcher by default. You can also import it and reuse it in custom retry logic.
|
|
118
122
|
|
|
@@ -10,6 +10,22 @@
|
|
|
10
10
|
|
|
11
11
|
For usage patterns and concepts, see [Schedules](https://mastra.ai/docs/harness/schedules).
|
|
12
12
|
|
|
13
|
+
## Delivery guarantees
|
|
14
|
+
|
|
15
|
+
Scheduled publication is best-effort, not at-least-once delivery. The scheduler atomically claims an occurrence and advances `nextFireAt` before publishing the agent or workflow start event. An exhausted cron schedule is marked `completed` in that claim. Completion means there are no remaining occurrences, not that the target started or succeeded.
|
|
16
|
+
|
|
17
|
+
The scheduler makes up to three publication attempts for the same claimed occurrence, waiting 100 ms and then 200 ms between attempts. A transport can accept an event before returning an error, so retries can publish duplicates with the same run ID.
|
|
18
|
+
|
|
19
|
+
After all three attempts fail, the scheduler logs the schedule ID, run ID, scheduled fire time, `publicationOutcome: 'unknown'`, and `automaticReplay: false`. It invokes the configured `scheduler.onError` hook and attempts to record a trigger with outcome `failed`. This failure describes the publication attempts. It doesn't prove that the target never started.
|
|
20
|
+
|
|
21
|
+
Once those attempts are exhausted, the scheduler doesn't replay the occurrence. Recurring schedules remain active and can fire at their next scheduled time. Terminal schedules remain completed with any recorded failure details in trigger history.
|
|
22
|
+
|
|
23
|
+
After a successful claim, an info-level `Claimed schedule occurrence` log identifies the schedule ID, run ID, and scheduled fire time. A matching `Published schedule occurrence` log reports transport acceptance. If neither that success log nor the final failure log follows a claim, publication is unconfirmed. These logs aren't durable state: a crash between the claim commit and logging, or before logs are flushed, can leave no log record.
|
|
24
|
+
|
|
25
|
+
If a publisher process dies after the claim commits, or confirmation is lost, that occurrence may be skipped without a failed trigger. A replacement scheduler can't distinguish an unpublished event from one accepted before the crash using claim metadata or missing trigger history. It doesn't replay the occurrence or block later recurring fires. A publication acknowledgement also doesn't guarantee target execution, and transport redelivery can produce duplicates.
|
|
26
|
+
|
|
27
|
+
Before manually rerunning missed work, check target execution and transport records independently. Missing trigger history or a failed publication attempt alone isn't evidence that rerunning is safe.
|
|
28
|
+
|
|
13
29
|
## Usage example
|
|
14
30
|
|
|
15
31
|
Create an agent schedule:
|
|
@@ -12,15 +12,32 @@ Mastra storage is organized into domains. Each domain owns a set of tables or co
|
|
|
12
12
|
|
|
13
13
|
Not every storage adapter implements every domain. Composite storage lets you mix adapters per domain when the adapter packages export the corresponding domain classes.
|
|
14
14
|
|
|
15
|
-
| Domain
|
|
16
|
-
|
|
|
17
|
-
| `memory`
|
|
18
|
-
| `workflows`
|
|
19
|
-
| `workflowDefinitions`
|
|
20
|
-
| `scores`
|
|
21
|
-
| `observability`
|
|
22
|
-
| `datasets`
|
|
23
|
-
| `experiments`
|
|
15
|
+
| Domain | Description |
|
|
16
|
+
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `memory` | Conversation persistence: messages, threads, and resources (including working memory). |
|
|
18
|
+
| `workflows` | Workflow run snapshots used for suspend and resume. |
|
|
19
|
+
| `workflowDefinitions` | Persisted [dynamic workflow](https://mastra.ai/docs/workflows/dynamic-workflows) definitions (beta). Loaded and live-registered on boot. |
|
|
20
|
+
| `scores` | Evaluation score records from eval runs. |
|
|
21
|
+
| `observability` | Traces and spans used by observability exporters and Studio. |
|
|
22
|
+
| `datasets` | Dataset records, versioned items, and dataset versions used by experiments. |
|
|
23
|
+
| `experiments` | Experiment runs and per-item experiment results. |
|
|
24
|
+
| `agents` | Stored agent definitions and their versions, used by the Mastra Editor. |
|
|
25
|
+
| `promptBlocks` | Stored prompt blocks and their versions, used by the Mastra Editor. |
|
|
26
|
+
| `scorerDefinitions` | Stored scorer definitions, used by the Mastra Editor. |
|
|
27
|
+
| `mcpClients` | Stored MCP client configurations, used by the Mastra Editor. |
|
|
28
|
+
| `mcpServers` | Stored MCP server configurations, used by the Mastra Editor. |
|
|
29
|
+
| `workspaces` | Stored workspace configurations, used by the Mastra Editor. |
|
|
30
|
+
| `skills` | Stored skills and their versions, used by the Mastra Editor. |
|
|
31
|
+
| `favorites` | Per-user favorites on stored entities. |
|
|
32
|
+
| `blobs` | Content-addressable blobs keyed by SHA-256 hash. Stores file contents for skill versioning. |
|
|
33
|
+
| `backgroundTasks` | Background task state: creation, status updates, and cleanup. |
|
|
34
|
+
| `schedules` | Schedules polled by the scheduler to trigger workflow and agent runs. |
|
|
35
|
+
| `channels` | Channel installations and configuration for multi-platform integrations. |
|
|
36
|
+
| `harness` | Harness session records. |
|
|
37
|
+
| `toolProviderConnections` | User-assigned names for tool provider connections. |
|
|
38
|
+
| `notifications` | Notification records. |
|
|
39
|
+
| `threadState` | Durable per-thread state, such as task lists and goals. |
|
|
40
|
+
| `knowledge` | Knowledge graph nodes and records (experimental). |
|
|
24
41
|
|
|
25
42
|
The schema definitions below cover the built-in database-backed tables documented for `memory`, `workflows`, `scores`, and `observability`. Other domains, and non-database adapters, use implementation-specific storage structures.
|
|
26
43
|
|
|
@@ -54,7 +54,7 @@ await agent.streamLegacy('message for agent')
|
|
|
54
54
|
|
|
55
55
|
**options.onFinish** (`StreamTextOnFinishCallback<any> | StreamObjectOnFinishCallback<OUTPUT>`): Callback function called when streaming completes. Receives the final result.
|
|
56
56
|
|
|
57
|
-
**options.onStepFinish** (`StreamTextOnStepFinishCallback<any> | never`): Callback function called after each execution step. Receives step
|
|
57
|
+
**options.onStepFinish** (`StreamTextOnStepFinishCallback<any> | never`): Callback function called after each execution step. Receives the step result (text, tool calls, tool results, usage, finish reason) plus the runId. Unavailable for structured output
|
|
58
58
|
|
|
59
59
|
**options.resourceId** (`string`): \*\*Deprecated.\*\* Use memory.resource instead. Identifier for the user or resource interacting with the agent. Must be provided if threadId is provided.
|
|
60
60
|
|
|
@@ -60,7 +60,7 @@ if (result!.status === 'suspended') {
|
|
|
60
60
|
|
|
61
61
|
**stream.status** (`Promise<RunStatus>`): A promise that resolves to the current workflow run status
|
|
62
62
|
|
|
63
|
-
**stream.result** (`Promise<WorkflowResult<TState, TOutput, TSteps>>`): A promise that resolves to the final workflow result
|
|
63
|
+
**stream.result** (`Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>`): A promise that resolves to the final workflow result
|
|
64
64
|
|
|
65
65
|
**stream.usage** (`Promise<{ inputTokens: number; outputTokens: number; totalTokens: number, reasoningTokens?: number, cacheInputTokens?: number }>`): A promise that resolves to token usage statistics
|
|
66
66
|
|
|
@@ -37,7 +37,7 @@ const { chunks } = await chunker.execute()
|
|
|
37
37
|
|
|
38
38
|
### `ChunkParams`
|
|
39
39
|
|
|
40
|
-
**strategy** (`'recursive'`): The chunking strategy to use (Default: `'recursive'`)
|
|
40
|
+
**strategy** (`'character' | 'recursive' | 'token' | 'markdown' | 'html' | 'json' | 'latex' | 'sentence' | 'semantic-markdown'`): The chunking strategy to use (Default: `'recursive'`)
|
|
41
41
|
|
|
42
42
|
**maxSize** (`number`): Maximum size of each chunk in tokens/characters (Default: `512`)
|
|
43
43
|
|
|
@@ -8,6 +8,8 @@ The AstraVector class provides vector search using [DataStax Astra DB](https://w
|
|
|
8
8
|
|
|
9
9
|
## Constructor options
|
|
10
10
|
|
|
11
|
+
**id** (`string`): Unique identifier for this vector store instance
|
|
12
|
+
|
|
11
13
|
**token** (`string`): Astra DB API token
|
|
12
14
|
|
|
13
15
|
**endpoint** (`string`): Astra DB API endpoint
|
|
@@ -16,7 +16,7 @@ The `AzureAISearchVector` class provides vector search using [Azure AI Search](h
|
|
|
16
16
|
|
|
17
17
|
**apiVersion** (`string`): Azure AI Search REST API version to use. Defaults to the SDK default.
|
|
18
18
|
|
|
19
|
-
**clientOptions** (`SearchClientOptions
|
|
19
|
+
**clientOptions** (`Omit<SearchClientOptions, 'apiVersion'>`): Additional options passed to the underlying SearchClient/SearchIndexClient, such as additionalPolicies for proxies, custom headers, or retry behavior.
|
|
20
20
|
|
|
21
21
|
**autoIndexMetadata** (`boolean`): Add a filterable field to the index the first time a top-level string, number, or boolean metadata key is seen in upsert() or updateVector(). Azure AI Search can only filter on declared fields, so this is required for Memory semantic recall (which filters by thread_id and resource_id) unless you declare those keys via metadataIndexes. Set to false to manage the schema yourself. (Default: `true`)
|
|
22
22
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Couchbase vector store
|
|
6
6
|
|
|
7
|
-
The `CouchbaseVector` class provides vector search using [Couchbase Vector Search](https://docs.couchbase.com/server/current/vector-search/vector-search.html). It enables efficient similarity search
|
|
7
|
+
The `CouchbaseVector` class provides vector search using [Couchbase Vector Search](https://docs.couchbase.com/server/current/vector-search/vector-search.html). It enables efficient similarity search within your Couchbase collections.
|
|
8
8
|
|
|
9
9
|
## Requirements
|
|
10
10
|
|
|
@@ -137,7 +137,7 @@ Deletes the Search index. Documents stored in the collection aren't deleted.
|
|
|
137
137
|
|
|
138
138
|
### `listIndexes()`
|
|
139
139
|
|
|
140
|
-
Lists all
|
|
140
|
+
Lists the names of all Search indexes in the configured scope.
|
|
141
141
|
|
|
142
142
|
Returns: `Promise<string[]>`
|
|
143
143
|
|
|
@@ -161,11 +161,17 @@ Deletes a single vector by its ID from the index.
|
|
|
161
161
|
|
|
162
162
|
### `deleteVectors()`
|
|
163
163
|
|
|
164
|
-
Deletes
|
|
164
|
+
Deletes vectors by ID from the configured Couchbase collection. Pass a non-empty `ids` array to remove multiple documents. Missing IDs are ignored. Filter-based deletion isn't supported and throws a `MastraError`. Providing an empty `ids` array, both `ids` and `filter`, or neither, also throws.
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
await store.deleteVectors({ indexName: 'my_index', ids: ['vec_1', 'vec_2'] })
|
|
168
|
+
```
|
|
165
169
|
|
|
166
170
|
**indexName** (`string`): Name of the index containing the vectors to delete
|
|
167
171
|
|
|
168
|
-
**ids** (`string[]`):
|
|
172
|
+
**ids** (`string[]`): IDs of the vectors to delete (required for Couchbase)
|
|
173
|
+
|
|
174
|
+
**filter** (`VectorFilter`): Not supported for Couchbase. Passing a filter throws an error
|
|
169
175
|
|
|
170
176
|
### `disconnect()`
|
|
171
177
|
|
|
@@ -217,7 +223,8 @@ try {
|
|
|
217
223
|
## Limitations
|
|
218
224
|
|
|
219
225
|
- Index creation delays may impact immediate querying after creation.
|
|
220
|
-
-
|
|
226
|
+
- Vector dimension is enforced at ingest only after `createIndex()` creates a new index on the same `CouchbaseVector` instance. Calling `createIndex()` for an index that already exists doesn't turn on the ingest check. When the check is on, `upsert()` and `updateVector()` throw on a dimension mismatch. `query()` always checks the query vector against the index dimension.
|
|
227
|
+
- `deleteVectors()` supports deletion by ID only. Metadata-filter deletion isn't supported.
|
|
221
228
|
- Vector insertion and index updates are eventually consistent. Strong consistency isn't guaranteed immediately after writes.
|
|
222
229
|
|
|
223
230
|
## Related
|
|
@@ -245,11 +245,11 @@ const results = await store.query({
|
|
|
245
245
|
|
|
246
246
|
## Distance metrics
|
|
247
247
|
|
|
248
|
-
| Metric | Description | Score Interpretation
|
|
249
|
-
| ------------ | ----------------- |
|
|
250
|
-
| `cosine` | Cosine similarity |
|
|
251
|
-
| `euclidean` | L2 distance | 0
|
|
252
|
-
| `dotproduct` | Inner product | Higher = more similar
|
|
248
|
+
| Metric | Description | Score Interpretation | Best For |
|
|
249
|
+
| ------------ | ----------------- | ------------------------------------------------------------- | ----------------------------------- |
|
|
250
|
+
| `cosine` | Cosine similarity | -1 to 1, computed as `1 - cosine distance` (1 = most similar) | Text embeddings, normalized vectors |
|
|
251
|
+
| `euclidean` | L2 distance | 0-1, computed as `1 / (1 + distance)` (1 = most similar) | Image embeddings, spatial data |
|
|
252
|
+
| `dotproduct` | Inner product | Higher = more similar | When vector magnitude matters |
|
|
253
253
|
|
|
254
254
|
## Error handling
|
|
255
255
|
|
|
@@ -178,7 +178,7 @@ await store.createSearchIndex({
|
|
|
178
178
|
})
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
-
The field-mapped index name includes the logical `indexName`, so two logical indexes on the same collection get distinct text indexes.
|
|
181
|
+
The field-mapped index name includes the logical `indexName`, so two logical indexes on the same collection get distinct text indexes. Calling `createSearchIndex()` again for the _same_ logical index with different `fields` updates the existing text index definition in place. You don't need to drop it first.
|
|
182
182
|
|
|
183
183
|
### `waitForSearchIndexReady()`
|
|
184
184
|
|
|
@@ -279,18 +279,18 @@ Returns:
|
|
|
279
279
|
interface IndexStats {
|
|
280
280
|
dimension: number
|
|
281
281
|
count: number
|
|
282
|
-
metric
|
|
282
|
+
metric?: 'cosine' | 'euclidean' | 'dotproduct'
|
|
283
283
|
}
|
|
284
284
|
```
|
|
285
285
|
|
|
286
|
-
On an `autoEmbed` index, `dimension` is read from the index definition and reports MongoDB's default of `1024` when the index doesn't pin one. `count` counts documents that carry the embedded text field, since the generated vectors aren't stored on your documents.
|
|
286
|
+
On an `autoEmbed` index, `dimension` is read from the index definition and reports MongoDB's default of `1024` when the index doesn't pin one. `metric` is omitted when the `autoEmbed` index doesn't specify a similarity. `count` counts documents that carry the embedded text field, since the generated vectors aren't stored on your documents.
|
|
287
287
|
|
|
288
288
|
### `deleteIndex()`
|
|
289
289
|
|
|
290
290
|
Deletes a vector index. Behavior depends on how the index was created:
|
|
291
291
|
|
|
292
292
|
- **Managed index** (created without `collectionName`): drops the entire collection and all its data.
|
|
293
|
-
- **Bring-your-own index** (created with `collectionName`): drops the MongoDB vectorSearch index. If `createSearchIndex()` provisioned a companion full-text search index, it drops that index too. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
|
|
293
|
+
- **Bring-your-own index** (created with `collectionName`): drops the MongoDB vectorSearch index. If `createSearchIndex()` provisioned a companion full-text search index, it drops that index too. A vectorSearch or full-text index that another logical index on the same collection still references is kept for that index. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
|
|
294
294
|
|
|
295
295
|
The BYO classification is recorded durably when the index is created, so it's applied correctly even by a different process (e.g. an index created by a setup job and later deleted by a long-lived service). Always pass the **logical index name** (the `indexName` used at `createIndex`), not the physical collection name.
|
|
296
296
|
|
|
@@ -350,7 +350,7 @@ Query results are returned in this format:
|
|
|
350
350
|
interface QueryResult {
|
|
351
351
|
id: string
|
|
352
352
|
score: number
|
|
353
|
-
metadata
|
|
353
|
+
metadata?: Record<string, any>
|
|
354
354
|
vector?: number[] // Only included if includeVector is true
|
|
355
355
|
document?: string // Source text stored with the vector, when available
|
|
356
356
|
}
|
|
@@ -40,6 +40,7 @@ bun add @mastra/s3vectors@latest
|
|
|
40
40
|
import { S3Vectors } from '@mastra/s3vectors'
|
|
41
41
|
|
|
42
42
|
const store = new S3Vectors({
|
|
43
|
+
id: 's3-vectors',
|
|
43
44
|
vectorBucketName: process.env.S3_VECTORS_BUCKET_NAME!, // e.g. "my-vector-bucket"
|
|
44
45
|
clientConfig: {
|
|
45
46
|
region: process.env.AWS_REGION!, // credentials use the default AWS provider chain
|
|
@@ -88,6 +89,8 @@ await store.disconnect()
|
|
|
88
89
|
|
|
89
90
|
## Constructor options
|
|
90
91
|
|
|
92
|
+
**id** (`string`): Unique identifier for this vector store instance
|
|
93
|
+
|
|
91
94
|
**vectorBucketName** (`string`): Target S3 Vectors vector bucket name.
|
|
92
95
|
|
|
93
96
|
**clientConfig** (`S3VectorsClientConfig`): AWS SDK v3 client options (e.g., region, credentials).
|
|
@@ -18,13 +18,13 @@ The UpstashVector class provides vector search using [Upstash Vector](https://up
|
|
|
18
18
|
|
|
19
19
|
### `createIndex()`
|
|
20
20
|
|
|
21
|
-
Note: This method is a no-op for Upstash
|
|
21
|
+
Note: This method is a no-op for Upstash. Indexes (Upstash namespaces) are created automatically on first write, and the parameters below are ignored.
|
|
22
22
|
|
|
23
23
|
**indexName** (`string`): Name of the index to create
|
|
24
24
|
|
|
25
25
|
**dimension** (`number`): Vector dimension (must match your embedding model)
|
|
26
26
|
|
|
27
|
-
**metric** (`'cosine' | 'euclidean' | 'dotproduct'`):
|
|
27
|
+
**metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Ignored. The metric is set on the Upstash index itself.
|
|
28
28
|
|
|
29
29
|
### `upsert()`
|
|
30
30
|
|
|
@@ -70,7 +70,7 @@ Returns:
|
|
|
70
70
|
interface IndexStats {
|
|
71
71
|
dimension: number
|
|
72
72
|
count: number
|
|
73
|
-
metric
|
|
73
|
+
metric?: 'cosine' | 'euclidean' | 'dotproduct'
|
|
74
74
|
}
|
|
75
75
|
```
|
|
76
76
|
|
|
@@ -82,10 +82,14 @@ interface IndexStats {
|
|
|
82
82
|
|
|
83
83
|
**indexName** (`string`): Name of the index to update
|
|
84
84
|
|
|
85
|
-
**id** (`string`): ID of the item to update
|
|
85
|
+
**id** (`string`): ID of the item to update. Mutually exclusive with filter.
|
|
86
|
+
|
|
87
|
+
**filter** (`Record<string, any>`): Metadata filter matching up to 1,000 items to update. Mutually exclusive with id. Must not be empty.
|
|
86
88
|
|
|
87
89
|
**update** (`object`): Update object containing vector, sparse vector, and/or metadata
|
|
88
90
|
|
|
91
|
+
Provide exactly one of `id` or `filter`.
|
|
92
|
+
|
|
89
93
|
The `update` object can have the following properties:
|
|
90
94
|
|
|
91
95
|
- `vector` (optional): An array of numbers representing the new dense vector.
|
|
@@ -8,6 +8,8 @@ The CloudflareVector class provides vector search using [Cloudflare Vectorize](h
|
|
|
8
8
|
|
|
9
9
|
## Constructor options
|
|
10
10
|
|
|
11
|
+
**id** (`string`): Unique identifier for this vector store instance.
|
|
12
|
+
|
|
11
13
|
**accountId** (`string`): Cloudflare account ID
|
|
12
14
|
|
|
13
15
|
**apiToken** (`string`): Cloudflare API token with Vectorize permissions
|
|
@@ -58,7 +60,7 @@ Returns:
|
|
|
58
60
|
interface IndexStats {
|
|
59
61
|
dimension: number
|
|
60
62
|
count: number
|
|
61
|
-
metric
|
|
63
|
+
metric?: 'cosine' | 'euclidean' | 'dotproduct'
|
|
62
64
|
}
|
|
63
65
|
```
|
|
64
66
|
|
|
@@ -126,7 +128,7 @@ Query results are returned in this format:
|
|
|
126
128
|
interface QueryResult {
|
|
127
129
|
id: string
|
|
128
130
|
score: number
|
|
129
|
-
metadata
|
|
131
|
+
metadata?: Record<string, any>
|
|
130
132
|
vector?: number[]
|
|
131
133
|
}
|
|
132
134
|
```
|
|
@@ -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. When omitted, returns up to topK objects matching filter (or any objects if no filter is given).
|
|
54
54
|
|
|
55
55
|
**topK** (`number`): Number of results to return. (Default: `10`)
|
|
56
56
|
|
|
@@ -61,7 +61,7 @@ Returns a `Promise<void>`. For providers that support real-time audio, it resolv
|
|
|
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,
|
|
64
|
+
- If called on a voice provider that doesn't support this functionality, the default implementation logs a debug message and resolves immediately. `CompositeVoice` instead throws a `MastraError` (`VOICE_COMPOSITE_NO_REALTIME_PROVIDER_SEND`) when no `realtimeProvider` is configured
|
|
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
|
|
@@ -48,7 +48,7 @@ const restartedResult = await run.restart()
|
|
|
48
48
|
|
|
49
49
|
## Returns
|
|
50
50
|
|
|
51
|
-
**result** (`Promise<WorkflowResult<TState, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
51
|
+
**result** (`Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
52
52
|
|
|
53
53
|
**traceId** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
54
54
|
|
|
@@ -58,7 +58,7 @@ if (result.status === 'suspended') {
|
|
|
58
58
|
|
|
59
59
|
## Returns
|
|
60
60
|
|
|
61
|
-
**result** (`Promise<WorkflowResult<TState, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
61
|
+
**result** (`Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
62
62
|
|
|
63
63
|
**traceId** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
64
64
|
|
|
@@ -52,7 +52,7 @@ const result = await run.start({
|
|
|
52
52
|
|
|
53
53
|
## Returns
|
|
54
54
|
|
|
55
|
-
**result** (`Promise<WorkflowResult<TState, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
55
|
+
**result** (`Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
56
56
|
|
|
57
57
|
**traceId** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
58
58
|
|
|
@@ -32,7 +32,7 @@ if (result.status === 'suspended') {
|
|
|
32
32
|
|
|
33
33
|
**resumeStream** (`(options?: ResumeStreamOptions) => MastraWorkflowStream`): Resumes a suspended workflow with streaming support
|
|
34
34
|
|
|
35
|
-
**cancel** (`() => Promise<
|
|
35
|
+
**cancel** (`() => Promise<void>`): Cancels the workflow execution and prevents subsequent steps from executing. It does not wait for running steps to finish: a running step only stops early if it checks its abortSignal.
|
|
36
36
|
|
|
37
37
|
**restart** (`(options?: RestartOptions) => Promise<WorkflowResult>`): Restarts the workflow execution from last active step
|
|
38
38
|
|
|
@@ -60,7 +60,7 @@ A workflow run's `status` indicates its current execution state. The possible va
|
|
|
60
60
|
|
|
61
61
|
**paused** (`string`): Workflow execution stopped after a single step because the run uses per-step execution
|
|
62
62
|
|
|
63
|
-
**canceled** (`string`): Workflow execution was canceled via the cancel() method,
|
|
63
|
+
**canceled** (`string`): Workflow execution was canceled via the cancel() method. Subsequent steps do not run, and running steps stop only if they respond to their abortSignal
|
|
64
64
|
|
|
65
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
66
|
|
|
@@ -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: ConditionFunctionParams & { iterationCount: number }) => Promise<boolean>) | { predicate: Predicate }`): A function that returns a boolean indicating whether
|
|
19
|
+
**condition** (`((params: ConditionFunctionParams & { iterationCount: number }) => Promise<boolean>) | { predicate: Predicate }`): A function that returns a boolean indicating whether the loop is done. When it returns true the loop ends; when it returns false the step runs again. 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
|
|
|
@@ -72,7 +72,7 @@ Configuration options for native OS sandboxing (used with `isolation: 'seatbelt'
|
|
|
72
72
|
|
|
73
73
|
**seatbeltProfilePath** (`string`): Path to a custom seatbelt profile file (macOS only). If you wrote the file, it's used exactly as written: Mastra doesn't add mounted paths to it, so the profile must already allow every path you mount. If the file doesn't exist, a default profile is generated and written to this path, and that generated profile allows mounted paths. Mastra marks the profiles it generates, so a later run regenerates them instead of reading them back as your own. To edit a generated profile and keep your edits, delete its marker comment: the file then counts as yours, and mounted paths are no longer added to it.
|
|
74
74
|
|
|
75
|
-
**bwrapArgs** (`string[]`):
|
|
75
|
+
**bwrapArgs** (`string[]`): Custom arguments to pass to bwrap (Linux only). When set, these replace the generated isolation arguments instead of extending them.
|
|
76
76
|
|
|
77
77
|
**allowSystemBinaries** (`boolean`): Allow read access to standard system binary paths (/bin, /usr/bin, etc.). (Default: `true`)
|
|
78
78
|
|
|
@@ -203,8 +203,8 @@ const sandbox = new LocalSandbox({
|
|
|
203
203
|
|
|
204
204
|
When isolation is enabled:
|
|
205
205
|
|
|
206
|
-
- File writes are restricted to the workspace directory (and
|
|
207
|
-
- File reads are allowed everywhere (needed for system binaries)
|
|
206
|
+
- File writes are restricted to the workspace directory, `readWritePaths`, and temporary locations. On macOS (seatbelt), writes are also allowed under `/private/tmp`, `/var/folders`, and `/private/var/folders`. On Linux (bubblewrap), `/tmp` is a private in-sandbox tmpfs that isn't written to the host.
|
|
207
|
+
- File reads depend on the backend. On macOS (seatbelt), reads are allowed everywhere (needed for system binaries). On Linux (bubblewrap), the generated policy exposes only selected system paths (such as `/usr`, `/lib`, `/bin`, and essential `/etc` files), `readOnlyPaths`, `readWritePaths`, and the workspace. When `allowSystemBinaries` isn't `false`, the Node.js directory, `/opt`, and `/snap` are also visible. Other host paths aren't accessible. If you set `bwrapArgs`, it replaces the generated policy, so your arguments alone determine what's visible.
|
|
208
208
|
- Network access is blocked by default
|
|
209
209
|
- Process isolation prevents affecting the host system
|
|
210
210
|
|
|
@@ -164,10 +164,12 @@ const sandbox = new PlatformSandbox({
|
|
|
164
164
|
await sandbox.start()
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
`Template()` supports `cpuCount`, `memoryMB`, `runCmd`, `setWorkdir`, `setEnvs`, `aptInstall`, `pipInstall`, and `npmInstall`. Platform serializes the builder internally and computes the content hash. Call `await template.build(options)` to start or reuse that provider build without provisioning a sandbox. It returns `ready`, `pending`, or `failed`, with the template ID and an optional retry hint or error.
|
|
167
|
+
`Template()` supports `cpuCount`, `memoryMB`, `docker`, `runCmd`, `setWorkdir`, `setEnvs`, `aptInstall`, `pipInstall`, and `npmInstall`. Platform serializes the builder internally and computes the content hash. Call `await template.build(options)` to start or reuse that provider build without provisioning a sandbox. It returns `ready`, `pending`, or `failed`, with the template ID and an optional retry hint or error.
|
|
168
168
|
|
|
169
169
|
For E2B, `cpuCount()` and `memoryMB()` set the template build resources inherited by sandboxes created from the exact template or a resource-matched stale template. Both methods accept a positive safe integer. They default to 2 CPUs and 1,024 MB. Resource setters use last-value-wins semantics, and their effective values are part of the content identity. Omitting both setters is equivalent to explicitly selecting the defaults. If a pending build falls back to the provider base, that sandbox may use the provider's default resources. Check `templatePending` to detect this case.
|
|
170
170
|
|
|
171
|
+
`docker()` installs Docker Engine and Compose in the E2B template. The daemon starts the first time something uses Docker, so sandboxes that never use it don't pay for it. Docker is part of the content identity only when it's on, so templates without it keep their IDs. Use at least 2,048 MB of memory with Docker.
|
|
172
|
+
|
|
171
173
|
Railway converts the command, working directory, environment, and package operations to Railway template instructions. Railway currently ignores `cpuCount()` and `memoryMB()` because its sandbox template API doesn't expose matching resource settings.
|
|
172
174
|
|
|
173
175
|
For public GitHub repositories, `createRepoTemplate()` can resolve and build the commit-pinned definition lazily when `start()` needs a fresh sandbox:
|
|
@@ -186,7 +188,7 @@ const sandbox = new PlatformSandbox({
|
|
|
186
188
|
await sandbox.start()
|
|
187
189
|
```
|
|
188
190
|
|
|
189
|
-
`createRepoTemplate()` accepts the same `cpuCount` and `
|
|
191
|
+
`createRepoTemplate()` accepts the same `cpuCount`, `memoryMB`, and `docker` settings as the `Template()` builder methods, as plain options. They carry the identity and stale-fallback semantics described above. Omit them for the provider defaults.
|
|
190
192
|
|
|
191
193
|
`setupCommand` also accepts an array. Each entry runs as its own cached build step. `workingDirectory` sets the cwd for the build and the sandbox, and the repository is cloned to `<workingDirectory>/<repo>`. `buildEnv` passes environment variables to the build steps only. They never enter the serialized definition.
|
|
192
194
|
|