@mastra/mcp-docs-server 1.1.41 → 1.1.42-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agent-builder/access-control.md +97 -0
- package/.docs/docs/agent-builder/browser.md +61 -0
- package/.docs/docs/agent-builder/channels.md +76 -0
- package/.docs/docs/agent-builder/configuration.md +147 -0
- package/.docs/docs/agent-builder/deploying.md +121 -0
- package/.docs/docs/agent-builder/memory.md +65 -0
- package/.docs/docs/agent-builder/model-policy.md +48 -0
- package/.docs/docs/agent-builder/overview.md +97 -0
- package/.docs/docs/agent-builder/skill-registries.md +31 -0
- package/.docs/docs/agent-builder/workspace.md +60 -0
- package/.docs/docs/agents/channels.md +2 -0
- package/.docs/docs/memory/observational-memory.md +19 -0
- package/.docs/guides/deployment/inngest.md +69 -0
- package/.docs/reference/agents/channels.md +1 -1
- package/.docs/reference/client-js/agent-builder.md +161 -0
- package/.docs/reference/client-js/mastra-client.md +4 -0
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +74 -0
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +77 -0
- package/.docs/reference/editor/agent-builder/builder-models.md +64 -0
- package/.docs/reference/editor/blob-store-provider.md +59 -0
- package/.docs/reference/editor/browser-provider.md +75 -0
- package/.docs/reference/editor/filesystem-provider.md +62 -0
- package/.docs/reference/editor/mastra-editor.md +44 -0
- package/.docs/reference/editor/processor-provider.md +64 -0
- package/.docs/reference/editor/sandbox-provider.md +61 -0
- package/.docs/reference/editor/storage-browser-ref.md +80 -0
- package/.docs/reference/editor/storage-workspace-ref.md +93 -0
- package/.docs/reference/evals/create-scorer.md +2 -0
- package/.docs/reference/index.md +12 -0
- package/.docs/reference/memory/observational-memory.md +2 -0
- package/.docs/reference/memory/serialized-memory-config.md +72 -0
- package/CHANGELOG.md +21 -0
- package/package.json +4 -4
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# builder.configuration.agent.models
|
|
2
|
+
|
|
3
|
+
`builder.configuration.agent.models` is the admin-facing model policy input on `AgentBuilderOptions`. It controls which providers and models the Agent Builder exposes, and which model is pre-selected on new-agent create.
|
|
4
|
+
|
|
5
|
+
See [Model policy](https://mastra.ai/docs/agent-builder/model-policy) for concepts and worked examples.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { MastraEditor } from '@mastra/editor'
|
|
11
|
+
|
|
12
|
+
new MastraEditor({
|
|
13
|
+
builder: {
|
|
14
|
+
enabled: true,
|
|
15
|
+
configuration: {
|
|
16
|
+
agent: {
|
|
17
|
+
models: {
|
|
18
|
+
allowed: [
|
|
19
|
+
{ provider: 'openai', modelId: 'gpt-5.4-mini' },
|
|
20
|
+
{ provider: 'openai', modelId: 'gpt-5.4' },
|
|
21
|
+
{ provider: 'anthropic', modelId: 'claude-opus-4-7' },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Properties
|
|
31
|
+
|
|
32
|
+
**allowed** (`ProviderModelEntry[]`): Allowlist of providers and models. Omit to allow every registered model. When non-empty, only the listed entries are selectable in the Builder.
|
|
33
|
+
|
|
34
|
+
**allowed.provider** (`Provider`): Provider id from the generated provider registry (for example, \`openai\`, \`anthropic\`).
|
|
35
|
+
|
|
36
|
+
**allowed.modelId** (`ModelForProvider<Provider>`): Specific model id for that provider. Omit to allow every model under the provider.
|
|
37
|
+
|
|
38
|
+
**allowed.kind** (`'custom'`): Discriminant marking this entry as a gateway or self-hosted provider not in the registry.
|
|
39
|
+
|
|
40
|
+
**allowed.provider** (`string`): Provider id for the custom provider.
|
|
41
|
+
|
|
42
|
+
**allowed.modelId** (`string`): Specific model id under the custom provider. Omit to allow every model under it.
|
|
43
|
+
|
|
44
|
+
**default** (`DefaultModelEntry`): Pre-selected model on new-agent create. Same shape as \`ProviderModelEntry\`, but \`modelId\` is required. Must satisfy the \`allowed\` list when set.
|
|
45
|
+
|
|
46
|
+
**default.provider** (`Provider | string`): Provider id. Use a \`Provider\` literal for known providers, or any \`string\` with \`kind: 'custom'\`.
|
|
47
|
+
|
|
48
|
+
**default.modelId** (`string`): Required model id. Points at a specific model, not a whole provider.
|
|
49
|
+
|
|
50
|
+
**default.kind** (`'custom'`): Set to \`custom\` when targeting a provider that isn't in the generated registry.
|
|
51
|
+
|
|
52
|
+
## Validation rules
|
|
53
|
+
|
|
54
|
+
Mastra validates the admin policy at server boot. Violations surface as warnings on `GET /editor/builder/settings.modelPolicyWarnings`.
|
|
55
|
+
|
|
56
|
+
- `allowed` empty or omitted: no restriction. Every registered model is available.
|
|
57
|
+
- When `allowed` is non-empty and a `default` is set: `default` must satisfy `isModelAllowed(allowed, default)`. A `default` that fails this check is dropped and surfaced as a warning.
|
|
58
|
+
- To hide the end-user model picker, set `features.agent.model: false` in [AgentBuilderOptions](https://mastra.ai/reference/editor/agent-builder/agent-builder-options). When the picker is hidden, provide a `default` so new agents resolve a model.
|
|
59
|
+
|
|
60
|
+
## Related
|
|
61
|
+
|
|
62
|
+
- [BuilderAgentDefaults](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) — parent object containing `models`.
|
|
63
|
+
- [AgentBuilderOptions](https://mastra.ai/reference/editor/agent-builder/agent-builder-options) — the top-level Builder options.
|
|
64
|
+
- [Model policy](https://mastra.ai/docs/agent-builder/model-policy) — concept and worked examples.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# BlobStoreProvider
|
|
2
|
+
|
|
3
|
+
`BlobStoreProvider` is the interface a package implements to register a blob store with [`MastraEditor`](https://mastra.ai/reference/editor/mastra-editor). Blob stores hold content-addressable skill blobs and other large artifacts produced by the editor.
|
|
4
|
+
|
|
5
|
+
The built-in `storage` provider uses the configured storage backend's `blobs` domain. External providers (for example, S3) are supplied via `MastraEditorConfig.blobStores`.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { MastraEditor } from '@mastra/editor'
|
|
11
|
+
import { s3BlobStoreProvider } from '@mastra/s3'
|
|
12
|
+
|
|
13
|
+
new MastraEditor({
|
|
14
|
+
blobStores: {
|
|
15
|
+
[s3BlobStoreProvider.id]: s3BlobStoreProvider,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Properties
|
|
21
|
+
|
|
22
|
+
**id** (`string`): Unique provider identifier (for example, \`"storage"\`, \`"s3"\`).
|
|
23
|
+
|
|
24
|
+
**name** (`string`): Human-readable name for UI display.
|
|
25
|
+
|
|
26
|
+
**description** (`string`): Short description.
|
|
27
|
+
|
|
28
|
+
**configSchema** (`Record<string, unknown>`): JSON Schema describing provider-specific configuration. Used by the UI to render config forms.
|
|
29
|
+
|
|
30
|
+
**createBlobStore** (`(config: TConfig) => BlobStore | Promise<BlobStore>`): Create a runtime \`BlobStore\` instance from the stored config. Called when the editor resolves a blob store via \`MastraEditor.resolveBlobStore(providerId, config)\`.
|
|
31
|
+
|
|
32
|
+
## Implementing a provider
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import type { BlobStore, BlobStoreProvider } from '@mastra/core/editor'
|
|
36
|
+
|
|
37
|
+
export const myBlobStoreProvider: BlobStoreProvider<{ bucket: string; region: string }> = {
|
|
38
|
+
id: 'my-blob-store',
|
|
39
|
+
name: 'My Blob Store',
|
|
40
|
+
description: 'Object-store-backed blob storage.',
|
|
41
|
+
configSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
required: ['bucket', 'region'],
|
|
44
|
+
properties: {
|
|
45
|
+
bucket: { type: 'string' },
|
|
46
|
+
region: { type: 'string' },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
async createBlobStore(config): Promise<BlobStore> {
|
|
50
|
+
return createMyBlobStore({ bucket: config.bucket, region: config.region })
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
When no `providerId` is passed to `MastraEditor.resolveBlobStore()`, the editor falls back to the storage backend's `blobs` domain.
|
|
56
|
+
|
|
57
|
+
## Related
|
|
58
|
+
|
|
59
|
+
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor) — provider registry and `resolveBlobStore()` method.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# BrowserProvider
|
|
2
|
+
|
|
3
|
+
`BrowserProvider` is the interface a package implements to register a browser with [`MastraEditor`](https://mastra.ai/reference/editor/mastra-editor). The editor calls `createBrowser(config)` at agent hydration time, using the `provider` id from the stored [`StorageBrowserRef`](https://mastra.ai/reference/editor/storage-browser-ref) as the lookup key.
|
|
4
|
+
|
|
5
|
+
There are no built-in browser providers. To use the `browser` feature in the Agent Builder, register a provider package (for example, `@mastra/stagehand`).
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { MastraEditor } from '@mastra/editor'
|
|
11
|
+
import { stagehandBrowserProvider } from '@mastra/stagehand'
|
|
12
|
+
|
|
13
|
+
new MastraEditor({
|
|
14
|
+
browsers: {
|
|
15
|
+
[stagehandBrowserProvider.id]: stagehandBrowserProvider,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Properties
|
|
21
|
+
|
|
22
|
+
**id** (`string`): Unique provider identifier (for example, \`"stagehand"\`). Must match \`StorageBrowserConfig.provider\` on every stored agent that uses this provider.
|
|
23
|
+
|
|
24
|
+
**name** (`string`): Human-readable name for UI display.
|
|
25
|
+
|
|
26
|
+
**description** (`string`): Short description shown in the Agent Builder browser picker.
|
|
27
|
+
|
|
28
|
+
**configSchema** (`Record<string, unknown>`): JSON Schema describing provider-specific configuration. Used by the UI to render config forms.
|
|
29
|
+
|
|
30
|
+
**createBrowser** (`(config: TConfig) => MastraBrowser | Promise<MastraBrowser>`): Create a runtime \`MastraBrowser\` instance from the stored config. Called once per agent hydration; the resulting instance is cached alongside the agent.
|
|
31
|
+
|
|
32
|
+
## Implementing a provider
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import type { BrowserProvider, MastraBrowser } from '@mastra/core/editor'
|
|
36
|
+
|
|
37
|
+
export const myBrowserProvider: BrowserProvider<{ apiKey: string }> = {
|
|
38
|
+
id: 'my-browser',
|
|
39
|
+
name: 'My Browser',
|
|
40
|
+
description: 'Headless browser for agent use.',
|
|
41
|
+
configSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
apiKey: { type: 'string' },
|
|
45
|
+
},
|
|
46
|
+
required: ['apiKey'],
|
|
47
|
+
},
|
|
48
|
+
async createBrowser(config): Promise<MastraBrowser> {
|
|
49
|
+
// construct and return a MastraBrowser instance
|
|
50
|
+
return createMastraBrowser({ apiKey: config.apiKey })
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Once registered, admins can pin the provider as a Builder default via [`BuilderAgentDefaults.browser`](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults):
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
new MastraEditor({
|
|
59
|
+
browsers: { [myBrowserProvider.id]: myBrowserProvider },
|
|
60
|
+
builder: {
|
|
61
|
+
enabled: true,
|
|
62
|
+
configuration: {
|
|
63
|
+
agent: {
|
|
64
|
+
browser: { type: 'inline', config: { provider: 'my-browser' } },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Related
|
|
72
|
+
|
|
73
|
+
- [Browser](https://mastra.ai/docs/agent-builder/browser) — concept and worked examples.
|
|
74
|
+
- [StorageBrowserRef](https://mastra.ai/reference/editor/storage-browser-ref) — stored configuration consumed by `createBrowser`.
|
|
75
|
+
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor) — provider registry.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# FilesystemProvider
|
|
2
|
+
|
|
3
|
+
`FilesystemProvider` is the interface a package implements to register a filesystem with [`MastraEditor`](https://mastra.ai/reference/editor/mastra-editor). The editor calls `createFilesystem(config)` at workspace hydration time, using the `provider` id from the stored [`StorageWorkspaceRef`](https://mastra.ai/reference/editor/storage-workspace-ref) filesystem config as the lookup key.
|
|
4
|
+
|
|
5
|
+
The built-in `local` filesystem provider is auto-registered. External providers (for example, S3 or GCS) are supplied via `MastraEditorConfig.filesystems`.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { MastraEditor } from '@mastra/editor'
|
|
11
|
+
import { s3FilesystemProvider } from '@mastra/s3'
|
|
12
|
+
|
|
13
|
+
new MastraEditor({
|
|
14
|
+
filesystems: {
|
|
15
|
+
[s3FilesystemProvider.id]: s3FilesystemProvider,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Properties
|
|
21
|
+
|
|
22
|
+
**id** (`string`): Unique provider identifier (for example, \`"local"\`, \`"s3"\`). Must match \`StorageFilesystemConfig.provider\` on every stored workspace that uses this provider.
|
|
23
|
+
|
|
24
|
+
**name** (`string`): Human-readable name for UI display.
|
|
25
|
+
|
|
26
|
+
**description** (`string`): Short description shown in the workspace filesystem picker.
|
|
27
|
+
|
|
28
|
+
**configSchema** (`Record<string, unknown>`): JSON Schema describing provider-specific configuration. Used by the UI to render config forms.
|
|
29
|
+
|
|
30
|
+
**createFilesystem** (`(config: TConfig) => WorkspaceFilesystem | Promise<WorkspaceFilesystem>`): Create a runtime \`WorkspaceFilesystem\` instance from the stored config. Called at workspace hydration time.
|
|
31
|
+
|
|
32
|
+
## Implementing a provider
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import type { FilesystemProvider, WorkspaceFilesystem } from '@mastra/core/editor'
|
|
36
|
+
|
|
37
|
+
export const myFilesystemProvider: FilesystemProvider<{ bucket: string; region: string }> = {
|
|
38
|
+
id: 'my-fs',
|
|
39
|
+
name: 'My Filesystem',
|
|
40
|
+
description: 'Object-store-backed filesystem.',
|
|
41
|
+
configSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
required: ['bucket', 'region'],
|
|
44
|
+
properties: {
|
|
45
|
+
bucket: { type: 'string' },
|
|
46
|
+
region: { type: 'string' },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
async createFilesystem(config): Promise<WorkspaceFilesystem> {
|
|
50
|
+
return createMyFilesystem({ bucket: config.bucket, region: config.region })
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Once registered, admins can reference the provider from an inline workspace config or a stored [`StorageWorkspaceRef`](https://mastra.ai/reference/editor/storage-workspace-ref).
|
|
56
|
+
|
|
57
|
+
## Related
|
|
58
|
+
|
|
59
|
+
- [Workspace](https://mastra.ai/docs/agent-builder/workspace) — concept and worked examples.
|
|
60
|
+
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref) — stored configuration consumed by `createFilesystem`.
|
|
61
|
+
- [SandboxProvider](https://mastra.ai/reference/editor/sandbox-provider) — sibling provider for command execution.
|
|
62
|
+
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor) — provider registry.
|
|
@@ -39,6 +39,50 @@ export const mastra = new Mastra({
|
|
|
39
39
|
|
|
40
40
|
**blobStores** (`Record<string, BlobStoreProvider>`): Blob storage providers for binary data (for example, S3). Falls back to the Mastra storage blob store if no provider is specified. (Default: `{}`)
|
|
41
41
|
|
|
42
|
+
**browsers** (`Record<string, BrowserProvider>`): Browser providers for agent browser access (for example, Stagehand). No built-ins — required when \`builder.features.agent.browser\` is enabled. See the BrowserProvider reference for the provider interface. (Default: `{}`)
|
|
43
|
+
|
|
44
|
+
**builder** (`AgentBuilderOptions`): Agent Builder configuration. See the AgentBuilderOptions reference. Omit or set \`enabled: false\` to disable the Builder.
|
|
45
|
+
|
|
46
|
+
### Provider interfaces
|
|
47
|
+
|
|
48
|
+
Each provider field above takes a record keyed by provider id. See the per-provider reference pages for the implementation shape:
|
|
49
|
+
|
|
50
|
+
- [ProcessorProvider](https://mastra.ai/reference/editor/processor-provider)
|
|
51
|
+
- [FilesystemProvider](https://mastra.ai/reference/editor/filesystem-provider)
|
|
52
|
+
- [SandboxProvider](https://mastra.ai/reference/editor/sandbox-provider)
|
|
53
|
+
- [BlobStoreProvider](https://mastra.ai/reference/editor/blob-store-provider)
|
|
54
|
+
- [BrowserProvider](https://mastra.ai/reference/editor/browser-provider)
|
|
55
|
+
|
|
56
|
+
## Agent Builder
|
|
57
|
+
|
|
58
|
+
The `builder` field enables the [Agent Builder](https://mastra.ai/docs/agent-builder/overview), a browser-based UI for creating and editing stored agents. See:
|
|
59
|
+
|
|
60
|
+
- [Agent Builder overview](https://mastra.ai/docs/agent-builder/overview) — concepts and getting started.
|
|
61
|
+
- [AgentBuilderOptions](https://mastra.ai/reference/editor/agent-builder/agent-builder-options) — full options schema.
|
|
62
|
+
- [BuilderAgentDefaults](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) — admin-pinned defaults for new agents.
|
|
63
|
+
- [builder.configuration.agent.models](https://mastra.ai/reference/editor/agent-builder/builder-models) — model allowlist and default model.
|
|
64
|
+
|
|
65
|
+
### Registering the Builder agent
|
|
66
|
+
|
|
67
|
+
The Builder UI runs against an agent created by the `createBuilderAgent()` factory from `@mastra/editor/ee`. Import the factory, invoke it, and register the returned agent under `agents` on your Mastra instance:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { Mastra } from '@mastra/core'
|
|
71
|
+
import { MastraEditor } from '@mastra/editor'
|
|
72
|
+
import { createBuilderAgent } from '@mastra/editor/ee'
|
|
73
|
+
|
|
74
|
+
export const mastra = new Mastra({
|
|
75
|
+
agents: { builderAgent: createBuilderAgent() },
|
|
76
|
+
editor: new MastraEditor({
|
|
77
|
+
builder: { enabled: true },
|
|
78
|
+
}),
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The key name (`builderAgent`) is conventional — any key works. The `@mastra/editor/ee` subpath is gated by the Mastra Enterprise Edition license at runtime.
|
|
83
|
+
|
|
84
|
+
See the [Agent Builder overview](https://mastra.ai/docs/agent-builder/overview) for the full setup checklist.
|
|
85
|
+
|
|
42
86
|
## Namespaces
|
|
43
87
|
|
|
44
88
|
The editor exposes namespaces for managing different entity types. Access them from any Mastra instance with `mastra.getEditor()` and call the CRUD methods directly in application code, or rely on the Mastra server routes that use them under the hood.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# ProcessorProvider
|
|
2
|
+
|
|
3
|
+
`ProcessorProvider` is the interface a package implements to register a configurable processor with [`MastraEditor`](https://mastra.ai/reference/editor/mastra-editor). Processor providers serve two purposes:
|
|
4
|
+
|
|
5
|
+
1. **Discovery** — the UI uses `info`, `configSchema`, and `availablePhases` to render configuration forms.
|
|
6
|
+
2. **Runtime** — the editor calls `createProcessor(config)` during agent hydration to instantiate processors from stored configuration.
|
|
7
|
+
|
|
8
|
+
Providers are supplied via `MastraEditorConfig.processorProviders`.
|
|
9
|
+
|
|
10
|
+
## Usage example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { MastraEditor } from '@mastra/editor'
|
|
14
|
+
import { moderationProcessorProvider } from '@mastra/processors/moderation'
|
|
15
|
+
|
|
16
|
+
new MastraEditor({
|
|
17
|
+
processorProviders: {
|
|
18
|
+
moderation: moderationProcessorProvider,
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Properties
|
|
24
|
+
|
|
25
|
+
**info** (`ProcessorProviderInfo`): Metadata about the provider.
|
|
26
|
+
|
|
27
|
+
**info.id** (`string`): Unique identifier (for example, \`"moderation"\`, \`"token-limiter"\`).
|
|
28
|
+
|
|
29
|
+
**info.name** (`string`): Human-readable name.
|
|
30
|
+
|
|
31
|
+
**info.description** (`string`): Short description of the provider.
|
|
32
|
+
|
|
33
|
+
**configSchema** (`ZodSchema`): Zod schema describing the configuration this provider accepts. Used by the UI to render a form. The validated config object is passed to \`createProcessor()\`.
|
|
34
|
+
|
|
35
|
+
**availablePhases** (`ProcessorPhase[]`): Phases this provider's processors support. One or more of \`'processInput'\`, \`'processInputStep'\`, \`'processOutputStream'\`, \`'processOutputResult'\`, \`'processOutputStep'\`.
|
|
36
|
+
|
|
37
|
+
**createProcessor** (`(config: Record<string, unknown>) => Processor`): Create a \`Processor\` instance from the validated configuration. Called during agent hydration to resolve stored processor configs into live instances.
|
|
38
|
+
|
|
39
|
+
## Implementing a provider
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import type { ProcessorProvider } from '@mastra/core/processor-provider'
|
|
43
|
+
import { z } from 'zod'
|
|
44
|
+
import { MyProcessor } from './my-processor-impl'
|
|
45
|
+
|
|
46
|
+
export const myProcessorProvider: ProcessorProvider = {
|
|
47
|
+
info: {
|
|
48
|
+
id: 'my-processor',
|
|
49
|
+
name: 'My Processor',
|
|
50
|
+
description: 'Filters output for sensitive content.',
|
|
51
|
+
},
|
|
52
|
+
configSchema: z.object({
|
|
53
|
+
threshold: z.number().min(0).max(1),
|
|
54
|
+
}),
|
|
55
|
+
availablePhases: ['processOutputStream', 'processOutputResult'],
|
|
56
|
+
createProcessor(config) {
|
|
57
|
+
return new MyProcessor(config as { threshold: number })
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Related
|
|
63
|
+
|
|
64
|
+
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor) — provider registry.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# SandboxProvider
|
|
2
|
+
|
|
3
|
+
`SandboxProvider` is the interface a package implements to register a sandbox with [`MastraEditor`](https://mastra.ai/reference/editor/mastra-editor). The editor calls `createSandbox(config)` at workspace hydration time, using the `provider` id from the stored [`StorageWorkspaceRef`](https://mastra.ai/reference/editor/storage-workspace-ref) sandbox config as the lookup key.
|
|
4
|
+
|
|
5
|
+
The built-in `local` sandbox provider is auto-registered. External providers (for example, E2B) are supplied via `MastraEditorConfig.sandboxes`.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { MastraEditor } from '@mastra/editor'
|
|
11
|
+
import { e2bSandboxProvider } from '@mastra/e2b'
|
|
12
|
+
|
|
13
|
+
new MastraEditor({
|
|
14
|
+
sandboxes: {
|
|
15
|
+
[e2bSandboxProvider.id]: e2bSandboxProvider,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Properties
|
|
21
|
+
|
|
22
|
+
**id** (`string`): Unique provider identifier (for example, \`"local"\`, \`"e2b"\`). Must match \`StorageSandboxConfig.provider\` on every stored workspace that uses this provider.
|
|
23
|
+
|
|
24
|
+
**name** (`string`): Human-readable name for UI display.
|
|
25
|
+
|
|
26
|
+
**description** (`string`): Short description shown in the workspace sandbox picker.
|
|
27
|
+
|
|
28
|
+
**configSchema** (`Record<string, unknown>`): JSON Schema describing provider-specific configuration. Used by the UI to render config forms.
|
|
29
|
+
|
|
30
|
+
**createSandbox** (`(config: TConfig) => WorkspaceSandbox | Promise<WorkspaceSandbox>`): Create a runtime \`WorkspaceSandbox\` instance from the stored config. Called at workspace hydration time.
|
|
31
|
+
|
|
32
|
+
## Implementing a provider
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import type { SandboxProvider, WorkspaceSandbox } from '@mastra/core/editor'
|
|
36
|
+
|
|
37
|
+
export const mySandboxProvider: SandboxProvider<{ apiKey: string }> = {
|
|
38
|
+
id: 'my-sandbox',
|
|
39
|
+
name: 'My Sandbox',
|
|
40
|
+
description: 'Cloud sandbox for command execution.',
|
|
41
|
+
configSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
required: ['apiKey'],
|
|
44
|
+
properties: {
|
|
45
|
+
apiKey: { type: 'string' },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
async createSandbox(config): Promise<WorkspaceSandbox> {
|
|
49
|
+
return createMySandbox({ apiKey: config.apiKey })
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Once registered, admins can reference the provider from an inline workspace config or a stored [`StorageWorkspaceRef`](https://mastra.ai/reference/editor/storage-workspace-ref).
|
|
55
|
+
|
|
56
|
+
## Related
|
|
57
|
+
|
|
58
|
+
- [Workspace](https://mastra.ai/docs/agent-builder/workspace) — concept and worked examples.
|
|
59
|
+
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref) — stored configuration consumed by `createSandbox`.
|
|
60
|
+
- [FilesystemProvider](https://mastra.ai/reference/editor/filesystem-provider) — sibling provider for file access.
|
|
61
|
+
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor) — provider registry.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# StorageBrowserRef
|
|
2
|
+
|
|
3
|
+
`StorageBrowserRef` is the inline browser configuration attached to a stored agent. The `provider` id is resolved at hydration time against the [`BrowserProvider`](https://mastra.ai/reference/editor/browser-provider) registered on [`MastraEditor.browsers`](https://mastra.ai/reference/editor/mastra-editor).
|
|
4
|
+
|
|
5
|
+
It is the type used by [`BuilderAgentDefaults.browser`](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) and by stored agent records.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { MastraEditor } from '@mastra/editor'
|
|
11
|
+
import { stagehandBrowserProvider } from '@mastra/stagehand'
|
|
12
|
+
|
|
13
|
+
new MastraEditor({
|
|
14
|
+
browsers: { [stagehandBrowserProvider.id]: stagehandBrowserProvider },
|
|
15
|
+
builder: {
|
|
16
|
+
enabled: true,
|
|
17
|
+
configuration: {
|
|
18
|
+
agent: {
|
|
19
|
+
browser: {
|
|
20
|
+
type: 'inline',
|
|
21
|
+
config: {
|
|
22
|
+
provider: 'stagehand',
|
|
23
|
+
headless: true,
|
|
24
|
+
viewport: { width: 1280, height: 720 },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Type
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
type StorageBrowserRef = { type: 'inline'; config: StorageBrowserConfig }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
There is no `{ type: 'id' }` variant for browsers — they are always inlined.
|
|
40
|
+
|
|
41
|
+
## Properties
|
|
42
|
+
|
|
43
|
+
**type** (`'inline'`): Discriminant. Must be the literal \`"inline"\`.
|
|
44
|
+
|
|
45
|
+
**config** (`StorageBrowserConfig`): Provider id and per-instance browser configuration. See the section below.
|
|
46
|
+
|
|
47
|
+
## `StorageBrowserConfig`
|
|
48
|
+
|
|
49
|
+
The shape embedded under `config`. Defined in `@mastra/core/storage`.
|
|
50
|
+
|
|
51
|
+
**provider** (`string`): Provider identifier (for example, \`"stagehand"\`). Must match a \`BrowserProvider.id\` registered on \`MastraEditor.browsers\`. There are no built-in providers.
|
|
52
|
+
|
|
53
|
+
**headless** (`boolean`): Run the browser in headless mode (no visible UI). (Default: `true`)
|
|
54
|
+
|
|
55
|
+
**viewport** (`{ width: number; height: number }`): Browser viewport dimensions. Controls window size and how pages render.
|
|
56
|
+
|
|
57
|
+
**timeout** (`number`): Default timeout in milliseconds for browser operations. (Default: `10000`)
|
|
58
|
+
|
|
59
|
+
**screencast** (`ScreencastOptions`): Screencast options for streaming browser frames to the UI.
|
|
60
|
+
|
|
61
|
+
**screencast.format** (`'jpeg' | 'png'`): Image format.
|
|
62
|
+
|
|
63
|
+
**screencast.quality** (`number`): JPEG quality 0–100.
|
|
64
|
+
|
|
65
|
+
**screencast.maxWidth** (`number`): Max width in pixels.
|
|
66
|
+
|
|
67
|
+
**screencast.maxHeight** (`number`): Max height in pixels.
|
|
68
|
+
|
|
69
|
+
**screencast.everyNthFrame** (`number`): Capture every Nth frame.
|
|
70
|
+
|
|
71
|
+
## Hydration
|
|
72
|
+
|
|
73
|
+
`StorageBrowserRef` is resolved lazily on `mastra.editor.agent.getById()`. The editor looks up `config.provider` on `MastraEditor.browsers` and calls `provider.createBrowser(config)`. If the provider is not registered, the editor logs a warning and returns `undefined` — the agent still loads, but without a browser.
|
|
74
|
+
|
|
75
|
+
## Related
|
|
76
|
+
|
|
77
|
+
- [Browser](https://mastra.ai/docs/agent-builder/browser) — concept and worked examples.
|
|
78
|
+
- [BrowserProvider](https://mastra.ai/reference/editor/browser-provider) — implementer-facing provider interface.
|
|
79
|
+
- [BuilderAgentDefaults](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) — where this type is pinned as the Builder default.
|
|
80
|
+
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref) — sibling reference type for workspace configuration.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# StorageWorkspaceRef
|
|
2
|
+
|
|
3
|
+
`StorageWorkspaceRef` is the discriminated union used to attach a workspace to a stored agent. It either points at a workspace registered on the Mastra runtime by ID, or embeds a workspace snapshot inline.
|
|
4
|
+
|
|
5
|
+
It is the type used by [`BuilderAgentDefaults.workspace`](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) and by stored agent records.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { MastraEditor } from '@mastra/editor'
|
|
11
|
+
|
|
12
|
+
// Variant 1 — reference a runtime workspace by id
|
|
13
|
+
new MastraEditor({
|
|
14
|
+
builder: {
|
|
15
|
+
enabled: true,
|
|
16
|
+
configuration: {
|
|
17
|
+
agent: {
|
|
18
|
+
workspace: { type: 'id', workspaceId: 'builder-workspace' },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
// Variant 2 — inline a workspace snapshot
|
|
25
|
+
new MastraEditor({
|
|
26
|
+
builder: {
|
|
27
|
+
enabled: true,
|
|
28
|
+
configuration: {
|
|
29
|
+
agent: {
|
|
30
|
+
workspace: {
|
|
31
|
+
type: 'inline',
|
|
32
|
+
config: {
|
|
33
|
+
name: 'inline-builder-workspace',
|
|
34
|
+
filesystem: {
|
|
35
|
+
provider: 'local',
|
|
36
|
+
config: { basePath: './agent-files' },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Variants
|
|
47
|
+
|
|
48
|
+
**{ type: 'id'; workspaceId: string }** (`IdRef`): Reference a workspace registered on the Mastra runtime via \`new Mastra({ workspace })\` or \`mastra.addWorkspace()\`. The id is the join key between admin config, stored agent record, and hydration.
|
|
49
|
+
|
|
50
|
+
**{ type: 'id'; workspaceId: string }.type** (`'id'`): Discriminant. Must be the literal \`"id"\`.
|
|
51
|
+
|
|
52
|
+
**{ type: 'id'; workspaceId: string }.workspaceId** (`string`): Id of a workspace registered on the Mastra runtime. Used by the Builder to snapshot, persist, and later hydrate the workspace.
|
|
53
|
+
|
|
54
|
+
**{ type: 'inline'; config: StorageWorkspaceSnapshotType }** (`InlineRef`): Embed a workspace snapshot directly. The Builder derives a deterministic id of the form \`inline-\<sha256(config)\[:12]>\` and persists the snapshot, so identical inline configs are deduplicated across agents.
|
|
55
|
+
|
|
56
|
+
**{ type: 'inline'; config: StorageWorkspaceSnapshotType }.type** (`'inline'`): Discriminant. Must be the literal \`"inline"\`.
|
|
57
|
+
|
|
58
|
+
**{ type: 'inline'; config: StorageWorkspaceSnapshotType }.config** (`StorageWorkspaceSnapshotType`): Serialized workspace configuration (filesystem, sandbox, mounts, search, skills, tools). See the \`StorageWorkspaceSnapshotType\` section below for the field list.
|
|
59
|
+
|
|
60
|
+
## `StorageWorkspaceSnapshotType`
|
|
61
|
+
|
|
62
|
+
The shape embedded under `{ type: 'inline', config }`. Defined in `@mastra/core/storage`.
|
|
63
|
+
|
|
64
|
+
**name** (`string`): Display name of the workspace.
|
|
65
|
+
|
|
66
|
+
**description** (`string`): Purpose description shown in the workspace listing.
|
|
67
|
+
|
|
68
|
+
**filesystem** (`StorageFilesystemConfig`): Primary filesystem configuration. \`provider\` must match an id registered on \`MastraEditor.filesystems\` (built-in: \`local\`).
|
|
69
|
+
|
|
70
|
+
**sandbox** (`StorageSandboxConfig`): Sandbox configuration. \`provider\` must match an id registered on \`MastraEditor.sandboxes\` (built-in: \`local\`).
|
|
71
|
+
|
|
72
|
+
**mounts** (`Record<string, StorageFilesystemConfig>`): Additional filesystems mounted on the workspace, keyed by mount path.
|
|
73
|
+
|
|
74
|
+
**search** (`StorageSearchConfig`): Search configuration (vector provider, embedder, BM25 settings).
|
|
75
|
+
|
|
76
|
+
**skills** (`string[]`): Skill entity IDs assigned to this workspace.
|
|
77
|
+
|
|
78
|
+
**tools** (`StorageWorkspaceToolsConfig`): Workspace tool configuration (allowlists, defaults).
|
|
79
|
+
|
|
80
|
+
**autoSync** (`boolean`): Auto-sync between filesystem and sandbox. (Default: `false`)
|
|
81
|
+
|
|
82
|
+
**operationTimeout** (`number`): Timeout for individual operations in milliseconds.
|
|
83
|
+
|
|
84
|
+
## Hydration
|
|
85
|
+
|
|
86
|
+
`StorageWorkspaceRef` is resolved lazily on `mastra.editor.agent.getById()`, not on `list()`. The editor looks up filesystem and sandbox providers on `MastraEditor.filesystems` / `MastraEditor.sandboxes` and materializes a runtime `Workspace`. Missing providers surface as a warning and the workspace is omitted.
|
|
87
|
+
|
|
88
|
+
## Related
|
|
89
|
+
|
|
90
|
+
- [Workspace](https://mastra.ai/docs/agent-builder/workspace) — concept and worked examples.
|
|
91
|
+
- [BuilderAgentDefaults](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) — where this type is pinned as the Builder default.
|
|
92
|
+
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor) — registers filesystem and sandbox providers.
|
|
93
|
+
- [StorageBrowserRef](https://mastra.ai/reference/editor/storage-browser-ref) — sibling reference type for browser configuration.
|
|
@@ -49,6 +49,8 @@ const scorer = createScorer({
|
|
|
49
49
|
|
|
50
50
|
**judge.instructions** (`string`): System prompt/instructions for the LLM.
|
|
51
51
|
|
|
52
|
+
**judge.jsonPromptInjection** (`boolean`): When true, inject the JSON schema into the prompt instead of using the provider's native \`response\_format\` API. Set this for models that don't support native structured output (e.g. some Groq Llama models) to avoid a wasted 400 call.
|
|
53
|
+
|
|
52
54
|
**type** (`string`): Type specification for input/output. Use 'agent' for automatic agent types. For custom types, use the generic approach instead.
|
|
53
55
|
|
|
54
56
|
**prepareRun** (`(run: ScorerRun) => ScorerRun | Promise<ScorerRun>`): Transform the scorer run data before the pipeline executes. Use this to filter messages, limit context size, or drop fields the scorer doesn't need. The \[\`filterRun()\`]\(/reference/evals/filter-run) utility creates this function from declarative options. Can be async.
|
package/.docs/reference/index.md
CHANGED
|
@@ -47,6 +47,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
47
47
|
- [StagehandBrowser](https://mastra.ai/reference/browser/stagehand-browser)
|
|
48
48
|
- [create-mastra](https://mastra.ai/reference/cli/create-mastra)
|
|
49
49
|
- [mastra](https://mastra.ai/reference/cli/mastra)
|
|
50
|
+
- [Agent Builder API](https://mastra.ai/reference/client-js/agent-builder)
|
|
50
51
|
- [Agents API](https://mastra.ai/reference/client-js/agents)
|
|
51
52
|
- [Conversations API](https://mastra.ai/reference/client-js/conversations)
|
|
52
53
|
- [Error Handling](https://mastra.ai/reference/client-js/error-handling)
|
|
@@ -94,8 +95,18 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
94
95
|
- [Deployer](https://mastra.ai/reference/deployer)
|
|
95
96
|
- [Netlify](https://mastra.ai/reference/deployer/netlify)
|
|
96
97
|
- [Vercel](https://mastra.ai/reference/deployer/vercel)
|
|
98
|
+
- [BlobStoreProvider](https://mastra.ai/reference/editor/blob-store-provider)
|
|
97
99
|
- [MastraEditor Class](https://mastra.ai/reference/editor/mastra-editor)
|
|
100
|
+
- [ProcessorProvider](https://mastra.ai/reference/editor/processor-provider)
|
|
98
101
|
- [ToolProvider](https://mastra.ai/reference/editor/tool-provider)
|
|
102
|
+
- [AgentBuilderOptions](https://mastra.ai/reference/editor/agent-builder/agent-builder-options)
|
|
103
|
+
- [BuilderAgentDefaults](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults)
|
|
104
|
+
- [Models default](https://mastra.ai/reference/editor/agent-builder/builder-models)
|
|
105
|
+
- [BrowserProvider](https://mastra.ai/reference/editor/browser-provider)
|
|
106
|
+
- [StorageBrowserRef](https://mastra.ai/reference/editor/storage-browser-ref)
|
|
107
|
+
- [FilesystemProvider](https://mastra.ai/reference/editor/filesystem-provider)
|
|
108
|
+
- [SandboxProvider](https://mastra.ai/reference/editor/sandbox-provider)
|
|
109
|
+
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref)
|
|
99
110
|
- [createScorer()](https://mastra.ai/reference/evals/create-scorer)
|
|
100
111
|
- [filterRun()](https://mastra.ai/reference/evals/filter-run)
|
|
101
112
|
- [MastraScorer](https://mastra.ai/reference/evals/mastra-scorer)
|
|
@@ -147,6 +158,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
147
158
|
- [Cloned Thread Utilities](https://mastra.ai/reference/memory/clone-utilities)
|
|
148
159
|
- [Memory Class](https://mastra.ai/reference/memory/memory-class)
|
|
149
160
|
- [Observational Memory](https://mastra.ai/reference/memory/observational-memory)
|
|
161
|
+
- [SerializedMemoryConfig](https://mastra.ai/reference/memory/serialized-memory-config)
|
|
150
162
|
- [.cloneThread()](https://mastra.ai/reference/memory/cloneThread)
|
|
151
163
|
- [.createThread()](https://mastra.ai/reference/memory/createThread)
|
|
152
164
|
- [.deleteMessages()](https://mastra.ai/reference/memory/deleteMessages)
|