@mastra/mcp-docs-server 1.2.16-alpha.1 → 1.2.16-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agents/a2a.md +1 -1
- package/.docs/docs/agents/overview.md +2 -0
- package/.docs/docs/agents/processors.md +4 -4
- package/.docs/docs/agents/structured-output.md +1 -1
- package/.docs/docs/agents/using-tools.md +15 -11
- package/.docs/docs/browser/overview.md +22 -3
- package/.docs/docs/capabilities/subagents.md +2 -2
- package/.docs/docs/datasets/running-experiments.md +2 -2
- package/.docs/docs/deployment/overview.md +3 -3
- package/.docs/docs/deployment/sandbox.md +1 -1
- package/.docs/docs/deployment/workers.md +5 -5
- package/.docs/docs/deployment/workflow-runners.md +1 -1
- package/.docs/docs/editor/overview.md +3 -1
- package/.docs/docs/evals/custom-scorers.md +1 -1
- package/.docs/docs/evals/multi-turn.md +1 -1
- package/.docs/docs/evals/overview.md +3 -3
- package/.docs/docs/getting-started/develop.md +1 -1
- package/.docs/docs/harness/agent-controller.md +2 -2
- package/.docs/docs/harness/overview.md +1 -1
- package/.docs/docs/long-running-agents/background-tasks.md +2 -2
- package/.docs/docs/long-running-agents/goals.md +3 -2
- package/.docs/docs/long-running-agents/signals.md +2 -2
- package/.docs/docs/mastra-platform/deploy.md +1 -1
- package/.docs/docs/mastra-platform/github.md +1 -1
- package/.docs/docs/mastra-platform/observability.md +1 -1
- package/.docs/docs/mastra-platform/overview.md +3 -3
- package/.docs/docs/mastra-platform/server.md +2 -2
- package/.docs/docs/mastra-platform/trace-intelligence.md +3 -3
- package/.docs/docs/memory/memory-processors.md +1 -1
- package/.docs/docs/memory/message-history.md +2 -2
- package/.docs/docs/memory/observational-memory.md +13 -13
- package/.docs/docs/memory/semantic-recall.md +1 -1
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/metrics/querying.md +1 -1
- package/.docs/docs/observability/tracing/overview.md +3 -3
- package/.docs/docs/server/custom-adapters.md +2 -2
- package/.docs/docs/server/custom-api-routes.md +1 -1
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/server-adapters.md +1 -1
- package/.docs/docs/studio/deployment.md +2 -2
- package/.docs/docs/studio/observability.md +1 -1
- package/.docs/docs/studio/overview.md +2 -0
- package/.docs/docs/workflows/dynamic-workflows.md +1 -1
- package/.docs/docs/workflows/scheduled-workflows.md +1 -1
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workspace/lsp.md +27 -0
- package/.docs/docs/workspace/overview.md +2 -1
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/docs/workspace/skills.md +1 -1
- package/.docs/integrations/browsers/agent-browser.md +2 -3
- package/.docs/integrations/browsers/firecrawl.md +0 -1
- package/.docs/integrations/browsers/stagehand.md +2 -3
- package/.docs/models/environment-variables.md +2 -0
- package/.docs/models/gateways/openrouter.md +5 -2
- package/.docs/models/gateways/vercel.md +3 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/aiand.md +3 -2
- package/.docs/models/providers/digitalocean.md +2 -1
- package/.docs/models/providers/edenai.md +88 -0
- package/.docs/models/providers/hyper.md +3 -3
- package/.docs/models/providers/inceptron.md +8 -9
- package/.docs/models/providers/kilo.md +10 -7
- package/.docs/models/providers/llmgateway.md +3 -1
- package/.docs/models/providers/merge-gateway.md +262 -0
- package/.docs/models/providers/nano-gpt.md +11 -34
- package/.docs/models/providers/opencode.md +2 -1
- package/.docs/models/providers/tinfoil.md +9 -8
- package/.docs/models/providers/xai.md +2 -1
- package/.docs/models/providers.md +2 -0
- package/.docs/reference/acp/acp-agent.md +1 -1
- package/.docs/reference/agent-controller/session.md +1 -1
- package/.docs/reference/agents/channels.md +1 -1
- package/.docs/reference/agents/inngest-agent.md +1 -1
- package/.docs/reference/ai-sdk/overview.md +1 -1
- package/.docs/reference/auth/auth0.md +1 -1
- package/.docs/reference/auth/google.md +1 -1
- package/.docs/reference/browser/agent-browser.md +2 -2
- package/.docs/reference/browser/browser-viewer.md +1 -1
- package/.docs/reference/browser/stagehand-browser.md +2 -2
- package/.docs/reference/channels/channel-provider.md +1 -1
- package/.docs/reference/channels/slack-provider.md +1 -1
- package/.docs/reference/cli/mastra.md +5 -5
- package/.docs/reference/code-sdk/mount-agent-controller.md +1 -1
- package/.docs/reference/coding-agent/build-base-prompt.md +2 -1
- package/.docs/reference/configuration.md +3 -3
- package/.docs/reference/core/getAgentById.md +1 -1
- package/.docs/reference/core/getWorkflow.md +2 -2
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/deployer/netlify.md +1 -1
- package/.docs/reference/deployer.md +1 -1
- package/.docs/reference/editor/prompt-blocks.md +1 -1
- package/.docs/reference/editor/tools.md +1 -1
- package/.docs/reference/evals/completeness.md +1 -1
- package/.docs/reference/evals/noise-sensitivity.md +1 -1
- package/.docs/reference/evals/summarization.md +1 -1
- package/.docs/reference/file-based-agents/config.md +1 -1
- package/.docs/reference/file-based-agents/skills.md +5 -5
- package/.docs/reference/file-based-agents/workspace.md +1 -1
- package/.docs/reference/logging/pino-logger.md +1 -1
- package/.docs/reference/memory/observational-memory.md +12 -4
- package/.docs/reference/migrations/upgrade-to-v1/agent.md +3 -3
- package/.docs/reference/migrations/upgrade-to-v1/client.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/evals.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/mastra.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/mcp.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/overview.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/processors.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/storage.md +5 -5
- package/.docs/reference/migrations/upgrade-to-v1/tools.md +1 -1
- package/.docs/reference/observability/tracing/bridges/datadog.md +1 -1
- package/.docs/reference/observability/tracing/bridges/otel.md +1 -1
- package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +2 -2
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/otel.md +1 -1
- package/.docs/reference/observability/tracing/exporters/sentry.md +1 -1
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +27 -3
- package/.docs/reference/processors/batch-parts-processor.md +1 -1
- package/.docs/reference/processors/language-detector.md +1 -2
- package/.docs/reference/processors/processor-interface.md +16 -16
- package/.docs/reference/processors/stream-error-retry-processor.md +2 -2
- package/.docs/reference/rag/chunking-and-embedding.md +1 -1
- package/.docs/reference/rag/metadata-filters.md +1 -1
- package/.docs/reference/server/koa-adapter.md +1 -1
- package/.docs/reference/signals/webhook-signal-provider.md +1 -1
- package/.docs/reference/storage/retention.md +1 -1
- package/.docs/reference/tools/bedrock-kb-tool.md +1 -1
- package/.docs/reference/tools/mcp-client.md +3 -3
- package/.docs/reference/tools/mcp-server.md +5 -5
- package/.docs/reference/tools/task-tools.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +1 -1
- package/.docs/reference/vectors/chroma.md +1 -1
- package/.docs/reference/vectors/convex.md +1 -1
- package/.docs/reference/vectors/couchbase.md +1 -1
- package/.docs/reference/vectors/mongodb.md +2 -2
- package/.docs/reference/vectors/pg.md +1 -1
- package/.docs/reference/vectors/qdrant.md +2 -2
- package/.docs/reference/voice/overview.md +1 -1
- package/.docs/reference/voice/speech-to-speech.md +1 -1
- package/.docs/reference/voice/speech-to-text.md +1 -1
- package/.docs/reference/voice/voice.on.md +1 -1
- package/.docs/reference/voice/voice.updateConfig.md +1 -1
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +1 -1
- package/CHANGELOG.md +14 -0
- package/package.json +5 -5
- package/.docs/docs/browser/recording.md +0 -120
|
@@ -101,7 +101,7 @@ Missing `instructions.md`, `instructions.ts`, and `config.instructions` fails th
|
|
|
101
101
|
|
|
102
102
|
## Discovery lifecycle
|
|
103
103
|
|
|
104
|
-
File-based primitives are discovered by the Mastra bundler under `mastra dev` and `mastra build`. During discovery, Mastra reads supported files under `src/mastra
|
|
104
|
+
File-based primitives are discovered by the Mastra bundler under `mastra dev` and `mastra build`. During discovery, Mastra reads supported files under `src/mastra/` and imports TypeScript and JavaScript modules. It also reads markdown instructions and skills. The bundler then copies workspace seed files and registers the assembled primitives with your Mastra app.
|
|
105
105
|
|
|
106
106
|
After discovery, a file-based agent runs as a normal [`Agent`](https://mastra.ai/reference/agents/agent). Calling it from the Agent API, Studio, workflows, or your application code uses the same runtime as a code-defined agent.
|
|
107
107
|
|
|
@@ -22,11 +22,11 @@ Always report temperatures in Celsius and Fahrenheit. Include the user's preferr
|
|
|
22
22
|
|
|
23
23
|
## Skills vs tools vs instructions
|
|
24
24
|
|
|
25
|
-
| Need | Use | Why
|
|
26
|
-
| ---------------------------------------------------- | ------------------------------------------------------------------------------- |
|
|
27
|
-
| Always-on identity, tone, or rules | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | The model should see the guidance every turn.
|
|
28
|
-
| Callable action with inputs and outputs | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | The model needs to execute code
|
|
29
|
-
| Detailed reference or procedure loaded when relevant | `skills/` | The model only needs the full guidance for specific tasks.
|
|
25
|
+
| Need | Use | Why |
|
|
26
|
+
| ---------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
27
|
+
| Always-on identity, tone, or rules | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | The model should see the guidance every turn. |
|
|
28
|
+
| Callable action with inputs and outputs | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | The model needs to execute code or call APIs, including operations that perform side effects. |
|
|
29
|
+
| Detailed reference or procedure loaded when relevant | `skills/` | The model only needs the full guidance for specific tasks. |
|
|
30
30
|
|
|
31
31
|
## Skill formats
|
|
32
32
|
|
|
@@ -15,7 +15,7 @@ Without `workspace.ts`, a file-based agent gets a default [`Workspace`](https://
|
|
|
15
15
|
- [`LocalFilesystem`](https://mastra.ai/reference/workspace/local-filesystem) rooted at the agent's bundled workspace directory.
|
|
16
16
|
- [`LocalSandbox`](https://mastra.ai/reference/workspace/local-sandbox) with the same working directory.
|
|
17
17
|
|
|
18
|
-
This gives the agent file tools and shell tools automatically. The default workspace is per agent
|
|
18
|
+
This gives the agent file tools and shell tools automatically. The default workspace is per agent. Subagents get nested workspace directories under their parent agent's workspace path.
|
|
19
19
|
|
|
20
20
|
## Quickstart
|
|
21
21
|
|
|
@@ -149,7 +149,7 @@ You can create custom transports using the `createCustomTransport` utility to in
|
|
|
149
149
|
|
|
150
150
|
### Sentry transport example
|
|
151
151
|
|
|
152
|
-
Creates a custom transport using `createCustomTransport` and integrates it with a third-party logging stream such as `pino-sentry-transport`.
|
|
152
|
+
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.
|
|
153
153
|
|
|
154
154
|
```typescript
|
|
155
155
|
import { createCustomTransport } from '@mastra/core/loggers'
|
|
@@ -87,7 +87,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
|
|
|
87
87
|
|
|
88
88
|
**observation.activateOnProviderChange** (`boolean`): Force buffered observations to activate when the actor provider or model changes. If unset, the top-level activateOnProviderChange value is used for observations. Currently only applied when using the standalone ObservationalMemory class; new Memory(...) applies the top-level activateOnProviderChange only.
|
|
89
89
|
|
|
90
|
-
**observation.blockAfter** (`number`): Safety net
|
|
90
|
+
**observation.blockAfter** (`number`): Safety net for when background buffering can't keep up. Values from 1 up to (but not including) 100 are multipliers of messageTokens: 1.2 resolves to 120% of the threshold (36k tokens with the default 30k). Values of 100 or more are absolute token counts and must be greater than messageTokens. Above this point, activation uses the smallest set of buffered chunks that reaches the retention target, even when that overshoots the target by more than the usual safeguard allows. It never activates more chunks than are needed to reach the retention target, so it removes only slightly more history than a normal activation. It changes the result only when the retention floor is above roughly 20,000 tokens; with the default bufferActivation (a 6k floor) it has no observable effect. Activation usually keeps a minimum remaining context (the smaller of 1000 tokens or the retention floor), but a single buffered chunk that covers the whole pending window still activates and can leave less. Crossing blockAfter does not trigger a blocking observation. A synchronous (blocking) observation runs when the messageTokens threshold is reached and buffered activation did not happen. Only relevant when bufferTokens is set. Defaults to 1.2 when async buffering is enabled.
|
|
91
91
|
|
|
92
92
|
**observation.previousObserverTokens** (`number | false`): Optional token budget for the observer's previous-observations context. When set to a number, the observations passed to the Observer agent are tail-truncated to fit within this budget while keeping the newest observations and preserving highlighted 🔴 items when possible. When a buffered reflection is pending, the already-reflected observation lines are automatically replaced with the reflection summary before truncation. Set to 0 to omit previous observations entirely, or false to disable truncation explicitly.
|
|
93
93
|
|
|
@@ -353,7 +353,7 @@ export const agent = new Agent({
|
|
|
353
353
|
|
|
354
354
|
Async buffering is **enabled by default**. It pre-computes observations in the background as the conversation grows: when the `messageTokens` threshold is reached, buffered observations activate instantly with no blocking LLM call.
|
|
355
355
|
|
|
356
|
-
The lifecycle follows **buffer → activate → remove messages → repeat**. Background Observer calls run at `bufferTokens` intervals, each producing a chunk of observations. At threshold, chunks activate: observations move into the log, raw messages are removed from context.
|
|
356
|
+
The lifecycle follows **buffer → activate → remove messages → repeat**. Background Observer calls run at `bufferTokens` intervals, each producing a chunk of observations. At threshold, chunks activate: observations move into the log, raw messages are removed from context. Above the `blockAfter` threshold, activation may overshoot the retention target instead of activating fewer chunks. If the threshold is reached and no buffered chunk activates, a synchronous observation runs instead.
|
|
357
357
|
|
|
358
358
|
Default settings:
|
|
359
359
|
|
|
@@ -383,7 +383,7 @@ export const agent = new Agent({
|
|
|
383
383
|
bufferTokens: 5_000,
|
|
384
384
|
// Activate to retain 30% of threshold
|
|
385
385
|
bufferActivation: 0.7,
|
|
386
|
-
//
|
|
386
|
+
// Above 1.5x the threshold, let activation overshoot the retention target
|
|
387
387
|
blockAfter: 1.5,
|
|
388
388
|
},
|
|
389
389
|
reflection: {
|
|
@@ -787,6 +787,8 @@ Mastra also injects scope-aware usage instructions into the agent's context. For
|
|
|
787
787
|
|
|
788
788
|
**partIndex** (`number`): Fetch a single message part at full detail by its positional index. Use this when a low-detail recall shows an interesting part at \[p1] — call again with partIndex: 1 to see the full content without loading every part.
|
|
789
789
|
|
|
790
|
+
**charOffset** (`number`): Character position to continue reading a truncated single part. Only applies with cursor and partIndex. When a part is larger than the token budget, the result includes nextCharOffset — pass that exact value here in the next call to read the following chunk. The chunks concatenate to the original part text. (Default: `0`)
|
|
791
|
+
|
|
790
792
|
**before** (`string`): For mode: "threads" only. Filter to threads created before this date. Accepts ISO 8601 format (e.g. "2026-03-15", "2026-03-10T00:00:00Z").
|
|
791
793
|
|
|
792
794
|
**after** (`string`): For mode: "threads" only. Filter to threads created after this date. Accepts ISO 8601 format (e.g. "2026-03-01", "2026-03-10T00:00:00Z").
|
|
@@ -809,10 +811,16 @@ Mastra also injects scope-aware usage instructions into the agent's context. For
|
|
|
809
811
|
|
|
810
812
|
**hasPrevPage** (`boolean`): Whether more messages exist before this page.
|
|
811
813
|
|
|
812
|
-
**truncated** (`boolean`): Present and true when the output was capped by the token budget. The agent can paginate or use partIndex to access remaining content.
|
|
814
|
+
**truncated** (`boolean`): Present and true when the output was capped by the token budget. The agent can paginate or use partIndex to access remaining content. When a single part is itself too large, the partIndex result includes nextCharOffset for continuing within the part.
|
|
813
815
|
|
|
814
816
|
**tokenOffset** (`number`): Approximate number of tokens that were trimmed when truncated is true.
|
|
815
817
|
|
|
818
|
+
**charOffset** (`number`): On single-part results (partIndex), the character position this chunk starts at. 0 unless the call passed a charOffset.
|
|
819
|
+
|
|
820
|
+
**nextCharOffset** (`number`): On single-part results, present when the part was truncated and more content remains. Pass this value as charOffset in the next call to continue reading from where this chunk ended.
|
|
821
|
+
|
|
822
|
+
**note** (`string`): On truncated single-part results, the exact follow-up call for retrieving the next chunk.
|
|
823
|
+
|
|
816
824
|
### Returns (threads mode)
|
|
817
825
|
|
|
818
826
|
**threads** (`string`): Formatted thread listing. Each thread shows its title, ID, and dates. The current thread is marked with ← current.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Agent class
|
|
4
4
|
|
|
5
|
-
The Agent class has been updated with reorganized voice methods
|
|
5
|
+
The Agent class has been updated with reorganized voice methods and property access patterns, plus streamlined streaming APIs.
|
|
6
6
|
|
|
7
7
|
## Changed
|
|
8
8
|
|
|
@@ -70,7 +70,7 @@ To migrate, update all imports and parameter names from `RuntimeContext`/`runtim
|
|
|
70
70
|
|
|
71
71
|
### Direct property access to getter methods
|
|
72
72
|
|
|
73
|
-
Direct property access to `agent.llm`, `agent.tools`, and `agent.instructions` is deprecated.
|
|
73
|
+
Direct property access to `agent.llm`, `agent.tools`, and `agent.instructions` is deprecated. The accessors improve encapsulation and align with the broader API design.
|
|
74
74
|
|
|
75
75
|
To migrate, replace property access with the corresponding getter methods.
|
|
76
76
|
|
|
@@ -146,7 +146,7 @@ To migrate, update processor method names.
|
|
|
146
146
|
|
|
147
147
|
Mastra v1 continues to accept both Zod v3 and Zod v4 schemas in public agent APIs that take structured output schemas. This includes methods such as `agent.generateLegacy()` and `agent.streamLegacy()` and the related option types.
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
Existing Zod schemas passed to agent APIs don't require migration for Zod version compatibility. Keep your existing schema imports:
|
|
150
150
|
|
|
151
151
|
```ts
|
|
152
152
|
import { z as z3 } from 'zod/v3'
|
|
@@ -148,7 +148,7 @@ client.memory.listMessages({
|
|
|
148
148
|
|
|
149
149
|
### `getMemoryThread` parameter structure
|
|
150
150
|
|
|
151
|
-
The `getMemoryThread` method parameter structure has been updated.
|
|
151
|
+
The `getMemoryThread` method parameter structure has been updated. The new structure aligns the API across memory methods.
|
|
152
152
|
|
|
153
153
|
To migrate, update the method call with the new parameter structure. Check the updated API documentation for the specific changes.
|
|
154
154
|
|
|
@@ -74,7 +74,7 @@ const scorer = createScorer({
|
|
|
74
74
|
|
|
75
75
|
### Scorer configuration from `name` to `id`
|
|
76
76
|
|
|
77
|
-
Scorers now require an `id` field instead of `name`. The `name` field is now optional.
|
|
77
|
+
Scorers now require an `id` field instead of `name`. The `name` field is now optional. The new field aligns scorers with other Mastra entities.
|
|
78
78
|
|
|
79
79
|
To migrate, update scorer definitions to use `id` as the required field.
|
|
80
80
|
|
|
@@ -49,7 +49,7 @@ const mastra = new Mastra({
|
|
|
49
49
|
|
|
50
50
|
### Required `id` parameter for all mastra primitives
|
|
51
51
|
|
|
52
|
-
All storages, vector stores, agents, workflows, mcpServers, processors, scorers, and tools now require an `id` parameter during initialization.
|
|
52
|
+
All storages, vector stores, agents, workflows, mcpServers, processors, scorers, and tools now require an `id` parameter during initialization. Required IDs standardize the Mastra API and prevent ID conflicts.
|
|
53
53
|
|
|
54
54
|
All these primitives also now have `get`, `list`, and `add` functions.
|
|
55
55
|
|
|
@@ -59,7 +59,7 @@ To migrate, replace all calls to `mcp.getToolsets()` with `mcp.listToolsets()`.
|
|
|
59
59
|
|
|
60
60
|
### MCP tool context properties organization
|
|
61
61
|
|
|
62
|
-
Context properties in MCP tools are now organized under the `context.mcp` namespace.
|
|
62
|
+
Context properties in MCP tools are now organized under the `context.mcp` namespace. The namespace organizes MCP-specific functionality under a clear API surface.
|
|
63
63
|
|
|
64
64
|
To migrate, access MCP-specific properties like `elicitation` and `extra` through `context.mcp` instead of directly from the context parameter.
|
|
65
65
|
|
|
@@ -108,7 +108,7 @@ Work through this checklist in order, starting with high-impact changes that aff
|
|
|
108
108
|
- Update storage methods from `get*` to `list*` pattern - [Storage](https://mastra.ai/reference/migrations/upgrade-to-v1/storage)
|
|
109
109
|
- Replace direct property access with getter methods - [Mastra Class](https://mastra.ai/reference/migrations/upgrade-to-v1/mastra), [Agent Class](https://mastra.ai/reference/migrations/upgrade-to-v1/agent)
|
|
110
110
|
- Update memory scope if relying on default `thread` scope - [Memory](https://mastra.ai/reference/migrations/upgrade-to-v1/memory)
|
|
111
|
-
- Update vector store calls to use
|
|
111
|
+
- Update vector store calls to use arguments by name - [Storage](https://mastra.ai/reference/migrations/upgrade-to-v1/storage)
|
|
112
112
|
- Remove `format` parameter from agent methods - [Agent Class](https://mastra.ai/reference/migrations/upgrade-to-v1/agent)
|
|
113
113
|
- Update voice methods to use `agent.voice` namespace - [Agent Class](https://mastra.ai/reference/migrations/upgrade-to-v1/agent)
|
|
114
114
|
- Rename configuration property `processors` to `spanOutputProcessors` (if using custom processors) - [Tracing](https://mastra.ai/reference/migrations/upgrade-to-v1/tracing)
|
|
@@ -8,7 +8,7 @@ Processor interfaces have been updated to use consistent naming patterns and dat
|
|
|
8
8
|
|
|
9
9
|
### Processor configuration from `name` to `id`
|
|
10
10
|
|
|
11
|
-
Processors now require an `id` field instead of `name`. The `name` field is now optional.
|
|
11
|
+
Processors now require an `id` field instead of `name`. The `name` field is now optional. The new field aligns processors with other Mastra entities such as scorers and agents.
|
|
12
12
|
|
|
13
13
|
To migrate, update processor definitions to use `id` as the required field.
|
|
14
14
|
|
|
@@ -93,7 +93,7 @@ USING snapshot::jsonb;
|
|
|
93
93
|
|
|
94
94
|
### Storage composition in `MastraCompositeStore`
|
|
95
95
|
|
|
96
|
-
`MastraCompositeStore` can now compose storage domains from different adapters. Use it when
|
|
96
|
+
`MastraCompositeStore` can now compose storage domains from different adapters. Use it when different purposes require different databases, such as PostgreSQL for memory and workflows with a specialized database for observability.
|
|
97
97
|
|
|
98
98
|
```typescript
|
|
99
99
|
import { MastraCompositeStore } from '@mastra/core/storage'
|
|
@@ -386,7 +386,7 @@ To migrate, use the memory store, remove format parameters, and update code to w
|
|
|
386
386
|
+ const saved = saveResult?.messages; // MastraDBMessage[]
|
|
387
387
|
```
|
|
388
388
|
|
|
389
|
-
### Vector store API from positional to
|
|
389
|
+
### Vector store API from positional arguments to arguments by name
|
|
390
390
|
|
|
391
391
|
All vector store methods now use an arguments object instead of positional arguments. This makes each value's purpose visible at the call site and lets method signatures evolve without relying on argument order.
|
|
392
392
|
|
|
@@ -430,7 +430,7 @@ To migrate, rename the methods and pass an arguments object.
|
|
|
430
430
|
|
|
431
431
|
### PGVector constructor from connection string to object
|
|
432
432
|
|
|
433
|
-
The PGVector constructor now requires object parameters instead of a connection string.
|
|
433
|
+
The PGVector constructor now requires object parameters instead of a connection string. Object parameters align the API across storage adapters.
|
|
434
434
|
|
|
435
435
|
To migrate, pass the connection string as an object property.
|
|
436
436
|
|
|
@@ -484,7 +484,7 @@ const pgStore = new PostgresStore({
|
|
|
484
484
|
|
|
485
485
|
### Score storage methods to `listScoresBy*` pattern
|
|
486
486
|
|
|
487
|
-
Score storage APIs have been renamed to follow the `listScoresBy*` pattern.
|
|
487
|
+
Score storage APIs have been renamed to follow the `listScoresBy*` pattern. The new names follow the broader API naming conventions.
|
|
488
488
|
|
|
489
489
|
To migrate, update method names from `getScores` to `listScoresByScorerId` and related variants.
|
|
490
490
|
|
|
@@ -500,7 +500,7 @@ To migrate, update method names from `getScores` to `listScoresByScorerId` and r
|
|
|
500
500
|
|
|
501
501
|
### Non-paginated storage functions
|
|
502
502
|
|
|
503
|
-
Non-paginated storage functions have been removed in favor of paginated versions. All list operations now use pagination, though you can fetch all records with `perPage: false`.
|
|
503
|
+
Non-paginated storage functions have been removed in favor of paginated versions. All list operations now use pagination, though you can fetch all records with `perPage: false`. Pagination aligns list operations across the API and prevents accidental loading of large datasets.
|
|
504
504
|
|
|
505
505
|
To migrate, use paginated methods via domain stores. For fetching all records, use `perPage: false`.
|
|
506
506
|
|
|
@@ -32,7 +32,7 @@ createTool({
|
|
|
32
32
|
|
|
33
33
|
### `createTool` context properties organization
|
|
34
34
|
|
|
35
|
-
Context properties in `createTool` are now organized into namespaces. Agent-specific properties are under `context.agent`, workflow-specific properties are under `context.workflow`, and MCP-specific properties are under `context.mcp`.
|
|
35
|
+
Context properties in `createTool` are now organized into namespaces. Agent-specific properties are under `context.agent`, workflow-specific properties are under `context.workflow`, and MCP-specific properties are under `context.mcp`. The namespaces organize these properties under a clearer API surface.
|
|
36
36
|
|
|
37
37
|
For tools that are executed inside an agent, access agent-specific properties through `context.agent`.
|
|
38
38
|
|
|
@@ -78,7 +78,7 @@ Force-flushes any buffered LLM Observability data to Datadog without shutting do
|
|
|
78
78
|
async shutdown(): Promise<void>
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
Force-finishes any APM spans that weren't properly closed
|
|
81
|
+
Force-finishes any APM spans that weren't properly closed and flushes pending LLM Observability data. It then disables the integration and clears all internal state.
|
|
82
82
|
|
|
83
83
|
## Usage examples
|
|
84
84
|
|
|
@@ -146,7 +146,7 @@ Tags are stored as a JSON-stringified array in the `mastra.tags` span attribute:
|
|
|
146
146
|
}
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
The format is compatible with all OTEL-compatible backends and collectors.
|
|
150
150
|
|
|
151
151
|
## Related
|
|
152
152
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# ArizeExporter
|
|
4
4
|
|
|
5
|
-
Sends Tracing data to Arize Phoenix
|
|
5
|
+
Sends Tracing data to Arize Phoenix or Arize AX, as well as any OpenTelemetry-compatible observability platform that supports OpenInference semantic conventions.
|
|
6
6
|
|
|
7
7
|
## Constructor
|
|
8
8
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Added in:** `@mastra/observability@1.8.0`. **Deprecated in `1.12.0`** in favor of [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter).
|
|
6
6
|
|
|
7
|
-
> **Deprecated:** `CloudExporter` is retained for backward compatibility and will be removed in a future major version. Use [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for new projects. Both classes share the same constructor, environment variables, and runtime behavior
|
|
7
|
+
> **Deprecated:** `CloudExporter` is retained for backward compatibility and will be removed in a future major version. Use [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for new projects. Both classes share the same constructor, environment variables, and runtime behavior. `CloudExporter` keeps its original `mastra-cloud-observability-exporter` exporter `name` and `CLOUD_EXPORTER_*` error IDs so monitoring rules built against it keep working.
|
|
8
8
|
|
|
9
9
|
Sends tracing spans, logs, metrics, scores, and feedback to the Mastra platform for online visualization and monitoring.
|
|
10
10
|
|
|
@@ -183,7 +183,7 @@ The exporter batches tracing spans, logs, metrics, scores, and feedback for effi
|
|
|
183
183
|
### Signal Processing
|
|
184
184
|
|
|
185
185
|
- `exportTracingEvent()` only exports `SPAN_ENDED` tracing events
|
|
186
|
-
- `onLogEvent()`, `onMetricEvent()`, `onScoreEvent()`, and `onFeedbackEvent()` buffer every event they receive for
|
|
186
|
+
- `onLogEvent()`, `onMetricEvent()`, `onScoreEvent()`, and `onFeedbackEvent()` buffer every event they receive for that signal type
|
|
187
187
|
- All supported signal batches are uploaded to their matching Cloud publish endpoints during `flush()` and `shutdown()`
|
|
188
188
|
|
|
189
189
|
## `MastraCloudSpanRecord`
|
|
@@ -199,7 +199,7 @@ The probe timer doesn't keep the Node.js process alive, so short-lived and serve
|
|
|
199
199
|
### Signal Processing
|
|
200
200
|
|
|
201
201
|
- `exportTracingEvent()` only exports `SPAN_ENDED` tracing events
|
|
202
|
-
- `onLogEvent()`, `onMetricEvent()`, `onScoreEvent()`, and `onFeedbackEvent()` buffer every event they receive for
|
|
202
|
+
- `onLogEvent()`, `onMetricEvent()`, `onScoreEvent()`, and `onFeedbackEvent()` buffer every event they receive for that signal type
|
|
203
203
|
- All supported signal batches are uploaded to their matching publish endpoints during `flush()` and `shutdown()`
|
|
204
204
|
|
|
205
205
|
## Span wire format
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# OtelExporter
|
|
4
4
|
|
|
5
|
-
Sends traces and logs to any OpenTelemetry-compatible observability platform. Traces use the standardized GenAI semantic conventions
|
|
5
|
+
Sends traces and logs to any OpenTelemetry-compatible observability platform. Traces use the standardized GenAI semantic conventions. Logs carry their original severity and message body and are correlated to traces via both the OTEL log record's native trace context and `mastra.traceId` / `mastra.spanId` attributes.
|
|
6
6
|
|
|
7
7
|
## Constructor
|
|
8
8
|
|
|
@@ -51,7 +51,7 @@ Force flushes any pending spans to Sentry without shutting down the exporter. Wa
|
|
|
51
51
|
async shutdown(): Promise<void>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Ends all active spans
|
|
54
|
+
Ends all active spans and clears internal state before closing the Sentry connection. Waits up to 2 seconds for pending data to be sent.
|
|
55
55
|
|
|
56
56
|
## Usage
|
|
57
57
|
|
|
@@ -57,7 +57,7 @@ new SensitiveDataFilter(options?: SensitiveDataFilterOptions)
|
|
|
57
57
|
|
|
58
58
|
**redactionToken** (`string`): Replacement value used for full redaction and short values under partial redaction. (Default: `'[REDACTED]'`)
|
|
59
59
|
|
|
60
|
-
**redactionStyle** (`'full' | 'partial'`): Controls
|
|
60
|
+
**redactionStyle** (`'full' | 'partial' | 'indexed'`): Controls how matched values are redacted. (Default: `'full'`)
|
|
61
61
|
|
|
62
62
|
```typescript
|
|
63
63
|
interface SensitiveDataFilterOptions {
|
|
@@ -66,7 +66,7 @@ interface SensitiveDataFilterOptions {
|
|
|
66
66
|
redactionStyle?: RedactionStyle
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
type RedactionStyle = 'full' | 'partial'
|
|
69
|
+
type RedactionStyle = 'full' | 'partial' | 'indexed'
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
## Redaction styles
|
|
@@ -101,6 +101,30 @@ const filter = new SensitiveDataFilter({
|
|
|
101
101
|
{ "apiKey": "sk-…789" }
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
### Indexed redaction
|
|
105
|
+
|
|
106
|
+
Indexed redaction replaces each unique value with a stable token derived from the first field name that matched it, for example `[APIKEY_1]`. The same value maps to the same token across the spans of a trace while the trace's mapping is retained, so redacted values stay correlatable without exposing the raw value. Later occurrences under other sensitive fields reuse the first token.
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
const filter = new SensitiveDataFilter({
|
|
110
|
+
redactionStyle: 'indexed',
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```jsonc
|
|
115
|
+
// Before (two spans in the same trace)
|
|
116
|
+
[{ "apiKey": "sk-alice-key" }, { "apiKey": "sk-bob-key" }]
|
|
117
|
+
|
|
118
|
+
// After
|
|
119
|
+
[{ "apiKey": "[APIKEY_1]" }, { "apiKey": "[APIKEY_2]" }]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The mapping is scoped per trace. Numbering restarts for each trace, so tokens from different traces can't be linked.
|
|
123
|
+
|
|
124
|
+
State is bounded in two ways. The filter keeps mappings for the 1000 most recently used traces. The least recently used trace is evicted beyond that, and spans arriving for an evicted trace start a fresh mapping, so later values may receive new tokens. Each trace also tracks up to 1000 unique values. Once that cap is reached, already-tracked values keep their tokens and new values are redacted with `redactionToken`.
|
|
125
|
+
|
|
126
|
+
Non-string values are converted to strings before a token is assigned.
|
|
127
|
+
|
|
104
128
|
## Field matching
|
|
105
129
|
|
|
106
130
|
Field names are lowercased and stripped of non-alphanumeric characters before comparison:
|
|
@@ -165,7 +189,7 @@ Returns: `AnySpan`
|
|
|
165
189
|
|
|
166
190
|
#### `shutdown()`
|
|
167
191
|
|
|
168
|
-
Completes processor shutdown
|
|
192
|
+
Completes processor shutdown and clears the per-trace state used by indexed redaction.
|
|
169
193
|
|
|
170
194
|
```typescript
|
|
171
195
|
await filter.shutdown()
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# BatchPartsProcessor
|
|
4
4
|
|
|
5
|
-
The `BatchPartsProcessor` is an **output processor** that batches multiple stream parts together to reduce the frequency of emissions during streaming. This processor is useful for reducing network overhead
|
|
5
|
+
The `BatchPartsProcessor` is an **output processor** that batches multiple stream parts together to reduce the frequency of emissions during streaming. This processor is useful for reducing network overhead and consolidating small text chunks for users, while controlling emissions to optimize streaming performance.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -40,7 +40,7 @@ const processor = new LanguageDetector({
|
|
|
40
40
|
|
|
41
41
|
**options.includeDetectionDetails** (`boolean`): Whether to include detailed detection info in logs
|
|
42
42
|
|
|
43
|
-
**options.translationQuality** (`'speed' | 'quality' | 'balanced'`):
|
|
43
|
+
**options.translationQuality** (`'speed' | 'quality' | 'balanced'`): Deprecated. This option previously selected prompt-level "Quality Level" guidance, but that behavior was removed when the detection and translation prompts were streamlined. The option now has no effect. For model-specific speed and quality controls, use providerOptions when your provider supports them.
|
|
44
44
|
|
|
45
45
|
**options.providerOptions** (`ProviderOptions`): Provider-specific options passed to the internal detection agent. Use this to control model behavior like reasoning effort for thinking models (e.g., { openai: { reasoningEffort: 'low' } })
|
|
46
46
|
|
|
@@ -74,7 +74,6 @@ export const agent = new Agent({
|
|
|
74
74
|
'Detect language and translate non-English content to English while preserving original intent',
|
|
75
75
|
minTextLength: 10,
|
|
76
76
|
includeDetectionDetails: true,
|
|
77
|
-
translationQuality: 'quality',
|
|
78
77
|
}),
|
|
79
78
|
],
|
|
80
79
|
})
|
|
@@ -78,17 +78,17 @@ Processor methods run at different points in the agent execution lifecycle:
|
|
|
78
78
|
└────────────────────────────────────────────────────────────────────┘
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
| Method | When it runs
|
|
82
|
-
| --------------------- |
|
|
83
|
-
| `processInput` | Once at the start, before the agentic loop
|
|
84
|
-
| `processInputStep` | At each step of the agentic loop, before each LLM call
|
|
85
|
-
| `processLLMRequest` | After LLM request conversion, before the provider call
|
|
86
|
-
| `processAPIError` | When an LLM API call fails
|
|
87
|
-
| `processOutputStream` | On each streaming chunk during LLM response
|
|
88
|
-
| `processLLMResponse` | After the LLM step completes and stream chunks are collected
|
|
89
|
-
| `processOutputStep` | After each LLM response, before tool execution
|
|
90
|
-
| `processToolResult` | Per tool, after
|
|
91
|
-
| `processOutputResult` | Once after generation completes
|
|
81
|
+
| Method | When it runs | Use case |
|
|
82
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
|
|
83
|
+
| `processInput` | Once at the start, before the agentic loop | Validate/transform initial user input, add context |
|
|
84
|
+
| `processInputStep` | At each step of the agentic loop, before each LLM call | Transform messages between steps, handle tool results |
|
|
85
|
+
| `processLLMRequest` | After LLM request conversion, before the provider call | Rewrite the outbound `LanguageModelV2Prompt` for the current call without persisting changes |
|
|
86
|
+
| `processAPIError` | When an LLM API call fails | Inspect API rejections, optionally mutate state/messages, and request a retry |
|
|
87
|
+
| `processOutputStream` | On each streaming chunk during LLM response | Filter/modify streaming content, detect patterns in real-time |
|
|
88
|
+
| `processLLMResponse` | After the LLM step completes and stream chunks are collected | Capture or cache the full response, run post-call side effects paired with `processLLMRequest` |
|
|
89
|
+
| `processOutputStep` | After each LLM response, before tool execution | Validate output quality, implement guardrails with retry |
|
|
90
|
+
| `processToolResult` | Per tool, after a locally executed tool returns or a provider-executed result arrives, before the raw result is persisted to `messageList` | Inspect tool output and enforce security policies |
|
|
91
|
+
| `processOutputResult` | Once after generation completes | Post-process final response, log results |
|
|
92
92
|
|
|
93
93
|
## Interface definition
|
|
94
94
|
|
|
@@ -212,7 +212,7 @@ function getText(message: MastraDBMessage): string {
|
|
|
212
212
|
|
|
213
213
|
Key points:
|
|
214
214
|
|
|
215
|
-
- `message.content.parts` is the primary source. A single message can contain multiple parts
|
|
215
|
+
- `message.content.parts` is the primary source. A single message can contain multiple parts. Non-text parts include tool calls and tool results, plus file parts. Filter by `part.type === 'text'` before reading `part.text`.
|
|
216
216
|
- `message.content.content` is a flattened string kept for backward compatibility. Use it only as a fallback when `parts` is empty or missing.
|
|
217
217
|
- `message.content` itself is never a plain string on `MastraDBMessage`. Legacy `CoreMessage` shapes may be strings, but processors always receive `MastraDBMessage`.
|
|
218
218
|
|
|
@@ -365,7 +365,7 @@ System messages are **reset to their original values** at the start of each step
|
|
|
365
365
|
#### Use cases
|
|
366
366
|
|
|
367
367
|
- Dynamic model switching based on step number or context
|
|
368
|
-
- Disabling tools after a
|
|
368
|
+
- Disabling tools after a configured number of steps
|
|
369
369
|
- Dynamically adding or replacing tools based on conversation context
|
|
370
370
|
- Transforming message part types between providers (e.g., `reasoning` → `thinking` for Anthropic)
|
|
371
371
|
- Modifying messages based on step number or accumulated context
|
|
@@ -708,11 +708,11 @@ export class QualityGuardrail implements Processor {
|
|
|
708
708
|
|
|
709
709
|
### `processToolResult`
|
|
710
710
|
|
|
711
|
-
Processes a tool's result after
|
|
711
|
+
Processes a tool's result after a locally executed tool returns or a provider-executed result arrives, before the raw result is persisted to `messageList` or fed to the next LLM call. Symmetric with `processOutputStep`, which fires before tool execution. Use this method to enforce security policies on tool output. For example, scan for prompt injection or redact sensitive fields. Call `abort('reason', { retry: true })` to abort and retry the same step.
|
|
712
712
|
|
|
713
|
-
To replace the tool's result, mutate `messageList` in place via `messageList.updateToolInvocation`. The runtime re-reads the post-processor result from the message list and overwrites the downstream tool-result stream chunk before it
|
|
713
|
+
To replace the tool's result, mutate `messageList` in place via `messageList.updateToolInvocation`. The runtime re-reads the post-processor result from the message list and overwrites the downstream tool-result stream chunk before it's enqueued, so streaming clients see the processed value.
|
|
714
714
|
|
|
715
|
-
This method
|
|
715
|
+
This method doesn't fire when `tool.execute()` throws. It's called only for successful tool executions where a result is available.
|
|
716
716
|
|
|
717
717
|
```typescript
|
|
718
718
|
processToolResult?(args: ProcessToolResultArgs): ProcessorMessageResult;
|
|
@@ -49,7 +49,7 @@ For retryable errors with a `Retry-After` response header, the processor reads c
|
|
|
49
49
|
|
|
50
50
|
## Retry unknown errors
|
|
51
51
|
|
|
52
|
-
Set `retryUnknownErrors` to retry errors that don't match provider metadata
|
|
52
|
+
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 authorization failures, including HTTP `401` and `403` responses, aren't retried:
|
|
53
53
|
|
|
54
54
|
```typescript
|
|
55
55
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -105,7 +105,7 @@ export const agent = new Agent({
|
|
|
105
105
|
|
|
106
106
|
## Default OpenAI Responses matcher
|
|
107
107
|
|
|
108
|
-
`isRetryableOpenAIResponsesStreamError` matches OpenAI Responses stream error chunks with `type: 'error'` or `type: 'response.failed'`. It retries known transient OpenAI error codes
|
|
108
|
+
`isRetryableOpenAIResponsesStreamError` matches OpenAI Responses stream error chunks with `type: 'error'` or `type: 'response.failed'`. It retries known transient OpenAI error codes. As a fallback, it retries errors with explicit retry guidance such as `You can retry your request`.
|
|
109
109
|
|
|
110
110
|
`StreamErrorRetryProcessor` includes this matcher by default. You can also import it and reuse it in custom retry logic.
|
|
111
111
|
|
|
@@ -127,7 +127,7 @@ const { embeddings } = await embedMany({
|
|
|
127
127
|
})
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
> **Vector Database Compatibility:** When storing embeddings, the vector database index
|
|
130
|
+
> **Vector Database Compatibility:** When storing embeddings, configure the vector database index to match the output size of your embedding model to avoid errors or data corruption from mismatched dimensions.
|
|
131
131
|
|
|
132
132
|
## Example: Complete pipeline
|
|
133
133
|
|
|
@@ -201,7 +201,7 @@ const results = await store.query({
|
|
|
201
201
|
### Amazon S3 Vectors
|
|
202
202
|
|
|
203
203
|
- Equality values must be primitives (string/number/boolean). `null`/`undefined`, arrays, objects, and Date aren't allowed for equality. Range operators accept numbers or Date (Dates are normalized to epoch ms).
|
|
204
|
-
- `$in`/`$nin` require **non-empty arrays of primitives
|
|
204
|
+
- `$in`/`$nin` require **non-empty arrays of primitives**. Date elements are allowed and normalized to epoch ms. **Array equality** isn't supported.
|
|
205
205
|
- Implicit AND is canonicalized (`{a:1,b:2}` → `{$and:[{a:1},{b:2}]`). Logical operators must contain field conditions and use non-empty arrays. They may appear only at the root or within other logical operators (not inside field values).
|
|
206
206
|
- Keys listed in `nonFilterableMetadataKeys` at index creation are stored but not filterable. This setting is immutable.
|
|
207
207
|
- $exists requires a boolean value.
|
|
@@ -76,7 +76,7 @@ app.listen(3000, () => {
|
|
|
76
76
|
|
|
77
77
|
## Error handling
|
|
78
78
|
|
|
79
|
-
The Koa adapter propagates errors from route handlers up through Koa's middleware chain, following Koa's standard error handling pattern.
|
|
79
|
+
The Koa adapter propagates errors from route handlers up through Koa's middleware chain, following Koa's standard error handling pattern. You can use regular Koa error-handling middleware:
|
|
80
80
|
|
|
81
81
|
```typescript
|
|
82
82
|
const app = new Koa()
|
|
@@ -100,7 +100,7 @@ Returns: `boolean`
|
|
|
100
100
|
|
|
101
101
|
#### `handleWebhook(request)`
|
|
102
102
|
|
|
103
|
-
Process an incoming webhook request. Extracts the resource ID from the payload
|
|
103
|
+
Process an incoming webhook request. Extracts the resource ID from the payload and finds matching subscriptions. It builds a notification for each subscription and calls `notify()`.
|
|
104
104
|
|
|
105
105
|
```typescript
|
|
106
106
|
const result = await webhookProvider.handleWebhook({
|
|
@@ -234,7 +234,7 @@ const storage = new MongoDBStore({
|
|
|
234
234
|
|
|
235
235
|
`prune()` deletes rows but doesn't shrink the database file. On SQLite/libSQL the freed pages go on a freelist and are reused by future writes, so the file stops growing: for most users this alone solves the unbounded-growth problem.
|
|
236
236
|
|
|
237
|
-
Handing that free space back to the OS is a separate concern that Mastra doesn't manage. If you specifically need to shrink the file, run the underlying database's compaction (for example `VACUUM` on self-hosted libSQL) yourself in a maintenance window. A full `VACUUM` locks the file and needs roughly twice the file size in free disk. On PostgreSQL, autovacuum reclaims dead tuples for reuse automatically
|
|
237
|
+
Handing that free space back to the OS is a separate concern that Mastra doesn't manage. If you specifically need to shrink the file, run the underlying database's compaction (for example `VACUUM` on self-hosted libSQL) yourself in a maintenance window. A full `VACUUM` locks the file and needs roughly twice the file size in free disk. On PostgreSQL, autovacuum reclaims dead tuples for reuse automatically. A manual `VACUUM FULL` is only needed if you must return disk to the OS.
|
|
238
238
|
|
|
239
239
|
For MongoDB, deleted documents are reused by future insertions. To reclaim disk space, run [`db.runCommand({ compact: "collection_name" })`](https://www.mongodb.com/docs/manual/reference/command/compact/) during a maintenance window.
|
|
240
240
|
|
|
@@ -65,7 +65,7 @@ The tool returns an object with:
|
|
|
65
65
|
| ---------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
66
|
| `content` | `string` | The text content of the retrieved passage. |
|
|
67
67
|
| `source` | `string \| undefined` | The source URI when Bedrock provides one. Agentic retrieval only includes this field when the result metadata contains `_source_uri`. |
|
|
68
|
-
| `score` | `number \| undefined` | The relevance score returned by standard retrieval
|
|
68
|
+
| `score` | `number \| undefined` | The relevance score returned by standard retrieval, which the agentic API omits from result items. |
|
|
69
69
|
| `metadata` | `Record<string, unknown>` | Additional metadata from the retrieval result. |
|
|
70
70
|
|
|
71
71
|
## Retrieval Modes
|