@mastra/mcp-docs-server 1.1.42-alpha.8 → 1.1.43-alpha.0
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/memory.md +1 -1
- package/.docs/docs/agents/a2a.md +1 -1
- package/.docs/docs/agents/acp.md +23 -160
- package/.docs/docs/agents/adding-voice.md +7 -7
- package/.docs/docs/agents/agent-approval.md +1 -1
- package/.docs/docs/agents/background-tasks.md +2 -2
- package/.docs/docs/agents/channels.md +1 -1
- package/.docs/docs/agents/code-mode.md +3 -3
- 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 +146 -3
- package/.docs/docs/agents/sdk-agents.md +261 -0
- package/.docs/docs/agents/signals.md +230 -10
- 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/build-with-ai/skills.md +3 -3
- package/.docs/docs/editor/overview.md +12 -11
- 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/build-with-ai.md +37 -0
- package/.docs/docs/mastra-platform/observability.md +4 -4
- 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 +2 -2
- package/.docs/docs/memory/semantic-recall.md +1 -1
- package/.docs/docs/memory/storage.md +2 -1
- package/.docs/docs/memory/working-memory.md +28 -1
- package/.docs/docs/observability/metrics/querying.md +1 -1
- 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 +2 -0
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/pubsub.md +124 -0
- 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/studio/auth.md +20 -0
- package/.docs/docs/voice/overview.md +25 -25
- package/.docs/docs/voice/speech-to-speech.md +4 -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 +1 -1
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +1 -1
- 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 +1 -1
- 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/reference/acp/acp-agent.md +228 -0
- package/.docs/reference/acp/create-acp-tool.md +131 -0
- package/.docs/reference/agents/agent.md +55 -5
- package/.docs/reference/agents/channels.md +47 -5
- package/.docs/reference/agents/durable-agent.md +239 -0
- 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/cli/mastra.md +5 -5
- package/.docs/reference/client-js/agents.md +41 -7
- package/.docs/reference/configuration.md +1 -1
- 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/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 +9 -0
- package/.docs/reference/memory/memory-class.md +3 -3
- package/.docs/reference/memory/observational-memory.md +4 -4
- 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/response-cache.md +2 -2
- 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 +2 -2
- package/.docs/reference/processors/unicode-normalizer.md +1 -1
- package/.docs/reference/processors/working-memory-processor.md +1 -1
- package/.docs/reference/pubsub/base.md +168 -0
- package/.docs/reference/pubsub/caching-pubsub.md +102 -0
- package/.docs/reference/pubsub/event-emitter.md +72 -0
- package/.docs/reference/pubsub/google-cloud-pubsub.md +94 -0
- package/.docs/reference/pubsub/redis-streams.md +108 -0
- package/.docs/reference/pubsub/unix-socket-pubsub.md +52 -0
- package/.docs/reference/rag/rerank.md +1 -1
- package/.docs/reference/server/nestjs-adapter.md +1 -1
- package/.docs/reference/storage/dsql.md +1 -1
- package/.docs/reference/storage/libsql.md +6 -0
- package/.docs/reference/storage/mongodb.md +4 -1
- package/.docs/reference/storage/postgresql.md +4 -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 +1 -1
- package/.docs/reference/tools/mcp-client.md +2 -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 +1 -1
- package/.docs/reference/vectors/upstash.md +1 -1
- package/.docs/reference/voice/voice.addInstructions.md +1 -1
- package/.docs/reference/workspace/agentfs-filesystem.md +1 -1
- package/.docs/reference/workspace/azure-blob-filesystem.md +1 -1
- package/.docs/reference/workspace/docker-sandbox.md +1 -1
- 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/CHANGELOG.md +38 -0
- package/package.json +6 -6
- package/.docs/docs/agents/response-caching.md +0 -150
|
@@ -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
|
|
|
@@ -32,6 +32,8 @@ bun x skills add mastra-ai/skills
|
|
|
32
32
|
|
|
33
33
|
Mastra skills work with any coding agent that supports the [Skills standard](https://agentskills.io/), including Claude Code, Cursor, Codex, OpenCode, and others.
|
|
34
34
|
|
|
35
|
+
They're also available on [GitHub](https://github.com/mastra-ai/skills).
|
|
36
|
+
|
|
35
37
|
## Update skill
|
|
36
38
|
|
|
37
39
|
To update to the latest version of the Mastra skill, run:
|
|
@@ -58,6 +60,4 @@ yarn dlx skills update mastra
|
|
|
58
60
|
|
|
59
61
|
```bash
|
|
60
62
|
bun x skills update mastra
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
They're also available on [GitHub](https://github.com/mastra-ai/skills).
|
|
63
|
+
```
|
|
@@ -149,16 +149,17 @@ The `editor.agent` namespace also exposes `getById`, `list`, `listResolved`, and
|
|
|
149
149
|
|
|
150
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:
|
|
151
151
|
|
|
152
|
-
| Method | Path
|
|
153
|
-
| -------- |
|
|
154
|
-
| `GET` | `/stored/agents`
|
|
155
|
-
| `POST` | `/stored/agents`
|
|
156
|
-
| `GET` | `/stored/agents/:storedAgentId`
|
|
157
|
-
| `PATCH` | `/stored/agents/:storedAgentId`
|
|
158
|
-
| `DELETE` | `/stored/agents/:storedAgentId`
|
|
159
|
-
| `
|
|
160
|
-
|
|
161
|
-
|
|
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
|
+
| `GET` | `/stored/agents/:storedAgentId/dependents` | List agents that reference this agent as a sub-agent. |
|
|
160
|
+
| `POST` | `/stored/agents/:storedAgentId/export` | Export a stored agent's override as a deterministic JSON config. |
|
|
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 cannot 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.
|
|
162
163
|
|
|
163
164
|
### Automated experimentation
|
|
164
165
|
|
|
@@ -194,7 +195,7 @@ import { Agent } from '@mastra/core/agent'
|
|
|
194
195
|
|
|
195
196
|
export const supportAgent = new Agent({
|
|
196
197
|
name: 'support-agent',
|
|
197
|
-
model: 'openai/gpt-5.
|
|
198
|
+
model: 'openai/gpt-5.5',
|
|
198
199
|
editor: { instructions: true, tools: { description: true } },
|
|
199
200
|
})
|
|
200
201
|
```
|
|
@@ -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
|
},
|
|
@@ -40,6 +40,43 @@ In addition to documentation access, the [MCP Docs Server](https://mastra.ai/doc
|
|
|
40
40
|
|
|
41
41
|
Learn how to use the [MCP Docs Server](https://mastra.ai/docs/build-with-ai/mcp-docs-server).
|
|
42
42
|
|
|
43
|
+
## Mastra CLI
|
|
44
|
+
|
|
45
|
+
The [Mastra CLI](https://mastra.ai/reference/cli/mastra) gives your coding agent a direct line to your Mastra runtime. Agents can invoke agents, run workflows, execute tools, inspect memory, run evals, and query traces and logs.
|
|
46
|
+
|
|
47
|
+
**npm**:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install mastra@latest -g
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**pnpm**:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pnpm add mastra@latest -g
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Yarn**:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
yarn global add mastra@latest
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Bun**:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
bun add mastra@latest --global
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For example, your coding agent can run an agent, then pull traces to inspect the results:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
mastra api --url http://localhost:4111 agent run weather-agent '{"messages":"What is the weather in London?"}'
|
|
75
|
+
mastra api --url http://localhost:4111 trace list
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
See the [CLI commands reference](https://mastra.ai/reference/cli/mastra) for the full list of available commands.
|
|
79
|
+
|
|
43
80
|
## Embedded package docs
|
|
44
81
|
|
|
45
82
|
Mastra packages ship with embedded documentation in `dist/docs`. When you install a Mastra package, your AI agent can read these files directly from `node_modules` to understand the package's APIs and patterns.
|
|
@@ -105,25 +105,25 @@ After your project is publishing traces, logs, or scores to Mastra Platform Obse
|
|
|
105
105
|
**npm**:
|
|
106
106
|
|
|
107
107
|
```bash
|
|
108
|
-
npx mastra api trace list
|
|
108
|
+
npx mastra api trace list
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
**pnpm**:
|
|
112
112
|
|
|
113
113
|
```bash
|
|
114
|
-
pnpm dlx mastra api trace list
|
|
114
|
+
pnpm dlx mastra api trace list
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
**Yarn**:
|
|
118
118
|
|
|
119
119
|
```bash
|
|
120
|
-
yarn dlx mastra api trace list
|
|
120
|
+
yarn dlx mastra api trace list
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
**Bun**:
|
|
124
124
|
|
|
125
125
|
```bash
|
|
126
|
-
bun x mastra api trace list
|
|
126
|
+
bun x mastra api trace list
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
For observability commands, the CLI targets the hosted observability API and can infer credentials from your project environment. See the [`mastra api` CLI reference](https://mastra.ai/reference/cli/mastra) for available observability commands, filtering, pagination, credential resolution, and direct `curl` examples.
|
|
@@ -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.
|
|
@@ -135,7 +135,7 @@ const memory = new Memory({
|
|
|
135
135
|
|
|
136
136
|
The model reads identity from the `<turn>` tag on the current message and from prior tagged messages brought back through `lastMessages`.
|
|
137
137
|
|
|
138
|
-
### With
|
|
138
|
+
### With Observational Memory (recommended)
|
|
139
139
|
|
|
140
140
|
[Observational Memory](https://mastra.ai/docs/memory/observational-memory) (OM) extracts per-user facts into a background log without burning the agent's tool budget. The default Observer model reads `<turn>` tags natively and produces named attribution like `Alice stated her favorite color is teal.` and `Bob asked for QA sign-off before publish.`
|
|
141
141
|
|
|
@@ -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',
|
|
@@ -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
|
},
|
|
@@ -26,7 +26,7 @@ const agent = new Agent({
|
|
|
26
26
|
id: 'personal-assistant',
|
|
27
27
|
name: 'PersonalAssistant',
|
|
28
28
|
instructions: 'You are a helpful personal assistant.',
|
|
29
|
-
model: 'openai/gpt-5.
|
|
29
|
+
model: 'openai/gpt-5.5',
|
|
30
30
|
memory: new Memory({
|
|
31
31
|
options: {
|
|
32
32
|
workingMemory: {
|
|
@@ -393,6 +393,33 @@ const response = await agent.generate('What do you know about me?', {
|
|
|
393
393
|
})
|
|
394
394
|
```
|
|
395
395
|
|
|
396
|
+
## Opt in to state signals (experimental)
|
|
397
|
+
|
|
398
|
+
By default, working memory reaches the model as part of the system message. You can opt into delivering it as a [state signal](https://mastra.ai/docs/agents/signals) instead by setting `useStateSignals: true`:
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
const memory = new Memory({
|
|
402
|
+
storage: new LibSQLStore({ url: 'file:./mastra.db' }),
|
|
403
|
+
options: {
|
|
404
|
+
workingMemory: {
|
|
405
|
+
enabled: true,
|
|
406
|
+
template: '# User\n- name:\n- location:',
|
|
407
|
+
useStateSignals: true, // experimental: deliver as state signal
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
})
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
What changes:
|
|
414
|
+
|
|
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 is 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
|
+
- **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
|
+
|
|
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
|
+
|
|
421
|
+
The default (`useStateSignals: false`) keeps the existing system-message behavior unchanged. `useStateSignals` is not supported with template working memory `version: 'vnext'`.
|
|
422
|
+
|
|
396
423
|
## Examples
|
|
397
424
|
|
|
398
425
|
- [Working memory with template](https://github.com/mastra-ai/mastra/tree/main/examples/memory-with-template)
|
|
@@ -78,7 +78,7 @@ The `@mastra/client-js` SDK wraps the same routes as `mastraClient.getMetricAggr
|
|
|
78
78
|
```bash
|
|
79
79
|
mastra api metric aggregate \
|
|
80
80
|
'{"name":["mastra_agent_duration_ms"],"aggregation":"avg"}' \
|
|
81
|
-
--url http://localhost:4111
|
|
81
|
+
--url http://localhost:4111
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
By default the CLI targets hosted Mastra observability (`https://observability.mastra.ai`). Pass `--url http://localhost:4111` to query a local `mastra dev` server. See [`mastra api metric aggregate`](https://mastra.ai/reference/cli/mastra) and the surrounding entries for the full command list.
|
|
@@ -214,7 +214,7 @@ const prompt = await exporter.client.prompt.get('customer-support', { type: 'tex
|
|
|
214
214
|
export const supportAgent = new Agent({
|
|
215
215
|
name: 'support-agent',
|
|
216
216
|
instructions: prompt.compile(), // Use the prompt text from Langfuse
|
|
217
|
-
model: 'openai/gpt-5.
|
|
217
|
+
model: 'openai/gpt-5.5',
|
|
218
218
|
defaultGenerateOptions: {
|
|
219
219
|
tracingOptions: buildTracingOptions(
|
|
220
220
|
withLangfusePrompt({ name: prompt.name, version: prompt.version }),
|
|
@@ -143,7 +143,7 @@ export const supportAgent = new Agent({
|
|
|
143
143
|
id: 'support-agent',
|
|
144
144
|
name: 'support-agent',
|
|
145
145
|
instructions: 'You are a helpful support agent.',
|
|
146
|
-
model: 'openai/gpt-5.
|
|
146
|
+
model: 'openai/gpt-5.5',
|
|
147
147
|
defaultOptions: {
|
|
148
148
|
tracingOptions: buildTracingOptions(withLangsmithMetadata({ projectName: 'customer-support' })),
|
|
149
149
|
},
|
|
@@ -163,7 +163,7 @@ export const supportAgent = new Agent({
|
|
|
163
163
|
id: 'support-agent',
|
|
164
164
|
name: 'support-agent',
|
|
165
165
|
instructions: 'You are a helpful support agent.',
|
|
166
|
-
model: 'openai/gpt-5.
|
|
166
|
+
model: 'openai/gpt-5.5',
|
|
167
167
|
defaultOptions: ({ requestContext }) => {
|
|
168
168
|
const userTier = requestContext?.get('user-tier') as string
|
|
169
169
|
const userId = requestContext?.get('user-id') as string
|
|
@@ -75,7 +75,7 @@ const ragAgent = new Agent({
|
|
|
75
75
|
instructions: `You are a helpful assistant that answers questions based on the provided context.
|
|
76
76
|
When answering questions, use the graph query tool to find relevant information and relationships.
|
|
77
77
|
Base your answers on the context provided by the tool, and clearly state if the context doesn't contain enough information.`,
|
|
78
|
-
model: 'openai/gpt-5.
|
|
78
|
+
model: 'openai/gpt-5.5',
|
|
79
79
|
tools: {
|
|
80
80
|
graphQueryTool,
|
|
81
81
|
},
|
|
@@ -197,7 +197,7 @@ const agent = new Agent({
|
|
|
197
197
|
name: 'RAG Agent',
|
|
198
198
|
instructions: `Use vector search for simple fact-finding queries.
|
|
199
199
|
Use graph search when you need to understand relationships or find connected information.`,
|
|
200
|
-
model: 'openai/gpt-5.
|
|
200
|
+
model: 'openai/gpt-5.5',
|
|
201
201
|
tools: {
|
|
202
202
|
vectorQueryTool,
|
|
203
203
|
graphQueryTool,
|
|
@@ -272,7 +272,7 @@ import { PGVECTOR_PROMPT } from '@mastra/pg'
|
|
|
272
272
|
export const ragAgent = new Agent({
|
|
273
273
|
id: 'rag-agent',
|
|
274
274
|
name: 'RAG Agent',
|
|
275
|
-
model: 'openai/gpt-5.
|
|
275
|
+
model: 'openai/gpt-5.5',
|
|
276
276
|
instructions: `
|
|
277
277
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
278
278
|
${PGVECTOR_PROMPT}
|
|
@@ -289,7 +289,7 @@ import { PINECONE_PROMPT } from '@mastra/pinecone'
|
|
|
289
289
|
export const ragAgent = new Agent({
|
|
290
290
|
id: 'rag-agent',
|
|
291
291
|
name: 'RAG Agent',
|
|
292
|
-
model: 'openai/gpt-5.
|
|
292
|
+
model: 'openai/gpt-5.5',
|
|
293
293
|
instructions: `
|
|
294
294
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
295
295
|
${PINECONE_PROMPT}
|
|
@@ -306,7 +306,7 @@ import { QDRANT_PROMPT } from '@mastra/qdrant'
|
|
|
306
306
|
export const ragAgent = new Agent({
|
|
307
307
|
id: 'rag-agent',
|
|
308
308
|
name: 'RAG Agent',
|
|
309
|
-
model: 'openai/gpt-5.
|
|
309
|
+
model: 'openai/gpt-5.5',
|
|
310
310
|
instructions: `
|
|
311
311
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
312
312
|
${QDRANT_PROMPT}
|
|
@@ -323,7 +323,7 @@ import { CHROMA_PROMPT } from '@mastra/chroma'
|
|
|
323
323
|
export const ragAgent = new Agent({
|
|
324
324
|
id: 'rag-agent',
|
|
325
325
|
name: 'RAG Agent',
|
|
326
|
-
model: 'openai/gpt-5.
|
|
326
|
+
model: 'openai/gpt-5.5',
|
|
327
327
|
instructions: `
|
|
328
328
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
329
329
|
${CHROMA_PROMPT}
|
|
@@ -340,7 +340,7 @@ import { ASTRA_PROMPT } from '@mastra/astra'
|
|
|
340
340
|
export const ragAgent = new Agent({
|
|
341
341
|
id: 'rag-agent',
|
|
342
342
|
name: 'RAG Agent',
|
|
343
|
-
model: 'openai/gpt-5.
|
|
343
|
+
model: 'openai/gpt-5.5',
|
|
344
344
|
instructions: `
|
|
345
345
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
346
346
|
${ASTRA_PROMPT}
|
|
@@ -357,7 +357,7 @@ import { LIBSQL_PROMPT } from '@mastra/libsql'
|
|
|
357
357
|
export const ragAgent = new Agent({
|
|
358
358
|
id: 'rag-agent',
|
|
359
359
|
name: 'RAG Agent',
|
|
360
|
-
model: 'openai/gpt-5.
|
|
360
|
+
model: 'openai/gpt-5.5',
|
|
361
361
|
instructions: `
|
|
362
362
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
363
363
|
${LIBSQL_PROMPT}
|
|
@@ -374,7 +374,7 @@ import { UPSTASH_PROMPT } from '@mastra/upstash'
|
|
|
374
374
|
export const ragAgent = new Agent({
|
|
375
375
|
id: 'rag-agent',
|
|
376
376
|
name: 'RAG Agent',
|
|
377
|
-
model: 'openai/gpt-5.
|
|
377
|
+
model: 'openai/gpt-5.5',
|
|
378
378
|
instructions: `
|
|
379
379
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
380
380
|
${UPSTASH_PROMPT}
|
|
@@ -391,7 +391,7 @@ import { VECTORIZE_PROMPT } from '@mastra/vectorize'
|
|
|
391
391
|
export const ragAgent = new Agent({
|
|
392
392
|
id: 'rag-agent',
|
|
393
393
|
name: 'RAG Agent',
|
|
394
|
-
model: 'openai/gpt-5.
|
|
394
|
+
model: 'openai/gpt-5.5',
|
|
395
395
|
instructions: `
|
|
396
396
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
397
397
|
${VECTORIZE_PROMPT}
|
|
@@ -408,7 +408,7 @@ import { MONGODB_PROMPT } from '@mastra/mongodb'
|
|
|
408
408
|
export const ragAgent = new Agent({
|
|
409
409
|
id: 'rag-agent',
|
|
410
410
|
name: 'RAG Agent',
|
|
411
|
-
model: 'openai/gpt-5.
|
|
411
|
+
model: 'openai/gpt-5.5',
|
|
412
412
|
instructions: `
|
|
413
413
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
414
414
|
${MONGODB_PROMPT}
|
|
@@ -425,7 +425,7 @@ import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
|
|
|
425
425
|
export const ragAgent = new Agent({
|
|
426
426
|
id: 'rag-agent',
|
|
427
427
|
name: 'RAG Agent',
|
|
428
|
-
model: 'openai/gpt-5.
|
|
428
|
+
model: 'openai/gpt-5.5',
|
|
429
429
|
instructions: `
|
|
430
430
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
431
431
|
${OPENSEARCH_PROMPT}
|
|
@@ -442,7 +442,7 @@ import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
|
|
|
442
442
|
export const ragAgent = new Agent({
|
|
443
443
|
id: 'rag-agent',
|
|
444
444
|
name: 'RAG Agent',
|
|
445
|
-
model: 'openai/gpt-5.
|
|
445
|
+
model: 'openai/gpt-5.5',
|
|
446
446
|
instructions: `
|
|
447
447
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
448
448
|
${S3VECTORS_PROMPT}
|
|
@@ -474,7 +474,7 @@ const initialResults = await pgVector.query({
|
|
|
474
474
|
// Create a relevance scorer
|
|
475
475
|
const relevanceProvider = new MastraAgentRelevanceScorer(
|
|
476
476
|
'relevance-scorer',
|
|
477
|
-
'openai/gpt-5.
|
|
477
|
+
'openai/gpt-5.5',
|
|
478
478
|
)
|
|
479
479
|
|
|
480
480
|
// Re-rank the results
|
|
@@ -213,6 +213,8 @@ When an FGA provider is configured, Mastra automatically checks authorization at
|
|
|
213
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
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).
|
|
217
|
+
|
|
216
218
|
Direct SDK calls to `createRun().start()`, `resume()`, or `restart()` are not 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.
|
|
217
219
|
|
|
218
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.
|
|
@@ -235,7 +235,7 @@ export const colorAgent = new Agent({
|
|
|
235
235
|
instructions: `You are a helpful CSS assistant.
|
|
236
236
|
You can change the background color of web pages.
|
|
237
237
|
Respond with a hex reference for the color requested by the user`,
|
|
238
|
-
model: 'openai/gpt-5.
|
|
238
|
+
model: 'openai/gpt-5.5',
|
|
239
239
|
})
|
|
240
240
|
```
|
|
241
241
|
|