@mastra/mcp-docs-server 1.2.13-alpha.0 → 1.2.13-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agents/agent-approval.md +72 -0
- package/.docs/docs/agents/overview.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +2 -2
- package/.docs/docs/agents/using-tools.md +61 -33
- package/.docs/docs/{evals/datasets → datasets}/overview.md +3 -3
- package/.docs/docs/{evals/datasets → datasets}/running-experiments.md +57 -9
- package/.docs/docs/deployment/workers.md +14 -14
- package/.docs/docs/editor/overview.md +201 -206
- package/.docs/docs/evals/evals-with-memory.md +1 -1
- package/.docs/docs/getting-started/develop.md +196 -0
- package/.docs/docs/index.md +78 -1
- package/.docs/docs/long-running-agents/durable-agents.md +2 -2
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/mastra-platform/workspaces.md +152 -0
- package/.docs/docs/memory/observational-memory.md +53 -13
- package/.docs/docs/memory/overview.md +14 -0
- package/.docs/docs/server/auth/workers.md +7 -5
- package/.docs/docs/server/mastra-client.md +60 -0
- package/.docs/docs/server/pubsub.md +2 -2
- package/.docs/docs/studio/observability.md +4 -0
- package/.docs/docs/studio/overview.md +2 -2
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/docs/workflows/scheduled-workflows.md +1 -0
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/guides/deployment/kubernetes.md +2 -0
- package/.docs/guides/deployment/mastra-workers.md +350 -6
- package/.docs/guides/deployment/vercel.md +2 -0
- package/.docs/guides/getting-started/quickstart.md +3 -3
- package/.docs/{docs → guides}/rag/chunking-and-embedding.md +1 -1
- package/.docs/{docs → guides}/rag/graph-rag.md +1 -1
- package/.docs/{docs → guides}/rag/overview.md +2 -2
- package/.docs/{docs → guides}/rag/retrieval.md +1 -1
- package/.docs/{docs → guides}/voice/overview.md +4 -4
- package/.docs/{docs → guides}/voice/realtime-voice.md +2 -2
- package/.docs/{docs → guides}/voice/speech-to-speech.md +1 -1
- package/.docs/{docs → guides}/voice/speech-to-text.md +1 -1
- package/.docs/{docs → guides}/voice/text-to-speech.md +2 -2
- package/.docs/models/embeddings.md +63 -65
- package/.docs/models/environment-variables.md +2 -1
- package/.docs/models/gateways/openrouter.md +3 -6
- package/.docs/models/gateways/vercel.md +4 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/cortecs.md +2 -1
- package/.docs/models/providers/crof.md +2 -1
- package/.docs/models/providers/crossmodel.md +4 -3
- package/.docs/models/providers/empiriolabs.md +2 -1
- package/.docs/models/providers/greenpt.md +98 -0
- package/.docs/models/providers/huggingface.md +3 -1
- package/.docs/models/providers/hyper.md +10 -7
- package/.docs/models/providers/llmgateway.md +5 -4
- package/.docs/models/providers/minimax.md +1 -1
- package/.docs/models/providers/neuralwatt.md +3 -1
- package/.docs/models/providers/openai.md +2 -2
- package/.docs/models/providers/opencode-go.md +2 -1
- package/.docs/models/providers/opencode.md +1 -1
- package/.docs/models/providers/perplexity-agent.md +3 -1
- package/.docs/models/providers/scaleway.md +1 -3
- package/.docs/models/providers/the-grid-ai.md +3 -3
- package/.docs/models/providers/zai-coding-plan.md +11 -13
- package/.docs/models/providers/zhipuai-coding-plan.md +12 -12
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/agents/agent.md +1 -1
- package/.docs/reference/agents/durable-agent.md +12 -1
- package/.docs/reference/agents/generate.md +1 -1
- package/.docs/reference/agents/getVoice.md +1 -1
- package/.docs/{docs/getting-started → reference}/build-with-ai.md +5 -110
- package/.docs/reference/cli/create-mastra.md +2 -0
- package/.docs/reference/cli/mastra.md +36 -16
- package/.docs/reference/client-js/agents.md +1 -1
- package/.docs/reference/configuration.md +2 -2
- package/.docs/reference/core/getEditor.md +1 -1
- package/.docs/reference/core/getVector.md +2 -2
- package/.docs/reference/core/listVectors.md +2 -2
- package/.docs/reference/core/mastra-class.md +2 -2
- package/.docs/reference/datasets/startExperiment.md +8 -0
- package/.docs/reference/datasets/startExperimentAsync.md +4 -0
- package/.docs/reference/editor/browser-provider.md +2 -2
- package/.docs/reference/editor/filesystem-provider.md +1 -1
- package/.docs/reference/editor/mastra-editor.md +31 -18
- package/.docs/reference/editor/prompt-blocks.md +137 -0
- package/.docs/reference/editor/sandbox-provider.md +1 -1
- package/.docs/reference/editor/storage-browser-ref.md +3 -3
- package/.docs/reference/editor/storage-workspace-ref.md +3 -3
- package/.docs/reference/editor/tool-provider.md +44 -10
- package/.docs/reference/editor/tools.md +100 -0
- package/.docs/reference/editor/versioning.md +130 -0
- package/.docs/reference/evals/mastra-scorer.md +68 -8
- package/.docs/reference/evals/summarization.md +203 -0
- package/.docs/reference/file-based-agents/config.md +39 -1
- package/.docs/reference/index.md +4 -4
- package/.docs/reference/memory/observational-memory.md +76 -24
- package/.docs/reference/memory/serialized-memory-config.md +3 -3
- package/.docs/reference/observability/tracing/interfaces.md +6 -1
- package/.docs/reference/processors/processor-interface.md +14 -2
- package/.docs/reference/processors/regex-filter-processor.md +81 -9
- package/.docs/reference/processors/token-limiter-processor.md +15 -1
- package/.docs/reference/project-structure.md +1 -1
- package/.docs/reference/rag/database-config.md +1 -1
- package/.docs/reference/storage/composite.md +2 -0
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/tools/isolated-vm-transport.md +1 -1
- package/.docs/reference/vectors/mongodb.md +13 -13
- package/.docs/reference/voice/livekit.md +3 -3
- package/.docs/reference/workers/overview.md +10 -8
- package/.docs/reference/workspace/platform-filesystem.md +8 -5
- package/.docs/reference/workspace/platform-sandbox.md +83 -7
- package/CHANGELOG.md +51 -0
- package/README.md +1 -1
- package/package.json +5 -5
- package/.docs/docs/agent-builder/access-control.md +0 -99
- package/.docs/docs/agent-builder/browser.md +0 -63
- package/.docs/docs/agent-builder/channels.md +0 -78
- package/.docs/docs/agent-builder/configuration.md +0 -132
- package/.docs/docs/agent-builder/deploying.md +0 -124
- package/.docs/docs/agent-builder/integrations.md +0 -115
- package/.docs/docs/agent-builder/memory.md +0 -69
- package/.docs/docs/agent-builder/model-policy.md +0 -50
- package/.docs/docs/agent-builder/overview.md +0 -114
- package/.docs/docs/agent-builder/skill-registries.md +0 -31
- package/.docs/docs/agent-builder/workspace.md +0 -62
- package/.docs/docs/editor/prompts.md +0 -140
- package/.docs/docs/editor/tools.md +0 -148
- package/.docs/docs/getting-started/file-based-agents.md +0 -121
- package/.docs/docs/mastra-platform/workspace.md +0 -111
- package/.docs/docs/what-is-mastra.md +0 -161
- package/.docs/reference/client-js/agent-builder.md +0 -163
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +0 -76
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +0 -79
- package/.docs/reference/editor/agent-builder/builder-models.md +0 -66
- /package/.docs/{docs → guides}/getting-started/manual-install.md +0 -0
- /package/.docs/{docs → guides}/rag/vector-databases.md +0 -0
|
@@ -2,110 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Build with AI
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
To give your agent access to Mastra's documentation, we recommend using **skills**. While the MCP docs server also provides this information, skills will perform better. Use the MCP docs server when you need its tools, e.g. the migration tool.
|
|
8
|
-
|
|
9
|
-
## Mastra skills
|
|
10
|
-
|
|
11
|
-
Agent Skills are folders of instructions, scripts, and resources that agents can discover and use to do things accurately and efficiently. Mastra skills contain setup instructions, best practices, CLI commands, and instructions on how to fetch up-to-date information from Mastra's documentation.
|
|
12
|
-
|
|
13
|
-
To install all available Mastra skills, run the following command:
|
|
14
|
-
|
|
15
|
-
**npm**:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npx skills add mastra-ai/skills
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
**pnpm**:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
pnpm dlx skills add mastra-ai/skills
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Yarn**:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
yarn dlx skills add mastra-ai/skills
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**Bun**:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
bun x skills add mastra-ai/skills
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Mastra skills work with any coding agent that supports the [Skills standard](https://agentskills.io/), including Claude Code, Cursor, Codex, OpenCode, and others.
|
|
40
|
-
|
|
41
|
-
They're also available on [GitHub](https://github.com/mastra-ai/skills).
|
|
42
|
-
|
|
43
|
-
### Update skill
|
|
44
|
-
|
|
45
|
-
To update to the latest version of the Mastra skill, run:
|
|
46
|
-
|
|
47
|
-
**npm**:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
npx skills update mastra
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
**pnpm**:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
pnpm dlx skills update mastra
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**Yarn**:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
yarn dlx skills update mastra
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**Bun**:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
bun x skills update mastra
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Mastra CLI
|
|
72
|
-
|
|
73
|
-
The [Mastra CLI](https://mastra.ai/reference/cli/mastra) gives your coding agent a direct line to your Mastra runtime.
|
|
74
|
-
|
|
75
|
-
Agents can invoke other agents and run workflows. They can execute tools and inspect memory. They can also run evals or query traces and logs.
|
|
76
|
-
|
|
77
|
-
**npm**:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
npm install mastra@latest -g
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
**pnpm**:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
pnpm add mastra@latest -g
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
**Yarn**:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
yarn global add mastra@latest
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**Bun**:
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
bun add mastra@latest --global
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
For example, your coding agent can run an agent, then pull traces to inspect the results:
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
mastra api --url http://localhost:4111 agent run weather-agent '{"messages":"What is the weather in London?"}'
|
|
105
|
-
mastra api --url http://localhost:4111 trace list
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Install the [Mastra skills](#mastra-skills) to teach your agent how to use the CLI. See the [CLI commands reference](https://mastra.ai/reference/cli/mastra) for the full list of available commands.
|
|
5
|
+
For everyday AI-assisted development with Mastra skills and the CLI, see [Develop](https://mastra.ai/docs/getting-started/develop). This page covers other ways to give coding agents access to Mastra documentation.
|
|
109
6
|
|
|
110
7
|
## Embedded package docs
|
|
111
8
|
|
|
@@ -130,12 +27,10 @@ Examples for the [introduction page](https://mastra.ai/docs):
|
|
|
130
27
|
- [`/docs/llms.txt`](https://mastra.ai/docs/llms.txt)
|
|
131
28
|
- [`/docs.md`](https://mastra.ai/docs.md)
|
|
132
29
|
|
|
133
|
-
## Mastra's documentation
|
|
134
|
-
|
|
135
|
-
In addition to the [context files](#context-files) each documentation page also features a "Copy markdown" button at the top of the page. It'll copy the streamlined markdown version to your clipboard. Beside it, you'll find a dropdown menu to open the page on GitHub, in ChatGPT, Claude, and others.
|
|
136
|
-
|
|
137
30
|
## MCP docs server
|
|
138
31
|
|
|
32
|
+
> **Warning:** The MCP docs server isn't recommended for everyday development. Use the [Mastra skill](https://mastra.ai/docs/getting-started/develop) instead because it's more up to date and performs better.
|
|
33
|
+
|
|
139
34
|
The `@mastra/mcp-docs-server` package provides direct local access to Mastra’s full documentation via the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/docs/getting-started/intro). It works with Cursor, Windsurf, Cline, Claude Code, VS Code, Codex or any tool that supports MCP.
|
|
140
35
|
|
|
141
36
|
These tools are designed to help agents retrieve precise, task-specific information, whether you're adding a feature to an agent or scaffolding a new project, or alternatively exploring how something works.
|
|
@@ -144,7 +39,7 @@ If you're unable to use a local MCP server and need to connect to a remote serve
|
|
|
144
39
|
|
|
145
40
|
### Installation
|
|
146
41
|
|
|
147
|
-
The [`create-mastra`](https://mastra.ai/reference/cli/create-mastra) command
|
|
42
|
+
The [`create-mastra`](https://mastra.ai/reference/cli/create-mastra) command doesn't configure the MCP docs server. Add the server manually when you need MCP-specific tools such as the migration tool.
|
|
148
43
|
|
|
149
44
|
If there are no specific instructions for your tool below, you may be able to add the MCP server with this common JSON configuration.
|
|
150
45
|
|
|
@@ -354,7 +249,7 @@ Once configured, you can ask your AI tool questions about Mastra or instruct it
|
|
|
354
249
|
- "How does working memory behave in Mastra and how can I use it to do `[task]`? It doesn't seem to work the way I expect."
|
|
355
250
|
- "I saw there are new workflow features, explain them to me and then update `[workflow]` to use them."
|
|
356
251
|
|
|
357
|
-
|
|
252
|
+
### Troubleshooting
|
|
358
253
|
|
|
359
254
|
1. **Server Not Starting**
|
|
360
255
|
|
|
@@ -201,6 +201,8 @@ Invalid input is rejected before templates are fetched or files are created.
|
|
|
201
201
|
|
|
202
202
|
**--no-git** (`boolean`): Skip automatic Git initialization and the initial commit.
|
|
203
203
|
|
|
204
|
+
**--no-install** (`boolean`): Skip dependency installation.
|
|
205
|
+
|
|
204
206
|
**-t, --template \[template]** (`string`): Use a template slug or public GitHub URL. Omit the value to select interactively.
|
|
205
207
|
|
|
206
208
|
**--timeout \<milliseconds>** (`number`): Positive integer timeout for dependency installation. Defaults to 60000.
|
|
@@ -103,7 +103,7 @@ These are forwarded to the Mastra model router and will work with any `"openai/.
|
|
|
103
103
|
|
|
104
104
|
## `mastra factory dev`
|
|
105
105
|
|
|
106
|
-
Starts a development server for [Agent Builder](https://mastra.ai/
|
|
106
|
+
Starts a development server for [Agent Builder](https://agent-builder.mastra.ai/) development. It uses the same dev runtime and flags as [`mastra dev`](#mastra-dev) and writes to the same `.mastra/output` directory.
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
109
|
npx mastra factory dev
|
|
@@ -171,7 +171,7 @@ Comma-separated list of custom arguments to pass to the Node.js process, e.g. `-
|
|
|
171
171
|
|
|
172
172
|
## `mastra worker build`
|
|
173
173
|
|
|
174
|
-
Bundles your Mastra application for worker deployment. Produces the same output as `mastra build
|
|
174
|
+
Bundles your Mastra application for worker deployment. Produces the same output as `mastra build`: a self-contained `.mastra/output/` directory.
|
|
175
175
|
|
|
176
176
|
```bash
|
|
177
177
|
mastra worker build [options]
|
|
@@ -179,29 +179,45 @@ mastra worker build [options]
|
|
|
179
179
|
|
|
180
180
|
### Flags
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
#### `--dir`
|
|
183
|
+
|
|
184
|
+
Path to your Mastra source directory. Defaults to `src/mastra`.
|
|
185
|
+
|
|
186
|
+
#### `--root`
|
|
187
|
+
|
|
188
|
+
Project root directory. Defaults to the current directory.
|
|
189
|
+
|
|
190
|
+
#### `--tools`
|
|
191
|
+
|
|
192
|
+
Comma-separated tool paths to include in the bundle.
|
|
193
|
+
|
|
194
|
+
#### `--output-dir`
|
|
195
|
+
|
|
196
|
+
Custom output directory. Defaults to `.mastra/output`.
|
|
197
|
+
|
|
198
|
+
#### `--debug`
|
|
199
|
+
|
|
200
|
+
Enable debug logging during the build.
|
|
189
201
|
|
|
190
202
|
## `mastra worker start`
|
|
191
203
|
|
|
192
204
|
> **Info:** You need to run `mastra worker build` or `mastra build` before using `mastra worker start`.
|
|
193
205
|
|
|
194
|
-
Starts a worker process from a previously built bundle.
|
|
206
|
+
Starts a worker process from a previously built bundle. The optional `name` argument sets `MASTRA_WORKERS` in the spawned process, controlling which worker starts.
|
|
195
207
|
|
|
196
208
|
```bash
|
|
197
209
|
mastra worker start [name] [options]
|
|
198
210
|
```
|
|
199
211
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
212
|
+
### Flags
|
|
213
|
+
|
|
214
|
+
#### `--dir`
|
|
215
|
+
|
|
216
|
+
Path to the build output directory. Defaults to `.mastra/output`.
|
|
217
|
+
|
|
218
|
+
#### `--env`
|
|
219
|
+
|
|
220
|
+
Path to the environment file. Defaults to `.env.production`, falling back to `.env`.
|
|
205
221
|
|
|
206
222
|
### Examples
|
|
207
223
|
|
|
@@ -412,12 +428,16 @@ mastra env vars pull
|
|
|
412
428
|
mastra env vars pull <env> --output .env.staging
|
|
413
429
|
```
|
|
414
430
|
|
|
415
|
-
`<env>` can be an environment name, slug, or ID, and can be omitted when the project has exactly one environment. The file is written with `0600` permissions.
|
|
431
|
+
`<env>` can be an environment name, slug, or ID, and can be omitted when the project has exactly one environment. The file is written with `0600` permissions. The command stops if the output file already exists. Pass `--force` to replace it.
|
|
416
432
|
|
|
417
433
|
#### `-o, --output`
|
|
418
434
|
|
|
419
435
|
File to write. Defaults to `.env`.
|
|
420
436
|
|
|
437
|
+
#### `-f, --force`
|
|
438
|
+
|
|
439
|
+
Replace an existing output file.
|
|
440
|
+
|
|
421
441
|
### `mastra env db`
|
|
422
442
|
|
|
423
443
|
Manages databases attached to a project on Mastra platform. Databases are provisioned from a managed provider (for example Turso or Neon) and inject their connection env vars into deploys automatically.
|
|
@@ -838,7 +838,7 @@ console.log(result.success) // true
|
|
|
838
838
|
|
|
839
839
|
## Version management
|
|
840
840
|
|
|
841
|
-
Both `Agent` (code-defined) and `StoredAgent` instances have methods for managing configuration versions. See
|
|
841
|
+
Both `Agent` (code-defined) and `StoredAgent` instances have methods for managing configuration versions. See [Editor versioning](https://mastra.ai/docs/editor/overview) for lifecycle and selection behavior.
|
|
842
842
|
|
|
843
843
|
### Getting an agent with a specific version
|
|
844
844
|
|
|
@@ -419,7 +419,7 @@ export const mastra = new Mastra({
|
|
|
419
419
|
|
|
420
420
|
Text-to-speech providers for voice synthesis capabilities. Register voice providers to enable agents to convert text responses into spoken audio.
|
|
421
421
|
|
|
422
|
-
Visit the [Voice documentation](https://mastra.ai/
|
|
422
|
+
Visit the [Voice documentation](https://mastra.ai/guides/voice/overview) to learn more.
|
|
423
423
|
|
|
424
424
|
> **Note:** Most users configure voice directly on agents. This top-level configuration is for defining reusable voice providers that can be shared across multiple agents.
|
|
425
425
|
|
|
@@ -440,7 +440,7 @@ export const mastra = new Mastra({
|
|
|
440
440
|
|
|
441
441
|
Vector stores for semantic search and embeddings. Used in RAG pipelines, similarity search, and other embedding-based features. Mastra supports multiple vector databases including Pinecone, PostgreSQL with pgvector, MongoDB, and more.
|
|
442
442
|
|
|
443
|
-
Visit the [RAG documentation](https://mastra.ai/
|
|
443
|
+
Visit the [RAG documentation](https://mastra.ai/guides/rag/overview) to learn more.
|
|
444
444
|
|
|
445
445
|
> **Note:** Most users create vector stores directly when building RAG pipelines. This top-level configuration is for defining reusable vector store instances that can be shared across your application.
|
|
446
446
|
|
|
@@ -20,5 +20,5 @@ mastra.getVector('testVectorStore')
|
|
|
20
20
|
|
|
21
21
|
## Related
|
|
22
22
|
|
|
23
|
-
- [Vector stores overview](https://mastra.ai/
|
|
24
|
-
- [RAG overview](https://mastra.ai/
|
|
23
|
+
- [Vector stores overview](https://mastra.ai/guides/rag/vector-databases)
|
|
24
|
+
- [RAG overview](https://mastra.ai/guides/rag/overview)
|
|
@@ -20,5 +20,5 @@ This method doesn't accept any parameters.
|
|
|
20
20
|
|
|
21
21
|
## Related
|
|
22
22
|
|
|
23
|
-
- [Vector stores overview](https://mastra.ai/
|
|
24
|
-
- [RAG overview](https://mastra.ai/
|
|
23
|
+
- [Vector stores overview](https://mastra.ai/guides/rag/vector-databases)
|
|
24
|
+
- [RAG overview](https://mastra.ai/guides/rag/overview)
|
|
@@ -97,7 +97,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
97
97
|
|
|
98
98
|
**notifications.dispatch.batchSize** (`number`): Maximum number of due notification records to process per dispatch run.
|
|
99
99
|
|
|
100
|
-
**versions** (`VersionOverrides`): Global version overrides for sub-agent delegation. When a supervisor agent delegates to a sub-agent, these overrides determine which stored version of that sub-agent to use instead of the code-defined default. Requires the editor package to be configured. See
|
|
100
|
+
**versions** (`VersionOverrides`): Global version overrides for sub-agent delegation. When a supervisor agent delegates to a sub-agent, these overrides determine which stored version of that sub-agent to use instead of the code-defined default. Requires the editor package to be configured. See Editor versioning for details.
|
|
101
101
|
|
|
102
102
|
**versions.agents** (`Record<string, VersionSelector>`): A map of agent IDs to their version selectors. Each selector can target a specific version by ID or by publication status.
|
|
103
103
|
|
|
@@ -135,7 +135,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
135
135
|
|
|
136
136
|
Re-drives every orphaned `running` durable-agent run across all registered durable agents. Called automatically on boot when `recovery.durableAgents` is `'auto'`. You can also call it directly for manual recovery or from a scheduled task.
|
|
137
137
|
|
|
138
|
-
Requires persistent storage
|
|
138
|
+
Requires persistent storage. With an in-memory store, there's nothing to recover after a process restart.
|
|
139
139
|
|
|
140
140
|
```typescript
|
|
141
141
|
const result = await mastra.recoverAllDurableAgents()
|
|
@@ -77,6 +77,14 @@ console.log(`Status: ${summary2.status}`)
|
|
|
77
77
|
|
|
78
78
|
**maxRetries** (`number`): Maximum retries per item on failure. Defaults to 0 (no retries). Abort errors are never retried.
|
|
79
79
|
|
|
80
|
+
**unmockedToolPolicy** (`'allow' | 'deny'`): Controls undeclared agent tool calls. allow executes them live. deny fails the item with TOOL\_MOCK\_NOT\_DECLARED before execution. An item-level value overrides this experiment default. (Default: `'allow'`)
|
|
81
|
+
|
|
82
|
+
**persistence** (`ExperimentPersistencePolicy`): Controls whether this run writes experiment records and score records. Targets and scorers still execute, and results remain available in the returned summary.
|
|
83
|
+
|
|
84
|
+
**persistence.experiments** (`'default' | 'none'`): Set to none to skip experiment creation, item results, progress, and terminal status writes.
|
|
85
|
+
|
|
86
|
+
**persistence.scores** (`'default' | 'none'`): Set to none to skip score writes while still running scorers.
|
|
87
|
+
|
|
80
88
|
## Returns
|
|
81
89
|
|
|
82
90
|
**result** (`Promise<ExperimentSummary>`): Summary of the completed experiment.
|
|
@@ -33,6 +33,10 @@ console.log(`Current status: ${experiment.status}`)
|
|
|
33
33
|
|
|
34
34
|
Takes the same `StartExperimentConfig` as [`dataset.startExperiment()`](https://mastra.ai/reference/datasets/startExperiment).
|
|
35
35
|
|
|
36
|
+
When `persistence.experiments` is set to `'none'`, `startExperimentAsync()` doesn't persist an experiment record, progress updates, or item results. Score persistence remains controlled separately by `persistence.scores`. Without an experiment event observer, the run is fire-and-forget, and the experiment API can't report whether it completed or failed.
|
|
37
|
+
|
|
38
|
+
Use synchronous [`startExperiment()`](https://mastra.ai/reference/datasets/startExperiment) when the caller needs the returned summary. An experiment event observer can receive lifecycle events and the terminal summary.
|
|
39
|
+
|
|
36
40
|
## Returns
|
|
37
41
|
|
|
38
42
|
**result** (`Promise<object>`): Immediate response with experiment ID.
|
|
@@ -54,7 +54,7 @@ export const myBrowserProvider: BrowserProvider<{ apiKey: string }> = {
|
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Once registered, admins can pin the provider as a Builder default via [`BuilderAgentDefaults.browser`](https://mastra.ai/reference/
|
|
57
|
+
Once registered, admins can pin the provider as a Builder default via [`BuilderAgentDefaults.browser`](https://agent-builder.mastra.ai/reference/builder-agent-defaults):
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
60
|
new MastraEditor({
|
|
@@ -72,6 +72,6 @@ new MastraEditor({
|
|
|
72
72
|
|
|
73
73
|
## Related
|
|
74
74
|
|
|
75
|
-
- [Browser](https://mastra.ai/
|
|
75
|
+
- [Browser](https://agent-builder.mastra.ai/browser): Concept and worked examples.
|
|
76
76
|
- [StorageBrowserRef](https://mastra.ai/reference/editor/storage-browser-ref): Stored configuration consumed by `createBrowser`.
|
|
77
77
|
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor): Provider registry.
|
|
@@ -58,7 +58,7 @@ Once registered, admins can reference the provider from an inline workspace conf
|
|
|
58
58
|
|
|
59
59
|
## Related
|
|
60
60
|
|
|
61
|
-
- [Workspace](https://mastra.ai/
|
|
61
|
+
- [Workspace](https://agent-builder.mastra.ai/workspace): Concept and worked examples.
|
|
62
62
|
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref): Stored configuration consumed by `createFilesystem`.
|
|
63
63
|
- [SandboxProvider](https://mastra.ai/reference/editor/sandbox-provider): Sibling provider for command execution.
|
|
64
64
|
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor): Provider registry.
|
|
@@ -4,24 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
The `MastraEditor` class sets up the editor system. Pass it to the `Mastra` constructor to turn on editor features like prompt blocks, agent code override, versioning, and tool providers.
|
|
6
6
|
|
|
7
|
-
See
|
|
7
|
+
See [Editor](https://mastra.ai/docs/editor/overview) for an introduction to what the editor does.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
import { Mastra } from '@mastra/core'
|
|
13
13
|
import { MastraEditor } from '@mastra/editor'
|
|
14
|
-
import { ComposioToolProvider } from '@mastra/editor/providers/composio'
|
|
15
14
|
|
|
16
15
|
export const mastra = new Mastra({
|
|
17
16
|
agents: {/* your agents */},
|
|
18
|
-
editor: new MastraEditor(
|
|
19
|
-
toolProviders: {
|
|
20
|
-
composio: new ComposioToolProvider({
|
|
21
|
-
apiKey: process.env.COMPOSIO_API_KEY!,
|
|
22
|
-
}),
|
|
23
|
-
},
|
|
24
|
-
}),
|
|
17
|
+
editor: new MastraEditor(),
|
|
25
18
|
})
|
|
26
19
|
```
|
|
27
20
|
|
|
@@ -43,7 +36,7 @@ export const mastra = new Mastra({
|
|
|
43
36
|
|
|
44
37
|
**builder** (`AgentBuilderOptions`): Agent Builder configuration. See the AgentBuilderOptions reference. Omit or set enabled: false to disable the Builder.
|
|
45
38
|
|
|
46
|
-
**source** (`'code' | 'db'`): Where agent overrides are stored. With 'db', overrides live in the configured storage backend and Studio shows the save and publish flow. With 'code', overrides live as per-agent JSON files on disk (routed through a local FilesystemStore) and Studio shows filesystem actions. See
|
|
39
|
+
**source** (`'code' | 'db'`): Where agent overrides are stored. With 'db', overrides live in the configured storage backend and Studio shows the save and publish flow. With 'code', overrides live as per-agent JSON files on disk (routed through a local FilesystemStore) and Studio shows filesystem actions. See Editor storage options for the difference. (Default: `'db'`)
|
|
47
40
|
|
|
48
41
|
**codePath** (`string`): Directory used by the 'code' source for per-agent JSON files. Ignored when source is not 'code'. (Default: `'./mastra/editor/'`)
|
|
49
42
|
|
|
@@ -59,12 +52,12 @@ Each provider field above takes a record keyed by provider id. See the per-provi
|
|
|
59
52
|
|
|
60
53
|
## Agent Builder
|
|
61
54
|
|
|
62
|
-
The `builder` field enables the [Agent Builder](https://mastra.ai/
|
|
55
|
+
The `builder` field enables the [Agent Builder](https://agent-builder.mastra.ai/), a browser-based UI for creating and editing stored agents. See:
|
|
63
56
|
|
|
64
|
-
- [Agent Builder overview](https://mastra.ai/
|
|
65
|
-
- [AgentBuilderOptions](https://mastra.ai/reference/
|
|
66
|
-
- [BuilderAgentDefaults](https://mastra.ai/reference/
|
|
67
|
-
- [builder.configuration.agent.models](https://mastra.ai/reference/
|
|
57
|
+
- [Agent Builder overview](https://agent-builder.mastra.ai/): Concepts and getting started.
|
|
58
|
+
- [AgentBuilderOptions](https://agent-builder.mastra.ai/reference/agent-builder-options): Full options schema.
|
|
59
|
+
- [BuilderAgentDefaults](https://agent-builder.mastra.ai/reference/builder-agent-defaults): Admin-pinned defaults for new agents.
|
|
60
|
+
- [builder.configuration.agent.models](https://agent-builder.mastra.ai/reference/builder-models): Model allowlist and default model.
|
|
68
61
|
|
|
69
62
|
### Registering the Builder agent
|
|
70
63
|
|
|
@@ -85,7 +78,7 @@ export const mastra = new Mastra({
|
|
|
85
78
|
|
|
86
79
|
The key name (`builderAgent`) is conventional. Any key works. The `@mastra/editor/ee` subpath is gated by the Mastra Enterprise Edition license at runtime.
|
|
87
80
|
|
|
88
|
-
See the [Agent Builder overview](https://mastra.ai
|
|
81
|
+
See the [Agent Builder overview](https://agent-builder.mastra.ai/#prerequisites) for the full setup checklist.
|
|
89
82
|
|
|
90
83
|
## Namespaces
|
|
91
84
|
|
|
@@ -99,7 +92,7 @@ All namespaces extend a shared CRUD base class, so they expose the same `create`
|
|
|
99
92
|
|
|
100
93
|
**agent.getById** (`(id: string, options?: GetByIdOptions) => Promise<Agent | null>`): Return a hydrated Agent instance for a stored agent. Pass options with versionId, versionNumber, or status ("draft" | "published" | "archived") to target a specific version. Default version requests are cached.
|
|
101
94
|
|
|
102
|
-
**agent.update** (`(input: StorageUpdateAgentInput) => Promise<Agent>`): Partially update a stored agent. Creates a
|
|
95
|
+
**agent.update** (`(input: StorageUpdateAgentInput) => Promise<Agent>`): Partially update a stored agent. Creates a version from the provided snapshot fields, assigns it to activeVersionId, and invalidates the cache. Set memory to null to disable memory.
|
|
103
96
|
|
|
104
97
|
**agent.delete** (`(id: string) => Promise<void>`): Delete a stored agent and remove it from the Mastra runtime registry.
|
|
105
98
|
|
|
@@ -179,6 +172,24 @@ All namespaces extend a shared CRUD base class, so they expose the same `create`
|
|
|
179
172
|
|
|
180
173
|
**scorer.clearCache** (`(id?: string) => void`): Clear the in-memory cache for one scorer or all scorers.
|
|
181
174
|
|
|
175
|
+
### Agent namespace examples
|
|
176
|
+
|
|
177
|
+
Create a stored override for an existing code-defined agent:
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import { mastra } from '../mastra'
|
|
181
|
+
|
|
182
|
+
const editor = mastra.getEditor()!
|
|
183
|
+
|
|
184
|
+
await editor.agent.create({
|
|
185
|
+
id: 'support-agent',
|
|
186
|
+
instructions: 'You are a friendly support agent for Acme.',
|
|
187
|
+
tools: {
|
|
188
|
+
search_kb: { description: 'Search the Acme knowledge base' },
|
|
189
|
+
},
|
|
190
|
+
})
|
|
191
|
+
```
|
|
192
|
+
|
|
182
193
|
## Methods
|
|
183
194
|
|
|
184
195
|
### Provider access
|
|
@@ -225,4 +236,6 @@ Returns the configured source (`'code'` or `'db'`), or `undefined` when the edit
|
|
|
225
236
|
const source = mastra.getEditor()?.getSource()
|
|
226
237
|
```
|
|
227
238
|
|
|
228
|
-
Returns: `'code' | 'db' | undefined`
|
|
239
|
+
Returns: `'code' | 'db' | undefined`
|
|
240
|
+
|
|
241
|
+
When `source` is omitted, Editor uses the configured database storage even though `getSource()` returns `undefined`. See [Editor storage options](https://mastra.ai/docs/editor/overview) for the storage workflows and [code-source versioning](https://mastra.ai/reference/editor/versioning) for activation and Git history behavior.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Prompt blocks
|
|
4
|
+
|
|
5
|
+
Prompt blocks are reusable instruction templates managed by Editor. An agent's instructions can combine inline text, embedded prompt blocks, and references to independently versioned prompt blocks.
|
|
6
|
+
|
|
7
|
+
See [Prompt blocks](https://mastra.ai/docs/editor/overview) for the Studio workflow and common uses.
|
|
8
|
+
|
|
9
|
+
## Block types
|
|
10
|
+
|
|
11
|
+
| Type | Description |
|
|
12
|
+
| ------------------ | ----------------------------------------------------------------- |
|
|
13
|
+
| `text` | Free-form text stored only in the agent version |
|
|
14
|
+
| `prompt_block` | A prompt block embedded in the agent version |
|
|
15
|
+
| `prompt_block_ref` | A reference to an independently stored and versioned prompt block |
|
|
16
|
+
|
|
17
|
+
Referenced blocks resolve at runtime. A missing or unpublished reference is omitted from the final instructions. Resolved nonempty blocks are joined with two newlines.
|
|
18
|
+
|
|
19
|
+
The following example attaches a stored block and inline text to an agent:
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { mastra } from '../mastra'
|
|
23
|
+
|
|
24
|
+
const editor = mastra.getEditor()!
|
|
25
|
+
|
|
26
|
+
await editor.agent.update({
|
|
27
|
+
id: 'support-agent',
|
|
28
|
+
instructions: [
|
|
29
|
+
{ type: 'prompt_block_ref', id: 'brand-voice' },
|
|
30
|
+
{ type: 'text', content: 'Answer only questions about Acme products.' },
|
|
31
|
+
],
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Template values
|
|
36
|
+
|
|
37
|
+
Templates resolve values from the request context at runtime.
|
|
38
|
+
|
|
39
|
+
| Syntax | Request context | Output |
|
|
40
|
+
| ------------------------- | ---------------------------- | ------------------ |
|
|
41
|
+
| `{{userName}}` | `{ userName: 'Maya' }` | `Maya` |
|
|
42
|
+
| `{{user.name}}` | `{ user: { name: 'Maya' } }` | `Maya` |
|
|
43
|
+
| `{{task \|\| 'request'}}` | `{}` | `request` |
|
|
44
|
+
| `{{missingValue}}` | `{}` | `{{missingValue}}` |
|
|
45
|
+
|
|
46
|
+
Variable names must begin with a letter or underscore. Fallbacks must be single-quoted or double-quoted strings. Unresolved placeholders without a fallback remain unchanged. Objects and arrays are serialized as JSON. Other values are converted to strings.
|
|
47
|
+
|
|
48
|
+
Pass values through [request context](https://mastra.ai/docs/server/request-context). Editor doesn't read a separate agent `variables` field.
|
|
49
|
+
|
|
50
|
+
## Display conditions
|
|
51
|
+
|
|
52
|
+
A prompt block can include a display condition that controls whether it's included in the final instructions. Each condition has three parts:
|
|
53
|
+
|
|
54
|
+
- **Key**: The request-context field to check, such as `user.role` or `account.plan`.
|
|
55
|
+
- **Operator**: The comparison to make, such as `equals`, `contains`, or `exists`.
|
|
56
|
+
- **Value**: The value to compare against. The `exists` and `not_exists` operators don't need one.
|
|
57
|
+
|
|
58
|
+
For example, the condition `user.role` `equals` `admin` includes the block only when request context contains `{ user: { role: 'admin' } }`.
|
|
59
|
+
|
|
60
|
+
| Operator | Example | The block is included when |
|
|
61
|
+
| ---------------------------------------------- | --------------------------------------------- | --------------------------------------------------------- |
|
|
62
|
+
| `equals` / `not_equals` | `user.role` equals `admin` | The field strictly equals, or doesn't equal, the value |
|
|
63
|
+
| `contains` / `not_contains` | `user.tags` contains `beta` | A string contains the value or an array contains the item |
|
|
64
|
+
| `greater_than` / `less_than` | `order.total` greater than `100` | The numeric field is above or below the value |
|
|
65
|
+
| `greater_than_or_equal` / `less_than_or_equal` | `account.seats` greater than or equal to `10` | The numeric field is at or beyond the value |
|
|
66
|
+
| `in` / `not_in` | `user.region` in `['US', 'CA']` | The field is, or isn't, in the supplied array |
|
|
67
|
+
| `exists` / `not_exists` | `account.plan` exists | The field has, or doesn't have, a non-null value |
|
|
68
|
+
|
|
69
|
+
Groups combine conditions with `AND` or `OR`. For example, this group includes a block for admins on a paid plan:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
const rules = {
|
|
73
|
+
operator: 'AND',
|
|
74
|
+
conditions: [
|
|
75
|
+
{
|
|
76
|
+
field: 'user.role',
|
|
77
|
+
operator: 'equals',
|
|
78
|
+
value: 'admin',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
field: 'account.plan',
|
|
82
|
+
operator: 'in',
|
|
83
|
+
value: ['pro', 'enterprise'],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Dot paths are supported. An empty group evaluates to `true`, and an unknown operator evaluates to `false`. The storage type supports up to three nested group levels.
|
|
90
|
+
|
|
91
|
+
Blocks without conditions are always included.
|
|
92
|
+
|
|
93
|
+
## Programmatic API
|
|
94
|
+
|
|
95
|
+
Access prompt blocks through `mastra.getEditor().prompt`. See the [`prompt` namespace](https://mastra.ai/reference/editor/mastra-editor) for complete method signatures.
|
|
96
|
+
|
|
97
|
+
Create a prompt block:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { mastra } from '../mastra'
|
|
101
|
+
|
|
102
|
+
const editor = mastra.getEditor()!
|
|
103
|
+
|
|
104
|
+
await editor.prompt.create({
|
|
105
|
+
id: 'brand-voice',
|
|
106
|
+
name: 'Brand voice',
|
|
107
|
+
description: 'Acme tone and style guidelines',
|
|
108
|
+
content: 'Write in a friendly, concise tone. Address the user as {{userName || "there"}}.',
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Update an existing block:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
await editor.prompt.update({
|
|
116
|
+
id: 'brand-voice',
|
|
117
|
+
content: 'Write in a friendly, concise tone. Greet the user by name when available.',
|
|
118
|
+
})
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`update()` creates a new draft when the content changes. Use `list()` to paginate through stored blocks, `getById()` to fetch one block, and `preview(blocks, context)` to resolve templates and conditions with draft references.
|
|
122
|
+
|
|
123
|
+
## REST API
|
|
124
|
+
|
|
125
|
+
The default Mastra server prefix is `/api`. A custom server prefix changes the paths below.
|
|
126
|
+
|
|
127
|
+
| Method | Path | Description |
|
|
128
|
+
| -------- | ------------------------------------------------ | ---------------------------- |
|
|
129
|
+
| `GET` | `/api/stored/prompt-blocks` | List stored prompt blocks |
|
|
130
|
+
| `POST` | `/api/stored/prompt-blocks` | Create a stored prompt block |
|
|
131
|
+
| `GET` | `/api/stored/prompt-blocks/:storedPromptBlockId` | Get a stored prompt block |
|
|
132
|
+
| `PATCH` | `/api/stored/prompt-blocks/:storedPromptBlockId` | Update a stored prompt block |
|
|
133
|
+
| `DELETE` | `/api/stored/prompt-blocks/:storedPromptBlockId` | Delete a stored prompt block |
|
|
134
|
+
|
|
135
|
+
## Version resolution
|
|
136
|
+
|
|
137
|
+
Runtime references resolve the active published block. Editor previews resolve the latest draft. See [Editor versioning](https://mastra.ai/docs/editor/overview) for the shared draft, publish, and restore lifecycle.
|
|
@@ -57,7 +57,7 @@ Once registered, admins can reference the provider from an inline workspace conf
|
|
|
57
57
|
|
|
58
58
|
## Related
|
|
59
59
|
|
|
60
|
-
- [Workspace](https://mastra.ai/
|
|
60
|
+
- [Workspace](https://agent-builder.mastra.ai/workspace): Concept and worked examples.
|
|
61
61
|
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref): Stored configuration consumed by `createSandbox`.
|
|
62
62
|
- [FilesystemProvider](https://mastra.ai/reference/editor/filesystem-provider): Sibling provider for file access.
|
|
63
63
|
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor): Provider registry.
|