@mastra/mcp-docs-server 1.2.13-alpha.8 → 1.2.13
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/overview.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +2 -2
- package/.docs/docs/agents/using-tools.md +29 -0
- package/.docs/docs/capabilities/channels/imessage.md +181 -0
- package/.docs/docs/capabilities/channels/overview.md +1 -0
- package/.docs/docs/{evals/datasets → datasets}/overview.md +3 -3
- package/.docs/docs/{evals/datasets → datasets}/running-experiments.md +59 -2
- 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/mastra-platform/workspaces.md +13 -13
- package/.docs/docs/memory/observational-memory.md +23 -0
- package/.docs/docs/studio/observability.md +4 -0
- package/.docs/docs/studio/overview.md +2 -2
- package/.docs/docs/workspace/search.md +1 -1
- 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 +5 -1
- package/.docs/models/gateways/netlify.md +1 -2
- package/.docs/models/gateways/openrouter.md +5 -3
- package/.docs/models/gateways/vercel.md +8 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +3 -1
- package/.docs/models/providers/alibaba-token-plan-cn.md +27 -25
- package/.docs/models/providers/alibaba-token-plan.md +27 -25
- package/.docs/models/providers/alibaba.md +2 -1
- package/.docs/models/providers/ambient.md +13 -12
- package/.docs/models/providers/baseten.md +3 -1
- package/.docs/models/providers/chutes.md +6 -8
- package/.docs/models/providers/crof.md +2 -1
- package/.docs/models/providers/crossmodel.md +7 -3
- package/.docs/models/providers/deepinfra.md +9 -2
- package/.docs/models/providers/digitalocean.md +34 -27
- package/.docs/models/providers/empiriolabs.md +4 -1
- package/.docs/models/providers/fireworks-ai.md +20 -19
- package/.docs/models/providers/greenpt.md +17 -8
- package/.docs/models/providers/groq.md +20 -20
- package/.docs/models/providers/huggingface.md +3 -1
- package/.docs/models/providers/hyper.md +9 -7
- package/.docs/models/providers/impossibl.md +148 -0
- package/.docs/models/providers/infomaniak.md +83 -0
- package/.docs/models/providers/kilo.md +349 -350
- package/.docs/models/providers/llmgateway.md +6 -3
- package/.docs/models/providers/mistral.md +5 -2
- package/.docs/models/providers/modal.md +5 -4
- package/.docs/models/providers/modelis.md +81 -0
- package/.docs/models/providers/nano-gpt.md +146 -148
- package/.docs/models/providers/neuralwatt.md +2 -1
- package/.docs/models/providers/ofox.md +2 -2
- package/.docs/models/providers/ollama-cloud.md +23 -22
- package/.docs/models/providers/opencode-go.md +3 -2
- package/.docs/models/providers/requesty.md +54 -45
- package/.docs/models/providers/scx.md +74 -0
- package/.docs/models/providers/tensorx.md +97 -0
- package/.docs/models/providers/togetherai.md +2 -1
- package/.docs/models/providers/umans-ai-coding-plan.md +11 -9
- package/.docs/models/providers/umans-ai.md +11 -9
- package/.docs/models/providers/wandb.md +2 -2
- 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 +5 -1
- package/.docs/reference/agents/agent.md +1 -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 +66 -1
- 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 +1 -1
- package/.docs/reference/datasets/startExperiment.md +6 -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/file-based-agents/config.md +39 -1
- package/.docs/reference/index.md +3 -4
- package/.docs/reference/memory/observational-memory.md +3 -1
- package/.docs/reference/memory/serialized-memory-config.md +3 -3
- package/.docs/reference/observability/tracing/interfaces.md +3 -1
- 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/voice/livekit.md +3 -3
- package/.docs/reference/workspace/platform-filesystem.md +3 -3
- package/.docs/reference/workspace/platform-sandbox.md +5 -5
- package/CHANGELOG.md +30 -0
- package/README.md +1 -1
- package/package.json +6 -6
- 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/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
|
@@ -1,354 +1,349 @@
|
|
|
1
1
|
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
2
|
|
|
3
|
-
# Editor
|
|
3
|
+
# Editor
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Editor works like a CMS for Mastra agents. Collaborators can change an agent's instructions and tools in Studio without accessing the codebase or writing code. They can test changes before making them live.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
TypeScript defines the agent's default values. Editor saves changes separately instead of updating the source code, so collaborators can improve the agent while developers retain control over its model, identity, and runtime.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- [**Tools**](https://mastra.ai/docs/editor/tools): Add tools from integration providers, MCP servers, and override tool descriptions at runtime.
|
|
9
|
+
A [deployed Studio](https://mastra.ai/docs/studio/deployment) makes Editor available to collaborators outside local development.
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
> **📹 Watch:** Watch the [Mastra Editor workshop](https://www.youtube.com/watch?v=XTjuRoI7t_k\&pp=ygUWbWFzdHJhIGVkaXRvciB3b3Jrc2hvcA%3D%3D) for a guided walkthrough.
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
## When to use Editor
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
- **Version everything**: Every save creates a snapshot so you can compare changes and roll back instantly, plus audit what changed and when.
|
|
18
|
-
- **Run experiments**: Route different users or requests to different agent versions for A/B testing or canary rollouts, or alternatively prompt experimentation.
|
|
19
|
-
- **Target specific versions**: Pin a version per request or per user, or alternatively per environment so production stays stable while new versions are tested.
|
|
20
|
-
- **Manage tools at runtime**: Add integration tools from Composio or Arcade, or connect MCP servers, without updating code.
|
|
21
|
-
- **Override code agents**: Change the instructions, tools, or variables of a code-defined agent while keeping the original code as the baseline.
|
|
22
|
-
|
|
23
|
-
For building agents entirely in code, see the [Agents overview](https://mastra.ai/docs/agents/overview).
|
|
15
|
+
Use Editor when an agent is defined in code but the people responsible for its behavior shouldn't edit the codebase. It works well when instructions or tools change often and need testing before they reach users. If developers own every change and release agent configuration with the application, keep the [agent configuration in code](https://mastra.ai/docs/agents/overview) instead.
|
|
24
16
|
|
|
25
17
|
## Quickstart
|
|
26
18
|
|
|
27
|
-
|
|
19
|
+
Install `@mastra/editor`. This quickstart uses LibSQL to store Editor changes:
|
|
28
20
|
|
|
29
21
|
**npm**:
|
|
30
22
|
|
|
31
23
|
```bash
|
|
32
|
-
npm install @mastra/editor
|
|
24
|
+
npm install @mastra/editor @mastra/libsql
|
|
33
25
|
```
|
|
34
26
|
|
|
35
27
|
**pnpm**:
|
|
36
28
|
|
|
37
29
|
```bash
|
|
38
|
-
pnpm add @mastra/editor
|
|
30
|
+
pnpm add @mastra/editor @mastra/libsql
|
|
39
31
|
```
|
|
40
32
|
|
|
41
33
|
**Yarn**:
|
|
42
34
|
|
|
43
35
|
```bash
|
|
44
|
-
yarn add @mastra/editor
|
|
36
|
+
yarn add @mastra/editor @mastra/libsql
|
|
45
37
|
```
|
|
46
38
|
|
|
47
39
|
**Bun**:
|
|
48
40
|
|
|
49
41
|
```bash
|
|
50
|
-
bun add @mastra/editor
|
|
42
|
+
bun add @mastra/editor @mastra/libsql
|
|
51
43
|
```
|
|
52
44
|
|
|
53
|
-
|
|
45
|
+
Add `MastraEditor` and storage to the `Mastra` instance. Existing storage can be reused instead of adding the LibSQL store shown here.
|
|
54
46
|
|
|
55
47
|
```typescript
|
|
56
48
|
import { Mastra } from '@mastra/core'
|
|
57
49
|
import { MastraEditor } from '@mastra/editor'
|
|
50
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
58
51
|
|
|
59
52
|
export const mastra = new Mastra({
|
|
60
|
-
agents: {/*
|
|
53
|
+
agents: {/* existing agents */},
|
|
54
|
+
storage: new LibSQLStore({
|
|
55
|
+
id: 'mastra-storage',
|
|
56
|
+
url: 'file:./mastra.db',
|
|
57
|
+
}),
|
|
61
58
|
editor: new MastraEditor(),
|
|
62
59
|
})
|
|
63
60
|
```
|
|
64
61
|
|
|
65
|
-
|
|
62
|
+
## Use Editor in Studio
|
|
66
63
|
|
|
67
|
-
|
|
64
|
+
In [Studio](https://mastra.ai/docs/studio/overview), open **Agents**, select an agent, then select **Editor**. Collaborators can update the agent's instructions and tools based on its Editor permissions.
|
|
68
65
|
|
|
69
|
-
|
|
66
|
+
With database storage, save changes as a draft to test them without affecting the live agent. Publish the draft when it's ready to use.
|
|
70
67
|
|
|
71
|
-
|
|
72
|
-
| -------------- | --------------------------------------------------------- | -------------------------------------------------------- |
|
|
73
|
-
| `db` (default) | The configured storage backend. | Save and publish drafts. |
|
|
74
|
-
| `code` | Per-agent JSON files on disk, tracked in your repository. | Download the override file or save it to the filesystem. |
|
|
68
|
+
## Instructions
|
|
75
69
|
|
|
76
|
-
The
|
|
70
|
+
The **Instructions** section shows the agent's system prompt defined in code. Collaborators can override it or add instruction blocks.
|
|
77
71
|
|
|
78
|
-
|
|
72
|
+
An instruction block can include values from the current request. For example, `{{userName}}` inserts a name supplied through [request context](https://mastra.ai/docs/server/request-context). A [display condition](https://mastra.ai/reference/editor/prompt-blocks) can show a block only for a customer, role, or feature flag.
|
|
79
73
|
|
|
80
|
-
|
|
81
|
-
import { Mastra } from '@mastra/core'
|
|
82
|
-
import { MastraEditor } from '@mastra/editor'
|
|
83
|
-
|
|
84
|
-
export const mastra = new Mastra({
|
|
85
|
-
agents: {/* your existing agents */},
|
|
86
|
-
editor: new MastraEditor({
|
|
87
|
-
source: 'code',
|
|
88
|
-
}),
|
|
89
|
-
})
|
|
90
|
-
```
|
|
74
|
+
### Prompt blocks
|
|
91
75
|
|
|
92
|
-
|
|
76
|
+
A prompt block is a saved piece of instruction text that can be used by more than one agent. Create one under **Prompts**, publish it, then open an agent's **Instructions** section and select **Add block**.
|
|
93
77
|
|
|
94
|
-
|
|
78
|
+
For example, agents for support, returns, and order status may all need the same refund policy. Save the policy as a prompt block and add it to each agent. When the policy changes, update and publish the block once instead of editing three agents.
|
|
95
79
|
|
|
96
|
-
|
|
80
|
+
When a prompt block changes, every agent that references its published version receives the update. Draft changes are used only while previewing, so they don't affect the live agents until the block is published.
|
|
97
81
|
|
|
98
|
-
|
|
82
|
+
See the [prompt blocks reference](https://mastra.ai/reference/editor/prompt-blocks) for template syntax, conditions, versions, and APIs.
|
|
99
83
|
|
|
100
|
-
##
|
|
84
|
+
## Tools
|
|
101
85
|
|
|
102
|
-
|
|
86
|
+
Tools let an agent take actions. Collaborators choose from the tools available to Editor, but they can't implement new tools in Studio. How tools become available depends on their source:
|
|
103
87
|
|
|
104
|
-
|
|
88
|
+
- **Project tools** must be implemented and registered in the Mastra project by a developer.
|
|
89
|
+
- **Integration tools** become available after a developer registers a provider such as Composio or Arcade. Collaborators can then browse the provider's catalog and add tools without each tool being added in code first.
|
|
90
|
+
- **MCP tools** become available when an MCP client is configured. A collaborator with access can create the client in Studio, then choose from the tools exposed by its servers.
|
|
105
91
|
|
|
106
|
-
|
|
92
|
+
In the agent's **Tools** section, collaborators can add the tools it needs or rewrite a tool's description for that agent. A more specific description helps the agent understand when to use the tool without changing the tool itself.
|
|
107
93
|
|
|
108
|
-
|
|
94
|
+
### Project tools
|
|
109
95
|
|
|
110
|
-
|
|
96
|
+
Developers can register a project tool on the `Mastra` instance to make it available in Editor:
|
|
111
97
|
|
|
112
98
|
```typescript
|
|
113
|
-
import {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (!editor) throw new Error('Editor is not registered on Mastra')
|
|
99
|
+
import { Mastra } from '@mastra/core'
|
|
100
|
+
import { MastraEditor } from '@mastra/editor'
|
|
101
|
+
import { searchOrders } from './tools/search-orders'
|
|
117
102
|
|
|
118
|
-
|
|
119
|
-
await editor.agent.create({
|
|
120
|
-
id: 'support-agent',
|
|
121
|
-
instructions: 'You are a friendly support agent for Acme Inc.',
|
|
103
|
+
export const mastra = new Mastra({
|
|
122
104
|
tools: {
|
|
123
|
-
|
|
105
|
+
searchOrders,
|
|
124
106
|
},
|
|
107
|
+
agents: {/* agents */},
|
|
108
|
+
editor: new MastraEditor(),
|
|
125
109
|
})
|
|
126
110
|
```
|
|
127
111
|
|
|
128
|
-
|
|
112
|
+
The Studio tool picker lists the tool. A collaborator can add it to an agent when that agent allows tool editing. The agent's Editor view also lists tools attached in code.
|
|
129
113
|
|
|
130
|
-
|
|
131
|
-
import { mastra } from '../mastra'
|
|
114
|
+
### Composio
|
|
132
115
|
|
|
133
|
-
|
|
116
|
+
[Composio](https://composio.dev) provides tools for services such as GitHub, Slack, and Gmail. Register the provider with a Composio API key to make its tool catalog available in Editor:
|
|
134
117
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
118
|
+
```typescript
|
|
119
|
+
import { Mastra } from '@mastra/core'
|
|
120
|
+
import { MastraEditor } from '@mastra/editor'
|
|
121
|
+
import { ComposioToolProvider } from '@mastra/editor/composio'
|
|
122
|
+
|
|
123
|
+
export const mastra = new Mastra({
|
|
124
|
+
agents: {/* agents */},
|
|
125
|
+
editor: new MastraEditor({
|
|
126
|
+
toolProviders: {
|
|
127
|
+
composio: new ComposioToolProvider({
|
|
128
|
+
apiKey: process.env.COMPOSIO_API_KEY!,
|
|
129
|
+
}),
|
|
130
|
+
},
|
|
131
|
+
}),
|
|
139
132
|
})
|
|
140
133
|
```
|
|
141
134
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
### Server endpoints
|
|
145
|
-
|
|
146
|
-
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:
|
|
135
|
+
Composio tool IDs look like `GITHUB_CREATE_ISSUE`. By default, a selected tool uses the connection associated with the agent's author. See [connection scope](https://agent-builder.mastra.ai/tool-providers#connection-scope) to use each caller's connection instead.
|
|
147
136
|
|
|
148
|
-
|
|
149
|
-
| -------- | ------------------------------------------ | ---------------------------------------------------------------- |
|
|
150
|
-
| `GET` | `/stored/agents` | List all stored agents. |
|
|
151
|
-
| `POST` | `/stored/agents` | Create a stored agent. |
|
|
152
|
-
| `GET` | `/stored/agents/:storedAgentId` | Get a stored agent by ID. |
|
|
153
|
-
| `PATCH` | `/stored/agents/:storedAgentId` | Update a stored agent. |
|
|
154
|
-
| `DELETE` | `/stored/agents/:storedAgentId` | Delete a stored agent. |
|
|
155
|
-
| `GET` | `/stored/agents/:storedAgentId/dependents` | List agents that reference this agent as a sub-agent. |
|
|
156
|
-
| `POST` | `/stored/agents/:storedAgentId/export` | Export a stored agent's override as a deterministic JSON config. |
|
|
137
|
+
### Arcade
|
|
157
138
|
|
|
158
|
-
|
|
139
|
+
[Arcade](https://arcade.dev) provides another catalog of tools with built-in authentication. Register it with an Arcade API key:
|
|
159
140
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
141
|
+
```typescript
|
|
142
|
+
import { Mastra } from '@mastra/core'
|
|
143
|
+
import { MastraEditor } from '@mastra/editor'
|
|
144
|
+
import { ArcadeToolProvider } from '@mastra/editor/arcade'
|
|
163
145
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
146
|
+
export const mastra = new Mastra({
|
|
147
|
+
agents: {/* agents */},
|
|
148
|
+
editor: new MastraEditor({
|
|
149
|
+
toolProviders: {
|
|
150
|
+
arcade: new ArcadeToolProvider({
|
|
151
|
+
apiKey: process.env.ARCADE_API_KEY!,
|
|
152
|
+
}),
|
|
153
|
+
},
|
|
154
|
+
}),
|
|
155
|
+
})
|
|
156
|
+
```
|
|
169
157
|
|
|
170
|
-
|
|
158
|
+
Arcade tool IDs use `Toolkit.ToolName` format, such as `Github.GetRepository`.
|
|
171
159
|
|
|
172
|
-
|
|
160
|
+
### MCP clients
|
|
173
161
|
|
|
174
|
-
|
|
162
|
+
Collaborators can also create a reusable MCP client in Studio and add its tools to an agent. Stored clients can start a local `stdio` server or connect to a remote HTTP server. Tool filters let each agent use only the tools it needs from that server.
|
|
175
163
|
|
|
176
|
-
|
|
177
|
-
| ------------ | ------------------------------------------------------------------------------------------------------------- |
|
|
178
|
-
| Instructions | Replace or extend the agent's system prompt using [prompt blocks](https://mastra.ai/docs/editor/prompts). |
|
|
179
|
-
| Tools | Add tools from the tool registry, integration providers, or MCP clients. Code-defined tools remain available. |
|
|
164
|
+
See the [Editor tools reference](https://mastra.ai/reference/editor/tools) for MCP configuration, conditions, filtering, and resolution order. See [`ToolProvider`](https://mastra.ai/reference/editor/tool-provider) for provider options.
|
|
180
165
|
|
|
181
|
-
|
|
166
|
+
## Decide what collaborators can edit
|
|
182
167
|
|
|
183
|
-
|
|
168
|
+
By default, collaborators can change an agent's instructions and manage its tools, including their descriptions. The agent's `id`, `name`, and `model` always come from code.
|
|
184
169
|
|
|
185
|
-
Use the `editor` field
|
|
170
|
+
Use the agent's `editor` field to limit what can be changed:
|
|
186
171
|
|
|
187
172
|
```typescript
|
|
188
173
|
import { Agent } from '@mastra/core/agent'
|
|
189
174
|
|
|
190
175
|
export const supportAgent = new Agent({
|
|
191
176
|
id: 'support-agent',
|
|
192
|
-
name: '
|
|
177
|
+
name: 'Support agent',
|
|
178
|
+
instructions: 'Help customers with Acme products.',
|
|
193
179
|
model: 'openai/gpt-5.6-sol',
|
|
194
|
-
editor: {
|
|
180
|
+
editor: {
|
|
181
|
+
instructions: true,
|
|
182
|
+
tools: {
|
|
183
|
+
description: true,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
195
186
|
})
|
|
196
187
|
```
|
|
197
188
|
|
|
198
|
-
|
|
189
|
+
This agent lets collaborators change its instructions and improve the descriptions of tools already attached to it. They can't add or remove tools.
|
|
199
190
|
|
|
200
|
-
|
|
|
201
|
-
| ---------------------------------- |
|
|
202
|
-
| Omitted | Instructions and
|
|
203
|
-
| `false` | Nothing
|
|
204
|
-
| `{ instructions: true }` | Instructions
|
|
205
|
-
| `{ tools: true }` |
|
|
206
|
-
| `{ tools: { description: true } }` |
|
|
191
|
+
| `editor` value | What collaborators can change |
|
|
192
|
+
| ---------------------------------- | ------------------------------------------- |
|
|
193
|
+
| Omitted | Instructions, tools, and tool descriptions |
|
|
194
|
+
| `false` | Nothing |
|
|
195
|
+
| `{ instructions: true }` | Instructions |
|
|
196
|
+
| `{ tools: true }` | Tools and tool descriptions |
|
|
197
|
+
| `{ tools: { description: true } }` | Descriptions of tools already added in code |
|
|
207
198
|
|
|
208
|
-
|
|
199
|
+
Studio shows everything else as read-only. See [editor overrides](https://mastra.ai/reference/agents/agent) for the complete configuration.
|
|
209
200
|
|
|
210
|
-
##
|
|
201
|
+
## Choose where changes are stored
|
|
202
|
+
|
|
203
|
+
Editor can save changes in the configured database or as files in the repository.
|
|
204
|
+
|
|
205
|
+
### Database storage
|
|
206
|
+
|
|
207
|
+
The database option is the default. Editor uses the storage configured on the `Mastra` instance, so the application and Editor can share the same backend.
|
|
208
|
+
|
|
209
|
+
To use a separate backend for Editor data, set the `editor` option on [`MastraCompositeStore`](https://mastra.ai/reference/storage/composite). Storage domains without an explicit route continue to use its `default` store.
|
|
210
|
+
|
|
211
|
+
The following example keeps application and Editor data in separate LibSQL files:
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
import { Mastra } from '@mastra/core'
|
|
215
|
+
import { MastraCompositeStore } from '@mastra/core/storage'
|
|
216
|
+
import { MastraEditor } from '@mastra/editor'
|
|
217
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
211
218
|
|
|
212
|
-
|
|
219
|
+
export const mastra = new Mastra({
|
|
220
|
+
agents: {/* existing agents */},
|
|
221
|
+
storage: new MastraCompositeStore({
|
|
222
|
+
id: 'mastra-storage',
|
|
223
|
+
default: new LibSQLStore({
|
|
224
|
+
id: 'app-storage',
|
|
225
|
+
url: 'file:./mastra.db',
|
|
226
|
+
}),
|
|
227
|
+
editor: new LibSQLStore({
|
|
228
|
+
id: 'editor-storage',
|
|
229
|
+
url: 'file:./editor.db',
|
|
230
|
+
}),
|
|
231
|
+
}),
|
|
232
|
+
editor: new MastraEditor(),
|
|
233
|
+
})
|
|
234
|
+
```
|
|
213
235
|
|
|
214
|
-
|
|
236
|
+
### Repository files
|
|
215
237
|
|
|
216
|
-
|
|
238
|
+
Use the code source to keep overrides alongside application code. Developers can review the files in pull requests and deploy them with the application:
|
|
217
239
|
|
|
218
|
-
|
|
240
|
+
```typescript
|
|
241
|
+
import { Mastra } from '@mastra/core'
|
|
242
|
+
import { MastraEditor } from '@mastra/editor'
|
|
219
243
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
244
|
+
export const mastra = new Mastra({
|
|
245
|
+
agents: {/* existing agents */},
|
|
246
|
+
editor: new MastraEditor({
|
|
247
|
+
source: 'code',
|
|
248
|
+
codePath: './mastra/editor',
|
|
249
|
+
}),
|
|
250
|
+
})
|
|
251
|
+
```
|
|
226
252
|
|
|
227
|
-
|
|
253
|
+
In this mode, each edited agent has one JSON override file. Editor doesn't generate TypeScript or change the file where the agent was created. By default, an agent with the ID `support-agent` gets this file:
|
|
228
254
|
|
|
229
|
-
|
|
255
|
+
```text
|
|
256
|
+
mastra/editor/agents/support-agent.json
|
|
257
|
+
```
|
|
230
258
|
|
|
231
|
-
|
|
259
|
+
The file contains only the parts managed by Editor. For example:
|
|
232
260
|
|
|
233
|
-
|
|
261
|
+
```json
|
|
262
|
+
{
|
|
263
|
+
"instructions": "Help customers with Acme products and answer in their language.",
|
|
264
|
+
"tools": {
|
|
265
|
+
"searchOrders": {
|
|
266
|
+
"description": "Look up an order by its number"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
```
|
|
234
271
|
|
|
235
|
-
-
|
|
236
|
-
- **Canary rollouts**: Send a small percentage of requests to a draft or historical version before publishing it.
|
|
237
|
-
- **Per-user targeting**: Pin specific users or accounts to a version while others use the active version.
|
|
238
|
-
- **Environment separation**: Use the latest version in staging and the active version in production.
|
|
272
|
+
The agent's model, name, and other code-owned fields stay in its TypeScript file. Mastra reads the JSON and applies these values when the agent runs.
|
|
239
273
|
|
|
240
|
-
|
|
274
|
+
When a collaborator saves in Studio, they can write the file to the local filesystem or download it. With a source-control integration, Studio can open a pull request instead. Git then provides the review and version history.
|
|
241
275
|
|
|
242
|
-
|
|
276
|
+
See [`MastraEditor`](https://mastra.ai/reference/editor/mastra-editor) for file locations and source options.
|
|
243
277
|
|
|
244
|
-
|
|
278
|
+
## Versioning
|
|
245
279
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
280
|
+
Database-backed agents and prompt blocks use draft and published versions. Saving creates a draft while the live agent continues using the published version. Publishing makes the draft live. Restoring an older version creates a draft that collaborators can test before publishing.
|
|
281
|
+
|
|
282
|
+
Code-backed agent overrides use JSON files and Git history.
|
|
283
|
+
|
|
284
|
+
### Select a version
|
|
249
285
|
|
|
250
|
-
|
|
286
|
+
An application can choose a stored version for each request by passing a status (`published` or `draft`) or an exact version ID:
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
251
289
|
const publishedAgent = await mastra.getAgentById('support-agent', {
|
|
252
290
|
status: 'published',
|
|
253
291
|
})
|
|
254
292
|
|
|
255
|
-
// Load the latest override
|
|
256
293
|
const draftAgent = await mastra.getAgentById('support-agent', {
|
|
257
294
|
status: 'draft',
|
|
258
295
|
})
|
|
259
296
|
|
|
260
|
-
// Load a specific version
|
|
261
297
|
const versionedAgent = await mastra.getAgentById('support-agent', {
|
|
262
298
|
versionId: 'abc-123',
|
|
263
299
|
})
|
|
264
300
|
```
|
|
265
301
|
|
|
266
|
-
|
|
302
|
+
Version selection supports:
|
|
267
303
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
304
|
+
- Compare two versions in an A/B test.
|
|
305
|
+
- Give a draft to a small group before publishing it for everyone.
|
|
306
|
+
- Keep production on the published version while staging uses the latest draft.
|
|
307
|
+
- Pin a customer to a particular version.
|
|
271
308
|
|
|
272
|
-
|
|
273
|
-
curl http://localhost:4111/agents/support-agent?status=draft
|
|
309
|
+
The same version controls work when a supervisor calls sub-agents. Developers can test a draft sub-agent without changing the rest of the system.
|
|
274
310
|
|
|
275
|
-
|
|
276
|
-
curl http://localhost:4111/agents/support-agent?versionId=abc-123
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
See the [Client SDK agents reference](https://mastra.ai/reference/client-js/agents) for API methods.
|
|
280
|
-
|
|
281
|
-
### Sub-agent versioning
|
|
282
|
-
|
|
283
|
-
When a [supervisor agent](https://mastra.ai/docs/agents/supervisor-agents) delegates to sub-agents, version overrides determine which stored version of each sub-agent to use instead of the code-defined default. This lets you iterate on sub-agent prompts and tools through the editor without redeploying the supervisor.
|
|
311
|
+
See the [Editor versioning reference](https://mastra.ai/reference/editor/versioning) for version selection, sub-agent behavior, REST endpoints, and SDK methods.
|
|
284
312
|
|
|
285
|
-
|
|
313
|
+
## Programmatic access
|
|
286
314
|
|
|
287
|
-
|
|
288
|
-
2. **Per-invocation options**: overrides passed directly to `generate()` or `stream()`.
|
|
289
|
-
3. **Server request body**: overrides sent in the `versions` field of an API request.
|
|
315
|
+
Everything available in Studio is also available programmatically through [`mastra.getEditor()`](https://mastra.ai/reference/core/getEditor), the REST API, or the Client SDK. Use it to script bulk updates or seed stored configurations from code. It can also power automation that tunes agents based on [evaluation results](https://mastra.ai/docs/datasets/running-experiments).
|
|
290
316
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
#### Mastra instance config
|
|
294
|
-
|
|
295
|
-
Set global defaults when creating the `Mastra` instance. Every supervisor call inherits these overrides:
|
|
317
|
+
Call `mastra.getEditor()` when application code has access to the Mastra instance:
|
|
296
318
|
|
|
297
319
|
```typescript
|
|
298
|
-
import {
|
|
299
|
-
import { MastraEditor } from '@mastra/editor'
|
|
300
|
-
|
|
301
|
-
export const mastra = new Mastra({
|
|
302
|
-
agents: { supervisor, researchAgent, writerAgent },
|
|
303
|
-
editor: new MastraEditor(),
|
|
304
|
-
versions: {
|
|
305
|
-
agents: {
|
|
306
|
-
'research-agent': { status: 'published' },
|
|
307
|
-
'writer-agent': { versionId: 'abc-123' },
|
|
308
|
-
},
|
|
309
|
-
},
|
|
310
|
-
})
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
#### Per-invocation overrides
|
|
320
|
+
import { mastra } from '../mastra'
|
|
314
321
|
|
|
315
|
-
|
|
322
|
+
const editor = mastra.getEditor()!
|
|
316
323
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
agents: {
|
|
321
|
-
'research-agent': { versionId: 'draft-456' },
|
|
322
|
-
},
|
|
323
|
-
},
|
|
324
|
+
await editor.agent.update({
|
|
325
|
+
id: 'support-agent',
|
|
326
|
+
instructions: 'Help customers with Acme products. Reply in their language.',
|
|
324
327
|
})
|
|
325
328
|
```
|
|
326
329
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
When calling agents through the Mastra server, pass version overrides in the request body:
|
|
330
|
+
The direct `editor.agent.update()` method activates the new version immediately. To create a draft without changing the live agent, use the stored-agent REST API or Client SDK instead:
|
|
330
331
|
|
|
331
332
|
```bash
|
|
332
|
-
curl -X
|
|
333
|
+
curl -X PATCH http://localhost:4111/api/stored/agents/support-agent \
|
|
333
334
|
-H "Content-Type: application/json" \
|
|
334
335
|
-d '{
|
|
335
|
-
"
|
|
336
|
-
"versions": {
|
|
337
|
-
"agents": {
|
|
338
|
-
"research-agent": { "versionId": "draft-456" }
|
|
339
|
-
}
|
|
340
|
-
}
|
|
336
|
+
"instructions": "Help customers with Acme products. Reply in their language."
|
|
341
337
|
}'
|
|
342
338
|
```
|
|
343
339
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
Version overrides propagate automatically through sub-agent delegation via `requestContext`. When a supervisor delegates to a sub-agent, the framework checks if a version override exists for that sub-agent's ID. If one is found, it resolves the stored version from the editor and uses it instead of the code-defined default.
|
|
340
|
+
The default server prefix is `/api`. Developers can set a custom prefix in the server configuration.
|
|
347
341
|
|
|
348
|
-
|
|
342
|
+
See the [`MastraEditor` namespaces](https://mastra.ai/reference/editor/mastra-editor) and [Client SDK agents API](https://mastra.ai/reference/client-js/agents) for available operations.
|
|
349
343
|
|
|
350
344
|
## Next steps
|
|
351
345
|
|
|
352
|
-
-
|
|
353
|
-
-
|
|
354
|
-
-
|
|
346
|
+
- [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor)
|
|
347
|
+
- [Prompt blocks reference](https://mastra.ai/reference/editor/prompt-blocks)
|
|
348
|
+
- [Editor tools reference](https://mastra.ai/reference/editor/tools)
|
|
349
|
+
- [Editor versioning reference](https://mastra.ai/reference/editor/versioning)
|
|
@@ -141,6 +141,6 @@ The inline `task` receives the item's `metadata`, so each row can drive its own
|
|
|
141
141
|
## Related
|
|
142
142
|
|
|
143
143
|
- [Running scorers in CI](https://mastra.ai/docs/evals/running-in-ci)
|
|
144
|
-
- [Running experiments](https://mastra.ai/docs/
|
|
144
|
+
- [Running experiments](https://mastra.ai/docs/datasets/running-experiments)
|
|
145
145
|
- [Observational memory](https://mastra.ai/docs/memory/observational-memory)
|
|
146
146
|
- [runEvals API reference](https://mastra.ai/reference/evals/run-evals)
|