@mastra/mcp-docs-server 1.1.46-alpha.2 → 1.1.46-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/agent-builder/browser.md +1 -1
- package/.docs/docs/agent-builder/channels.md +1 -1
- package/.docs/docs/agent-builder/integrations.md +73 -0
- package/.docs/docs/agent-builder/overview.md +1 -0
- package/.docs/docs/agents/adding-voice.md +1 -1
- package/.docs/docs/agents/agent-approval.md +2 -2
- package/.docs/docs/agents/background-tasks.md +1 -1
- package/.docs/docs/agents/channels.md +2 -2
- package/.docs/docs/agents/code-mode.md +20 -56
- package/.docs/docs/agents/overview.md +1 -0
- package/.docs/docs/agents/sdk-agents.md +165 -1
- package/.docs/docs/agents/supervisor-agents.md +40 -2
- package/.docs/docs/agents/using-tools.md +59 -1
- package/.docs/docs/browser/agent-browser.md +1 -1
- package/.docs/docs/browser/browser-viewer.md +22 -15
- package/.docs/docs/browser/overview.md +1 -1
- package/.docs/docs/browser/stagehand.md +1 -1
- package/.docs/docs/editor/overview.md +6 -6
- package/.docs/docs/editor/prompts.md +3 -3
- package/.docs/docs/editor/tools.md +2 -2
- package/.docs/docs/evals/evals-with-memory.md +8 -8
- package/.docs/docs/mastra-platform/observability.md +1 -1
- package/.docs/docs/mastra-platform/server.md +1 -1
- package/.docs/docs/mcp/mcp-apps.md +4 -4
- package/.docs/docs/memory/observational-memory.md +1 -1
- package/.docs/docs/memory/working-memory.md +2 -2
- package/.docs/docs/observability/integrations/bridges/datadog.md +1 -1
- package/.docs/docs/observability/integrations/bridges/otel.md +1 -1
- package/.docs/docs/observability/integrations/exporters/laminar.md +1 -1
- package/.docs/docs/observability/integrations/exporters/langfuse.md +26 -1
- package/.docs/docs/observability/integrations/exporters/mastra-platform.md +1 -1
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +4 -4
- package/.docs/docs/observability/integrations/exporters/otel.md +1 -1
- package/.docs/docs/observability/integrations/overview.md +1 -1
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/metrics/overview.md +3 -3
- package/.docs/docs/observability/metrics/querying.md +2 -2
- package/.docs/docs/observability/storage.md +2 -2
- package/.docs/docs/observability/tracing/overview.md +1 -1
- package/.docs/docs/server/auth/fga.md +15 -15
- package/.docs/docs/server/auth/okta.md +2 -2
- package/.docs/docs/server/auth/workos.md +1 -1
- package/.docs/docs/server/custom-api-routes.md +1 -1
- package/.docs/docs/server/pubsub.md +4 -4
- package/.docs/docs/studio/auth.md +1 -1
- package/.docs/docs/studio/observability.md +3 -1
- package/.docs/docs/workflows/scheduled-workflows.md +13 -13
- package/.docs/docs/workspace/filesystem.md +1 -1
- package/.docs/docs/workspace/lsp.md +1 -1
- package/.docs/docs/workspace/overview.md +35 -1
- package/.docs/docs/workspace/sandbox.md +4 -3
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +2 -2
- package/.docs/guides/deployment/aws-bedrock-agentcore.md +3 -3
- package/.docs/guides/deployment/inngest.md +5 -5
- package/.docs/guides/deployment/temporal.md +3 -3
- package/.docs/guides/getting-started/nestjs.md +1 -1
- package/.docs/guides/migrations/mastra-cloud.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +1 -1
- package/.docs/models/gateways/custom-gateways.md +57 -7
- package/.docs/reference/acp/acp-agent.md +2 -2
- package/.docs/reference/agents/agent.md +44 -0
- package/.docs/reference/agents/channels.md +1 -1
- package/.docs/reference/agents/durable-agent.md +2 -2
- package/.docs/reference/agents/generate.md +2 -0
- package/.docs/reference/agents/generateLegacy.md +2 -0
- package/.docs/reference/ai-sdk/handle-chat-stream.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
- package/.docs/reference/auth/okta.md +1 -1
- package/.docs/reference/auth/workos.md +1 -1
- package/.docs/reference/browser/agent-browser.md +1 -1
- package/.docs/reference/browser/browser-viewer.md +11 -9
- package/.docs/reference/browser/stagehand-browser.md +1 -1
- package/.docs/reference/cli/mastra.md +3 -1
- package/.docs/reference/client-js/responses.md +2 -2
- package/.docs/reference/client-js/workflows.md +1 -1
- package/.docs/reference/configuration.md +1 -1
- package/.docs/reference/core/mastra-model-gateway.md +15 -1
- package/.docs/reference/core/removeWorkspace.md +26 -0
- package/.docs/reference/editor/browser-provider.md +1 -1
- package/.docs/reference/editor/storage-browser-ref.md +3 -3
- package/.docs/reference/editor/storage-workspace-ref.md +1 -1
- package/.docs/reference/evals/rubric.md +113 -0
- package/.docs/reference/evals/trajectory-accuracy.md +3 -3
- package/.docs/reference/harness/harness-class.md +81 -62
- package/.docs/reference/index.md +5 -0
- package/.docs/reference/memory/serialized-memory-config.md +1 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +3 -3
- package/.docs/reference/observability/tracing/bridges/datadog.md +1 -1
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -3
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +5 -5
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/otel.md +1 -1
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +2 -2
- package/.docs/reference/processors/cost-guard-processor.md +2 -2
- package/.docs/reference/processors/processor-interface.md +4 -4
- package/.docs/reference/processors/response-cache.md +2 -2
- package/.docs/reference/processors/skill-search-processor.md +3 -3
- package/.docs/reference/processors/tool-search-processor.md +108 -4
- package/.docs/reference/pubsub/base.md +1 -1
- package/.docs/reference/pubsub/caching-pubsub.md +2 -2
- package/.docs/reference/pubsub/event-emitter.md +3 -3
- package/.docs/reference/pubsub/google-cloud-pubsub.md +1 -1
- package/.docs/reference/pubsub/redis-streams.md +1 -1
- package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
- package/.docs/reference/server/nestjs-adapter.md +2 -2
- package/.docs/reference/signals/task-signal-provider.md +62 -0
- package/.docs/reference/storage/clickhouse.md +49 -4
- package/.docs/reference/storage/composite.md +33 -1
- package/.docs/reference/storage/convex.md +2 -2
- package/.docs/reference/storage/dsql.md +7 -7
- package/.docs/reference/storage/duckdb.md +3 -3
- package/.docs/reference/storage/redis.md +3 -3
- package/.docs/reference/storage/spanner.md +7 -7
- package/.docs/reference/streaming/agents/stream.md +2 -0
- package/.docs/reference/streaming/agents/streamLegacy.md +2 -0
- package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
- package/.docs/reference/tools/brightdata.md +3 -3
- package/.docs/reference/tools/create-code-mode.md +124 -0
- package/.docs/reference/tools/create-tool.md +1 -1
- package/.docs/reference/tools/mcp-client.md +5 -5
- package/.docs/reference/tools/mcp-server.md +45 -0
- package/.docs/reference/tools/perplexity.md +4 -4
- package/.docs/reference/tools/tavily.md +3 -3
- package/.docs/reference/voice/aws-nova-sonic.md +1 -1
- package/.docs/reference/voice/google-gemini-live.md +1 -1
- package/.docs/reference/voice/inworld-realtime.md +5 -5
- package/.docs/reference/voice/inworld.md +1 -1
- package/.docs/reference/voice/sarvam.md +1 -1
- package/.docs/reference/workspace/agentcore-runtime-sandbox.md +7 -7
- package/.docs/reference/workspace/azure-blob-filesystem.md +2 -2
- package/.docs/reference/workspace/files-sdk-filesystem.md +3 -3
- package/.docs/reference/workspace/google-drive-filesystem.md +7 -7
- package/.docs/reference/workspace/modal-sandbox.md +1 -1
- package/.docs/reference/workspace/railway-sandbox.md +230 -0
- package/.docs/reference/workspace/vercel-microvm-sandbox.md +1 -1
- package/.docs/reference/workspace/vercel.md +2 -2
- package/.docs/reference/workspace/workspace-class.md +39 -3
- package/CHANGELOG.md +17 -0
- package/dist/chunk-GLPCVXXO.js +2075 -0
- package/dist/chunk-GLPCVXXO.js.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/stdio.js +1 -2070
- package/dist/stdio.js.map +1 -1
- package/package.json +4 -4
|
@@ -166,10 +166,9 @@ const displayState = harness.getDisplayState()
|
|
|
166
166
|
|
|
167
167
|
Restore the task portion of `HarnessDisplayState` after a UI replays persisted task tool history. This emits `display_state_changed` without emitting a live `task_updated` event.
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
The task list itself is held in the thread-scoped `tasks` storage domain (the task store) and projected onto the agent state-signal lane (`stateId: "tasks"`), not in Harness state, so this method only updates the display snapshot. Task tools read and write the task store directly; you no longer need to seed `setState({ tasks })`.
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
|
-
await harness.setState({ tasks: replayedTasks })
|
|
173
172
|
harness.restoreDisplayTasks(replayedTasks)
|
|
174
173
|
```
|
|
175
174
|
|
|
@@ -476,31 +475,50 @@ harness.respondToToolApproval({ decision: 'approve' })
|
|
|
476
475
|
harness.respondToToolApproval({ decision: 'decline' })
|
|
477
476
|
```
|
|
478
477
|
|
|
479
|
-
###
|
|
478
|
+
### Tool suspensions and plans
|
|
480
479
|
|
|
481
|
-
#### `
|
|
480
|
+
#### `respondToToolSuspension({ resumeData, toolCallId?, requestContext? })`
|
|
482
481
|
|
|
483
|
-
Respond to a pending
|
|
482
|
+
Respond to a pending tool suspension. Interactive built-in tools such as `ask_user` and `request_access` pause through the native tool-suspension primitive, which emits a `tool_suspended` event carrying `toolCallId`, `toolName`, and `suspendPayload`. Pass `resumeData` to resume the suspended tool with the user's response.
|
|
483
|
+
|
|
484
|
+
Provide `toolCallId` to select which suspension to resume. It is required when more than one tool is suspended at the same time (for example, parallel `ask_user` calls). When omitted, it resolves to the sole pending suspension.
|
|
484
485
|
|
|
485
486
|
```typescript
|
|
486
|
-
harness.
|
|
487
|
+
harness.subscribe(event => {
|
|
488
|
+
if (event.type === 'tool_suspended' && event.toolName === 'ask_user') {
|
|
489
|
+
const { question } = event.suspendPayload as { question: string }
|
|
490
|
+
// Show `question` to the user, then resume the tool with their answer.
|
|
491
|
+
harness.respondToToolSuspension({
|
|
492
|
+
toolCallId: event.toolCallId,
|
|
493
|
+
resumeData: 'Yes, proceed with the refactor',
|
|
494
|
+
})
|
|
495
|
+
}
|
|
496
|
+
})
|
|
487
497
|
```
|
|
488
498
|
|
|
489
499
|
For multi-select questions, pass the selected option labels as a string array.
|
|
490
500
|
|
|
491
501
|
```typescript
|
|
492
|
-
harness.
|
|
502
|
+
harness.respondToToolSuspension({
|
|
503
|
+
toolCallId: event.toolCallId,
|
|
504
|
+
resumeData: ['Add tests', 'Update docs'],
|
|
505
|
+
})
|
|
493
506
|
```
|
|
494
507
|
|
|
495
|
-
####
|
|
508
|
+
#### Responding to a submitted plan
|
|
509
|
+
|
|
510
|
+
The `submit_plan` built-in tool pauses via the native tool-suspension primitive, so it surfaces through the same `tool_suspended` event as other interactive tools. Resume it with [`respondToToolSuspension`](#respondtotoolsuspension-resumedata-toolcallid-requestcontext-), passing a `resumeData` object with `action` (`'approved'` or `'rejected'`) and an optional `feedback` string.
|
|
496
511
|
|
|
497
|
-
|
|
512
|
+
On approval, the Harness automatically switches to its default (execution) mode. On rejection, the plan-mode run resumes so the agent can revise and submit again.
|
|
498
513
|
|
|
499
514
|
```typescript
|
|
500
|
-
harness.
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
515
|
+
harness.respondToToolSuspension({
|
|
516
|
+
toolCallId: event.toolCallId,
|
|
517
|
+
resumeData: { action: 'approved' },
|
|
518
|
+
})
|
|
519
|
+
harness.respondToToolSuspension({
|
|
520
|
+
toolCallId: event.toolCallId,
|
|
521
|
+
resumeData: { action: 'rejected', feedback: 'Needs more detail' },
|
|
504
522
|
})
|
|
505
523
|
```
|
|
506
524
|
|
|
@@ -767,7 +785,7 @@ unsubscribe()
|
|
|
767
785
|
|
|
768
786
|
Returns: `() => void`
|
|
769
787
|
|
|
770
|
-
`subscribeDisplayState()`
|
|
788
|
+
`subscribeDisplayState()` doesn't call the listener immediately. Call [`getDisplayState`](#getdisplaystate) first if the UI needs an initial render before the next harness event.
|
|
771
789
|
|
|
772
790
|
#### `subscribe(listener)`
|
|
773
791
|
|
|
@@ -798,48 +816,46 @@ unsubscribe()
|
|
|
798
816
|
|
|
799
817
|
The harness emits events through registered listeners. The following table lists the available event types:
|
|
800
818
|
|
|
801
|
-
| Event type | Description
|
|
802
|
-
| -------------------------- |
|
|
803
|
-
| `mode_changed` | The active mode changed.
|
|
804
|
-
| `model_changed` | The active model changed.
|
|
805
|
-
| `thread_changed` | The active thread changed.
|
|
806
|
-
| `thread_created` | A new thread was created.
|
|
807
|
-
| `thread_deleted` | A thread was deleted.
|
|
808
|
-
| `state_changed` | Harness state was updated.
|
|
809
|
-
| `agent_start` | The agent started processing.
|
|
810
|
-
| `agent_end` | The agent finished processing.
|
|
811
|
-
| `message_start` | A new message started streaming.
|
|
812
|
-
| `message_update` | A message was updated with new content.
|
|
813
|
-
| `message_end` | A message finished streaming.
|
|
814
|
-
| `tool_start` | A tool call started.
|
|
815
|
-
| `tool_approval_required` | A tool call requires user approval.
|
|
816
|
-
| `
|
|
817
|
-
| `
|
|
818
|
-
| `
|
|
819
|
-
| `
|
|
820
|
-
| `
|
|
821
|
-
| `
|
|
822
|
-
| `
|
|
823
|
-
| `
|
|
824
|
-
| `
|
|
825
|
-
| `
|
|
826
|
-
| `
|
|
827
|
-
| `
|
|
828
|
-
| `
|
|
829
|
-
| `
|
|
830
|
-
| `
|
|
831
|
-
| `
|
|
832
|
-
| `
|
|
833
|
-
| `
|
|
834
|
-
| `
|
|
835
|
-
| `
|
|
836
|
-
| `
|
|
837
|
-
| `
|
|
838
|
-
| `
|
|
839
|
-
| `
|
|
840
|
-
| `
|
|
841
|
-
| `subagent_model_changed` | A subagent's model changed. |
|
|
842
|
-
| `task_updated` | A task list was updated. |
|
|
819
|
+
| Event type | Description |
|
|
820
|
+
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
821
|
+
| `mode_changed` | The active mode changed. |
|
|
822
|
+
| `model_changed` | The active model changed. |
|
|
823
|
+
| `thread_changed` | The active thread changed. |
|
|
824
|
+
| `thread_created` | A new thread was created. |
|
|
825
|
+
| `thread_deleted` | A thread was deleted. |
|
|
826
|
+
| `state_changed` | Harness state was updated. |
|
|
827
|
+
| `agent_start` | The agent started processing. |
|
|
828
|
+
| `agent_end` | The agent finished processing. |
|
|
829
|
+
| `message_start` | A new message started streaming. |
|
|
830
|
+
| `message_update` | A message was updated with new content. |
|
|
831
|
+
| `message_end` | A message finished streaming. |
|
|
832
|
+
| `tool_start` | A tool call started. |
|
|
833
|
+
| `tool_approval_required` | A tool call requires user approval. |
|
|
834
|
+
| `tool_suspended` | A tool paused via the native tool-suspension primitive (for example `ask_user`, `request_access`, or `submit_plan`). Includes `toolCallId`, `toolName`, and `suspendPayload`. Resume it with [`respondToToolSuspension`](#respondtotoolsuspension-resumedata-toolcallid-requestcontext-). |
|
|
835
|
+
| `tool_update` | A tool call was updated with progress. |
|
|
836
|
+
| `tool_end` | A tool call finished. |
|
|
837
|
+
| `tool_input_start` | Tool input started streaming. |
|
|
838
|
+
| `tool_input_delta` | Tool input received a streaming delta. |
|
|
839
|
+
| `tool_input_end` | Tool input finished streaming. |
|
|
840
|
+
| `usage_update` | Token usage was updated. |
|
|
841
|
+
| `error` | An error occurred. |
|
|
842
|
+
| `info` | An informational message was emitted. |
|
|
843
|
+
| `follow_up_queued` | A follow-up message was queued. |
|
|
844
|
+
| `workspace_status_changed` | The workspace status changed. |
|
|
845
|
+
| `workspace_ready` | The workspace finished initializing. |
|
|
846
|
+
| `workspace_error` | The workspace encountered an error. |
|
|
847
|
+
| `om_status` | Observational Memory status update. |
|
|
848
|
+
| `om_observation_start` | An observation started. |
|
|
849
|
+
| `om_observation_end` | An observation completed. |
|
|
850
|
+
| `om_reflection_start` | A reflection started. |
|
|
851
|
+
| `om_reflection_end` | A reflection completed. |
|
|
852
|
+
| `subagent_start` | A subagent started processing. |
|
|
853
|
+
| `subagent_text_delta` | A subagent emitted a text delta. |
|
|
854
|
+
| `subagent_tool_start` | A subagent started a tool call. |
|
|
855
|
+
| `subagent_tool_end` | A subagent finished a tool call. |
|
|
856
|
+
| `subagent_end` | A subagent finished processing. |
|
|
857
|
+
| `subagent_model_changed` | A subagent's model changed. |
|
|
858
|
+
| `task_updated` | A task list was updated. |
|
|
843
859
|
|
|
844
860
|
## Built-in tools
|
|
845
861
|
|
|
@@ -859,15 +875,18 @@ The harness provides built-in tools to agents in every mode:
|
|
|
859
875
|
|
|
860
876
|
The `ask_user` tool accepts `options` for choice prompts. Set `selectionMode` to `single_select` to let the user pick one option, or `multi_select` to let the user pick multiple options. When `options` are provided and `selectionMode` is omitted, the prompt defaults to `single_select`. Omit `options` for free-text questions.
|
|
861
877
|
|
|
862
|
-
The following example demonstrates a multi-select response handler. The UI reads `event.
|
|
878
|
+
The following example demonstrates a multi-select response handler. The tool pauses through the `tool_suspended` event, the UI reads `selectionMode` from `event.suspendPayload`, lets the user choose multiple options, then returns a string array with `respondToToolSuspension()`.
|
|
863
879
|
|
|
864
880
|
```typescript
|
|
865
881
|
harness.subscribe(event => {
|
|
866
|
-
if (event.type === '
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
882
|
+
if (event.type === 'tool_suspended' && event.toolName === 'ask_user') {
|
|
883
|
+
const { selectionMode } = event.suspendPayload as { selectionMode?: string }
|
|
884
|
+
if (selectionMode === 'multi_select') {
|
|
885
|
+
harness.respondToToolSuspension({
|
|
886
|
+
toolCallId: event.toolCallId,
|
|
887
|
+
resumeData: ['Add tests', 'Update docs'],
|
|
888
|
+
})
|
|
889
|
+
}
|
|
871
890
|
}
|
|
872
891
|
})
|
|
873
892
|
```
|
package/.docs/reference/index.md
CHANGED
|
@@ -92,6 +92,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
92
92
|
- [.listScorers()](https://mastra.ai/reference/core/listScorers)
|
|
93
93
|
- [.listVectors()](https://mastra.ai/reference/core/listVectors)
|
|
94
94
|
- [.listWorkflows()](https://mastra.ai/reference/core/listWorkflows)
|
|
95
|
+
- [.removeWorkspace()](https://mastra.ai/reference/core/removeWorkspace)
|
|
95
96
|
- [.setLogger()](https://mastra.ai/reference/core/setLogger)
|
|
96
97
|
- [.setStorage()](https://mastra.ai/reference/core/setStorage)
|
|
97
98
|
- [Cloudflare](https://mastra.ai/reference/deployer/cloudflare)
|
|
@@ -127,6 +128,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
127
128
|
- [Keyword Coverage Scorer](https://mastra.ai/reference/evals/keyword-coverage)
|
|
128
129
|
- [Noise Sensitivity Scorer](https://mastra.ai/reference/evals/noise-sensitivity)
|
|
129
130
|
- [Prompt Alignment Scorer](https://mastra.ai/reference/evals/prompt-alignment)
|
|
131
|
+
- [Rubric Scorer](https://mastra.ai/reference/evals/rubric)
|
|
130
132
|
- [Textual Difference Scorer](https://mastra.ai/reference/evals/textual-difference)
|
|
131
133
|
- [Tone Consistency Scorer](https://mastra.ai/reference/evals/tone-consistency)
|
|
132
134
|
- [Tool Call Accuracy Scorers](https://mastra.ai/reference/evals/tool-call-accuracy)
|
|
@@ -222,6 +224,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
222
224
|
- [Server Routes](https://mastra.ai/reference/server/routes)
|
|
223
225
|
- [createNotificationInboxTool()](https://mastra.ai/reference/signals/create-notification-inbox-tool)
|
|
224
226
|
- [SignalProvider](https://mastra.ai/reference/signals/signal-provider)
|
|
227
|
+
- [TaskSignalProvider](https://mastra.ai/reference/signals/task-signal-provider)
|
|
225
228
|
- [WebhookSignalProvider](https://mastra.ai/reference/signals/webhook-signal-provider)
|
|
226
229
|
- [Overview](https://mastra.ai/reference/storage/overview)
|
|
227
230
|
- [Aurora DSQL Storage](https://mastra.ai/reference/storage/dsql)
|
|
@@ -251,6 +254,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
251
254
|
- [.timeTravelStream()](https://mastra.ai/reference/streaming/workflows/timeTravelStream)
|
|
252
255
|
- [Overview](https://mastra.ai/reference/templates/overview)
|
|
253
256
|
- [Bright Data Tools](https://mastra.ai/reference/tools/brightdata)
|
|
257
|
+
- [createCodeMode()](https://mastra.ai/reference/tools/create-code-mode)
|
|
254
258
|
- [createDocumentChunkerTool()](https://mastra.ai/reference/tools/document-chunker-tool)
|
|
255
259
|
- [createGraphRAGTool()](https://mastra.ai/reference/tools/graph-rag-tool)
|
|
256
260
|
- [createTool()](https://mastra.ai/reference/tools/create-tool)
|
|
@@ -341,6 +345,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
341
345
|
- [LocalFilesystem](https://mastra.ai/reference/workspace/local-filesystem)
|
|
342
346
|
- [LocalSandbox](https://mastra.ai/reference/workspace/local-sandbox)
|
|
343
347
|
- [ModalSandbox](https://mastra.ai/reference/workspace/modal-sandbox)
|
|
348
|
+
- [RailwaySandbox](https://mastra.ai/reference/workspace/railway-sandbox)
|
|
344
349
|
- [S3Filesystem](https://mastra.ai/reference/workspace/s3-filesystem)
|
|
345
350
|
- [SandboxProcessManager](https://mastra.ai/reference/workspace/process-manager)
|
|
346
351
|
- [VercelMicroVMSandbox](https://mastra.ai/reference/workspace/vercel-microvm-sandbox)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`SerializedMemoryConfig` is the JSON-serializable subset of [`Memory`](https://mastra.ai/reference/memory/memory-class) configuration that lives on a stored agent record. The runtime hydrates it back into a `Memory` instance by resolving the vector and embedder IDs against the configured `Mastra` instance.
|
|
4
4
|
|
|
5
|
-
It
|
|
5
|
+
It's the type used by [`BuilderAgentDefaults.memory`](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) and by `EditorAgentNamespace.create({ memory })`.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ Two conditions must be true for a metric to reach storage:
|
|
|
15
15
|
1. `MastraStorageExporter` is configured as an exporter.
|
|
16
16
|
2. The storage backend supports metrics (ClickHouse or DuckDB).
|
|
17
17
|
|
|
18
|
-
If metrics aren't
|
|
18
|
+
If metrics aren't available, see [troubleshooting](#troubleshooting).
|
|
19
19
|
|
|
20
20
|
## Duration metrics
|
|
21
21
|
|
|
@@ -112,11 +112,11 @@ When you spot a spike in latency or token usage on the Metrics dashboard, correl
|
|
|
112
112
|
|
|
113
113
|
## Troubleshooting
|
|
114
114
|
|
|
115
|
-
### No metrics are
|
|
115
|
+
### No metrics are available
|
|
116
116
|
|
|
117
117
|
- **Observability is configured**: Verify that your `Mastra` instance has an `observability` config with at least one exporter.
|
|
118
118
|
- **`MastraStorageExporter` or `MastraPlatformExporter` is present**: Other exporters (Datadog, Langfuse, etc.) don't surface metrics in Mastra. `MastraStorageExporter` is required for the local Studio dashboard, and `MastraPlatformExporter` is required to view metrics in Mastra platform.
|
|
119
|
-
- **Storage supports metrics**: Metrics require an OLAP-capable store (ClickHouse or DuckDB). Row-oriented databases (PostgreSQL, LibSQL, MSSQL) and document stores (MongoDB)
|
|
119
|
+
- **Storage supports metrics**: Metrics require an OLAP-capable store (ClickHouse or DuckDB). Row-oriented databases (PostgreSQL, LibSQL, MSSQL) and document stores (MongoDB) aren't supported for metrics.
|
|
120
120
|
- **Sampling isn't 0%**: If sampling probability is `0` or strategy is `never`, all spans become no-ops and no metrics are extracted.
|
|
121
121
|
|
|
122
122
|
### Duration metrics are missing
|
|
@@ -121,7 +121,7 @@ new DatadogBridge({
|
|
|
121
121
|
})
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
Note: APM data
|
|
124
|
+
Note: APM data can't be sent in agentless mode. If you only need LLM Observability data without `dd-trace` APM, the [Datadog Exporter](https://mastra.ai/reference/observability/tracing/exporters/datadog) is a simpler choice.
|
|
125
125
|
|
|
126
126
|
### With Additional Exporters
|
|
127
127
|
|
|
@@ -104,7 +104,7 @@ async onMetricEvent(event: MetricEvent): Promise<void>
|
|
|
104
104
|
|
|
105
105
|
Processes metric signals for Cloud export.
|
|
106
106
|
|
|
107
|
-
Every `MetricEvent` passed to this handler is buffered and exported to the Cloud metrics endpoint derived from the configured base endpoint.
|
|
107
|
+
Every `MetricEvent` passed to this handler is buffered and exported to the Cloud metrics endpoint derived from the configured base endpoint. Additional filtering by metric subtype or status inside `CloudExporter` isn't performed; the exporter forwards every metric event it receives unless it's disabled.
|
|
108
108
|
|
|
109
109
|
**Returns:** `Promise<void>` after the metric event has been accepted for buffering.
|
|
110
110
|
|
|
@@ -116,7 +116,7 @@ async onScoreEvent(event: ScoreEvent): Promise<void>
|
|
|
116
116
|
|
|
117
117
|
Processes score signals for Cloud export.
|
|
118
118
|
|
|
119
|
-
Every `ScoreEvent` passed to this handler is buffered and exported to the Cloud scores endpoint derived from the configured base endpoint.
|
|
119
|
+
Every `ScoreEvent` passed to this handler is buffered and exported to the Cloud scores endpoint derived from the configured base endpoint. No extra filtering at the exporter layer beyond the disabled-exporter check is performed, so all score events received by this method are forwarded.
|
|
120
120
|
|
|
121
121
|
**Returns:** `Promise<void>` after the score event has been accepted for buffering.
|
|
122
122
|
|
|
@@ -128,7 +128,7 @@ async onFeedbackEvent(event: FeedbackEvent): Promise<void>
|
|
|
128
128
|
|
|
129
129
|
Processes feedback signals for Cloud export.
|
|
130
130
|
|
|
131
|
-
Every `FeedbackEvent` passed to this handler is buffered and exported to the Cloud feedback endpoint derived from the configured base endpoint.
|
|
131
|
+
Every `FeedbackEvent` passed to this handler is buffered and exported to the Cloud feedback endpoint derived from the configured base endpoint. No feedback-type filtering inside `CloudExporter` is performed; all feedback events received here are forwarded unless the exporter is disabled.
|
|
132
132
|
|
|
133
133
|
**Returns:** `Promise<void>` after the feedback event has been accepted for buffering.
|
|
134
134
|
|
|
@@ -132,7 +132,7 @@ Failed flushes are retried with exponential backoff:
|
|
|
132
132
|
- Maximum attempts: `maxRetries`
|
|
133
133
|
- Batch is dropped after all retries fail
|
|
134
134
|
|
|
135
|
-
When storage
|
|
135
|
+
When storage doesn't support a signal or retries are exhausted, `DefaultExporter` emits an `ObservabilityDropEvent` through `onDroppedEvent` handlers registered on exporters and bridges. The drop event includes the signal, reason, count, exporter name, storage name when known, and sanitized error details.
|
|
136
136
|
|
|
137
137
|
### Out-of-Order Handling
|
|
138
138
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Sends tracing spans, logs, metrics, scores, and feedback to the Mastra platform for online visualization and monitoring.
|
|
6
6
|
|
|
7
|
-
> **Note:** `MastraPlatformExporter` was previously called `CloudExporter`. The original `CloudExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it
|
|
7
|
+
> **Note:** `MastraPlatformExporter` was previously called `CloudExporter`. The original `CloudExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it's deprecated and will be removed in a future major version. New code should use `MastraPlatformExporter`.
|
|
8
8
|
|
|
9
9
|
## Constructor
|
|
10
10
|
|
|
@@ -106,7 +106,7 @@ async onMetricEvent(event: MetricEvent): Promise<void>
|
|
|
106
106
|
|
|
107
107
|
Processes metric signals for export.
|
|
108
108
|
|
|
109
|
-
Every `MetricEvent` passed to this handler is buffered and exported to the metrics endpoint derived from the configured base endpoint.
|
|
109
|
+
Every `MetricEvent` passed to this handler is buffered and exported to the metrics endpoint derived from the configured base endpoint. No additional filtering by metric subtype or status inside `MastraPlatformExporter` is performed; the exporter forwards every metric event it receives unless it's disabled.
|
|
110
110
|
|
|
111
111
|
**Returns:** `Promise<void>` after the metric event has been accepted for buffering.
|
|
112
112
|
|
|
@@ -118,7 +118,7 @@ async onScoreEvent(event: ScoreEvent): Promise<void>
|
|
|
118
118
|
|
|
119
119
|
Processes score signals for export.
|
|
120
120
|
|
|
121
|
-
Every `ScoreEvent` passed to this handler is buffered and exported to the scores endpoint derived from the configured base endpoint.
|
|
121
|
+
Every `ScoreEvent` passed to this handler is buffered and exported to the scores endpoint derived from the configured base endpoint. No extra filtering at the exporter layer beyond the disabled-exporter check is performed, so all score events received by this method are forwarded.
|
|
122
122
|
|
|
123
123
|
**Returns:** `Promise<void>` after the score event has been accepted for buffering.
|
|
124
124
|
|
|
@@ -130,7 +130,7 @@ async onFeedbackEvent(event: FeedbackEvent): Promise<void>
|
|
|
130
130
|
|
|
131
131
|
Processes feedback signals for export.
|
|
132
132
|
|
|
133
|
-
Every `FeedbackEvent` passed to this handler is buffered and exported to the feedback endpoint derived from the configured base endpoint.
|
|
133
|
+
Every `FeedbackEvent` passed to this handler is buffered and exported to the feedback endpoint derived from the configured base endpoint. No feedback-type filtering inside `MastraPlatformExporter` is performed; all feedback events received here are forwarded unless the exporter is disabled.
|
|
134
134
|
|
|
135
135
|
**Returns:** `Promise<void>` after the feedback event has been accepted for buffering.
|
|
136
136
|
|
|
@@ -190,7 +190,7 @@ Errors raised by `MastraPlatformExporter` use the `MASTRA_PLATFORM_EXPORTER_*` `
|
|
|
190
190
|
|
|
191
191
|
## Span wire format
|
|
192
192
|
|
|
193
|
-
The shape of each span sent to Mastra platform is documented here for reference only — it
|
|
193
|
+
The shape of each span sent to Mastra platform is documented here for reference only — it's not exported from `@mastra/observability` and shouldn't be imported. The exporter spreads the original `AnyExportedSpan` (so the source field names are preserved) and layers a small set of platform-friendly aliases on top:
|
|
194
194
|
|
|
195
195
|
```typescript
|
|
196
196
|
type MastraPlatformSpanRecord = AnyExportedSpan & {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Persists traces to Mastra's configured storage with automatic batching and retry logic.
|
|
4
4
|
|
|
5
|
-
> **Note:** `MastraStorageExporter` was previously called `DefaultExporter`. The original `DefaultExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it
|
|
5
|
+
> **Note:** `MastraStorageExporter` was previously called `DefaultExporter`. The original `DefaultExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it's deprecated and will be removed in a future major version. New code should use `MastraStorageExporter`.
|
|
6
6
|
|
|
7
7
|
## Constructor
|
|
8
8
|
|
|
@@ -161,7 +161,7 @@ const exporter = new OtelExporter({
|
|
|
161
161
|
|
|
162
162
|
## Protocol requirements
|
|
163
163
|
|
|
164
|
-
Different providers require different OTEL exporter packages. Trace and log export are independent: install only the trace package if you only need traces, or install both the trace and log packages for the chosen protocol if you also want log export. Zipkin
|
|
164
|
+
Different providers require different OTEL exporter packages. Trace and log export are independent: install only the trace package if you only need traces, or install both the trace and log packages for the chosen protocol if you also want log export. Zipkin doesn't support OTLP logs.
|
|
165
165
|
|
|
166
166
|
| Protocol | Trace package | Log package |
|
|
167
167
|
| ------------- | ------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
@@ -4,7 +4,7 @@ A SpanOutputProcessor that redacts sensitive information from span fields.
|
|
|
4
4
|
|
|
5
5
|
## Auto-applied by default
|
|
6
6
|
|
|
7
|
-
`Observability` automatically appends a `SensitiveDataFilter` to every configured instance's `spanOutputProcessors` so secrets are redacted before they reach exporters such as the Mastra cloud exporter. The filter runs last (after any user-provided processors) so that sensitive data introduced or surfaced by upstream processors is still redacted. You
|
|
7
|
+
`Observability` automatically appends a `SensitiveDataFilter` to every configured instance's `spanOutputProcessors` so secrets are redacted before they reach exporters such as the Mastra cloud exporter. The filter runs last (after any user-provided processors) so that sensitive data introduced or surfaced by upstream processors is still redacted. You don't need to add it manually unless you want to customize its options.
|
|
8
8
|
|
|
9
9
|
To opt out or customize the auto-applied filter, use the `sensitiveDataFilter` option on the [`Observability` registry config](https://mastra.ai/reference/observability/tracing/configuration):
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ new Observability({
|
|
|
22
22
|
})
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
If a config already includes a `SensitiveDataFilter` in `spanOutputProcessors`, the auto-applied filter is skipped to avoid double redaction. Pre-instantiated `ObservabilityInstance` values
|
|
25
|
+
If a config already includes a `SensitiveDataFilter` in `spanOutputProcessors`, the auto-applied filter is skipped to avoid double redaction. Pre-instantiated `ObservabilityInstance` values aren't modified — add a `SensitiveDataFilter` to their processors yourself if needed.
|
|
26
26
|
|
|
27
27
|
## Constructor
|
|
28
28
|
|
|
@@ -103,10 +103,10 @@ When the `block` strategy is active (default), `CostGuardProcessor` calls `abort
|
|
|
103
103
|
| `resource` | Yes | `resourceId` + time window | `resourceId` in `RequestContext` |
|
|
104
104
|
| `thread` | Yes | `threadId` + time window | `threadId` in `RequestContext` |
|
|
105
105
|
|
|
106
|
-
All scopes require observability storage with `getMetricAggregate` support. If the Mastra instance
|
|
106
|
+
All scopes require observability storage with `getMetricAggregate` support. If the Mastra instance doesn't have observability storage configured, an error is thrown at registration time.
|
|
107
107
|
|
|
108
108
|
For `run` scope, the processor reads the trace ID from the current span's tracing context. If no tracing context is available, the check is skipped (fail-open).
|
|
109
109
|
|
|
110
110
|
For `resource` and `thread` scopes, if the required context ID is missing at runtime, the check is skipped. Observability query failures are handled with a fail-open strategy: if a query fails, cost is treated as zero.
|
|
111
111
|
|
|
112
|
-
> **Note on metric persistence delay.** The observability pipeline uses buffered exporters that flush metrics asynchronously.
|
|
112
|
+
> **Note on metric persistence delay.** The observability pipeline uses buffered exporters that flush metrics asynchronously. A short delay exists between when an LLM call completes and when its cost metrics are available for query. During high-frequency agent execution, the cost guard may not detect a limit breach until one or more steps after the actual cost exceeded the threshold.
|
|
@@ -369,7 +369,7 @@ System messages are **reset to their original values** at the start of each step
|
|
|
369
369
|
|
|
370
370
|
Processes the final LLM request after Mastra converts the `MessageList` into `LanguageModelV2Prompt` and before the provider call. Use this method for transient, model-aware rewrites that should affect only the current outbound request.
|
|
371
371
|
|
|
372
|
-
Returned prompt changes are forwarded to the model for the current call only. They
|
|
372
|
+
Returned prompt changes are forwarded to the model for the current call only. They're not persisted back to `MessageList`, memory, UI history, or later provider calls.
|
|
373
373
|
|
|
374
374
|
```typescript
|
|
375
375
|
processLLMRequest?(
|
|
@@ -892,8 +892,8 @@ export class WordCounter implements Processor {
|
|
|
892
892
|
|
|
893
893
|
Every processor receives a `state` object in `processLLMRequest`, `processLLMResponse`, `processOutputStream`, `processOutputStep`, `processOutputResult`, and `processAPIError`. State has three important properties:
|
|
894
894
|
|
|
895
|
-
- **Per-processor**: Each processor gets its own `state` object, keyed by the processor's `id`. Two processors with different ids
|
|
896
|
-
- **Per-request**: A fresh state object is created at the start of every `agent.generate()` or `agent.stream()` call. State
|
|
895
|
+
- **Per-processor**: Each processor gets its own `state` object, keyed by the processor's `id`. Two processors with different ids can't read or overwrite each other's state.
|
|
896
|
+
- **Per-request**: A fresh state object is created at the start of every `agent.generate()` or `agent.stream()` call. State doesn't leak between requests or between users.
|
|
897
897
|
- **Shared across methods**: Within one request, the same `state` object is passed to `processLLMRequest` (before the provider call), `processLLMResponse` (after the step completes), `processOutputStream` (for every chunk), `processOutputStep` (after every LLM step), `processOutputResult` (once at the end), and `processAPIError` (when an LLM call fails). For example, `processLLMRequest` can stash a cache key and `processLLMResponse` can read it back to write the response.
|
|
898
898
|
|
|
899
899
|
Initialize fields defensively on first access, because `state` starts as an empty object:
|
|
@@ -957,7 +957,7 @@ await writer.custom({
|
|
|
957
957
|
})
|
|
958
958
|
```
|
|
959
959
|
|
|
960
|
-
By default, processors
|
|
960
|
+
By default, processors **don't** see `data-*` chunks in `processOutputStream` so they don't accidentally process tool telemetry or their own output. Opt in by setting `processDataParts: true` on the processor:
|
|
961
961
|
|
|
962
962
|
```typescript
|
|
963
963
|
class ModerationCollector implements Processor {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
The cache key is derived from the resolved `LanguageModelV2Prompt` Mastra is about to send to the model — i.e. _after_ memory has loaded and earlier input processors have transformed the prompt — so two users with different memory contexts produce different cache keys. Each step in an agentic tool loop is independently cached.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
No agent-level option for response caching exists; register `ResponseCache` explicitly on `inputProcessors`. Per-call overrides flow through `RequestContext` via [`ResponseCache.context()`](#static-helpers) and [`ResponseCache.applyContext()`](#static-helpers).
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
@@ -85,7 +85,7 @@ The shape passed to `ResponseCache.context()` / `ResponseCache.applyContext()`.
|
|
|
85
85
|
|
|
86
86
|
**bust** (`boolean`): Skip the cache read but still write on completion.
|
|
87
87
|
|
|
88
|
-
`cache`, `ttl`, and `agentId` are intentionally not overridable per call — they
|
|
88
|
+
`cache`, `ttl`, and `agentId` are intentionally not overridable per call — they're instance-level concerns that shouldn't vary per request.
|
|
89
89
|
|
|
90
90
|
## ResponseCacheKeyInputs
|
|
91
91
|
|
|
@@ -4,7 +4,7 @@ The `SkillSearchProcessor` is an **input processor** that enables on-demand skil
|
|
|
4
4
|
|
|
5
5
|
By default, when you attach only `SkillSearchProcessor` to an agent with a skill-enabled `Workspace`, the agent treats skills as on-demand:
|
|
6
6
|
|
|
7
|
-
- The default eager `SkillsProcessor`
|
|
7
|
+
- The default eager `SkillsProcessor` isn't auto-added.
|
|
8
8
|
- `search_skills` and `load_skill` are exposed for discovery and instruction loading.
|
|
9
9
|
- Overlapping `skill` and `skill_search` tools are hidden.
|
|
10
10
|
- `skill_read` remains available so the agent can read supporting skill files such as references, scripts, and assets.
|
|
@@ -90,11 +90,11 @@ The agent workflow is:
|
|
|
90
90
|
|
|
91
91
|
## Workspace file tools
|
|
92
92
|
|
|
93
|
-
`SkillSearchProcessor` loads skill instructions into the conversation. It
|
|
93
|
+
`SkillSearchProcessor` loads skill instructions into the conversation. It doesn't block workspace file tools from reading files.
|
|
94
94
|
|
|
95
95
|
Use `skill_read` for supporting files that belong to a loaded skill, such as files under `references/`, `scripts/`, or `assets/`.
|
|
96
96
|
|
|
97
|
-
Reserve workspace file tools such as `mastra_workspace_read_file` for explicit file inspection or editing workflows. During normal task execution, the agent
|
|
97
|
+
Reserve workspace file tools such as `mastra_workspace_read_file` for explicit file inspection or editing workflows. During normal task execution, the agent doesn't need to read the same `SKILL.md` file after `load_skill` succeeds.
|
|
98
98
|
|
|
99
99
|
## Compared to SkillsProcessor
|
|
100
100
|
|