@mastra/mcp-docs-server 1.1.46 → 1.1.48
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 +17 -17
- package/.docs/docs/agent-builder/browser.md +7 -7
- package/.docs/docs/agent-builder/channels.md +4 -4
- package/.docs/docs/agent-builder/configuration.md +12 -29
- package/.docs/docs/agent-builder/deploying.md +10 -10
- package/.docs/docs/agent-builder/memory.md +3 -3
- package/.docs/docs/agent-builder/model-policy.md +3 -3
- package/.docs/docs/agent-builder/overview.md +21 -12
- package/.docs/docs/agent-builder/skill-registries.md +2 -2
- package/.docs/docs/agent-builder/workspace.md +6 -6
- package/.docs/docs/agents/goals.md +110 -0
- package/.docs/docs/agents/using-tools.md +2 -0
- package/.docs/docs/browser/agent-browser.md +16 -0
- package/.docs/docs/browser/overview.md +2 -0
- package/.docs/docs/browser/recording.md +108 -0
- package/.docs/docs/browser/stagehand.md +17 -0
- package/.docs/docs/mastra-platform/configuration.md +1 -1
- package/.docs/docs/mastra-platform/database.md +150 -0
- package/.docs/docs/mastra-platform/github.md +131 -0
- package/.docs/docs/mastra-platform/overview.md +4 -0
- package/.docs/docs/mastra-platform/server.md +2 -0
- package/.docs/docs/mastra-platform/studio.md +2 -0
- package/.docs/reference/browser/agent-browser.md +4 -0
- package/.docs/reference/browser/stagehand-browser.md +7 -1
- package/.docs/reference/client-js/agents.md +20 -0
- package/.docs/reference/streaming/ChunkType.md +30 -0
- package/.docs/reference/templates/overview.md +10 -0
- package/CHANGELOG.md +7 -0
- package/package.json +9 -9
|
@@ -15,18 +15,18 @@ The Agent Builder ships with two supported roles: `admin` and `member`. Wire the
|
|
|
15
15
|
|
|
16
16
|
The Builder UI calls several resources on load, so a usable `member` role needs explicit grants on each. The Builder action layer (`/agent-builder/*`) is one resource; the data it reads and writes lives under separate resources.
|
|
17
17
|
|
|
18
|
-
| Permission | Used for
|
|
19
|
-
| ------------------------------------- |
|
|
20
|
-
| `agent-builder:*` | Load Builder actions
|
|
21
|
-
| `agents:read`, `agents:execute` | List registered agents and chat with the Builder agent
|
|
22
|
-
| `stored-agents:*` | List, view, create, and edit agents
|
|
23
|
-
| `stored-skills:*` | List, view, create, and edit stored skills
|
|
24
|
-
| `stored-workspaces:*` | Pick a workspace when editing an agent
|
|
25
|
-
| `tools:read`, `tools:execute` | Populate the tool picker and run tools through agents
|
|
26
|
-
| `workflows:read`, `workflows:execute` | Populate the workflow picker and run workflows through agents
|
|
27
|
-
| `memory:read` | Preview memory configuration in the picker
|
|
28
|
-
| `channels:read` | Show Slack/channel chips on agent pages
|
|
29
|
-
| `infrastructure:read` | Builder diagnostics banner on the shell
|
|
18
|
+
| Permission | Used for |
|
|
19
|
+
| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
20
|
+
| `agent-builder:*` | Load Builder actions and run Builder workflows. The derived Builder actions are `agent-builder:read` and `agent-builder:execute`; the wildcard grants both. |
|
|
21
|
+
| `agents:read`, `agents:execute` | List registered agents and chat with the Builder agent |
|
|
22
|
+
| `stored-agents:*` | List, view, create, and edit agents |
|
|
23
|
+
| `stored-skills:*` | List, view, create, and edit stored skills |
|
|
24
|
+
| `stored-workspaces:*` | Pick a workspace when editing an agent |
|
|
25
|
+
| `tools:read`, `tools:execute` | Populate the tool picker and run tools through agents |
|
|
26
|
+
| `workflows:read`, `workflows:execute` | Populate the workflow picker and run workflows through agents |
|
|
27
|
+
| `memory:read` | Preview memory configuration in the picker |
|
|
28
|
+
| `channels:read` | Show Slack/channel chips on agent pages |
|
|
29
|
+
| `infrastructure:read` | Builder diagnostics banner on the shell |
|
|
30
30
|
|
|
31
31
|
Grant `:write`, `:delete`, and `:publish` on `stored-agents` and `stored-skills` for users who should create or modify agents. The `:*` wildcards in the table above cover those actions. `admin` covers everything through the `*` wildcard.
|
|
32
32
|
|
|
@@ -85,13 +85,13 @@ export const mastra = new Mastra({
|
|
|
85
85
|
|
|
86
86
|
Permission patterns follow `resource:action`. Wildcards are supported on either side:
|
|
87
87
|
|
|
88
|
-
-
|
|
89
|
-
- `agent-builder
|
|
90
|
-
- `*:read
|
|
88
|
+
- `*`: Full access (every resource, every action). Used by `admin`.
|
|
89
|
+
- `agent-builder:*`: Every action on the `agent-builder` resource.
|
|
90
|
+
- `*:read`: `read` Across every resource.
|
|
91
91
|
|
|
92
92
|
Patterns resolve through `matchesPermission()`. The first matching role permission grants the action.
|
|
93
93
|
|
|
94
94
|
## Related
|
|
95
95
|
|
|
96
|
-
- [Configuration](https://mastra.ai/docs/agent-builder/configuration)
|
|
97
|
-
- [Deploying](https://mastra.ai/docs/agent-builder/deploying)
|
|
96
|
+
- [Configuration](https://mastra.ai/docs/agent-builder/configuration): Wire RBAC alongside the rest of the Builder config.
|
|
97
|
+
- [Deploying](https://mastra.ai/docs/agent-builder/deploying): Auth, RBAC, and EE license setup for production.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **Note:** The Agent Builder is part of the Mastra Enterprise Edition. Production deployments require a valid EE license. [Contact sales](https://mastra.ai/contact) for more information.
|
|
4
4
|
|
|
5
|
-
The Agent Builder can give end-user agents a browser tool driven by a registered provider. Unlike filesystems and sandboxes, **there are no built-in browser providers**
|
|
5
|
+
The Agent Builder can give end-user agents a browser tool driven by a registered provider. Unlike filesystems and sandboxes, **there are no built-in browser providers** and you must register one through `MastraEditor.browsers`.
|
|
6
6
|
|
|
7
7
|
## Quickstart
|
|
8
8
|
|
|
@@ -44,9 +44,9 @@ new MastraEditor({
|
|
|
44
44
|
|
|
45
45
|
`MastraEditor.browsers` accepts a `Record<string, BrowserProvider>`. Each provider exposes:
|
|
46
46
|
|
|
47
|
-
- `id
|
|
48
|
-
- `name
|
|
49
|
-
- `createBrowser(config)
|
|
47
|
+
- `id`: Provider identifier, matched against `StorageBrowserConfig.provider` (e.g., `'stagehand'`).
|
|
48
|
+
- `name`: Display name shown in the Builder UI.
|
|
49
|
+
- `createBrowser(config)`: Hydrates a stored browser config into a runtime `MastraBrowser`. This is where you inject runtime-only credentials (API keys, project IDs) that aren't stored in the agent snapshot.
|
|
50
50
|
|
|
51
51
|
Browser classes ship as separate packages (e.g., `@mastra/stagehand`, `@mastra/agent-browser`). The provider entry is a plain object wrapping the class — register one entry per browser you want the Builder to expose to end users. See the [StorageBrowserRef reference](https://mastra.ai/reference/editor/storage-browser-ref) for the full `browser` field schema, including all `StorageBrowserConfig` options.
|
|
52
52
|
|
|
@@ -56,6 +56,6 @@ The `features.agent.browser` toggle controls whether end users can enable browse
|
|
|
56
56
|
|
|
57
57
|
## Related
|
|
58
58
|
|
|
59
|
-
- [BuilderAgentDefaults reference](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults)
|
|
60
|
-
- [AgentBuilderOptions reference](https://mastra.ai/reference/editor/agent-builder/agent-builder-options)
|
|
61
|
-
- [Configuration](https://mastra.ai/docs/agent-builder/configuration)
|
|
59
|
+
- [BuilderAgentDefaults reference](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults): The full `browser` field schema.
|
|
60
|
+
- [AgentBuilderOptions reference](https://mastra.ai/reference/editor/agent-builder/agent-builder-options): The full Builder config surface, including `features.agent.browser`.
|
|
61
|
+
- [Configuration](https://mastra.ai/docs/agent-builder/configuration): Wire `browser` alongside the rest of the Builder config.
|
|
@@ -63,8 +63,8 @@ The Slack provider handles app creation, OAuth, slash commands, and message rout
|
|
|
63
63
|
|
|
64
64
|
`SlackProvider` requires one environment variable and accepts one optional override:
|
|
65
65
|
|
|
66
|
-
- `SLACK_APP_CONFIG_REFRESH_TOKEN` (required):
|
|
67
|
-
- `baseUrl` (optional):
|
|
66
|
+
- `SLACK_APP_CONFIG_REFRESH_TOKEN` (required): The refresh token from your Slack app configuration tokens, available under **Your App Configuration Tokens** on [api.slack.com/apps](https://api.slack.com/apps). The refresh token doesn't expire, but the access tokens it issues rotate every 12 hours and are auto-persisted to `Mastra.storage`.
|
|
67
|
+
- `baseUrl` (optional): The public URL Slack should send events and OAuth callbacks to. Defaults to the running Mastra server's host and port (for example, `http://localhost:4111` in local development). Pass `baseUrl` explicitly when the public URL differs from the server's resolved address — typically a tunnel for local development (`cloudflared tunnel --url http://localhost:4111`) or a deployed URL in production.
|
|
68
68
|
|
|
69
69
|
## Storage requirement
|
|
70
70
|
|
|
@@ -72,5 +72,5 @@ The Slack provider handles app creation, OAuth, slash commands, and message rout
|
|
|
72
72
|
|
|
73
73
|
## Related
|
|
74
74
|
|
|
75
|
-
- [Deploying](https://mastra.ai/docs/agent-builder/deploying)
|
|
76
|
-
- [Configuration](https://mastra.ai/docs/agent-builder/configuration)
|
|
75
|
+
- [Deploying](https://mastra.ai/docs/agent-builder/deploying): Set a public `baseUrl` for production deployments.
|
|
76
|
+
- [Configuration](https://mastra.ai/docs/agent-builder/configuration): Wire channel toggles into the Builder UI.
|
|
@@ -39,43 +39,26 @@ new MastraEditor({
|
|
|
39
39
|
tools: true,
|
|
40
40
|
agents: true,
|
|
41
41
|
workflows: true,
|
|
42
|
+
scorers: true,
|
|
42
43
|
skills: true,
|
|
43
44
|
memory: true,
|
|
45
|
+
variables: true,
|
|
46
|
+
favorites: true,
|
|
47
|
+
avatarUpload: true,
|
|
44
48
|
model: true,
|
|
45
49
|
browser: true,
|
|
46
|
-
avatarUpload: true,
|
|
47
|
-
favorites: true,
|
|
48
50
|
},
|
|
49
51
|
},
|
|
50
52
|
},
|
|
51
53
|
})
|
|
52
54
|
```
|
|
53
55
|
|
|
54
|
-
The shipping UI consumes these `AgentFeatures` keys: `tools`, `agents`, `workflows`, `skills`, `memory`, `
|
|
56
|
+
The shipping UI consumes these `AgentFeatures` keys: `tools`, `agents`, `workflows`, `scorers`, `skills`, `memory`, `variables`, `favorites`, `avatarUpload`, `model`, and `browser`. See the [AgentBuilderOptions reference](https://mastra.ai/reference/editor/agent-builder/agent-builder-options) for the full schema.
|
|
55
57
|
|
|
56
58
|
## Admin defaults
|
|
57
59
|
|
|
58
60
|
`builder.configuration.agent` pins admin-controlled defaults onto every agent the Builder produces.
|
|
59
61
|
|
|
60
|
-
```typescript
|
|
61
|
-
new MastraEditor({
|
|
62
|
-
builder: {
|
|
63
|
-
enabled: true,
|
|
64
|
-
configuration: {
|
|
65
|
-
agent: {
|
|
66
|
-
models: {
|
|
67
|
-
allowed: [
|
|
68
|
-
{ provider: 'openai', modelId: 'gpt-5.4-mini' },
|
|
69
|
-
{ provider: 'openai', modelId: 'gpt-5.4' },
|
|
70
|
-
{ provider: 'anthropic', modelId: 'claude-opus-4-7' },
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
})
|
|
77
|
-
```
|
|
78
|
-
|
|
79
62
|
`configuration.agent` accepts `models`, `memory`, `workspace`, `browser`, `tools`, `agents`, and `workflows`. See the [BuilderAgentDefaults reference](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) for the full shape.
|
|
80
63
|
|
|
81
64
|
## Making tools, agents, and workflows available
|
|
@@ -118,9 +101,9 @@ MCP tools work the same way: load them via `MCPClient.getTools()` and spread the
|
|
|
118
101
|
|
|
119
102
|
`configuration.agent.tools`, `configuration.agent.agents`, and `configuration.agent.workflows` constrain which registered entries appear in the Builder's pickers. Allowlist semantics are the same for all three:
|
|
120
103
|
|
|
121
|
-
- **Omitted**:
|
|
122
|
-
- **`allowed: []`**:
|
|
123
|
-
- **`allowed: [...ids]`**:
|
|
104
|
+
- **Omitted**: Unrestricted. The picker shows every registered entry.
|
|
105
|
+
- **`allowed: []`**: Explicit lockdown. The picker is empty.
|
|
106
|
+
- **`allowed: [...ids]`**: The picker shows only the listed IDs.
|
|
124
107
|
|
|
125
108
|
Unknown IDs are dropped and surfaced as warnings through `getModelPolicyWarnings()` and the server logs.
|
|
126
109
|
|
|
@@ -141,7 +124,7 @@ new MastraEditor({
|
|
|
141
124
|
|
|
142
125
|
## Related
|
|
143
126
|
|
|
144
|
-
- [Model policy](https://mastra.ai/docs/agent-builder/model-policy)
|
|
145
|
-
- [Memory](https://mastra.ai/docs/agent-builder/memory)
|
|
146
|
-
- [AgentBuilderOptions reference](https://mastra.ai/reference/editor/agent-builder/agent-builder-options)
|
|
147
|
-
- [BuilderAgentDefaults reference](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults)
|
|
127
|
+
- [Model policy](https://mastra.ai/docs/agent-builder/model-policy): Pin the allowed models and default model.
|
|
128
|
+
- [Memory](https://mastra.ai/docs/agent-builder/memory): Set the default memory shape for new agents.
|
|
129
|
+
- [AgentBuilderOptions reference](https://mastra.ai/reference/editor/agent-builder/agent-builder-options): Full property list.
|
|
130
|
+
- [BuilderAgentDefaults reference](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults): Every field on `configuration.agent`.
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
> **Note:** The Agent Builder is part of the Mastra Enterprise Edition. Production deployments require a valid EE license. [Contact sales](https://mastra.ai/contact) for more information.
|
|
4
4
|
|
|
5
|
-
Production deployments swap the local primitives in the Quickstart for cloud-backed equivalents. The shape of the `Mastra` and `MastraEditor` config doesn't change
|
|
5
|
+
Production deployments swap the local primitives in the Quickstart for cloud-backed equivalents. The shape of the `Mastra` and `MastraEditor` config doesn't change, only the providers behind it.
|
|
6
6
|
|
|
7
7
|
## What a production deployment needs
|
|
8
8
|
|
|
9
|
-
1. **EE license
|
|
10
|
-
2. **Hosted storage
|
|
11
|
-
3. **Shared workspace filesystem
|
|
12
|
-
4. **Cloud sandbox
|
|
13
|
-
5. **Auth and RBAC
|
|
14
|
-
6. **Public base URL for channels
|
|
9
|
+
1. **EE license**: A valid `MASTRA_EE_LICENSE` so the server will start with the Builder enabled.
|
|
10
|
+
2. **Hosted storage**: A shared store for agents, skills, runs, and memory.
|
|
11
|
+
3. **Shared workspace filesystem**: Survives across instances; `local` is single-node only.
|
|
12
|
+
4. **Cloud sandbox**: Runs agent commands safely; `local` is unsafe in shared environments.
|
|
13
|
+
5. **Auth and RBAC**: Gates the Builder UI and `/agent-builder/*` routes.
|
|
14
|
+
6. **Public base URL for channels**: Slack and other channel providers need a reachable URL.
|
|
15
15
|
|
|
16
16
|
## EE license
|
|
17
17
|
|
|
@@ -101,7 +101,7 @@ new Mastra({
|
|
|
101
101
|
|
|
102
102
|
`S3Filesystem` uses the default AWS credential chain (environment variables, `~/.aws` config, IAM roles, EC2 instance profile). For long-running deployments, use a credential provider function so credentials refresh automatically.
|
|
103
103
|
|
|
104
|
-
`DockerSandbox` and `VercelSandbox` are alternative cloud sandbox providers
|
|
104
|
+
`DockerSandbox` and `VercelSandbox` are alternative cloud sandbox providers, pick whichever matches your runtime.
|
|
105
105
|
|
|
106
106
|
> **Warning:** A local sandbox can't run commands safely in a shared environment. Always register a cloud sandbox provider and reference it in the workspace config before deploying.
|
|
107
107
|
|
|
@@ -117,5 +117,5 @@ Slack needs to reach your server through a public URL. Pass `baseUrl` to `SlackP
|
|
|
117
117
|
|
|
118
118
|
## Related
|
|
119
119
|
|
|
120
|
-
- [Access control](https://mastra.ai/docs/agent-builder/access-control)
|
|
121
|
-
- [Channels](https://mastra.ai/docs/agent-builder/channels)
|
|
120
|
+
- [Access control](https://mastra.ai/docs/agent-builder/access-control): Auth and RBAC setup.
|
|
121
|
+
- [Channels](https://mastra.ai/docs/agent-builder/channels): Slack `baseUrl` and channel-specific setup.
|
|
@@ -60,6 +60,6 @@ If a required adapter is missing, Mastra throws a descriptive error at agent run
|
|
|
60
60
|
|
|
61
61
|
## Related
|
|
62
62
|
|
|
63
|
-
- [Memory overview](https://mastra.ai/docs/memory/overview)
|
|
64
|
-
- [BuilderAgentDefaults reference](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults)
|
|
65
|
-
- [Configuration](https://mastra.ai/docs/agent-builder/configuration)
|
|
63
|
+
- [Memory overview](https://mastra.ai/docs/memory/overview): Concepts and core configuration.
|
|
64
|
+
- [BuilderAgentDefaults reference](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults): The full `memory` field schema.
|
|
65
|
+
- [Configuration](https://mastra.ai/docs/agent-builder/configuration): Wire `memory` alongside the rest of the Builder config.
|
|
@@ -43,6 +43,6 @@ See the [`builder.configuration.agent.models`](https://mastra.ai/reference/edito
|
|
|
43
43
|
|
|
44
44
|
## Related
|
|
45
45
|
|
|
46
|
-
- [Configuration](https://mastra.ai/docs/agent-builder/configuration)
|
|
47
|
-
- [`builder.configuration.agent.models`](https://mastra.ai/reference/editor/agent-builder/builder-models)
|
|
48
|
-
- [Provider registry](https://github.com/mastra-ai/mastra/blob/main/packages/core/src/llm/model/provider-registry.json)
|
|
46
|
+
- [Configuration](https://mastra.ai/docs/agent-builder/configuration): Wire the model policy into the broader Builder config.
|
|
47
|
+
- [`builder.configuration.agent.models`](https://mastra.ai/reference/editor/agent-builder/builder-models): Full property list.
|
|
48
|
+
- [Provider registry](https://github.com/mastra-ai/mastra/blob/main/packages/core/src/llm/model/provider-registry.json): Every model ID Mastra recognizes out of the box.
|
|
@@ -7,6 +7,8 @@ The Agent Builder lets you build, configure, and operate Mastra agents all withi
|
|
|
7
7
|
- [**Configuration**](https://mastra.ai/docs/agent-builder/configuration): Toggle UI sections and pin admin-controlled defaults for every new agent.
|
|
8
8
|
- [**Model policy**](https://mastra.ai/docs/agent-builder/model-policy): Restrict which providers and models the Builder exposes, and pin a default.
|
|
9
9
|
- [**Memory**](https://mastra.ai/docs/agent-builder/memory): Configure the default memory shape for every Builder-created agent.
|
|
10
|
+
- [**Workspace**](https://mastra.ai/docs/agent-builder/workspace): Configure the default filesystem, sandbox, and skills workspace for Builder-created agents.
|
|
11
|
+
- [**Browser**](https://mastra.ai/docs/agent-builder/browser): Register browser providers and pin a default browser configuration.
|
|
10
12
|
- [**Access control**](https://mastra.ai/docs/agent-builder/access-control): Gate the Builder behind Mastra RBAC roles and permissions.
|
|
11
13
|
- [**Channels**](https://mastra.ai/docs/agent-builder/channels): Connect Builder-created agents to Slack and other channels.
|
|
12
14
|
- [**Tool providers**](https://mastra.ai/docs/agent-builder/integrations): Connect Builder-created agents to third-party apps through OAuth-backed tool providers.
|
|
@@ -15,9 +17,18 @@ The Agent Builder lets you build, configure, and operate Mastra agents all withi
|
|
|
15
17
|
|
|
16
18
|
For building agents entirely in code, see the [Agents overview](https://mastra.ai/docs/agents/overview). For editing code-defined agents through Studio, see the [Editor overview](https://mastra.ai/docs/editor/overview).
|
|
17
19
|
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
The Agent Builder requires:
|
|
23
|
+
|
|
24
|
+
- An existing Mastra project (Follow the [installation guide](https://mastra.ai/guides/getting-started/quickstart) to set up a new project)
|
|
25
|
+
- **Storage**: A `@mastra/core` storage adapter on the `Mastra` instance. Agents, memory, and workspace state all persist through `Mastra.storage`.
|
|
26
|
+
- **A builder agent**: Register a `builderAgent` created with the `createBuilderAgent()` factory from `@mastra/editor/ee` on `Mastra.agents`. The chat-based editor invokes it through the same `Mastra.getAgent(id)` lookup as any other agent. Without this registration, the chat-based editor returns 404.
|
|
27
|
+
- **Model credentials**: `createBuilderAgent()` uses an OpenAI model by default, which requires `OPENAI_API_KEY`. To use a different provider, pass a `model` override to `createBuilderAgent({ model })` and set that provider's credentials instead.
|
|
28
|
+
|
|
18
29
|
## Get started
|
|
19
30
|
|
|
20
|
-
Install `@mastra/editor` alongside a storage adapter
|
|
31
|
+
Install `@mastra/editor` alongside a storage adapter. This example uses `@mastra/libsql`:
|
|
21
32
|
|
|
22
33
|
**npm**:
|
|
23
34
|
|
|
@@ -43,7 +54,7 @@ yarn add @mastra/editor @mastra/libsql
|
|
|
43
54
|
bun add @mastra/editor @mastra/libsql
|
|
44
55
|
```
|
|
45
56
|
|
|
46
|
-
|
|
57
|
+
The example below defines a storage adapter, registers a builder agent, and enables the editor as explained in the prerequisites:
|
|
47
58
|
|
|
48
59
|
```typescript
|
|
49
60
|
import { Mastra } from '@mastra/core/mastra'
|
|
@@ -67,7 +78,7 @@ export const mastra = new Mastra({
|
|
|
67
78
|
})
|
|
68
79
|
```
|
|
69
80
|
|
|
70
|
-
Start
|
|
81
|
+
Start Mastra's development server:
|
|
71
82
|
|
|
72
83
|
```bash
|
|
73
84
|
npx mastra dev
|
|
@@ -75,14 +86,6 @@ npx mastra dev
|
|
|
75
86
|
|
|
76
87
|
The Agent Builder is mounted at `http://localhost:4111/agent-builder`.
|
|
77
88
|
|
|
78
|
-
## Prerequisites
|
|
79
|
-
|
|
80
|
-
The Agent Builder requires:
|
|
81
|
-
|
|
82
|
-
- **Storage**: An `@mastra/core` storage adapter on the `Mastra` instance. Agents, memory, and workspace state all persist through `Mastra.storage`.
|
|
83
|
-
- **The Builder agent**: Register a Builder agent created with the `createBuilderAgent()` factory from `@mastra/editor/ee` on `Mastra.agents`. The chat-based editor invokes it through the same `Mastra.getAgent(id)` lookup as any other agent. Without this registration, the chat-based editor returns 404.
|
|
84
|
-
- **`OPENAI_API_KEY`**: The Builder agent created by `createBuilderAgent()` runs on an OpenAI model, so an `OPENAI_API_KEY` environment variable is required.
|
|
85
|
-
|
|
86
89
|
## Disabling the Builder
|
|
87
90
|
|
|
88
91
|
Set `enabled: false` to keep the config in place but turn the surface off:
|
|
@@ -95,4 +98,10 @@ new MastraEditor({
|
|
|
95
98
|
})
|
|
96
99
|
```
|
|
97
100
|
|
|
98
|
-
Omitting the `builder` field has the same effect.
|
|
101
|
+
Omitting the `builder` field has the same effect.
|
|
102
|
+
|
|
103
|
+
## Next steps
|
|
104
|
+
|
|
105
|
+
- [Configuration](https://mastra.ai/docs/agent-builder/configuration): Toggle Builder surfaces and pin defaults for new agents.
|
|
106
|
+
- [Access control](https://mastra.ai/docs/agent-builder/access-control): Gate the Builder with authentication and role-based access control.
|
|
107
|
+
- [Deploying](https://mastra.ai/docs/agent-builder/deploying): Replace local development primitives with production-ready storage, filesystems, and sandboxes.
|
|
@@ -27,5 +27,5 @@ The Builder library tab now exposes a **Browse** view backed by skills.sh. End u
|
|
|
27
27
|
|
|
28
28
|
## Related
|
|
29
29
|
|
|
30
|
-
- [Configuration](https://mastra.ai/docs/agent-builder/configuration)
|
|
31
|
-
- [AgentBuilderOptions reference](https://mastra.ai/reference/editor/agent-builder/agent-builder-options)
|
|
30
|
+
- [Configuration](https://mastra.ai/docs/agent-builder/configuration): Wire registries alongside the rest of the Builder config.
|
|
31
|
+
- [AgentBuilderOptions reference](https://mastra.ai/reference/editor/agent-builder/agent-builder-options): Every field on `builder`.
|
|
@@ -41,8 +41,8 @@ The Builder derives a deterministic id from the inline config and persists the s
|
|
|
41
41
|
|
|
42
42
|
`configuration.agent.workspace` accepts a `StorageWorkspaceRef`:
|
|
43
43
|
|
|
44
|
-
- **`{ type: 'inline', config }
|
|
45
|
-
- **`{ type: 'id', workspaceId }
|
|
44
|
+
- **`{ type: 'inline', config }`**: Embeds a serialized workspace snapshot directly on the agent. Useful for per-agent, ad-hoc configurations.
|
|
45
|
+
- **`{ type: 'id', workspaceId }`**: References a workspace already registered on the `Mastra` instance via `new Mastra({ workspace })` or `mastra.addWorkspace(...)`. Use this for shared, named workspaces.
|
|
46
46
|
|
|
47
47
|
See the [StorageWorkspaceRef reference](https://mastra.ai/reference/editor/storage-workspace-ref) for both variants.
|
|
48
48
|
|
|
@@ -54,7 +54,7 @@ For cloud deployments, swap `LocalFilesystem` / `LocalSandbox` for managed provi
|
|
|
54
54
|
|
|
55
55
|
## Related
|
|
56
56
|
|
|
57
|
-
- [Workspace overview](https://mastra.ai/docs/workspace/overview)
|
|
58
|
-
- [Filesystem](https://mastra.ai/docs/workspace/filesystem) and [Sandbox](https://mastra.ai/docs/workspace/sandbox)
|
|
59
|
-
- [BuilderAgentDefaults reference](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults)
|
|
60
|
-
- [Configuration](https://mastra.ai/docs/agent-builder/configuration)
|
|
57
|
+
- [Workspace overview](https://mastra.ai/docs/workspace/overview): The underlying workspace model.
|
|
58
|
+
- [Filesystem](https://mastra.ai/docs/workspace/filesystem) and [Sandbox](https://mastra.ai/docs/workspace/sandbox): The building blocks.
|
|
59
|
+
- [BuilderAgentDefaults reference](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults): The full `workspace` field schema.
|
|
60
|
+
- [Configuration](https://mastra.ai/docs/agent-builder/configuration): Wire `workspace` alongside the rest of the Builder config.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Goals
|
|
2
|
+
|
|
3
|
+
**Added in:** `@mastra/core@1.42.0`
|
|
4
|
+
|
|
5
|
+
A goal is a durable, thread-scoped objective: a standing instruction the agent keeps working toward across loop iterations until a judge model decides it is satisfied or a run budget is exhausted. The objective is persisted in thread state, so it survives reloads and is evaluated in-loop — even when a new message arrives in the middle of an already-running turn.
|
|
6
|
+
|
|
7
|
+
Goals build on the same machinery as [`isTaskComplete`](https://mastra.ai/docs/agents/supervisor-agents): an LLM-as-judge scores the agent's output each iteration and gates the loop. The difference is that a goal is **durable** (stored in thread state, not passed per call) and is set and updated through `Agent` methods rather than per-`stream()` options.
|
|
8
|
+
|
|
9
|
+
> **Note:** Goals are experimental and may change in a future release.
|
|
10
|
+
|
|
11
|
+
## When to use goals
|
|
12
|
+
|
|
13
|
+
Use a goal when you want an agent to keep working toward a single objective across many iterations and messages, without re-supplying the success criteria on every call:
|
|
14
|
+
|
|
15
|
+
- A standing objective the agent should pursue until a judge says it's done.
|
|
16
|
+
- Work that should continue across mid-run messages (a message delivered into a live run is still judged against the goal).
|
|
17
|
+
- An objective that must persist across thread reloads or process restarts.
|
|
18
|
+
|
|
19
|
+
For a one-off completion check within a single `stream()` call, use [`isTaskComplete`](https://mastra.ai/docs/agents/supervisor-agents) instead.
|
|
20
|
+
|
|
21
|
+
## Quickstart
|
|
22
|
+
|
|
23
|
+
Goals require a configured [storage](https://mastra.ai/docs/memory/storage) backend and a memory-backed thread. Add a `goal` config to the agent — a judge model is required for the goal to do anything — then set an objective for a thread:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { Agent } from '@mastra/core/agent'
|
|
27
|
+
|
|
28
|
+
const worker = new Agent({
|
|
29
|
+
name: 'worker',
|
|
30
|
+
instructions: 'You complete software tasks end to end.',
|
|
31
|
+
model: 'openai/gpt-5.5',
|
|
32
|
+
memory,
|
|
33
|
+
goal: {
|
|
34
|
+
judge: 'openai/gpt-5-mini',
|
|
35
|
+
maxRuns: 50,
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// Set the durable objective for a thread.
|
|
40
|
+
await worker.setObjective('Add and test a /health endpoint', {
|
|
41
|
+
threadId,
|
|
42
|
+
resourceId,
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
// The objective is judged each iteration until it's complete or maxRuns is hit.
|
|
46
|
+
const stream = await worker.stream('Start working on the goal', {
|
|
47
|
+
memory: { thread: threadId, resource: resourceId },
|
|
48
|
+
})
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The `goal` config auto-registers the state-signal projection, so the model always sees the current objective as `<current-objective>` in its context — no extra setup needed.
|
|
52
|
+
|
|
53
|
+
## How the goal step works
|
|
54
|
+
|
|
55
|
+
A goal step runs inside the agentic execution loop, right after `isTaskComplete`. On a real candidate answer it scores the conversation against the objective and gates the loop:
|
|
56
|
+
|
|
57
|
+
- **Not satisfied, budget remaining** → the loop continues; per-evaluation feedback is injected so the agent iterates.
|
|
58
|
+
- **Satisfied** → the loop stops and the objective is marked `done`.
|
|
59
|
+
- **Budget exhausted** (`runsUsed >= maxRuns`) → the loop stops but the objective stays `active`, so raising `maxRuns` later can resume it.
|
|
60
|
+
|
|
61
|
+
The step is a no-op for background-task, mid-tool-loop, and working-memory-only iterations — the same gating as `isTaskComplete`.
|
|
62
|
+
|
|
63
|
+
**The judge model is the activation switch.** If no judge resolves (neither the per-objective override nor the agent's `goal.judge`), the goal step does nothing: no scoring, no budget consumed, no `goal` chunk. Effective settings resolve as per-objective record value → agent `goal` config → built-in default (`maxRuns` `50`, a default judge prompt).
|
|
64
|
+
|
|
65
|
+
By default the step uses a built-in LLM-as-judge scorer that returns `1` when the objective is achieved and `0` otherwise. Supply your own scorer with `goal.scorer` to customize judging.
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
const worker = new Agent({
|
|
69
|
+
name: 'worker',
|
|
70
|
+
instructions: 'You complete software tasks end to end.',
|
|
71
|
+
model: 'openai/gpt-5.5',
|
|
72
|
+
memory,
|
|
73
|
+
goal: {
|
|
74
|
+
// A resolver function lets you inject provider credentials and read the
|
|
75
|
+
// current judge selection at runtime; returning `undefined` keeps the
|
|
76
|
+
// goal step a no-op.
|
|
77
|
+
judge: ({ requestContext }) => resolveJudgeModel(requestContext),
|
|
78
|
+
maxRuns: 30,
|
|
79
|
+
prompt: 'Only mark the goal complete when tests pass.',
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Each evaluation emits a typed `goal` stream chunk (`GoalEvaluationPayload`: `objective`, `iteration`, `maxRuns`, `passed`, `status`, `results`, `reason`, `duration`, `timedOut`, `maxRunsReached`, `suppressFeedback`) so a UI can show goal progress mid-run.
|
|
85
|
+
|
|
86
|
+
## Managing the objective
|
|
87
|
+
|
|
88
|
+
Control the objective for a thread with `Agent` methods. All of them no-op when the run is not memory-backed (they require storage and a `threadId`):
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// Read the current objective record.
|
|
92
|
+
const record = await worker.getObjective({ threadId })
|
|
93
|
+
|
|
94
|
+
// Update options on the active objective (only provided fields are written;
|
|
95
|
+
// unset fields fall back to the agent's `goal` config).
|
|
96
|
+
await worker.updateObjectiveOptions({ threadId, maxRuns: 100 })
|
|
97
|
+
|
|
98
|
+
// Drop the objective.
|
|
99
|
+
await worker.clearObjective({ threadId })
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Per-objective values written by `setObjective` / `updateObjectiveOptions` take precedence over the agent's `goal` config, and that precedence is remembered in thread state.
|
|
103
|
+
|
|
104
|
+
> **Note:** See the [`GoalEvaluationPayload` in the ChunkType reference](https://mastra.ai/reference/streaming/ChunkType) for the full goal chunk shape.
|
|
105
|
+
|
|
106
|
+
## Related
|
|
107
|
+
|
|
108
|
+
- [Supervisor agents](https://mastra.ai/docs/agents/supervisor-agents) — `isTaskComplete` and the rubric scorer
|
|
109
|
+
- [Signal providers](https://mastra.ai/docs/agents/signal-providers) — how the objective is projected into context
|
|
110
|
+
- [Memory storage](https://mastra.ai/docs/memory/storage) — the storage backend goals require
|
|
@@ -224,6 +224,8 @@ export const weatherTool = createTool({
|
|
|
224
224
|
})
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
+
`toModelOutput` also works on client-side tools passed through `clientTools`. The mapping runs on the client after the tool executes, and the transformed output is sent back to the server alongside the raw result.
|
|
228
|
+
|
|
227
229
|
## Transform tool payloads for UI and transcripts
|
|
228
230
|
|
|
229
231
|
Use `transform` when a tool returns raw data your application needs, but browser-facing streams or user-visible transcript messages should receive a smaller or safer shape. `transform` is separate from `toModelOutput`: `toModelOutput` shapes the payload sent back to the model, while `transform` shapes tool input, output, errors, approval payloads, and suspension payloads for `display` and `transcript` targets.
|
|
@@ -84,10 +84,26 @@ const browser = new AgentBrowser({
|
|
|
84
84
|
|
|
85
85
|
AgentBrowser uses accessibility tree refs to identify elements. When an agent calls `browser_snapshot`, it receives a text representation of the page with refs like `@e1`, `@e2`, etc. The agent then uses these refs with other tools to interact with elements.
|
|
86
86
|
|
|
87
|
+
## Recording
|
|
88
|
+
|
|
89
|
+
AgentBrowser can opt into alpha browser recording tools:
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
const browser = new AgentBrowser({
|
|
93
|
+
headless: false,
|
|
94
|
+
recording: {
|
|
95
|
+
outputDir: './browser-recordings',
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
This adds `browser_record` and `browser_record_caption` to the agent's toolset. See [Browser recording (alpha)](https://mastra.ai/docs/browser/recording) for details.
|
|
101
|
+
|
|
87
102
|
> **Note:** See [AgentBrowser reference](https://mastra.ai/reference/browser/agent-browser) for all configuration options and tool details.
|
|
88
103
|
|
|
89
104
|
## Related
|
|
90
105
|
|
|
91
106
|
- [Browser overview](https://mastra.ai/docs/browser/overview)
|
|
92
107
|
- [Stagehand](https://mastra.ai/docs/browser/stagehand)
|
|
108
|
+
- [Browser recording (alpha)](https://mastra.ai/docs/browser/recording)
|
|
93
109
|
- [AgentBrowser reference](https://mastra.ai/reference/browser/agent-browser)
|
|
@@ -7,6 +7,7 @@ Mastra supports two SDK providers and one CLI provider:
|
|
|
7
7
|
- [**AgentBrowser**](https://mastra.ai/docs/browser/agent-browser): A Playwright-based provider with accessibility-first element targeting. Best for general web automation and scraping.
|
|
8
8
|
- [**Stagehand**](https://mastra.ai/docs/browser/stagehand): A Browserbase provider with AI-powered element detection. Best for complex interactions that benefit from natural language selectors.
|
|
9
9
|
- [**BrowserViewer**](https://mastra.ai/docs/browser/browser-viewer): A CLI provider that launches Chrome and injects CDP URLs into CLI tools like agent-browser, browser-use, and browse. Best for workspace agents that drive browsers through shell commands.
|
|
10
|
+
- [**Browser recording (alpha)**](https://mastra.ai/docs/browser/recording): An opt-in tool layer that saves browser sessions as Motion-JPEG AVI videos with optional captions.
|
|
10
11
|
|
|
11
12
|
## When to use browser
|
|
12
13
|
|
|
@@ -164,5 +165,6 @@ const browser = new AgentBrowser({
|
|
|
164
165
|
|
|
165
166
|
- [AgentBrowser](https://mastra.ai/docs/browser/agent-browser)
|
|
166
167
|
- [Stagehand](https://mastra.ai/docs/browser/stagehand)
|
|
168
|
+
- [Browser recording (alpha)](https://mastra.ai/docs/browser/recording)
|
|
167
169
|
- [BrowserViewer](https://mastra.ai/docs/browser/browser-viewer)
|
|
168
170
|
- [MastraBrowser reference](https://mastra.ai/reference/browser/mastra-browser)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Browser recording (alpha)
|
|
2
|
+
|
|
3
|
+
Browser recording adds two opt-in tools that let an agent save a browser session as a Motion-JPEG AVI video. The agent can also add short captions while it works.
|
|
4
|
+
|
|
5
|
+
> **Caution:** Browser recording is an alpha feature. The API and output format may change.
|
|
6
|
+
|
|
7
|
+
## When to use browser recording
|
|
8
|
+
|
|
9
|
+
Use browser recording when you need to:
|
|
10
|
+
|
|
11
|
+
- Review what an agent did in a browser
|
|
12
|
+
- Share a short browser automation run with a teammate
|
|
13
|
+
- Debug missed actions, slow page loads, or unexpected navigation
|
|
14
|
+
- Add short captions that explain each major step
|
|
15
|
+
|
|
16
|
+
Recording tools are disabled by default. Enable them only for agents that need to write video files.
|
|
17
|
+
|
|
18
|
+
## Enable recording
|
|
19
|
+
|
|
20
|
+
Pass `recording.outputDir` to `AgentBrowser` or `StagehandBrowser`. The browser provider adds the `browser_record` and `browser_record_caption` tools to the agent's toolset.
|
|
21
|
+
|
|
22
|
+
The following example enables recording for `AgentBrowser`:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { join } from 'node:path'
|
|
26
|
+
import { AgentBrowser } from '@mastra/agent-browser'
|
|
27
|
+
|
|
28
|
+
export const browser = new AgentBrowser({
|
|
29
|
+
headless: false,
|
|
30
|
+
recording: {
|
|
31
|
+
outputDir: join(process.cwd(), 'browser-recordings'),
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The same option works with `StagehandBrowser`:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { join } from 'node:path'
|
|
40
|
+
import { StagehandBrowser } from '@mastra/stagehand'
|
|
41
|
+
|
|
42
|
+
export const browser = new StagehandBrowser({
|
|
43
|
+
headless: false,
|
|
44
|
+
recording: {
|
|
45
|
+
outputDir: join(process.cwd(), 'browser-recordings'),
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Recording tools
|
|
51
|
+
|
|
52
|
+
Enabling recording adds these tools:
|
|
53
|
+
|
|
54
|
+
| Tool | Description |
|
|
55
|
+
| ------------------------ | ------------------------------------------------------------ |
|
|
56
|
+
| `browser_record` | Starts, stops, or checks the status of a recording. |
|
|
57
|
+
| `browser_record_caption` | Adds a short caption at the current moment in the recording. |
|
|
58
|
+
|
|
59
|
+
`browser_record` accepts an `action` field:
|
|
60
|
+
|
|
61
|
+
- `start`: Start recording the current browser session.
|
|
62
|
+
- `status`: Check whether a recording is active.
|
|
63
|
+
- `stop`: Stop recording and write the `.avi` file.
|
|
64
|
+
|
|
65
|
+
The `outputPath` option for `browser_record` must be an absolute path inside the configured `recording.outputDir`. If you omit it, Mastra creates a file in `outputDir`.
|
|
66
|
+
|
|
67
|
+
## Example agent instructions
|
|
68
|
+
|
|
69
|
+
Tell the agent when to record and when to add captions:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { Agent } from '@mastra/core/agent'
|
|
73
|
+
import { browser } from '../browsers'
|
|
74
|
+
|
|
75
|
+
export const browserAgent = new Agent({
|
|
76
|
+
id: 'browser-agent',
|
|
77
|
+
name: 'Browser Agent',
|
|
78
|
+
model: 'openai/gpt-5.5',
|
|
79
|
+
browser,
|
|
80
|
+
instructions: `Use browser tools to complete the requested task.
|
|
81
|
+
|
|
82
|
+
When the user asks for a recording:
|
|
83
|
+
1. Call browser_record with action="start" before browser work begins.
|
|
84
|
+
2. After each major action, call browser_record_caption with a caption of about six words.
|
|
85
|
+
3. Call browser_record with action="stop" as soon as the task is complete.
|
|
86
|
+
4. Return the saved video path to the user.`,
|
|
87
|
+
})
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Output format and limits
|
|
91
|
+
|
|
92
|
+
Recordings are saved as Motion-JPEG AVI files. This format is encoded in JavaScript and does not require `ffmpeg` or native dependencies.
|
|
93
|
+
|
|
94
|
+
Default limits:
|
|
95
|
+
|
|
96
|
+
- Maximum duration: 30 seconds
|
|
97
|
+
- Hard duration cap: 120 seconds
|
|
98
|
+
- Maximum frame size: 1024 × 720
|
|
99
|
+
- Captions: 80 characters each
|
|
100
|
+
- One active recording per process
|
|
101
|
+
|
|
102
|
+
Use shorter recordings when possible. Long browser sessions produce larger files and are harder to review.
|
|
103
|
+
|
|
104
|
+
## Next steps
|
|
105
|
+
|
|
106
|
+
- [AgentBrowser](https://mastra.ai/docs/browser/agent-browser)
|
|
107
|
+
- [Stagehand](https://mastra.ai/docs/browser/stagehand)
|
|
108
|
+
- [Browser overview](https://mastra.ai/docs/browser/overview)
|
|
@@ -146,8 +146,25 @@ const browser = new StagehandBrowser({
|
|
|
146
146
|
|
|
147
147
|
> **Note:** See [StagehandBrowser reference](https://mastra.ai/reference/browser/stagehand-browser) for all configuration options.
|
|
148
148
|
|
|
149
|
+
## Recording
|
|
150
|
+
|
|
151
|
+
Stagehand can opt into alpha browser recording tools:
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
const browser = new StagehandBrowser({
|
|
155
|
+
headless: false,
|
|
156
|
+
model: 'openai/gpt-5.5',
|
|
157
|
+
recording: {
|
|
158
|
+
outputDir: './browser-recordings',
|
|
159
|
+
},
|
|
160
|
+
})
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
This adds `browser_record` and `browser_record_caption` to the agent's toolset. See [Browser recording (alpha)](https://mastra.ai/docs/browser/recording) for details.
|
|
164
|
+
|
|
149
165
|
## Related
|
|
150
166
|
|
|
151
167
|
- [Browser overview](https://mastra.ai/docs/browser/overview)
|
|
152
168
|
- [AgentBrowser](https://mastra.ai/docs/browser/agent-browser)
|
|
169
|
+
- [Browser recording (alpha)](https://mastra.ai/docs/browser/recording)
|
|
153
170
|
- [StagehandBrowser reference](https://mastra.ai/reference/browser/stagehand-browser)
|
|
@@ -6,7 +6,7 @@ This page explains both mechanisms and how they differ between Studio and Server
|
|
|
6
6
|
|
|
7
7
|
## Project config
|
|
8
8
|
|
|
9
|
-
The `.mastra-project.json` file is auto-generated on your first Studio or Server deploy. It links your local project to a platform project.
|
|
9
|
+
The `.mastra-project.json` file is auto-generated on your first Studio or Server deploy. It links your local project to a platform project. The [GitHub integration](https://mastra.ai/docs/mastra-platform/github) writes the same file into linked repositories.
|
|
10
10
|
|
|
11
11
|
Commit it to your version control so that subsequent deploys (including from CI) target the correct project.
|
|
12
12
|
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Hosted databases
|
|
2
|
+
|
|
3
|
+
From your [platform](https://mastra.ai/docs/mastra-platform/overview) project settings, provision a fully managed database and attach it to your project. Mastra creates it with your provider, stores credentials securely, and injects connection details as runtime environment variables when the database is ready, so there are no connection strings to copy or configure.
|
|
4
|
+
|
|
5
|
+
## When to use hosted databases
|
|
6
|
+
|
|
7
|
+
Use a hosted database when your project needs durable storage that's managed by the platform, including:
|
|
8
|
+
|
|
9
|
+
- **Agent memory**: Persist conversation history, working memory, and semantic recall across sessions.
|
|
10
|
+
- **Application data**: Store and retrieve relational or structured data your project needs at runtime.
|
|
11
|
+
- **Vector search**: Store embeddings for retrieval-augmented generation and semantic search.
|
|
12
|
+
|
|
13
|
+
## Providers
|
|
14
|
+
|
|
15
|
+
Hosted databases are available through three providers. Pick one when you attach a database from project settings. Mastra provisions it with the provider, stores credentials securely, and injects connection details as runtime environment variables when the database is ready. Wire those variables into the matching Mastra storage adapter in your code.
|
|
16
|
+
|
|
17
|
+
You can attach one database per provider to a project. This keeps environment variable names unambiguous — for example, a project has a single `DATABASE_URL` for Postgres and separate `TURSO_*` variables for Turso. Attach Turso and Postgres to the same project when you need separate stores for different workloads.
|
|
18
|
+
|
|
19
|
+
For most agent-focused projects, **Turso** is the simplest starting point. It provides a lightweight, SQLite-compatible engine well suited to agent memory, conversation history, and per-tenant isolation. Choose **Postgres** when your workload needs full SQL, relational schemas, or structured application data beyond Mastra runtime state. **MongoDB** (_coming soon_) will add document storage and built-in vector search for workloads that don't map cleanly to SQL.
|
|
20
|
+
|
|
21
|
+
| Provider | Engine | Best for |
|
|
22
|
+
| -------------- | -------------------------- | ----------------------------------------------- |
|
|
23
|
+
| **Turso** | LibSQL, SQLite-compatible | Agent memory, per-tenant isolation |
|
|
24
|
+
| **PostgreSQL** | Serverless Postgres | Relational workloads, structured data |
|
|
25
|
+
| **MongoDB** | Document and vector search | Document storage, vector search (_coming soon_) |
|
|
26
|
+
|
|
27
|
+
## Attach a database
|
|
28
|
+
|
|
29
|
+
1. Open your project in the [platform](https://mastra.ai/docs/mastra-platform/overview) and go to **Project Settings**.
|
|
30
|
+
|
|
31
|
+
2. Open the **Database** section, then select **Add database**.
|
|
32
|
+
|
|
33
|
+
3. Select a **provider** (Turso or Postgres). You can switch providers before attaching.
|
|
34
|
+
|
|
35
|
+
4. Configure the database:
|
|
36
|
+
|
|
37
|
+
- **Name**: A label for the database within your project.
|
|
38
|
+
- **Region**: Where the database is hosted. Select the region closest to your users. Turso defaults to `sjc` (San Jose) and is available in 20+ locations worldwide. Postgres defaults to `aws-us-west-2` and is available across AWS and Azure regions in the US, EU, and APAC.
|
|
39
|
+
|
|
40
|
+
5. Select **Attach database**. Provisioning runs in the background. The database starts in a `provisioning` state and moves to `ready` once the provider finishes setup. Connection details are injected into your project as server runtime environment variables automatically.
|
|
41
|
+
|
|
42
|
+
> **Note:** Hosted databases are created from your platform project settings. There is currently no CLI or public API for provisioning them.
|
|
43
|
+
|
|
44
|
+
## Connect from your code
|
|
45
|
+
|
|
46
|
+
When a database is `ready`, the provider has finished provisioning and the platform has injected connection details as managed environment variables. Check status in **Project Settings → Database** — each attached database shows `provisioning` while setup runs in the background, then `ready` when you can connect. Open a `ready` database to view its environment variables and a copy-pasteable code snippet. Wire those variables into a Mastra storage adapter, with no manual configuration required.
|
|
47
|
+
|
|
48
|
+
### Turso (LibSQL)
|
|
49
|
+
|
|
50
|
+
Turso exposes two environment variables: `TURSO_DATABASE_URL` and `TURSO_AUTH_TOKEN`. The following example connects a [LibSQLStore](https://mastra.ai/reference/storage/libsql) using those variables.
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
54
|
+
|
|
55
|
+
export const storage = new LibSQLStore({
|
|
56
|
+
url: process.env.TURSO_DATABASE_URL!,
|
|
57
|
+
authToken: process.env.TURSO_AUTH_TOKEN!,
|
|
58
|
+
})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Install the adapter:
|
|
62
|
+
|
|
63
|
+
**npm**:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install @mastra/libsql@latest
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**pnpm**:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pnpm add @mastra/libsql@latest
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Yarn**:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
yarn add @mastra/libsql@latest
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Bun**:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
bun add @mastra/libsql@latest
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### PostgreSQL
|
|
88
|
+
|
|
89
|
+
PostgreSQL exposes a single `DATABASE_URL` connection string. The following example connects a [PostgresStore](https://mastra.ai/reference/storage/postgresql) using that variable.
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { PostgresStore } from '@mastra/pg'
|
|
93
|
+
|
|
94
|
+
export const storage = new PostgresStore({
|
|
95
|
+
connectionString: process.env.DATABASE_URL!,
|
|
96
|
+
})
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Install the adapter:
|
|
100
|
+
|
|
101
|
+
**npm**:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm install @mastra/pg@latest
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**pnpm**:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pnpm add @mastra/pg@latest
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Yarn**:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
yarn add @mastra/pg@latest
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Bun**:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
bun add @mastra/pg@latest
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Pass the `storage` instance to your `Mastra` configuration so agents, memory, and workflows can use it:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
import { Mastra } from '@mastra/core'
|
|
129
|
+
import { storage } from './storage'
|
|
130
|
+
|
|
131
|
+
export const mastra = new Mastra({
|
|
132
|
+
storage,
|
|
133
|
+
})
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Environment variables
|
|
137
|
+
|
|
138
|
+
Each provider injects a fixed set of managed environment variables. These are available to your project at runtime when the database is `ready`. You don't define them yourself.
|
|
139
|
+
|
|
140
|
+
| Provider | Variables |
|
|
141
|
+
| -------- | ---------------------------------------- |
|
|
142
|
+
| Turso | `TURSO_DATABASE_URL`, `TURSO_AUTH_TOKEN` |
|
|
143
|
+
| Postgres | `DATABASE_URL` |
|
|
144
|
+
|
|
145
|
+
> **Warning:** Treat connection credentials as secrets. The auth token (`TURSO_AUTH_TOKEN`) and the Postgres connection string (`DATABASE_URL`) grant full access to your data. The platform masks them by default and only reveals them on request.
|
|
146
|
+
|
|
147
|
+
## Manage a database
|
|
148
|
+
|
|
149
|
+
- **View connection details**: Open a `ready` database in your project settings to see its environment variables and a copy-pasteable code snippet.
|
|
150
|
+
- **Detach**: Removing a database from a project deletes it with the provider and clears its injected environment variables. This is irreversible, so ensure you no longer need the data.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# GitHub integration on Mastra platform
|
|
2
|
+
|
|
3
|
+
The GitHub integration links a Mastra platform project to a GitHub repository. When you push changes to your repository Studio and Server will automatically be deployed.
|
|
4
|
+
|
|
5
|
+
> **Note:** The integration only works with repositories hosted on GitHub.com. Self-hosted GitHub Enterprise instances are not currently supported.
|
|
6
|
+
|
|
7
|
+
After a repository is linked, the platform:
|
|
8
|
+
|
|
9
|
+
- Builds and deploys Studio and Server on every push to the configured branches.
|
|
10
|
+
- Provisions managed databases and the Mastra gateway API key for projects created from a template.
|
|
11
|
+
- Surfaces commit, branch, and pull request context on each deploy.
|
|
12
|
+
- Reports build status back to GitHub as check runs and to the project dashboard with live status badges and inline logs.
|
|
13
|
+
|
|
14
|
+
## When to use the GitHub integration
|
|
15
|
+
|
|
16
|
+
Choose the GitHub integration when you want one of the following:
|
|
17
|
+
|
|
18
|
+
- Push-to-deploy from `main` or any other branch, including separate branches for Studio and Server.
|
|
19
|
+
- A managed onboarding flow that scaffolds a project from a Mastra template, including a fresh repository, managed database, and gateway API key.
|
|
20
|
+
- Pull-request and commit context inside the platform dashboard for triage.
|
|
21
|
+
|
|
22
|
+
The CLI flow (`mastra studio deploy` and `mastra server deploy`) is still available for ad-hoc deploys and CI providers other than GitHub. See [Studio](https://mastra.ai/docs/mastra-platform/studio) and [Server](https://mastra.ai/docs/mastra-platform/server) for the CLI-only path.
|
|
23
|
+
|
|
24
|
+
## Install the Mastra GitHub App
|
|
25
|
+
|
|
26
|
+
The integration is powered by the Mastra GitHub App. The App reads repository contents, listens for `push` events on the configured branches, and writes deploy status back as check runs.
|
|
27
|
+
|
|
28
|
+
1. In the [Mastra platform dashboard](https://projects.mastra.ai), open your organization settings. The page includes a **GitHub App** section.
|
|
29
|
+
|
|
30
|
+
2. Select **Install GitHub App** and choose the GitHub account or organization to install on.
|
|
31
|
+
|
|
32
|
+
If you don't own the GitHub organization, GitHub creates a pending **installation request** that an admin must approve. The dashboard tracks pending requests alongside completed installations.
|
|
33
|
+
|
|
34
|
+
3. Select the repositories the App can access. You can scope to specific repositories or grant access to all repositories on the account.
|
|
35
|
+
|
|
36
|
+
You can revoke or change repository access at any time from GitHub's App settings.
|
|
37
|
+
|
|
38
|
+
> **Note:** If GitHub later updates the App's required permissions, the dashboard surfaces an **outdated permissions** warning with an approval link. Repository operations return a `403` until an admin re-approves.
|
|
39
|
+
|
|
40
|
+
### Pending installation requests
|
|
41
|
+
|
|
42
|
+
When a non-admin requests the App on an organization, the request stays pending until an organization admin approves it on GitHub.com. The dashboard:
|
|
43
|
+
|
|
44
|
+
- Lists pending requests next to active installations.
|
|
45
|
+
- Lets the same user request access to multiple GitHub accounts at once.
|
|
46
|
+
- Reconciles pending state against GitHub when you open the page, removing requests an admin has declined or the requester has withdrawn.
|
|
47
|
+
|
|
48
|
+
To cancel a pending request, select **Cancel** next to it in the dashboard.
|
|
49
|
+
|
|
50
|
+
## Create a project from a template
|
|
51
|
+
|
|
52
|
+
Templates are the fastest way to get started. The platform creates a new repository from a Mastra template, links it to a fresh project, provisions any managed databases the template declares, and runs the first deploy.
|
|
53
|
+
|
|
54
|
+
1. In the dashboard, select **Create project** and choose **Start from a template**.
|
|
55
|
+
|
|
56
|
+
2. Pick a template and select the GitHub account that owns the new repository. Name the repository and choose whether it should be private.
|
|
57
|
+
|
|
58
|
+
3. Configure the template's managed database requirements. Templates can declare required databases (such as Turso or Neon) and you pick the provider and region per requirement.
|
|
59
|
+
|
|
60
|
+
4. Add any template-specific environment variables (for example, AI provider API keys). The platform seeds `MASTRA_GATEWAY_API_KEY` and `MASTRA_PLATFORM_ACCESS_TOKEN` automatically so that template code that talks to the Mastra gateway works on the first deploy.
|
|
61
|
+
|
|
62
|
+
5. Select **Create project**. The platform creates the repository, writes a `.mastra-project.json` config file into it, provisions the managed databases, and triggers the initial Studio and Server deploys.
|
|
63
|
+
|
|
64
|
+
The initial deploy waits for managed databases to finish provisioning before it starts, so the template's first build sees the database connection environment variables.
|
|
65
|
+
|
|
66
|
+
## Link an existing repository
|
|
67
|
+
|
|
68
|
+
Use this flow when you already have a Mastra project in a GitHub repository.
|
|
69
|
+
|
|
70
|
+
1. In the dashboard, select **Create project** and choose **Connect an existing repository**, or open an existing project and select **Link repository** from the project settings.
|
|
71
|
+
|
|
72
|
+
2. Pick an installation, then choose the repository. Repository search works across every repository the App has access to on that installation.
|
|
73
|
+
|
|
74
|
+
3. Choose the Studio and Server deploy branches. Both targets default to the repository's default branch, and they can share a branch or use different branches.
|
|
75
|
+
|
|
76
|
+
You can disable Studio or Server for the project. The manual **Deploy from GitHub** drawer selects both targets by default when both are configured.
|
|
77
|
+
|
|
78
|
+
4. Select **Link repository**. The platform validates that the repository doesn't already have a `.mastra-project.json` file pointing at a different project. If it does, the dashboard warns you and offers an **Overwrite** option that replaces the file on link.
|
|
79
|
+
|
|
80
|
+
After linking, the next push to the configured branch triggers a deploy.
|
|
81
|
+
|
|
82
|
+
### `.mastra-project.json` conflicts
|
|
83
|
+
|
|
84
|
+
The platform writes a `.mastra-project.json` file into every linked repository to identify the project. When you link a repository that already has one of these files, the dashboard checks its contents before submitting:
|
|
85
|
+
|
|
86
|
+
- **Missing**: The platform creates the file on link.
|
|
87
|
+
- **Matching**: The file already points at the project you're linking, so no change is needed.
|
|
88
|
+
- **Conflicting**: The file points at a different project. You can cancel or explicitly overwrite the file.
|
|
89
|
+
|
|
90
|
+
See [Configuration](https://mastra.ai/docs/mastra-platform/configuration) for the file's schema.
|
|
91
|
+
|
|
92
|
+
## Push-to-deploy
|
|
93
|
+
|
|
94
|
+
After a repository is linked, every push to a configured branch triggers a deploy:
|
|
95
|
+
|
|
96
|
+
- A push to the **Studio branch** triggers a Studio deploy.
|
|
97
|
+
- A push to the **Server branch** triggers a Server deploy.
|
|
98
|
+
- If both targets share a branch, one push triggers both deploys in parallel.
|
|
99
|
+
|
|
100
|
+
Each deploy carries the commit SHA, branch, and (when available) the pull request number that introduced the commit. Builds run inside the platform and report status back to GitHub as check runs on the commit.
|
|
101
|
+
|
|
102
|
+
Only one build per deploy target runs at a time. If a new push arrives while a build is in progress, the platform cancels older queued builds for that same target and runs the latest. Studio and Server builds are tracked independently, so they can run in parallel when both targets are configured.
|
|
103
|
+
|
|
104
|
+
### Manual GitHub deploys
|
|
105
|
+
|
|
106
|
+
You can also trigger a deploy from the dashboard without pushing. Open the project, select **Deploy from GitHub**, pick the target (Studio, Server, or both) and a branch, and submit. The platform runs the deploy against the head commit of that branch and records the trigger as a **GitHub Workflow** deploy.
|
|
107
|
+
|
|
108
|
+
## Track deploys
|
|
109
|
+
|
|
110
|
+
After a project is created from a template or linked to a repository, the **Setup** page shows one row per deploy target. Each row:
|
|
111
|
+
|
|
112
|
+
- Displays a live status badge that polls the deploy until it finishes.
|
|
113
|
+
- Links to the deploy detail page via the deploy ID.
|
|
114
|
+
- Exposes a **Show logs** toggle that streams build and runtime logs inline. Server logs poll every three seconds while the deploy is active.
|
|
115
|
+
|
|
116
|
+
## Permissions and revocation
|
|
117
|
+
|
|
118
|
+
To stop deploys from a repository, do one of the following:
|
|
119
|
+
|
|
120
|
+
- **Unlink the repository** from the project in **Project settings → Repository**. The project keeps its history and you can re-link a different repository later.
|
|
121
|
+
- **Remove repository access** for the Mastra GitHub App on GitHub.com. Existing deploys keep running, but no new push triggers a deploy.
|
|
122
|
+
- **Uninstall the GitHub App** from the GitHub account. This removes access to every repository on that account.
|
|
123
|
+
|
|
124
|
+
If GitHub revokes or rotates the App's installation token, repository reads return a `github_app_permissions_outdated` error and the dashboard prompts an admin to re-approve permissions.
|
|
125
|
+
|
|
126
|
+
## Related
|
|
127
|
+
|
|
128
|
+
- [Mastra platform overview](https://mastra.ai/docs/mastra-platform/overview)
|
|
129
|
+
- [Studio on Mastra platform](https://mastra.ai/docs/mastra-platform/studio)
|
|
130
|
+
- [Server on Mastra platform](https://mastra.ai/docs/mastra-platform/server)
|
|
131
|
+
- [Configuration](https://mastra.ai/docs/mastra-platform/configuration)
|
|
@@ -6,6 +6,10 @@ The [Mastra platform](https://projects.mastra.ai) provides three products for de
|
|
|
6
6
|
- [**Studio**](https://mastra.ai/docs/mastra-platform/studio): A hosted visual environment for testing agents, running workflows, and inspecting traces. Starting with Studio also gives you Observability.
|
|
7
7
|
- [**Server**](https://mastra.ai/docs/mastra-platform/server): A production deployment target that runs your Mastra application as an API server. Starting with Server also gives you Observability.
|
|
8
8
|
|
|
9
|
+
You can deploy Studio and Server from the CLI or connect a GitHub repository for push-to-deploy. See the [GitHub integration](https://mastra.ai/docs/mastra-platform/github) for the repository-linked flow.
|
|
10
|
+
|
|
11
|
+
You can also provision [**Hosted databases**](https://mastra.ai/docs/mastra-platform/database) from your project settings to persist your application data with no manual configuration.
|
|
12
|
+
|
|
9
13
|
## Get started
|
|
10
14
|
|
|
11
15
|
Choose the path that matches what you want to do:
|
|
@@ -62,6 +62,8 @@ A deploy transitions through **queued → uploading → building → deploying
|
|
|
62
62
|
|
|
63
63
|
Automate deployments from GitHub Actions, GitLab CI, or any CI provider. After your first interactive deploy, CI/CD needs two things: an API token and the `.mastra-project.json` file committed to your repository.
|
|
64
64
|
|
|
65
|
+
> **Tip:** If your code lives on GitHub, the [GitHub integration](https://mastra.ai/docs/mastra-platform/github) gives you push-to-deploy without writing a workflow file. Use the CLI-based CI/CD flow below when you need GitLab, another CI provider, or custom build steps before deploy.
|
|
66
|
+
|
|
65
67
|
### Create an API token
|
|
66
68
|
|
|
67
69
|
1. Run the following command locally:
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Studio on Mastra platform is a hosted visual environment for testing agents, running workflows, and inspecting traces. Use it when you want to share Studio with your team without hosting the Studio UI yourself.
|
|
4
4
|
|
|
5
|
+
You can deploy Studio from the CLI as shown below, or link a GitHub repository for push-to-deploy. See the [GitHub integration](https://mastra.ai/docs/mastra-platform/github) for the repository-linked flow.
|
|
6
|
+
|
|
5
7
|
## Quickstart
|
|
6
8
|
|
|
7
9
|
1. Follow the [get started guide](https://mastra.ai/docs) to create your first Mastra project.
|
|
@@ -44,12 +44,16 @@ then interact with elements using their refs (e.g., @e5).`,
|
|
|
44
44
|
|
|
45
45
|
**screencast** (`ScreencastOptions`): Configuration for streaming browser frames to Studio.
|
|
46
46
|
|
|
47
|
+
**recording** (`BrowserRecordingOptions`): Alpha option for adding browser recording tools. Provide outputDir to add browser\_record and browser\_record\_caption to the toolset.
|
|
48
|
+
|
|
47
49
|
**excludeTools** (`BrowserToolName[]`): Tool names to exclude from the browser toolset. Use this to disable specific tools for models that do not support certain capabilities, such as vision.
|
|
48
50
|
|
|
49
51
|
## Tools
|
|
50
52
|
|
|
51
53
|
`AgentBrowser` provides 16 deterministic tools for browser automation. All tools that interact with elements use refs from the accessibility tree snapshot.
|
|
52
54
|
|
|
55
|
+
When `recording` is configured, `AgentBrowser` also adds the alpha `browser_record` and `browser_record_caption` tools. See [Browser recording (alpha)](https://mastra.ai/docs/browser/recording).
|
|
56
|
+
|
|
53
57
|
### Core tools
|
|
54
58
|
|
|
55
59
|
| Tool | Description |
|
|
@@ -61,11 +61,17 @@ Use stagehand_extract to get data from pages.`,
|
|
|
61
61
|
|
|
62
62
|
**screencast** (`ScreencastOptions`): Configuration for streaming browser frames to Studio.
|
|
63
63
|
|
|
64
|
+
**recording** (`BrowserRecordingOptions`): Alpha option for adding browser recording tools. Provide outputDir to add browser\_record and browser\_record\_caption to the toolset.
|
|
65
|
+
|
|
64
66
|
**excludeTools** (`StagehandToolName[]`): Tool names to exclude from the browser toolset. Use this to disable specific tools for models that do not support certain capabilities, such as vision.
|
|
65
67
|
|
|
66
68
|
## Tools
|
|
67
69
|
|
|
68
|
-
`StagehandBrowser` provides 7 AI-powered tools for browser automation
|
|
70
|
+
`StagehandBrowser` provides 7 AI-powered tools for browser automation.
|
|
71
|
+
|
|
72
|
+
When `recording` is configured, `StagehandBrowser` also adds the alpha `browser_record` and `browser_record_caption` tools. See [Browser recording (alpha)](https://mastra.ai/docs/browser/recording).
|
|
73
|
+
|
|
74
|
+
Core tools:
|
|
69
75
|
|
|
70
76
|
| Tool | Description |
|
|
71
77
|
| ---------------------- | ------------------------------------------------------------------------------------- |
|
|
@@ -522,6 +522,26 @@ response.processDataStream({
|
|
|
522
522
|
})
|
|
523
523
|
```
|
|
524
524
|
|
|
525
|
+
### Shape client tool output for the model
|
|
526
|
+
|
|
527
|
+
Client tools support `toModelOutput` to control what the model receives, including multimodal content such as images. Because client tools execute locally, the mapping also runs on the client after `execute` completes. The transformed output is sent back to the server alongside the raw result, so the raw result stays available for storage and application logic.
|
|
528
|
+
|
|
529
|
+
```typescript
|
|
530
|
+
const screenshotTool = createTool({
|
|
531
|
+
id: 'takeScreenshot',
|
|
532
|
+
description: 'Takes a screenshot of the current page',
|
|
533
|
+
inputSchema: z.object({}),
|
|
534
|
+
execute: async () => {
|
|
535
|
+
const base64 = await captureScreenshot()
|
|
536
|
+
return { ok: true, data: base64 }
|
|
537
|
+
},
|
|
538
|
+
toModelOutput: output => ({
|
|
539
|
+
type: 'content',
|
|
540
|
+
value: [{ type: 'media', data: output.data, mediaType: 'image/jpeg' }],
|
|
541
|
+
}),
|
|
542
|
+
})
|
|
543
|
+
```
|
|
544
|
+
|
|
525
545
|
### Tracing client tools
|
|
526
546
|
|
|
527
547
|
When `@mastra/observability` is installed and configured on the server, a client-side tool records a `CLIENT_TOOL_CALL` span as a child of the current `AGENT_RUN` span. The server creates that span when the model emits the client tool call, injects a W3C trace carrier into the outgoing tool-call chunk, and ends the span once the tool arguments are available. Without server-side observability configured, client tool tracing is a no-op.
|
|
@@ -610,6 +610,36 @@ Contains monitoring and observability data from agent execution. Can include wor
|
|
|
610
610
|
|
|
611
611
|
**payload.\[key: string]** (`any`): Additional monitoring and execution data
|
|
612
612
|
|
|
613
|
+
### goal
|
|
614
|
+
|
|
615
|
+
Emitted on every evaluation of an agent [goal](https://mastra.ai/docs/agents/goals). Consumers use this to render judge progress and the result mid-run. A goal that has no judge model configured produces no `goal` chunk.
|
|
616
|
+
|
|
617
|
+
**type** (`"goal"`): Chunk type identifier
|
|
618
|
+
|
|
619
|
+
**payload** (`GoalEvaluationPayload`): The result of one goal evaluation
|
|
620
|
+
|
|
621
|
+
**payload.objective** (`string`): The objective being judged
|
|
622
|
+
|
|
623
|
+
**payload.iteration** (`number`): Goal evaluations consumed so far (runsUsed after this evaluation)
|
|
624
|
+
|
|
625
|
+
**payload.maxRuns** (`number`): Max evaluations before the goal stops
|
|
626
|
+
|
|
627
|
+
**payload.passed** (`boolean`): Whether the goal is judged complete
|
|
628
|
+
|
|
629
|
+
**payload.status** (`"active" | "paused" | "done"`): The objective status after this evaluation
|
|
630
|
+
|
|
631
|
+
**payload.results** (`ScorerResult[]`): Individual scorer results
|
|
632
|
+
|
|
633
|
+
**payload.reason** (`string`): Judge feedback or stop reason
|
|
634
|
+
|
|
635
|
+
**payload.duration** (`number`): Total duration of the goal scoring check
|
|
636
|
+
|
|
637
|
+
**payload.timedOut** (`boolean`): Whether scoring timed out
|
|
638
|
+
|
|
639
|
+
**payload.maxRunsReached** (`boolean`): Whether the run budget (maxRuns) was reached
|
|
640
|
+
|
|
641
|
+
**payload.suppressFeedback** (`boolean`): Whether the goal feedback message is suppressed from memory
|
|
642
|
+
|
|
613
643
|
### tripwire
|
|
614
644
|
|
|
615
645
|
Emitted when the stream is forcibly terminated due to content being blocked by a processor. This acts as a safety mechanism to prevent harmful or inappropriate content from being streamed. The payload includes information about why the content was blocked and whether a retry was requested.
|
|
@@ -9,6 +9,16 @@ Mastra templates are pre-built project structures that demonstrate specific use
|
|
|
9
9
|
- **Educational resources**: Learn Mastra patterns through real implementations
|
|
10
10
|
- **Quickstarts**: Bootstrap projects faster than building from scratch
|
|
11
11
|
|
|
12
|
+
## Available templates
|
|
13
|
+
|
|
14
|
+
The following templates demonstrate Gateway-first Mastra applications:
|
|
15
|
+
|
|
16
|
+
- `template-docs-expert`: Answers documentation questions with Mastra Gateway web search, citations, memory, and structured responses.
|
|
17
|
+
- `template-browser-agent`: Uses AgentBrowser to browse, inspect, and interact with web pages.
|
|
18
|
+
- `template-meeting-notes`: Turns Zoom transcripts or uploaded transcripts into structured notes with decisions and action items.
|
|
19
|
+
- `template-company-knowledge`: Indexes Linear and Notion content into pgvector and answers internal knowledge questions.
|
|
20
|
+
- `template-claw-assistant`: Operates a workspace with filesystem, sandbox, browser, and web-search tools.
|
|
21
|
+
|
|
12
22
|
## Using templates
|
|
13
23
|
|
|
14
24
|
### Installation
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.1.47
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`de66bb0`](https://github.com/mastra-ai/mastra/commit/de66bb040570444c702ce4d8e1e228a5de2949cb), [`67bf8e2`](https://github.com/mastra-ai/mastra/commit/67bf8e206dfe583954d96015cf0d09f7ac50e45f), [`8216d05`](https://github.com/mastra-ai/mastra/commit/8216d0528d866eb9a07f5d4c87ea3bb1e1139b45), [`d18b23c`](https://github.com/mastra-ai/mastra/commit/d18b23c5e29dfc381e73e3c51fcf6c779afd1823), [`5eb94eb`](https://github.com/mastra-ai/mastra/commit/5eb94ebcf66d4e28c9e26d5821ac93379bab20a0), [`1fa3e12`](https://github.com/mastra-ai/mastra/commit/1fa3e123582b63cfe49de4ee52dc6a065e8d956a), [`f9ee2ac`](https://github.com/mastra-ai/mastra/commit/f9ee2ac661af584e61bc063ac208c9035cd752ef), [`c853d53`](https://github.com/mastra-ai/mastra/commit/c853d535d2df84ab89db1adb4c28900c54c9a2d2), [`d8df1f8`](https://github.com/mastra-ai/mastra/commit/d8df1f8e947e1966c9d4e54713df56d0d0d65226), [`9192ddb`](https://github.com/mastra-ai/mastra/commit/9192ddbced8949113b30de444cbe763f075b59f5), [`ae96523`](https://github.com/mastra-ai/mastra/commit/ae965231f562d9766b0c90c49a69fc68acaa031c), [`17d5a92`](https://github.com/mastra-ai/mastra/commit/17d5a9211aa293b4d4418de3de70dc0394d58101), [`5573693`](https://github.com/mastra-ai/mastra/commit/5573693b589822250e20dfe6cf66e9ff3bc96da8), [`ec4da8a`](https://github.com/mastra-ai/mastra/commit/ec4da8a09e0d2ab452c6ee2c786042ea826b77e5), [`adc44e1`](https://github.com/mastra-ai/mastra/commit/adc44e13c7e570b91e86b20ea7556e61d819db31), [`ed346c0`](https://github.com/mastra-ai/mastra/commit/ed346c0bee2d8496690a4e538bfba1e46894660f), [`c9ce1b2`](https://github.com/mastra-ai/mastra/commit/c9ce1b28d10871110648f9d7b6d76e880b9fa999), [`3ef01fd`](https://github.com/mastra-ai/mastra/commit/3ef01fd130b53d5bd4f828beb174e516a2eb1158), [`245a9a3`](https://github.com/mastra-ai/mastra/commit/245a9a315705fce17ddd980f78a92504b6615c4a), [`dc0b611`](https://github.com/mastra-ai/mastra/commit/dc0b6119b769bd00ee2c5df9259fb376fe63077a), [`38b5de8`](https://github.com/mastra-ai/mastra/commit/38b5de8e5d1d41a69522addf53d96f4b3a1d5bf0), [`dc0b611`](https://github.com/mastra-ai/mastra/commit/dc0b6119b769bd00ee2c5df9259fb376fe63077a), [`dd6a66e`](https://github.com/mastra-ai/mastra/commit/dd6a66ea0b32e0dea8059aec6b35d151e2c87dc4), [`d785c59`](https://github.com/mastra-ai/mastra/commit/d785c593b67fcb4cdc4fab9fdbde5f3b7665efc0), [`1fa3e12`](https://github.com/mastra-ai/mastra/commit/1fa3e123582b63cfe49de4ee52dc6a065e8d956a), [`8b984f4`](https://github.com/mastra-ai/mastra/commit/8b984f4361c202270ceb69257185c4756c9a7c56), [`bf08402`](https://github.com/mastra-ai/mastra/commit/bf084022374fa5d06ca70ed67a86dd64e379071b), [`81fe587`](https://github.com/mastra-ai/mastra/commit/81fe587275035715c1720ddf3fee0505cf053036), [`1fa3e12`](https://github.com/mastra-ai/mastra/commit/1fa3e123582b63cfe49de4ee52dc6a065e8d956a), [`403c438`](https://github.com/mastra-ai/mastra/commit/403c438e417278989ce247233d2c465b8d902cdd), [`f8ba195`](https://github.com/mastra-ai/mastra/commit/f8ba1954e27ee2b20586cc6cd9cf13c002c232f2)]:
|
|
8
|
+
- @mastra/core@1.43.0
|
|
9
|
+
|
|
3
10
|
## 1.1.46
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.48",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"jsdom": "^26.1.0",
|
|
29
29
|
"local-pkg": "^1.1.2",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@mastra/core": "1.
|
|
31
|
+
"@mastra/core": "1.43.0",
|
|
32
32
|
"@mastra/mcp": "^1.10.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@hono/node-server": "^1.19.11",
|
|
36
36
|
"@types/jsdom": "^21.1.7",
|
|
37
|
-
"@types/node": "22.19.
|
|
38
|
-
"@vitest/coverage-v8": "4.1.
|
|
39
|
-
"@vitest/ui": "4.1.
|
|
37
|
+
"@types/node": "22.19.21",
|
|
38
|
+
"@vitest/coverage-v8": "4.1.8",
|
|
39
|
+
"@vitest/ui": "4.1.8",
|
|
40
40
|
"@wong2/mcp-cli": "^2.0.0",
|
|
41
41
|
"cross-env": "^10.1.0",
|
|
42
42
|
"eslint": "^10.4.1",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"tsup": "^8.5.1",
|
|
45
45
|
"tsx": "^4.22.4",
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
|
-
"vitest": "4.1.
|
|
48
|
-
"@internal/types-builder": "0.0.
|
|
49
|
-
"@internal/lint": "0.0.
|
|
50
|
-
"@mastra/core": "1.
|
|
47
|
+
"vitest": "4.1.8",
|
|
48
|
+
"@internal/types-builder": "0.0.80",
|
|
49
|
+
"@internal/lint": "0.0.105",
|
|
50
|
+
"@mastra/core": "1.43.0"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://mastra.ai",
|
|
53
53
|
"repository": {
|