@mastra/mcp-docs-server 1.1.46-alpha.3 → 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/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/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 +10 -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 +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BrowserViewer
|
|
2
2
|
|
|
3
|
-
The `@mastra/browser-viewer` package provides browser automation for CLI-based tools like [agent-browser](https://www.npmjs.com/package/agent-browser), [browser-use](https://pypi.org/project/browser-use/), and [browse](https://www.npmjs.com/package
|
|
3
|
+
The `@mastra/browser-viewer` package provides browser automation for CLI-based tools like [agent-browser](https://www.npmjs.com/package/agent-browser), [browser-use](https://pypi.org/project/browser-use/), and [browse](https://www.npmjs.com/package/browse). BrowserViewer launches Chrome via Playwright, exposes a Chrome DevTools Protocol (CDP) URL, and automatically injects it into CLI commands run through [workspace tools](https://mastra.ai/docs/workspace/overview).
|
|
4
4
|
|
|
5
5
|
## When to use BrowserViewer
|
|
6
6
|
|
|
@@ -58,6 +58,8 @@ Create a workspace with BrowserViewer and assign it to an agent:
|
|
|
58
58
|
```typescript
|
|
59
59
|
import { Mastra } from '@mastra/core/mastra'
|
|
60
60
|
import { Agent } from '@mastra/core/agent'
|
|
61
|
+
import { Memory } from '@mastra/memory'
|
|
62
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
61
63
|
import { Workspace, LocalSandbox } from '@mastra/core/workspace'
|
|
62
64
|
import { BrowserViewer } from '@mastra/browser-viewer'
|
|
63
65
|
|
|
@@ -77,10 +79,15 @@ const browserAgent = new Agent({
|
|
|
77
79
|
workspace,
|
|
78
80
|
instructions: `You are a web automation assistant.
|
|
79
81
|
Use browser-use commands to navigate and interact with websites.`,
|
|
82
|
+
memory: new Memory(),
|
|
80
83
|
})
|
|
81
84
|
|
|
82
85
|
export const mastra = new Mastra({
|
|
83
86
|
agents: { browserAgent },
|
|
87
|
+
storage: new LibSQLStore({
|
|
88
|
+
id: 'mastra-storage',
|
|
89
|
+
url: 'file:./mastra.db',
|
|
90
|
+
}),
|
|
84
91
|
})
|
|
85
92
|
```
|
|
86
93
|
|
|
@@ -97,7 +104,16 @@ When the agent runs a CLI command like `browser-use open https://example.com`, M
|
|
|
97
104
|
|
|
98
105
|
BrowserViewer supports three CLI providers. Each CLI must be installed separately in your workspace environment. Each CLI also publishes a [skill](https://mastra.ai/docs/workspace/skills) that teaches the agent its commands and workflows.
|
|
99
106
|
|
|
100
|
-
|
|
107
|
+
Set the `cli` option to match the CLI your agent uses:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
const viewer = new BrowserViewer({
|
|
111
|
+
cli: 'browser-use',
|
|
112
|
+
headless: false,
|
|
113
|
+
})
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### `agent-browser`
|
|
101
117
|
|
|
102
118
|
```bash
|
|
103
119
|
npm install -g agent-browser
|
|
@@ -106,7 +122,7 @@ npx skills add vercel-labs/agent-browser
|
|
|
106
122
|
|
|
107
123
|
CDP flag: `--cdp`
|
|
108
124
|
|
|
109
|
-
### browser-use
|
|
125
|
+
### `browser-use`
|
|
110
126
|
|
|
111
127
|
```bash
|
|
112
128
|
pip install browser-use
|
|
@@ -115,24 +131,15 @@ npx skills add browser-use/browser-use --skill browser-use
|
|
|
115
131
|
|
|
116
132
|
CDP flag: `--cdp-url`
|
|
117
133
|
|
|
118
|
-
### browse
|
|
134
|
+
### `browse`
|
|
119
135
|
|
|
120
136
|
```bash
|
|
121
|
-
npm install -g
|
|
122
|
-
|
|
137
|
+
npm install -g browse
|
|
138
|
+
browse skills install
|
|
123
139
|
```
|
|
124
140
|
|
|
125
141
|
CDP flag: `--ws`
|
|
126
142
|
|
|
127
|
-
Set the `cli` option to match the CLI your agent uses:
|
|
128
|
-
|
|
129
|
-
```typescript
|
|
130
|
-
const viewer = new BrowserViewer({
|
|
131
|
-
cli: 'browser-use',
|
|
132
|
-
headless: false,
|
|
133
|
-
})
|
|
134
|
-
```
|
|
135
|
-
|
|
136
143
|
> **Note:** See [BrowserViewer reference](https://mastra.ai/reference/browser/browser-viewer) for all configuration options, advanced connection modes, and method details.
|
|
137
144
|
|
|
138
145
|
## Related
|
|
@@ -144,7 +144,7 @@ yarn add ws @hono/node-ws
|
|
|
144
144
|
bun add ws @hono/node-ws
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
> **Note:** These packages
|
|
147
|
+
> **Note:** These packages aren't included by default because they're incompatible with serverless environments like Cloudflare Workers. If they aren't installed, screencast is disabled but all other browser functionality works normally.
|
|
148
148
|
|
|
149
149
|
Screencast is enabled by default and can be configured:
|
|
150
150
|
|
|
@@ -121,7 +121,7 @@ const browser = new StagehandBrowser({
|
|
|
121
121
|
})
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
To disable the screenshot tool for models that
|
|
124
|
+
To disable the screenshot tool for models that don't support vision, use `excludeTools`:
|
|
125
125
|
|
|
126
126
|
```typescript
|
|
127
127
|
const browser = new StagehandBrowser({
|
|
@@ -97,7 +97,7 @@ When `source` is `'code'`, the editor writes each override to a deterministic JS
|
|
|
97
97
|
|
|
98
98
|
### Versioning with the code source
|
|
99
99
|
|
|
100
|
-
The code source uses the Git history of each per-agent JSON file as its version history. Each commit that changes a file
|
|
100
|
+
The code source uses the Git history of each per-agent JSON file as its version history. Each commit that changes a file is shown as a read-only version in Studio, labeled with the commit message. Saving in Studio updates the working file in place rather than creating a database draft, so the version dropdown reflects your actual commit history.
|
|
101
101
|
|
|
102
102
|
This means versions and rollbacks are managed through Git rather than through draft and publish actions.
|
|
103
103
|
|
|
@@ -159,11 +159,11 @@ The same operations are available over HTTP through the Mastra server. Use these
|
|
|
159
159
|
| `GET` | `/stored/agents/:storedAgentId/dependents` | List agents that reference this agent as a sub-agent. |
|
|
160
160
|
| `POST` | `/stored/agents/:storedAgentId/export` | Export a stored agent's override as a deterministic JSON config. |
|
|
161
161
|
|
|
162
|
-
The dependents endpoint helps warn before deleting or unsharing an agent that other agents depend on: `dependents` lists caller-readable agents by `id` and `name`, while `hiddenCount` aggregates cross-workspace references the caller
|
|
162
|
+
The dependents endpoint helps warn before deleting or unsharing an agent that other agents depend on: `dependents` lists caller-readable agents by `id` and `name`, while `hiddenCount` aggregates cross-workspace references the caller can't read (surfaced only when the target is public). The export endpoint returns only the fields the agent's [`editor` config](https://mastra.ai/reference/agents/agent) allows, so the output matches the per-agent file the code source writes to disk. The Client SDK wraps these endpoints with `client.listStoredAgents()`, `client.createStoredAgent()`, `client.getStoredAgent()`, `client.getStoredAgent(id).dependents()`, and `client.getStoredAgent(id).export()`. Version management endpoints live under `/stored/agents/:storedAgentId/versions`, see [version management](https://mastra.ai/reference/client-js/agents) for the full list.
|
|
163
163
|
|
|
164
164
|
### Automated experimentation
|
|
165
165
|
|
|
166
|
-
Because stored agents are
|
|
166
|
+
Because stored agents are data, you can build automation loops that tune agents without human involvement. A common pattern is to pair the editor API with [datasets](https://mastra.ai/docs/evals/datasets/overview) and [experiments](https://mastra.ai/docs/evals/datasets/running-experiments):
|
|
167
167
|
|
|
168
168
|
- Run a dataset through the current version of an agent and score the results.
|
|
169
169
|
- Have another agent read the failing cases and propose changes to the instructions or tools.
|
|
@@ -186,7 +186,7 @@ When you edit a code-defined agent through the editor, only specific fields can
|
|
|
186
186
|
|
|
187
187
|
Fields like the agent's `id`, `name`, and `model` come from your code and can't be changed through the editor for code-defined agents. The variables are also read-only.
|
|
188
188
|
|
|
189
|
-
### Controlling what
|
|
189
|
+
### Controlling what's editable
|
|
190
190
|
|
|
191
191
|
Use the `editor` field on a code-defined agent to control which fields the editor can override. This lets you keep some fields code-owned while allowing edits to others:
|
|
192
192
|
|
|
@@ -226,7 +226,7 @@ Each version has one of three statuses:
|
|
|
226
226
|
| --------- | ----------------------------------------------------------------------------------- |
|
|
227
227
|
| Draft | The latest working copy. Every save creates a new draft version. |
|
|
228
228
|
| Published | The active version used in production. Only one version can be published at a time. |
|
|
229
|
-
| Archived | A previous version that
|
|
229
|
+
| Archived | A previous version that's no longer active. You can restore any archived version. |
|
|
230
230
|
|
|
231
231
|
The typical flow is: Edit the draft, test it, then activate it to make it the published version. The previously published version becomes archived so you can restore it if needed. You can do this through Studio or programmatically through the API.
|
|
232
232
|
|
|
@@ -344,7 +344,7 @@ curl -X POST http://localhost:4111/agents/supervisor/generate \
|
|
|
344
344
|
|
|
345
345
|
Version overrides propagate automatically through sub-agent delegation via `requestContext`. When a supervisor delegates to a sub-agent, the framework checks if a version override exists for that sub-agent's ID. If one is found, it resolves the stored version from the editor and uses it instead of the code-defined default.
|
|
346
346
|
|
|
347
|
-
If version resolution fails (for example, when the editor
|
|
347
|
+
If version resolution fails (for example, when the editor isn't configured or the version ID doesn't exist), the framework logs a warning and falls back to the code-defined agent.
|
|
348
348
|
|
|
349
349
|
## Next steps
|
|
350
350
|
|
|
@@ -10,7 +10,7 @@ Prompt blocks are reusable instruction templates that you compose into an agent'
|
|
|
10
10
|
4. Open an agent's **Instructions** section and select **Add block**.
|
|
11
11
|
5. Pick the saved prompt block from the block picker dialog.
|
|
12
12
|
|
|
13
|
-
The block
|
|
13
|
+
The block is added as a reference in the agent's instruction list. Changes to the original prompt block update every agent that references it.
|
|
14
14
|
|
|
15
15
|
## Block types
|
|
16
16
|
|
|
@@ -44,7 +44,7 @@ Variables are passed through the agent's `variables` configuration or through [r
|
|
|
44
44
|
|
|
45
45
|
Each block can have a **display condition**. A rule group that controls whether the block is included in the final prompt. Conditions are evaluated at runtime against the agent's variables and request context.
|
|
46
46
|
|
|
47
|
-
A rule group uses
|
|
47
|
+
A rule group uses `AND` or `OR` logic with one or more conditions. Each condition checks a context field against a value using an operator:
|
|
48
48
|
|
|
49
49
|
| Operator | Description |
|
|
50
50
|
| ---------------------------------------------- | ------------------------------------- |
|
|
@@ -55,7 +55,7 @@ A rule group uses **AND** or **OR** logic with one or more conditions. Each cond
|
|
|
55
55
|
| `in` / `not_in` | Checks if a value is in an array. |
|
|
56
56
|
| `exists` / `not_exists` | Checks if the field is present. |
|
|
57
57
|
|
|
58
|
-
Rule groups can be nested, so you can combine AND and OR conditions for complex logic.
|
|
58
|
+
Rule groups can be nested, so you can combine `AND` and `OR` conditions for complex logic.
|
|
59
59
|
|
|
60
60
|
In the Studio, open a block's **Display conditions** panel to set up rules visually. You can also configure conditions programmatically through the API. Blocks without conditions are always included.
|
|
61
61
|
|
|
@@ -24,7 +24,7 @@ In the Studio, select a tool in the agent's tool list and edit the **Description
|
|
|
24
24
|
|
|
25
25
|
Each tool in an agent can have display conditions — rule groups that control whether the tool is available at runtime. This uses the same rule system as [prompt blocks](https://mastra.ai/docs/editor/prompts).
|
|
26
26
|
|
|
27
|
-
When a request comes in, the editor evaluates each tool's rules against the current context (agent variables and request context). Tools whose conditions
|
|
27
|
+
When a request comes in, the editor evaluates each tool's rules against the current context (agent variables and request context). Tools whose conditions aren't met are excluded from that run.
|
|
28
28
|
|
|
29
29
|
Use display conditions to:
|
|
30
30
|
|
|
@@ -130,7 +130,7 @@ Tools from MCP servers are namespaced as `serverName_toolName` to avoid conflict
|
|
|
130
130
|
|
|
131
131
|
### Conditional activation
|
|
132
132
|
|
|
133
|
-
MCP client references in an agent can have display conditions,
|
|
133
|
+
MCP client references in an agent can have display conditions, like [prompt blocks](https://mastra.ai/docs/editor/prompts). This lets you conditionally include MCP tools based on request context or agent variables.
|
|
134
134
|
|
|
135
135
|
## How tools are merged
|
|
136
136
|
|
|
@@ -10,13 +10,13 @@ This page covers the three working patterns for running Mastra evals against mem
|
|
|
10
10
|
|
|
11
11
|
## When to use which approach
|
|
12
12
|
|
|
13
|
-
| Goal
|
|
14
|
-
|
|
|
15
|
-
| One shared conversation across every item
|
|
16
|
-
| One independent thread per item,
|
|
17
|
-
| Per-item threads driven by a stored `Dataset`
|
|
13
|
+
| Goal | Approach |
|
|
14
|
+
| ------------------------------------------------ | ----------------------------------------------------------------------------------------- |
|
|
15
|
+
| One shared conversation across every item | [`runEvals` with global `targetOptions.memory`](#shared-thread-with-runevals) |
|
|
16
|
+
| One independent thread per item, focused CI loop | [`runEvals` per item](#per-item-threads-with-runevals) |
|
|
17
|
+
| Per-item threads driven by a stored `Dataset` | [`dataset.startExperiment` with an inline task](#dataset-experiments-with-an-inline-task) |
|
|
18
18
|
|
|
19
|
-
Pre-seeding `RequestContext` with `MastraMemory`
|
|
19
|
+
Pre-seeding `RequestContext` with `MastraMemory` **isn't** a supported way to drive memory into an agent. Thread resolution reads `args.memory.thread` — `RequestContext.MastraMemory` is populated by `prepare-memory-step` after the agent has already resolved its thread.
|
|
20
20
|
|
|
21
21
|
## Shared thread with `runEvals`
|
|
22
22
|
|
|
@@ -43,7 +43,7 @@ const result = await runEvals({
|
|
|
43
43
|
})
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
`targetOptions` is **global per call**.
|
|
46
|
+
`targetOptions` is **global per call**. No per-item override on `RunEvalsDataItem` is available today.
|
|
47
47
|
|
|
48
48
|
## Per-item threads with `runEvals`
|
|
49
49
|
|
|
@@ -86,7 +86,7 @@ const average = scores.reduce((a, b) => a + b, 0) / scores.length
|
|
|
86
86
|
|
|
87
87
|
## Dataset experiments with an inline task
|
|
88
88
|
|
|
89
|
-
`dataset.startExperiment({ target: agent })`
|
|
89
|
+
`dataset.startExperiment({ target: agent })` **doesn't** forward a `memory` option to the agent — only `requestContext`. To run a stored dataset against a memory-enabled agent, use an inline `task` function and stash `{ threadId, resourceId }` in each item's `metadata`. The scorer pipeline still runs as normal.
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
92
|
import { randomUUID } from 'node:crypto'
|
|
@@ -48,7 +48,7 @@ The CLI authenticates with Mastra platform, creates a platform project, writes t
|
|
|
48
48
|
|
|
49
49
|
### Existing non-Mastra projects
|
|
50
50
|
|
|
51
|
-
If you already have an application, such as a Next.js app, but
|
|
51
|
+
If you already have an application, such as a Next.js app, but haven't added Mastra yet, run `mastra init` and enable Mastra Observability when prompted:
|
|
52
52
|
|
|
53
53
|
**npm**:
|
|
54
54
|
|
|
@@ -60,7 +60,7 @@ A deploy transitions through **queued → uploading → building → deploying
|
|
|
60
60
|
|
|
61
61
|
## CI/CD
|
|
62
62
|
|
|
63
|
-
Automate deployments from GitHub Actions, GitLab CI, or any CI provider. After your first interactive deploy, CI/CD needs
|
|
63
|
+
Automate deployments from GitHub Actions, GitLab CI, or any CI provider. After your first interactive deploy, CI/CD needs two things: an API token and the `.mastra-project.json` file committed to your repository.
|
|
64
64
|
|
|
65
65
|
### Create an API token
|
|
66
66
|
|
|
@@ -83,7 +83,7 @@ calculatorTool._meta = {
|
|
|
83
83
|
|
|
84
84
|
## Connecting MCP Apps to agents
|
|
85
85
|
|
|
86
|
-
Agents consume tools — they
|
|
86
|
+
Agents consume tools — they don't need to know about MCP servers. Pass tools to the agent's `tools` config, and register the MCP server at the Mastra level so Studio can resolve app resources.
|
|
87
87
|
|
|
88
88
|
```typescript
|
|
89
89
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -158,8 +158,8 @@ Agent calls tool → Tool returns brief content + structuredContent
|
|
|
158
158
|
|
|
159
159
|
Tools with app resources should return two fields:
|
|
160
160
|
|
|
161
|
-
- `content`: A brief text summary for the model. Keep this short so the agent
|
|
162
|
-
- `structuredContent`: The data payload that hydrates the UI. The model
|
|
161
|
+
- `content`: A brief text summary for the model. Keep this short so the agent doesn't parrot the full result.
|
|
162
|
+
- `structuredContent`: The data payload that hydrates the UI. The model doesn't see this field.
|
|
163
163
|
|
|
164
164
|
```typescript
|
|
165
165
|
execute: async ({ num1, num2, operation }) => {
|
|
@@ -294,7 +294,7 @@ App iframes are sandboxed with the following permissions:
|
|
|
294
294
|
- `allow-forms`: Allows form submission
|
|
295
295
|
- `allow-popups`: Permits `window.open()` and link targets
|
|
296
296
|
|
|
297
|
-
The iframe
|
|
297
|
+
The iframe doesn't have access to the parent page's DOM, cookies, or storage. All communication happens through the JSON-RPC postMessage protocol managed by `@mcp-ui/client`'s `AppRenderer` on the host side and `@modelcontextprotocol/ext-apps`'s `App` class on the guest side.
|
|
298
298
|
|
|
299
299
|
## Related
|
|
300
300
|
|
|
@@ -134,7 +134,7 @@ const memory = new Memory({
|
|
|
134
134
|
})
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
`bufferOnIdle` is off by default. It
|
|
137
|
+
`bufferOnIdle` is off by default. It's separate from `bufferTokens`: `bufferTokens` controls step-time async buffering, while `bufferOnIdle` controls end-of-turn buffering for idle turns.
|
|
138
138
|
|
|
139
139
|
See [the API reference](https://mastra.ai/reference/memory/observational-memory) for the full configuration shape.
|
|
140
140
|
|
|
@@ -413,12 +413,12 @@ const memory = new Memory({
|
|
|
413
413
|
What changes:
|
|
414
414
|
|
|
415
415
|
- **Storage is identical.** The same resource/thread `workingMemory` field is read and written.
|
|
416
|
-
- **The tool is the same shape, exposed under a new name.** Writes still flow through the same underlying tool; on this path it
|
|
416
|
+
- **The tool is the same shape, exposed under a new name.** Writes still flow through the same underlying tool; on this path it's registered as `setWorkingMemory` (instead of `updateWorkingMemory`). The rename keeps legacy strip filters from removing tool-call parts so they persist as a normal audit trail and the next model step picks the new value up automatically.
|
|
417
417
|
- **Delivery only.** Instead of folding into the system prompt, `Memory` auto-attaches a `WorkingMemoryStateProcessor` that emits the current working memory as a `state` signal with `stateId: 'working-memory'`.
|
|
418
418
|
|
|
419
419
|
You inherit the standard state-signal benefits: thread-scoped tracking metadata, `cacheKey` dedup so identical snapshots are only emitted once, and `contextWindow.hasSnapshot` re-injection when an older snapshot rolls out of the window.
|
|
420
420
|
|
|
421
|
-
The default (`useStateSignals: false`) keeps the existing system-message behavior unchanged. `useStateSignals`
|
|
421
|
+
The default (`useStateSignals: false`) keeps the existing system-message behavior unchanged. `useStateSignals` isn't supported with template working memory `version: 'vnext'`.
|
|
422
422
|
|
|
423
423
|
## Examples
|
|
424
424
|
|
|
@@ -148,7 +148,7 @@ new DatadogBridge({
|
|
|
148
148
|
})
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
> **Note:** For most bridge users, agent mode is the right choice. APM data
|
|
151
|
+
> **Note:** For most bridge users, agent mode is the right choice. APM data can't be sent in agentless mode, so enabling agentless splits LLM Observability traffic away from APM traffic. If you want LLM Observability only without an agent, use the [Datadog Exporter](https://mastra.ai/docs/observability/integrations/exporters/datadog) instead.
|
|
152
152
|
|
|
153
153
|
## Trace hierarchy
|
|
154
154
|
|
|
@@ -153,7 +153,7 @@ const sdk = new NodeSDK({
|
|
|
153
153
|
|
|
154
154
|
Logs that originate inside a Mastra span are emitted under that span's OTEL context, so backends like Datadog, Grafana, and Honeycomb correlate them with the surrounding trace automatically. Logs without trace context fall through to the currently active OTEL context.
|
|
155
155
|
|
|
156
|
-
If you
|
|
156
|
+
If you don't register a `LoggerProvider`, log emission is a silent no-op — traces continue to work as configured.
|
|
157
157
|
|
|
158
158
|
### Running Your Application
|
|
159
159
|
|
|
@@ -100,7 +100,7 @@ export const mastra = new Mastra({
|
|
|
100
100
|
|
|
101
101
|
> **Note:** For advanced usage, including the full `MastraExporter` options and multi-agent trace examples, see [Laminar's Mastra integration guide](https://laminar.sh/docs/tracing/integrations/mastra).
|
|
102
102
|
|
|
103
|
-
Mastra also ships a standalone [`LaminarExporter`](https://mastra.ai/reference/observability/tracing/exporters/laminar) in `@mastra/laminar` that sends spans over OTLP/HTTP. It
|
|
103
|
+
Mastra also ships a standalone [`LaminarExporter`](https://mastra.ai/reference/observability/tracing/exporters/laminar) in `@mastra/laminar` that sends spans over OTLP/HTTP. It can't inherit an active OTel context and doesn't fully map Mastra spans to Laminar's native format, so use the `@lmnr-ai/lmnr` integration above for `observe()` wrappers, multi-agent root spans, and accurate Laminar rendering.
|
|
104
104
|
|
|
105
105
|
## Related
|
|
106
106
|
|
|
@@ -189,10 +189,35 @@ To scope an evaluator to a specific agent, configure either filter in Langfuse:
|
|
|
189
189
|
- **Trace name**: equals the agent name (for example, `weather-agent`).
|
|
190
190
|
- **Metadata**: `agentId` equals the agent id.
|
|
191
191
|
|
|
192
|
-
The trace name dropdown in Langfuse evaluator filters lists every distinct value seen, so each agent
|
|
192
|
+
The trace name dropdown in Langfuse evaluator filters lists every distinct value seen, so each agent is shown as its own entry once it has produced at least one trace.
|
|
193
193
|
|
|
194
194
|
If you set a custom `traceName` via `mastra.metadata.traceName`, your value takes precedence over the default agent name.
|
|
195
195
|
|
|
196
|
+
## Custom trace metadata
|
|
197
|
+
|
|
198
|
+
Langfuse filters and groups traces by top-level metadata only. Nested metadata keys can't be used for filtering or grouping.
|
|
199
|
+
|
|
200
|
+
To add your own top-level metadata, set keys under `langfuse` in your span metadata. The exporter forwards each key to `langfuse.trace.metadata.<key>`, where it becomes filterable in Langfuse:
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
const tracingOptions = {
|
|
204
|
+
metadata: {
|
|
205
|
+
langfuse: {
|
|
206
|
+
customerId: 'cust_123',
|
|
207
|
+
tier: 'enterprise',
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
This example produces `langfuse.trace.metadata.customerId` and `langfuse.trace.metadata.tier`.
|
|
214
|
+
|
|
215
|
+
Notes:
|
|
216
|
+
|
|
217
|
+
- The reserved `prompt` key is used for [prompt linking](#prompt-linking) and isn't forwarded as trace metadata.
|
|
218
|
+
- The reserved identity keys `agentId`, `agentName`, `workflowId`, and `workflowName` are set from the root span and take precedence over custom values with the same name.
|
|
219
|
+
- Values are sent as strings, because Langfuse maps trace metadata attributes as strings. Numbers, booleans, and objects are serialized with JSON. Langfuse Cloud restores them to their original types on ingestion.
|
|
220
|
+
|
|
196
221
|
## Prompt linking
|
|
197
222
|
|
|
198
223
|
You can link LLM generations to prompts stored in [Langfuse Prompt Management](https://langfuse.com/docs/prompt-management). This enables version tracking and metrics for your prompts.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `MastraPlatformExporter` sends traces, logs, metrics, scores, and feedback to the Mastra platform. Use it to route observability data from any Mastra app to a hosted project in the Mastra platform.
|
|
4
4
|
|
|
5
|
-
> **Note:** `MastraPlatformExporter` was previously called `CloudExporter`. The original `CloudExporter` class is still exported from `@mastra/observability` for backward compatibility, but it
|
|
5
|
+
> **Note:** `MastraPlatformExporter` was previously called `CloudExporter`. The original `CloudExporter` class is still exported from `@mastra/observability` for backward compatibility, but it's deprecated. New code should use `MastraPlatformExporter`.
|
|
6
6
|
|
|
7
7
|
> **Self-hosted or standalone apps:** If you host your Mastra application on your own infrastructure (not on Mastra platform), you still need a deployed Studio project to view traces, logs, and metrics. `MastraPlatformExporter` sends data to a Studio project, so one must exist before you can use it.
|
|
8
8
|
>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `MastraStorageExporter` persists traces to your configured storage backend, making them accessible through Studio. It requires no external services.
|
|
4
4
|
|
|
5
|
-
> **Note:** `MastraStorageExporter` was previously called `DefaultExporter`. The original `DefaultExporter` class is still exported from `@mastra/observability` for backward compatibility, but it
|
|
5
|
+
> **Note:** `MastraStorageExporter` was previously called `DefaultExporter`. The original `DefaultExporter` class is still exported from `@mastra/observability` for backward compatibility, but it's deprecated. New code should use `MastraStorageExporter`.
|
|
6
6
|
|
|
7
7
|
> **Production Observability:** Observability data can quickly overwhelm general-purpose databases in production. For high-traffic applications, route the observability storage domain to [ClickHouse](https://mastra.ai/reference/storage/clickhouse) through [composite storage](https://mastra.ai/reference/storage/composite). See [Production Recommendations](#production-recommendations) for details.
|
|
8
8
|
|
|
@@ -178,11 +178,11 @@ The MastraStorageExporter includes robust error handling for production use:
|
|
|
178
178
|
|
|
179
179
|
## Dropped observability events
|
|
180
180
|
|
|
181
|
-
`DefaultExporter` emits structured drop events when it
|
|
181
|
+
`DefaultExporter` emits structured drop events when it can't persist observability data. Register an exporter or bridge with `onDroppedEvent` to forward these drops to alerting or monitoring.
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
For two reasons events are dropped:
|
|
184
184
|
|
|
185
|
-
- `unsupported-storage`: The storage provider
|
|
185
|
+
- `unsupported-storage`: The storage provider doesn't implement the signal type.
|
|
186
186
|
- `retry-exhausted`: The exporter retried a batch up to `maxRetries` times and then dropped it.
|
|
187
187
|
|
|
188
188
|
The following example demonstrates forwarding drop details to a monitoring endpoint:
|
|
@@ -458,7 +458,7 @@ bun add @opentelemetry/exporter-logs-otlp-proto
|
|
|
458
458
|
bun add @opentelemetry/exporter-logs-otlp-grpc @grpc/grpc-js
|
|
459
459
|
```
|
|
460
460
|
|
|
461
|
-
If the matching log exporter package
|
|
461
|
+
If the matching log exporter package isn't installed, log export is silently disabled and traces continue to work.
|
|
462
462
|
|
|
463
463
|
## Configuration options
|
|
464
464
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Integrations overview
|
|
2
2
|
|
|
3
|
-
Mastra observability integrations control where observability data goes and how it
|
|
3
|
+
Mastra observability integrations control where observability data goes and how it's transformed on the way out. Use integrations to store data in Mastra storage, send it to Mastra platform, connect to external observability providers, or redact exported span data.
|
|
4
4
|
|
|
5
5
|
## When to use integrations
|
|
6
6
|
|
|
@@ -24,7 +24,7 @@ export const mastra = new Mastra({
|
|
|
24
24
|
|
|
25
25
|
## Logging to observability storage
|
|
26
26
|
|
|
27
|
-
When [observability](https://mastra.ai/docs/observability/overview) is configured, all logger calls are automatically forwarded to your observability storage. This means every `debug`, `info`, `warn`, `error`, and `trackException` call from your application and from Mastra's internal components
|
|
27
|
+
When [observability](https://mastra.ai/docs/observability/overview) is configured, all logger calls are automatically forwarded to your observability storage. This means every `debug`, `info`, `warn`, `error`, and `trackException` call from your application and from Mastra's internal components is stored alongside your traces.
|
|
28
28
|
|
|
29
29
|
No code changes are required. Mastra wraps the configured logger so that it writes to both the original logger (console, file, or custom transport) and the observability system simultaneously.
|
|
30
30
|
|
|
@@ -8,11 +8,11 @@ Three categories of metrics are emitted automatically:
|
|
|
8
8
|
- **Token usage metrics**: Input and output token counts broken down by type (text, cache, audio, image, reasoning).
|
|
9
9
|
- **Cost estimation**: Estimated cost per model call based on an embedded pricing registry.
|
|
10
10
|
|
|
11
|
-
> **Note:** Metrics require an OLAP-capable store for observability. Relational databases like PostgreSQL, LibSQL, etc.
|
|
11
|
+
> **Note:** Metrics require an OLAP-capable store for observability. Relational databases like PostgreSQL, LibSQL, etc. aren't supported for metrics. In-memory storage resets on restart.
|
|
12
12
|
>
|
|
13
13
|
> For local development, use [DuckDB](https://duckdb.org/) through `@mastra/duckdb`. For production, use [ClickHouse](https://clickhouse.com/) through `@mastra/clickhouse`.
|
|
14
14
|
>
|
|
15
|
-
> Google Cloud Spanner supports metrics, but it
|
|
15
|
+
> Google Cloud Spanner supports metrics, but it's not recommended for heavy metrics workloads. The Spanner adapter disables metrics by default because metrics are write-heavy and scan-heavy. Set `disableMetrics: false` only for light workloads, or route metrics to an OLAP store.
|
|
16
16
|
|
|
17
17
|
## When to use metrics
|
|
18
18
|
|
|
@@ -83,7 +83,7 @@ export const mastra = new Mastra({
|
|
|
83
83
|
|
|
84
84
|
## Studio
|
|
85
85
|
|
|
86
|
-
The Studio metrics dashboard visualizes all automatic metrics with KPI cards, detailed breakdowns, and configurable time ranges. See [Studio observability](https://mastra.ai/docs/studio/observability) for a full walkthrough.
|
|
86
|
+
The Studio metrics dashboard visualizes all automatic metrics with KPI cards, detailed breakdowns, token usage timelines, and configurable time ranges. See [Studio observability](https://mastra.ai/docs/studio/observability) for a full walkthrough.
|
|
87
87
|
|
|
88
88
|
## What Mastra measures
|
|
89
89
|
|
|
@@ -11,7 +11,7 @@ Mastra exposes the same five OLAP queries (`getMetricAggregate`, `getMetricBreak
|
|
|
11
11
|
|
|
12
12
|
For setup of the observability store itself, see the [Metrics overview](https://mastra.ai/docs/observability/metrics/overview). For the list of metric names you can query, see the [Automatic metrics reference](https://mastra.ai/reference/observability/metrics/automatic-metrics).
|
|
13
13
|
|
|
14
|
-
> **Note:** Metric queries are served by the observability domain, which requires an OLAP-capable store (DuckDB locally, ClickHouse in production). See [Metrics overview](https://mastra.ai/docs/observability/metrics/overview) for setup. If the observability store
|
|
14
|
+
> **Note:** Metric queries are served by the observability domain, which requires an OLAP-capable store (DuckDB locally, ClickHouse in production). See [Metrics overview](https://mastra.ai/docs/observability/metrics/overview) for setup. If the observability store isn't configured, `getStore('observability')` returns `null`.
|
|
15
15
|
|
|
16
16
|
## Surfaces
|
|
17
17
|
|
|
@@ -46,7 +46,7 @@ export const agentLatencyTool = createTool({
|
|
|
46
46
|
})
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
`getStore('observability')` returns `null` when the configured backend
|
|
49
|
+
`getStore('observability')` returns `null` when the configured backend doesn't support OLAP queries.
|
|
50
50
|
|
|
51
51
|
### HTTP
|
|
52
52
|
|
|
@@ -49,7 +49,7 @@ Mastra storage-backed observability currently depends on an OLAP-capable backend
|
|
|
49
49
|
- ClickHouse: Recommended for production observability.
|
|
50
50
|
- Mastra platform: Use `MastraPlatformExporter` if you want hosted observability without managing the backend yourself.
|
|
51
51
|
|
|
52
|
-
Primary application stores such as LibSQL or PostgreSQL
|
|
52
|
+
Primary application stores such as LibSQL or PostgreSQL shouldn't be used as the observability store. Route the `observability` domain separately with composite storage when you use `MastraStorageExporter`.
|
|
53
53
|
|
|
54
54
|
## Local development
|
|
55
55
|
|
|
@@ -67,7 +67,7 @@ Observability traffic is usually more write-heavy than the rest of the applicati
|
|
|
67
67
|
|
|
68
68
|
- Use `MastraStorageExporter` with ClickHouse for the `observability` domain when you keep observability in your own storage.
|
|
69
69
|
- Use `MastraPlatformExporter` if you want hosted Mastra platform observability instead of managing the backend yourself.
|
|
70
|
-
-
|
|
70
|
+
- Don't route observability to your primary application store.
|
|
71
71
|
|
|
72
72
|
For backend compatibility details and exporter batching behavior, see [Mastra Storage exporter](https://mastra.ai/docs/observability/integrations/exporters/mastra-storage).
|
|
73
73
|
|
|
@@ -133,7 +133,7 @@ export const mastra = new Mastra({
|
|
|
133
133
|
})
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
If `environment`
|
|
136
|
+
If `environment` isn't set, Mastra falls back to `process.env.NODE_ENV`. If neither is set, the field is left undefined rather than guessed.
|
|
137
137
|
|
|
138
138
|
Per-call `tracingOptions.metadata.environment` always takes precedence, so individual calls can override the value when needed.
|
|
139
139
|
|
|
@@ -53,7 +53,7 @@ When using `MastraFGAWorkos`, set `fetchMemberships: true` on `MastraAuthWorkos`
|
|
|
53
53
|
|
|
54
54
|
Use `thread` as the resource-mapping key for memory authorization. `MastraFGAWorkos` still accepts the legacy alias `memory`, but new configs should prefer `thread`.
|
|
55
55
|
|
|
56
|
-
When `server.fga` is configured, Mastra enforces FGA on protected actions. If a protected action has no authenticated user, Mastra denies it. If `server.fga`
|
|
56
|
+
When `server.fga` is configured, Mastra enforces FGA on protected actions. If a protected action has no authenticated user, Mastra denies it. If `server.fga` isn't configured, these FGA checks are skipped and Mastra keeps the previous behavior.
|
|
57
57
|
|
|
58
58
|
### Resource mapping
|
|
59
59
|
|
|
@@ -100,7 +100,7 @@ Use `validatePermissions()` to validate the full set of permissions Mastra may e
|
|
|
100
100
|
|
|
101
101
|
### Stored resource scoping
|
|
102
102
|
|
|
103
|
-
FGA authorizes access to a resource. It
|
|
103
|
+
FGA authorizes access to a resource. It doesn't automatically filter stored records that live in shared storage. Enable stored resource scoping when the built-in stored resource APIs are used in a multi-tenant app.
|
|
104
104
|
|
|
105
105
|
```typescript
|
|
106
106
|
const mastra = new Mastra({
|
|
@@ -136,7 +136,7 @@ If `requireScope` is `true` or omitted, scoped stored resource routes fail when
|
|
|
136
136
|
|
|
137
137
|
Mastra includes route-level FGA metadata for built-in resource routes, including agents, workflows, tools, MCP tools, memory threads, responses, conversations, and stored resources. Stored resource route coverage includes `/stored/agents`, `/stored/mcp-clients`, `/stored/prompt-blocks`, `/stored/scorers`, `/stored/skills`, and `/stored/workspaces`. A route is checked when it has route-level `fga` metadata, when Mastra can derive built-in metadata for that route, or when the provider supplies metadata with `resolveRouteFGA()`.
|
|
138
138
|
|
|
139
|
-
To deny protected routes that
|
|
139
|
+
To deny protected routes that don't resolve FGA metadata, configure route policy coverage on the FGA provider:
|
|
140
140
|
|
|
141
141
|
```typescript
|
|
142
142
|
const fga = new MastraFGAWorkos({
|
|
@@ -202,20 +202,20 @@ const fga = new MastraFGAWorkos({
|
|
|
202
202
|
|
|
203
203
|
When an FGA provider is configured, Mastra automatically checks authorization at these lifecycle points:
|
|
204
204
|
|
|
205
|
-
| Lifecycle point | Permission checked | Resource type
|
|
206
|
-
| ---------------------------------------------------------------- | ----------------------------------------------- |
|
|
207
|
-
| Agent execution (`generate`, `stream`) | `agents:execute` | `agent`
|
|
208
|
-
| Built-in workflow HTTP execution routes and `Workflow.execute()` | `workflows:execute` | `workflow`
|
|
209
|
-
| Standalone tool execution | `tools:execute` | `tool`
|
|
210
|
-
| Agent tool execution | `tools:execute` | `tool`
|
|
211
|
-
| MCP tool execution | `tools:execute` | `tool`
|
|
212
|
-
| Thread and memory access | `memory:read`, `memory:write`, `memory:delete` | `thread`
|
|
213
|
-
| Stored resource routes | Stored resource permission for the route action | Stored resource type
|
|
214
|
-
| HTTP resource routes | Configured per route | Configured per route
|
|
205
|
+
| Lifecycle point | Permission checked | Resource type | Resource ID |
|
|
206
|
+
| ---------------------------------------------------------------- | ----------------------------------------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
207
|
+
| Agent execution (`generate`, `stream`) | `agents:execute` | `agent` | `agentId` |
|
|
208
|
+
| Built-in workflow HTTP execution routes and `Workflow.execute()` | `workflows:execute` | `workflow` | `workflowId` |
|
|
209
|
+
| Standalone tool execution | `tools:execute` | `tool` | `toolName` |
|
|
210
|
+
| Agent tool execution | `tools:execute` | `tool` | `${agentId}:${toolName}` |
|
|
211
|
+
| MCP tool execution | `tools:execute` | `tool` by default, or the server-level `fga.resourceMapping` override | `JSON.stringify([serverName, toolName])` by default, or the server-level derived ID |
|
|
212
|
+
| Thread and memory access | `memory:read`, `memory:write`, `memory:delete` | `thread` | `threadId` |
|
|
213
|
+
| Stored resource routes | Stored resource permission for the route action | Stored resource type | Route record ID, or the stored-resource scope for collection routes |
|
|
214
|
+
| HTTP resource routes | Configured per route | Configured per route | Configured per route |
|
|
215
215
|
|
|
216
|
-
For OAuth-protected MCP servers, HTTP MCP transports pass authenticated data as `extra.authInfo`. If an `MCPServer` is registered on an FGA-enabled Mastra instance, configure `mapAuthInfoToUser` so Mastra can set `requestContext.get('user')` before checking `tools/list` and `tools/call`. See [MCPServer authentication context](https://mastra.ai/reference/tools/mcp-server).
|
|
216
|
+
For OAuth-protected MCP servers, HTTP MCP transports pass authenticated data as `extra.authInfo`. If an `MCPServer` is registered on an FGA-enabled Mastra instance, configure `mapAuthInfoToUser` so Mastra can set `requestContext.get('user')` before checking `tools/list` and `tools/call`. Use the server-level `fga` option when MCP tool checks need different resource or permission mapping than internal agent and workflow tool checks. See [MCPServer authentication context](https://mastra.ai/reference/tools/mcp-server).
|
|
217
217
|
|
|
218
|
-
Direct SDK calls to `createRun().start()`, `resume()`, or `restart()`
|
|
218
|
+
Direct SDK calls to `createRun().start()`, `resume()`, or `restart()` aren't independently checked by core FGA in this release. Make those calls from a protected route or guard them in application code. Pass a `requestContext` with an authenticated user when invoking protected entry points directly.
|
|
219
219
|
|
|
220
220
|
Core agent, internal workflow, tool, and memory checks also pass `requestContext` and action metadata to the FGA provider. Route checks pass `requestContext`. Thread checks pass the owning `resourceId` when available.
|
|
221
221
|
|