@mastra/mcp-docs-server 1.1.41 → 1.1.42-alpha.10
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/access-control.md +97 -0
- package/.docs/docs/agent-builder/browser.md +61 -0
- package/.docs/docs/agent-builder/channels.md +76 -0
- package/.docs/docs/agent-builder/configuration.md +147 -0
- package/.docs/docs/agent-builder/deploying.md +121 -0
- package/.docs/docs/agent-builder/memory.md +65 -0
- package/.docs/docs/agent-builder/model-policy.md +48 -0
- package/.docs/docs/agent-builder/overview.md +97 -0
- package/.docs/docs/agent-builder/skill-registries.md +31 -0
- package/.docs/docs/agent-builder/workspace.md +60 -0
- package/.docs/docs/agents/a2a.md +1 -1
- package/.docs/docs/agents/acp.md +4 -4
- package/.docs/docs/agents/adding-voice.md +37 -6
- package/.docs/docs/agents/agent-approval.md +15 -1
- package/.docs/docs/agents/background-tasks.md +2 -2
- package/.docs/docs/agents/channels.md +3 -1
- package/.docs/docs/agents/code-mode.md +163 -0
- package/.docs/docs/agents/guardrails.md +2 -2
- package/.docs/docs/agents/networks.md +1 -1
- package/.docs/docs/agents/overview.md +1 -1
- package/.docs/docs/agents/processors.md +3 -3
- package/.docs/docs/agents/response-caching.md +1 -1
- package/.docs/docs/agents/sdk-agents.md +261 -0
- package/.docs/docs/agents/signals.md +150 -73
- package/.docs/docs/agents/structured-output.md +5 -5
- package/.docs/docs/agents/supervisor-agents.md +2 -2
- package/.docs/docs/agents/using-tools.md +5 -5
- package/.docs/docs/browser/agent-browser.md +1 -1
- package/.docs/docs/browser/browser-viewer.md +1 -1
- package/.docs/docs/browser/overview.md +1 -1
- package/.docs/docs/browser/stagehand.md +5 -5
- package/.docs/docs/editor/overview.md +70 -8
- package/.docs/docs/evals/custom-scorers.md +1 -1
- package/.docs/docs/evals/datasets/running-experiments.md +1 -1
- package/.docs/docs/evals/overview.md +2 -2
- package/.docs/docs/getting-started/manual-install.md +1 -1
- package/.docs/docs/mcp/mcp-apps.md +3 -3
- package/.docs/docs/mcp/overview.md +1 -1
- package/.docs/docs/memory/memory-processors.md +6 -6
- package/.docs/docs/memory/multi-user-threads.md +1 -1
- package/.docs/docs/memory/observational-memory.md +19 -0
- package/.docs/docs/memory/semantic-recall.md +2 -2
- package/.docs/docs/memory/storage.md +2 -1
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/metrics/overview.md +1 -0
- package/.docs/docs/observability/metrics/querying.md +292 -0
- package/.docs/docs/observability/tracing/exporters/langfuse.md +1 -1
- package/.docs/docs/observability/tracing/exporters/langsmith.md +2 -2
- package/.docs/docs/rag/graph-rag.md +2 -2
- package/.docs/docs/rag/retrieval.md +12 -12
- package/.docs/docs/server/auth/fga.md +4 -0
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/request-context.md +3 -3
- package/.docs/docs/streaming/overview.md +1 -1
- package/.docs/docs/streaming/tool-streaming.md +1 -1
- package/.docs/docs/voice/overview.md +86 -24
- package/.docs/docs/voice/speech-to-speech.md +55 -4
- package/.docs/docs/voice/speech-to-text.md +1 -1
- package/.docs/docs/voice/text-to-speech.md +1 -1
- package/.docs/docs/workspace/filesystem.md +2 -2
- package/.docs/docs/workspace/overview.md +1 -1
- package/.docs/docs/workspace/sandbox.md +5 -3
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +1 -1
- package/.docs/guides/deployment/inngest.md +69 -0
- package/.docs/guides/guide/ai-recruiter.md +1 -1
- package/.docs/guides/guide/chef-michel.md +1 -1
- package/.docs/guides/guide/code-review-bot.md +1 -1
- package/.docs/guides/guide/dev-assistant.md +1 -1
- package/.docs/guides/guide/docs-manager.md +1 -1
- package/.docs/guides/guide/firecrawl.md +6 -6
- package/.docs/guides/guide/github-actions-pr-description.md +1 -1
- package/.docs/guides/guide/research-assistant.md +1 -1
- package/.docs/guides/guide/research-coordinator.md +2 -2
- package/.docs/guides/guide/slack-assistant.md +1 -1
- package/.docs/guides/guide/stock-agent.md +2 -2
- package/.docs/guides/guide/whatsapp-chat-bot.md +2 -2
- package/.docs/guides/migrations/agentnetwork.md +4 -4
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +1 -1
- package/.docs/guides/migrations/vnext-to-standard-apis.md +2 -2
- package/.docs/models/embeddings.md +2 -2
- package/.docs/reference/agents/agent.md +60 -21
- package/.docs/reference/agents/channels.md +48 -6
- package/.docs/reference/agents/generateLegacy.md +1 -1
- package/.docs/reference/agents/getLLM.md +2 -2
- package/.docs/reference/agents/getMetadata.md +2 -2
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/browser/agent-browser.md +1 -1
- package/.docs/reference/browser/browser-viewer.md +1 -1
- package/.docs/reference/browser/mastra-browser.md +1 -1
- package/.docs/reference/browser/stagehand-browser.md +5 -5
- package/.docs/reference/client-js/agent-builder.md +161 -0
- package/.docs/reference/client-js/agents.md +19 -2
- package/.docs/reference/client-js/mastra-client.md +4 -0
- package/.docs/reference/configuration.md +1 -1
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +74 -0
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +77 -0
- package/.docs/reference/editor/agent-builder/builder-models.md +64 -0
- package/.docs/reference/editor/blob-store-provider.md +59 -0
- package/.docs/reference/editor/browser-provider.md +75 -0
- package/.docs/reference/editor/filesystem-provider.md +62 -0
- package/.docs/reference/editor/mastra-editor.md +61 -1
- package/.docs/reference/editor/processor-provider.md +64 -0
- package/.docs/reference/editor/sandbox-provider.md +61 -0
- package/.docs/reference/editor/storage-browser-ref.md +80 -0
- package/.docs/reference/editor/storage-workspace-ref.md +93 -0
- package/.docs/reference/evals/answer-relevancy.md +1 -1
- package/.docs/reference/evals/answer-similarity.md +1 -1
- package/.docs/reference/evals/bias.md +1 -1
- package/.docs/reference/evals/context-precision.md +3 -3
- package/.docs/reference/evals/context-relevance.md +11 -11
- package/.docs/reference/evals/create-scorer.md +2 -0
- package/.docs/reference/evals/faithfulness.md +1 -1
- package/.docs/reference/evals/hallucination.md +5 -5
- package/.docs/reference/evals/noise-sensitivity.md +11 -11
- package/.docs/reference/evals/prompt-alignment.md +15 -15
- package/.docs/reference/evals/tool-call-accuracy.md +3 -3
- package/.docs/reference/evals/toxicity.md +1 -1
- package/.docs/reference/index.md +15 -0
- package/.docs/reference/memory/memory-class.md +3 -3
- package/.docs/reference/memory/observational-memory.md +6 -4
- package/.docs/reference/memory/serialized-memory-config.md +72 -0
- package/.docs/reference/observability/metrics/automatic-metrics.md +7 -1
- package/.docs/reference/observability/tracing/exporters/langfuse.md +1 -1
- package/.docs/reference/processors/batch-parts-processor.md +1 -1
- package/.docs/reference/processors/cost-guard-processor.md +1 -1
- package/.docs/reference/processors/language-detector.md +1 -1
- package/.docs/reference/processors/message-history-processor.md +1 -1
- package/.docs/reference/processors/moderation-processor.md +2 -2
- package/.docs/reference/processors/pii-detector.md +2 -2
- package/.docs/reference/processors/prefill-error-handler.md +2 -2
- package/.docs/reference/processors/processor-interface.md +2 -2
- package/.docs/reference/processors/prompt-injection-detector.md +1 -1
- package/.docs/reference/processors/regex-filter-processor.md +1 -1
- package/.docs/reference/processors/semantic-recall-processor.md +1 -1
- package/.docs/reference/processors/skill-search-processor.md +1 -1
- package/.docs/reference/processors/system-prompt-scrubber.md +1 -1
- package/.docs/reference/processors/token-limiter-processor.md +3 -3
- package/.docs/reference/processors/tool-call-filter.md +2 -2
- package/.docs/reference/processors/tool-search-processor.md +33 -2
- package/.docs/reference/processors/unicode-normalizer.md +1 -1
- package/.docs/reference/processors/working-memory-processor.md +1 -1
- package/.docs/reference/rag/rerank.md +1 -1
- package/.docs/reference/server/nestjs-adapter.md +1 -1
- package/.docs/reference/server/routes.md +108 -9
- package/.docs/reference/storage/dsql.md +1 -1
- package/.docs/reference/storage/mongodb.md +1 -1
- package/.docs/reference/storage/postgresql.md +1 -1
- package/.docs/reference/storage/redis.md +1 -1
- package/.docs/reference/storage/spanner.md +5 -0
- package/.docs/reference/storage/upstash.md +1 -1
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/templates/overview.md +3 -3
- package/.docs/reference/tools/mcp-client.md +53 -2
- package/.docs/reference/tools/mcp-server.md +33 -1
- package/.docs/reference/tools/vector-query-tool.md +1 -1
- package/.docs/reference/vectors/libsql.md +1 -1
- package/.docs/reference/vectors/mongodb.md +1 -1
- package/.docs/reference/vectors/pg.md +3 -1
- package/.docs/reference/vectors/upstash.md +1 -1
- package/.docs/reference/voice/google-gemini-live.md +15 -2
- package/.docs/reference/voice/inworld-realtime.md +353 -0
- package/.docs/reference/voice/inworld.md +2 -0
- package/.docs/reference/voice/voice.addInstructions.md +1 -1
- package/.docs/reference/workspace/agentcore-runtime-sandbox.md +202 -0
- package/.docs/reference/workspace/agentfs-filesystem.md +1 -1
- package/.docs/reference/workspace/azure-blob-filesystem.md +1 -1
- package/.docs/reference/workspace/blaxel-sandbox.md +3 -0
- package/.docs/reference/workspace/docker-sandbox.md +4 -2
- package/.docs/reference/workspace/e2b-sandbox.md +9 -5
- package/.docs/reference/workspace/files-sdk-filesystem.md +1 -1
- package/.docs/reference/workspace/gcs-filesystem.md +1 -1
- package/.docs/reference/workspace/google-drive-filesystem.md +1 -1
- package/.docs/reference/workspace/local-filesystem.md +1 -1
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/modal-sandbox.md +1 -1
- package/.docs/reference/workspace/s3-filesystem.md +1 -1
- package/.docs/reference/workspace/vercel-microvm-sandbox.md +199 -0
- package/.docs/reference/workspace/vercel.md +2 -0
- package/CHANGELOG.md +65 -0
- package/package.json +8 -6
|
@@ -52,7 +52,7 @@ export const weatherAgent = new Agent({
|
|
|
52
52
|
instructions: `
|
|
53
53
|
You are a helpful weather assistant.
|
|
54
54
|
Use the weatherTool to fetch current weather data.`,
|
|
55
|
-
model: 'openai/gpt-5.
|
|
55
|
+
model: 'openai/gpt-5.5',
|
|
56
56
|
tools: { weatherTool },
|
|
57
57
|
})
|
|
58
58
|
```
|
|
@@ -145,7 +145,7 @@ export const weatherAgent = new Agent({
|
|
|
145
145
|
You are a helpful weather assistant.
|
|
146
146
|
Use the weatherTool to fetch current weather data.
|
|
147
147
|
Use the hazardsTool to provide information about potential weather hazards.`,
|
|
148
|
-
model: 'openai/gpt-5.
|
|
148
|
+
model: 'openai/gpt-5.5',
|
|
149
149
|
tools: { weatherTool, hazardsTool },
|
|
150
150
|
})
|
|
151
151
|
```
|
|
@@ -162,14 +162,14 @@ const writer = new Agent({
|
|
|
162
162
|
name: 'Writer',
|
|
163
163
|
description: 'Drafts and edits written content',
|
|
164
164
|
instructions: 'You are a skilled writer.',
|
|
165
|
-
model: 'openai/gpt-5.
|
|
165
|
+
model: 'openai/gpt-5.5',
|
|
166
166
|
})
|
|
167
167
|
|
|
168
168
|
export const supervisor = new Agent({
|
|
169
169
|
id: 'supervisor',
|
|
170
170
|
name: 'Supervisor',
|
|
171
171
|
instructions: 'Coordinate the writer to produce content.',
|
|
172
|
-
model: 'openai/gpt-5.
|
|
172
|
+
model: 'openai/gpt-5.5',
|
|
173
173
|
agents: { writer },
|
|
174
174
|
})
|
|
175
175
|
```
|
|
@@ -186,7 +186,7 @@ export const researchAgent = new Agent({
|
|
|
186
186
|
id: 'research-agent',
|
|
187
187
|
name: 'Research Agent',
|
|
188
188
|
instructions: 'You are a research assistant.',
|
|
189
|
-
model: 'openai/gpt-5.
|
|
189
|
+
model: 'openai/gpt-5.5',
|
|
190
190
|
workflows: { researchWorkflow },
|
|
191
191
|
})
|
|
192
192
|
```
|
|
@@ -73,7 +73,7 @@ const workspace = new Workspace({
|
|
|
73
73
|
|
|
74
74
|
const browserAgent = new Agent({
|
|
75
75
|
id: 'browser-agent',
|
|
76
|
-
model: 'openai/gpt-5.
|
|
76
|
+
model: 'openai/gpt-5.5',
|
|
77
77
|
workspace,
|
|
78
78
|
instructions: `You are a web automation assistant.
|
|
79
79
|
Use browser-use commands to navigate and interact with websites.`,
|
|
@@ -72,7 +72,7 @@ export const webAgent = new Agent({
|
|
|
72
72
|
id: 'web-agent',
|
|
73
73
|
name: 'Web Agent',
|
|
74
74
|
description: 'A web automation assistant that can navigate websites and complete tasks.',
|
|
75
|
-
model: 'openai/gpt-5.
|
|
75
|
+
model: 'openai/gpt-5.5',
|
|
76
76
|
browser,
|
|
77
77
|
instructions:
|
|
78
78
|
'You are a web automation assistant. Use browser tools to navigate websites and complete tasks.',
|
|
@@ -47,13 +47,13 @@ import { StagehandBrowser } from '@mastra/stagehand'
|
|
|
47
47
|
|
|
48
48
|
const browser = new StagehandBrowser({
|
|
49
49
|
headless: false,
|
|
50
|
-
model: 'openai/gpt-5.
|
|
50
|
+
model: 'openai/gpt-5.5',
|
|
51
51
|
})
|
|
52
52
|
|
|
53
53
|
export const stagehandAgent = new Agent({
|
|
54
54
|
id: 'stagehand-agent',
|
|
55
55
|
name: 'Stagehand Agent',
|
|
56
|
-
model: 'openai/gpt-5.
|
|
56
|
+
model: 'openai/gpt-5.5',
|
|
57
57
|
browser,
|
|
58
58
|
instructions: `You are a web automation assistant.
|
|
59
59
|
|
|
@@ -117,7 +117,7 @@ Use screenshots when you need to visually inspect the page — for example, eval
|
|
|
117
117
|
```typescript
|
|
118
118
|
const browser = new StagehandBrowser({
|
|
119
119
|
headless: false,
|
|
120
|
-
model: 'openai/gpt-5.
|
|
120
|
+
model: 'openai/gpt-5.5',
|
|
121
121
|
})
|
|
122
122
|
```
|
|
123
123
|
|
|
@@ -126,7 +126,7 @@ To disable the screenshot tool for models that do not support vision, use `exclu
|
|
|
126
126
|
```typescript
|
|
127
127
|
const browser = new StagehandBrowser({
|
|
128
128
|
headless: false,
|
|
129
|
-
model: 'openai/gpt-5.
|
|
129
|
+
model: 'openai/gpt-5.5',
|
|
130
130
|
excludeTools: ['stagehand_screenshot'],
|
|
131
131
|
})
|
|
132
132
|
```
|
|
@@ -140,7 +140,7 @@ const browser = new StagehandBrowser({
|
|
|
140
140
|
env: 'BROWSERBASE',
|
|
141
141
|
apiKey: process.env.BROWSERBASE_API_KEY,
|
|
142
142
|
projectId: process.env.BROWSERBASE_PROJECT_ID,
|
|
143
|
-
model: 'openai/gpt-5.
|
|
143
|
+
model: 'openai/gpt-5.5',
|
|
144
144
|
})
|
|
145
145
|
```
|
|
146
146
|
|
|
@@ -66,6 +66,41 @@ Once registered, you can manage agents through [Studio](https://mastra.ai/docs/s
|
|
|
66
66
|
|
|
67
67
|
> **Note:** See the [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor) for all configuration options.
|
|
68
68
|
|
|
69
|
+
## Code and database sources
|
|
70
|
+
|
|
71
|
+
The editor stores agent overrides in one of two sources, set with the `source` option on `MastraEditor`:
|
|
72
|
+
|
|
73
|
+
| Source | Where overrides live | Studio actions |
|
|
74
|
+
| -------------- | --------------------------------------------------------- | -------------------------------------------------------- |
|
|
75
|
+
| `db` (default) | The configured storage backend. | Save and publish drafts. |
|
|
76
|
+
| `code` | Per-agent JSON files on disk, tracked in your repository. | Download the override file or save it to the filesystem. |
|
|
77
|
+
|
|
78
|
+
The default `db` source is best when non-developers iterate through Studio and you want versioning, drafts, and runtime version targeting. The `code` source is best when overrides should live in your repository alongside the rest of your code, reviewed through pull requests and deployed with your application.
|
|
79
|
+
|
|
80
|
+
To use the code source, set `source: 'code'`:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { Mastra } from '@mastra/core'
|
|
84
|
+
import { MastraEditor } from '@mastra/editor'
|
|
85
|
+
|
|
86
|
+
export const mastra = new Mastra({
|
|
87
|
+
agents: {
|
|
88
|
+
/* your existing agents */
|
|
89
|
+
},
|
|
90
|
+
editor: new MastraEditor({
|
|
91
|
+
source: 'code',
|
|
92
|
+
}),
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
When `source` is `'code'`, the editor writes each override to a deterministic JSON file under `./mastra/editor/agents/<agentId>.json`. Set `codePath` to change the directory. Because the files are deterministic, every save produces a clean diff you can commit and review.
|
|
97
|
+
|
|
98
|
+
### Versioning with the code source
|
|
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 appears 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
|
+
|
|
102
|
+
This means versions and rollbacks are managed through Git rather than through draft and publish actions.
|
|
103
|
+
|
|
69
104
|
## Studio
|
|
70
105
|
|
|
71
106
|
Go to the **Agents** tab in Studio and select an agent to edit. Select the **Editor** tab. You'll be taken to the editor interface, where you can modify the agent's instructions, tools, and variables.
|
|
@@ -114,15 +149,16 @@ The `editor.agent` namespace also exposes `getById`, `list`, `listResolved`, and
|
|
|
114
149
|
|
|
115
150
|
The same operations are available over HTTP through the Mastra server. Use these when you want to manage stored agents from a separate service or from a non-TypeScript client:
|
|
116
151
|
|
|
117
|
-
| Method | Path
|
|
118
|
-
| -------- |
|
|
119
|
-
| `GET` | `/stored/agents`
|
|
120
|
-
| `POST` | `/stored/agents`
|
|
121
|
-
| `GET` | `/stored/agents/:storedAgentId`
|
|
122
|
-
| `PATCH` | `/stored/agents/:storedAgentId`
|
|
123
|
-
| `DELETE` | `/stored/agents/:storedAgentId`
|
|
152
|
+
| Method | Path | Description |
|
|
153
|
+
| -------- | -------------------------------------- | ---------------------------------------------------------------- |
|
|
154
|
+
| `GET` | `/stored/agents` | List all stored agents. |
|
|
155
|
+
| `POST` | `/stored/agents` | Create a stored agent. |
|
|
156
|
+
| `GET` | `/stored/agents/:storedAgentId` | Get a stored agent by ID. |
|
|
157
|
+
| `PATCH` | `/stored/agents/:storedAgentId` | Update a stored agent. |
|
|
158
|
+
| `DELETE` | `/stored/agents/:storedAgentId` | Delete a stored agent. |
|
|
159
|
+
| `POST` | `/stored/agents/:storedAgentId/export` | Export a stored agent's override as a deterministic JSON config. |
|
|
124
160
|
|
|
125
|
-
The Client SDK wraps these endpoints with `client.listStoredAgents()`, `client.createStoredAgent()`, and `client.getStoredAgent()`. Version management endpoints live under `/stored/agents/:storedAgentId/versions`, see [version management](https://mastra.ai/reference/client-js/agents) for the full list.
|
|
161
|
+
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()`, 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.
|
|
126
162
|
|
|
127
163
|
### Automated experimentation
|
|
128
164
|
|
|
@@ -149,6 +185,32 @@ When you edit a code-defined agent through the editor, only specific fields can
|
|
|
149
185
|
|
|
150
186
|
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.
|
|
151
187
|
|
|
188
|
+
### Controlling what is editable
|
|
189
|
+
|
|
190
|
+
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:
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
import { Agent } from '@mastra/core/agent'
|
|
194
|
+
|
|
195
|
+
export const supportAgent = new Agent({
|
|
196
|
+
name: 'support-agent',
|
|
197
|
+
model: 'openai/gpt-5.5',
|
|
198
|
+
editor: { instructions: true, tools: { description: true } },
|
|
199
|
+
})
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The `editor` field accepts these shapes:
|
|
203
|
+
|
|
204
|
+
| Value | Result |
|
|
205
|
+
| ---------------------------------- | ---------------------------------------------------------- |
|
|
206
|
+
| Omitted | Instructions and tools are editable. |
|
|
207
|
+
| `false` | Nothing is editable. The agent is locked. |
|
|
208
|
+
| `{ instructions: true }` | Instructions are editable. |
|
|
209
|
+
| `{ tools: true }` | Tool membership and descriptions are editable. |
|
|
210
|
+
| `{ tools: { description: true } }` | Only tool descriptions are editable. Membership is locked. |
|
|
211
|
+
|
|
212
|
+
When a field is owned by code, Studio shows it as read-only and the server strips it from saved overrides, so the stored config only contains the fields you allow. See the [`editor` overrides reference](https://mastra.ai/reference/agents/agent) for the full type.
|
|
213
|
+
|
|
152
214
|
## Versioning
|
|
153
215
|
|
|
154
216
|
Every time you save changes to an agent or prompt block, a new version snapshot is created. Versions give you a full history of your agent's configuration. You can roll back to any previous state, compare what changed between two snapshots, and target specific versions per request for A/B testing or gradual rollouts.
|
|
@@ -44,7 +44,7 @@ const glutenCheckerScorer = createScorer({
|
|
|
44
44
|
id: 'gluten-checker',
|
|
45
45
|
description: 'Check if recipes contain gluten ingredients',
|
|
46
46
|
judge: { // Optional: for prompt object steps
|
|
47
|
-
model: 'openai/gpt-5.
|
|
47
|
+
model: 'openai/gpt-5.5',
|
|
48
48
|
instructions: 'You are a Chef that identifies if recipes contain gluten.'
|
|
49
49
|
}
|
|
50
50
|
})
|
|
@@ -104,7 +104,7 @@ const summary = await dataset.startExperiment({
|
|
|
104
104
|
```typescript
|
|
105
105
|
import { createAnswerRelevancyScorer } from '@mastra/evals/scorers/prebuilt'
|
|
106
106
|
|
|
107
|
-
const relevancy = createAnswerRelevancyScorer({ model: '
|
|
107
|
+
const relevancy = createAnswerRelevancyScorer({ model: 'openai/gpt-5-mini' })
|
|
108
108
|
|
|
109
109
|
const summary = await dataset.startExperiment({
|
|
110
110
|
name: 'with-scorer-instances',
|
|
@@ -57,11 +57,11 @@ import { createAnswerRelevancyScorer, createToxicityScorer } from '@mastra/evals
|
|
|
57
57
|
export const evaluatedAgent = new Agent({
|
|
58
58
|
scorers: {
|
|
59
59
|
relevancy: {
|
|
60
|
-
scorer: createAnswerRelevancyScorer({ model: '
|
|
60
|
+
scorer: createAnswerRelevancyScorer({ model: 'openai/gpt-5-mini' }),
|
|
61
61
|
sampling: { type: 'ratio', rate: 0.5 },
|
|
62
62
|
},
|
|
63
63
|
safety: {
|
|
64
|
-
scorer: createToxicityScorer({ model: '
|
|
64
|
+
scorer: createToxicityScorer({ model: 'openai/gpt-5-mini' }),
|
|
65
65
|
sampling: { type: 'ratio', rate: 1 },
|
|
66
66
|
},
|
|
67
67
|
},
|
|
@@ -113,7 +113,7 @@ If you prefer not to use our automatic CLI tool, you can set up your project you
|
|
|
113
113
|
Add your API key:
|
|
114
114
|
|
|
115
115
|
```bash
|
|
116
|
-
|
|
116
|
+
GOOGLE_API_KEY=<your-api-key>
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
> **Note:** This guide uses Google Gemini, but you can use any supported [model provider](https://mastra.ai/models), including OpenAI, Anthropic, and more.
|
|
@@ -93,7 +93,7 @@ export const myAgent = new Agent({
|
|
|
93
93
|
id: 'my-agent',
|
|
94
94
|
name: 'My Agent',
|
|
95
95
|
instructions: 'You have access to interactive UI tools.',
|
|
96
|
-
model: '
|
|
96
|
+
model: 'openai/gpt-5-mini',
|
|
97
97
|
tools: { calculatorTool },
|
|
98
98
|
})
|
|
99
99
|
```
|
|
@@ -125,7 +125,7 @@ const mcpClient = new MCPClient({
|
|
|
125
125
|
const myAgent = new Agent({
|
|
126
126
|
id: 'my-agent',
|
|
127
127
|
name: 'My Agent',
|
|
128
|
-
model: '
|
|
128
|
+
model: 'openai/gpt-5-mini',
|
|
129
129
|
tools: await mcpClient.listTools(),
|
|
130
130
|
})
|
|
131
131
|
|
|
@@ -270,7 +270,7 @@ const mcpClient = new MCPClient({
|
|
|
270
270
|
const myAgent = new Agent({
|
|
271
271
|
id: 'my-agent',
|
|
272
272
|
name: 'My Agent',
|
|
273
|
-
model: '
|
|
273
|
+
model: 'openai/gpt-5-mini',
|
|
274
274
|
tools: await mcpClient.listTools(),
|
|
275
275
|
})
|
|
276
276
|
|
|
@@ -82,7 +82,7 @@ export const testAgent = new Agent({
|
|
|
82
82
|
- US National Weather Service
|
|
83
83
|
|
|
84
84
|
Answer questions using the information you find using the MCP Servers.`,
|
|
85
|
-
model: 'openai/gpt-5.
|
|
85
|
+
model: 'openai/gpt-5.5',
|
|
86
86
|
tools: await testMcpClient.listTools(),
|
|
87
87
|
})
|
|
88
88
|
```
|
|
@@ -45,7 +45,7 @@ const agent = new Agent({
|
|
|
45
45
|
id: 'test-agent',
|
|
46
46
|
name: 'Test Agent',
|
|
47
47
|
instructions: 'You are a helpful assistant',
|
|
48
|
-
model: 'openai/gpt-5.
|
|
48
|
+
model: 'openai/gpt-5.5',
|
|
49
49
|
memory: new Memory({
|
|
50
50
|
storage: new LibSQLStore({
|
|
51
51
|
id: 'memory-store',
|
|
@@ -95,7 +95,7 @@ import { openai } from '@ai-sdk/openai'
|
|
|
95
95
|
const agent = new Agent({
|
|
96
96
|
name: 'semantic-agent',
|
|
97
97
|
instructions: 'You are a helpful assistant with semantic memory',
|
|
98
|
-
model: 'openai/gpt-5.
|
|
98
|
+
model: 'openai/gpt-5.5',
|
|
99
99
|
memory: new Memory({
|
|
100
100
|
storage: new LibSQLStore({
|
|
101
101
|
id: 'memory-store',
|
|
@@ -148,7 +148,7 @@ import { openai } from '@ai-sdk/openai'
|
|
|
148
148
|
const agent = new Agent({
|
|
149
149
|
name: 'working-memory-agent',
|
|
150
150
|
instructions: 'You are an assistant with working memory',
|
|
151
|
-
model: 'openai/gpt-5.
|
|
151
|
+
model: 'openai/gpt-5.5',
|
|
152
152
|
memory: new Memory({
|
|
153
153
|
storage: new LibSQLStore({
|
|
154
154
|
id: 'memory-store',
|
|
@@ -180,7 +180,7 @@ const customMessageHistory = new MessageHistory({
|
|
|
180
180
|
const agent = new Agent({
|
|
181
181
|
name: 'custom-memory-agent',
|
|
182
182
|
instructions: 'You are a helpful assistant',
|
|
183
|
-
model: 'openai/gpt-5.
|
|
183
|
+
model: 'openai/gpt-5.5',
|
|
184
184
|
memory: new Memory({
|
|
185
185
|
storage: new LibSQLStore({ id: 'memory-store', url: 'file:memory.db' }),
|
|
186
186
|
lastMessages: 10, // This would normally add MessageHistory(10)
|
|
@@ -250,7 +250,7 @@ const contentBlocker = {
|
|
|
250
250
|
const agent = new Agent({
|
|
251
251
|
name: 'safe-agent',
|
|
252
252
|
instructions: 'You are a helpful assistant',
|
|
253
|
-
model: 'openai/gpt-5.
|
|
253
|
+
model: 'openai/gpt-5.5',
|
|
254
254
|
memory: new Memory({ lastMessages: 10 }),
|
|
255
255
|
// Your guardrail runs BEFORE memory saves
|
|
256
256
|
outputProcessors: [contentBlocker],
|
|
@@ -289,7 +289,7 @@ const inputValidator = {
|
|
|
289
289
|
const agent = new Agent({
|
|
290
290
|
name: 'validated-agent',
|
|
291
291
|
instructions: 'You are a helpful assistant',
|
|
292
|
-
model: 'openai/gpt-5.
|
|
292
|
+
model: 'openai/gpt-5.5',
|
|
293
293
|
memory: new Memory({ lastMessages: 10 }),
|
|
294
294
|
// Your guardrail runs AFTER memory loads history
|
|
295
295
|
inputProcessors: [inputValidator],
|
|
@@ -65,7 +65,7 @@ const memory = new Memory({
|
|
|
65
65
|
export const collabAgent = new Agent({
|
|
66
66
|
id: 'collab',
|
|
67
67
|
name: 'CollabAgent',
|
|
68
|
-
model: '
|
|
68
|
+
model: 'openai/gpt-5-mini',
|
|
69
69
|
memory,
|
|
70
70
|
instructions: `
|
|
71
71
|
You are a collaborative document assistant. Multiple users talk to you in the SAME thread.
|
|
@@ -117,6 +117,25 @@ const memory = new Memory({
|
|
|
117
117
|
|
|
118
118
|
In this example, the top-level idle setting is disabled for observations, while reflections opt into idle and provider-change activation.
|
|
119
119
|
|
|
120
|
+
### Buffer on idle
|
|
121
|
+
|
|
122
|
+
Set `observation.bufferOnIdle` to `true` to run background observation buffering when an agent turn ends and the agent becomes idle. This is useful for apps that want short turns to be observed without waiting for the next turn or the `messageTokens` threshold.
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
const memory = new Memory({
|
|
126
|
+
options: {
|
|
127
|
+
observationalMemory: {
|
|
128
|
+
model: 'openai/gpt-5-mini',
|
|
129
|
+
observation: {
|
|
130
|
+
bufferOnIdle: true,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
})
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`bufferOnIdle` is off by default. It is separate from `bufferTokens`: `bufferTokens` controls step-time async buffering, while `bufferOnIdle` controls end-of-turn buffering for idle turns.
|
|
138
|
+
|
|
120
139
|
See [the API reference](https://mastra.ai/reference/memory/observational-memory) for the full configuration shape.
|
|
121
140
|
|
|
122
141
|
## Benefits
|
|
@@ -30,7 +30,7 @@ const agent = new Agent({
|
|
|
30
30
|
id: 'support-agent',
|
|
31
31
|
name: 'SupportAgent',
|
|
32
32
|
instructions: 'You are a helpful support agent.',
|
|
33
|
-
model: 'openai/gpt-5.
|
|
33
|
+
model: 'openai/gpt-5.5',
|
|
34
34
|
memory: new Memory({
|
|
35
35
|
storage: new LibSQLStore({
|
|
36
36
|
id: 'agent-storage',
|
|
@@ -247,7 +247,7 @@ const agent = new Agent({
|
|
|
247
247
|
})
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
The model router automatically handles API key detection from environment variables (`OPENAI_API_KEY`, `
|
|
250
|
+
The model router automatically handles API key detection from environment variables (`OPENAI_API_KEY`, `GOOGLE_API_KEY`, `OPENROUTER_API_KEY`). Google models also fall back to `GOOGLE_GENERATIVE_AI_API_KEY`.
|
|
251
251
|
|
|
252
252
|
### Using AI SDK Packages
|
|
253
253
|
|
|
@@ -41,6 +41,7 @@ Each provider page includes installation instructions, configuration parameters,
|
|
|
41
41
|
- [DynamoDB](https://mastra.ai/reference/storage/dynamodb)
|
|
42
42
|
- [LanceDB](https://mastra.ai/reference/storage/lance)
|
|
43
43
|
- [Microsoft SQL Server](https://mastra.ai/reference/storage/mssql)
|
|
44
|
+
- [Google Cloud Spanner](https://mastra.ai/reference/storage/spanner)
|
|
44
45
|
|
|
45
46
|
> **Tip:** libSQL is the easiest way to get started because it doesn’t require running a separate database server.
|
|
46
47
|
|
|
@@ -179,7 +180,7 @@ export const agent = new Agent({
|
|
|
179
180
|
memory: new Memory({
|
|
180
181
|
options: {
|
|
181
182
|
generateTitle: {
|
|
182
|
-
model: '
|
|
183
|
+
model: 'openai/gpt-5-mini',
|
|
183
184
|
instructions: 'Generate a 1 word title',
|
|
184
185
|
},
|
|
185
186
|
},
|
|
@@ -110,6 +110,7 @@ Before storage, all metric labels pass through a cardinality filter that blocks
|
|
|
110
110
|
## Next steps
|
|
111
111
|
|
|
112
112
|
- [Automatic metrics reference](https://mastra.ai/reference/observability/metrics/automatic-metrics)
|
|
113
|
+
- [Querying metrics](https://mastra.ai/docs/observability/metrics/querying)
|
|
113
114
|
- [Tracing overview](https://mastra.ai/docs/observability/tracing/overview)
|
|
114
115
|
- [Studio observability](https://mastra.ai/docs/studio/observability)
|
|
115
116
|
- [Observability overview](https://mastra.ai/docs/observability/overview)
|