@mastra/mcp-docs-server 1.2.19-alpha.16 → 1.2.19-alpha.19
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/mastra-platform/api.md +54 -0
- package/.docs/docs/mastra-platform/observability.md +3 -1
- package/.docs/docs/observability/feedback.md +14 -0
- package/.docs/docs/sandbox/overview.md +43 -0
- package/.docs/docs/server/middleware.md +26 -0
- package/.docs/docs/subagents.md +6 -6
- package/.docs/integrations/channels/github.md +56 -9
- package/.docs/integrations/sandboxes/daytona.md +52 -0
- package/.docs/integrations/sandboxes/e2b-desktop.md +128 -0
- package/.docs/integrations/sandboxes/e2b.md +4 -0
- package/.docs/integrations/sandboxes/vercel.md +2 -2
- package/.docs/integrations.md +1 -0
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/gateways/netlify.md +1 -2
- package/.docs/models/gateways/openrouter.md +1 -3
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/agnes.md +7 -6
- package/.docs/models/providers/edenai.md +5 -3
- package/.docs/models/providers/evroc.md +3 -2
- package/.docs/models/providers/hyper.md +3 -3
- package/.docs/models/providers/inceptron.md +1 -1
- package/.docs/models/providers/kilo.md +8 -10
- package/.docs/models/providers/llmgateway-providers.md +4 -3
- package/.docs/models/providers/nano-gpt.md +3 -1
- package/.docs/models/providers/opencode-go.md +2 -2
- package/.docs/models/providers/pendra.md +78 -0
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/cli/mastra.md +10 -4
- package/.docs/reference/client-js/observability.md +1 -1
- package/.docs/reference/observability/feedback.md +4 -0
- package/.docs/reference/workspace/local-sandbox.md +2 -0
- package/.docs/reference/workspace/platform-sandbox.md +3 -1
- package/.docs/reference/workspace/sandbox.md +114 -2
- package/CHANGELOG.md +14 -0
- package/package.json +4 -4
|
@@ -105,6 +105,60 @@ The root URL for the endpoints below is: `/v1/gateway`
|
|
|
105
105
|
| GET | `/projects/:id/memory/threads/:threadId/observations/history` | Observation history (dashboard) |
|
|
106
106
|
| GET | `/models` | List available models |
|
|
107
107
|
|
|
108
|
+
## Observability feedback query API
|
|
109
|
+
|
|
110
|
+
The hosted feedback query API lists and analyzes feedback exported to Mastra Platform Observability. Because the API is unversioned, backwards compatibility isn't guaranteed. Rate limits, retention, and ingestion-to-query freshness aren't published contracts.
|
|
111
|
+
|
|
112
|
+
Use the root URL for your environment's data-residency region:
|
|
113
|
+
|
|
114
|
+
| Region | Root URL |
|
|
115
|
+
| -------------- | ------------------------------------------------------ |
|
|
116
|
+
| United States | `https://observability.mastra.ai/api/observability` |
|
|
117
|
+
| European Union | `https://observability.eu.mastra.ai/api/observability` |
|
|
118
|
+
|
|
119
|
+
Telemetry stays in its residency region. Querying the other region returns no records for the environment. See [Observability co-location](https://mastra.ai/docs/mastra-platform/regions) for the environment-to-region mapping.
|
|
120
|
+
|
|
121
|
+
### Authentication and project scope
|
|
122
|
+
|
|
123
|
+
Every request requires a platform access token. Create one in [Mastra Platform](https://projects.mastra.ai), or use the token written to `.env` during Platform setup.
|
|
124
|
+
|
|
125
|
+
Include `X-Mastra-Project-Id` to limit results to one project. If you omit it, the query covers feedback in every project available to the token's organization.
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
curl -sS "https://observability.mastra.ai/api/observability/feedback?page=0&perPage=20&feedbackType=rating" \
|
|
129
|
+
-H "Authorization: Bearer $MASTRA_PLATFORM_ACCESS_TOKEN" \
|
|
130
|
+
-H "X-Mastra-Project-Id: $MASTRA_PROJECT_ID" | jq
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Use an organization-scoped Platform access token. Gateway inference keys such as `mk_*` keys aren't accepted. Queries remain constrained to the token's organization even when you supply a project ID.
|
|
134
|
+
|
|
135
|
+
### Endpoints
|
|
136
|
+
|
|
137
|
+
| Method | Endpoint | Description |
|
|
138
|
+
| ------ | ----------------------- | ---------------------------- |
|
|
139
|
+
| GET | `/feedback` | List feedback records |
|
|
140
|
+
| POST | `/feedback/aggregate` | Return one aggregate value |
|
|
141
|
+
| POST | `/feedback/breakdown` | Group feedback by dimensions |
|
|
142
|
+
| POST | `/feedback/timeseries` | Bucket feedback by interval |
|
|
143
|
+
| POST | `/feedback/percentiles` | Return percentile series |
|
|
144
|
+
|
|
145
|
+
The list endpoint accepts page-mode parameters such as `page`, `perPage`, `field`, and `direction`, plus feedback filters as query parameters. It also supports delta polling with `mode=delta`, `after`, and `limit`. Responses contain a `feedback` array and page or delta metadata.
|
|
146
|
+
|
|
147
|
+
Analytics endpoints accept the same JSON request shapes and return types as the [feedback reference](https://mastra.ai/reference/observability/feedback). Analytics operate only on numeric feedback values.
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
curl -sS "https://observability.mastra.ai/api/observability/feedback/aggregate" \
|
|
151
|
+
-X POST \
|
|
152
|
+
-H "Authorization: Bearer $MASTRA_PLATFORM_ACCESS_TOKEN" \
|
|
153
|
+
-H "X-Mastra-Project-Id: $MASTRA_PROJECT_ID" \
|
|
154
|
+
-H "Content-Type: application/json" \
|
|
155
|
+
--data '{"feedbackType":"rating","feedbackSource":"user","aggregation":"avg"}' | jq
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The API returns `401` for invalid credentials, `403` for organization authorization failures, and `400` for malformed query arguments or JSON bodies.
|
|
159
|
+
|
|
160
|
+
Hosted observability doesn't provide a feedback creation route. Export feedback from the application as described in [Export feedback to Mastra Platform](https://mastra.ai/docs/observability/feedback).
|
|
161
|
+
|
|
108
162
|
## Gateway proxy endpoints
|
|
109
163
|
|
|
110
164
|
Visit the [Gateway documentation](https://gateway.mastra.ai/docs) for more details.
|
|
@@ -130,7 +130,7 @@ See [Mastra storage exporter](https://mastra.ai/docs/observability/integrations/
|
|
|
130
130
|
|
|
131
131
|
## View observability data
|
|
132
132
|
|
|
133
|
-
Open your project in [Mastra Platform](https://projects.mastra.ai) to inspect exported traces, logs, metrics,
|
|
133
|
+
Open your project in [Mastra Platform](https://projects.mastra.ai) to inspect exported traces, logs, metrics, and scores. A Studio or Server deployment isn't required. Query exported feedback through the hosted feedback API described below.
|
|
134
134
|
|
|
135
135
|
Use a consistent `serviceName` to filter data from a specific application or deployment.
|
|
136
136
|
|
|
@@ -164,6 +164,8 @@ bun x mastra api trace list
|
|
|
164
164
|
|
|
165
165
|
The CLI can infer platform credentials from your project environment. See the [`mastra api` CLI reference](https://mastra.ai/reference/cli/mastra) for available commands, filtering, pagination, credential resolution, and `curl` examples.
|
|
166
166
|
|
|
167
|
+
You can query exported feedback over HTTP. See the [observability feedback query API](https://mastra.ai/docs/mastra-platform/api) for its current status, regional endpoints, authentication, and project scoping.
|
|
168
|
+
|
|
167
169
|
## Next steps
|
|
168
170
|
|
|
169
171
|
- 📹 [Mastra observability and Studio workshop](https://www.youtube.com/watch?v=dKO_a3RPra0)
|
|
@@ -33,6 +33,10 @@ await mastra.observability.addFeedback({
|
|
|
33
33
|
})
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
When you pass only `traceId` and `spanId`, `addFeedback()` rehydrates the target from configured observability storage before emitting the feedback event. Configure [`MastraStorageExporter`](https://mastra.ai/docs/observability/integrations/exporters/mastra-storage) when feedback is added after the traced execution has finished. If the trace isn't available in storage, Mastra logs a warning and drops the feedback event.
|
|
37
|
+
|
|
38
|
+
During a live traced execution, you can pass its `correlationContext` to emit feedback without rehydrating the trace from storage. This path is useful when the active request collects feedback before its tracing context ends.
|
|
39
|
+
|
|
36
40
|
## Find the trace for a message
|
|
37
41
|
|
|
38
42
|
Feedback is usually collected against a message a user has already read, so you need the `traceId` for that message. Assistant messages carry it in `content.metadata`, both in the stream result and when the message is recalled later from memory:
|
|
@@ -143,6 +147,16 @@ const ratingsOverTime = await observability!.getFeedbackTimeSeries({
|
|
|
143
147
|
|
|
144
148
|
See the [feedback reference](https://mastra.ai/reference/observability/feedback) for all fields, filters, return types, and percentile query parameters.
|
|
145
149
|
|
|
150
|
+
The local runtime exposes the list route at `/api/observability/feedback` and analytics under its related paths. See the [HTTP routes table](https://mastra.ai/reference/observability/feedback). Mastra Platform provides a separate, unversioned hosted query API. See the [observability feedback query API](https://mastra.ai/docs/mastra-platform/api) for regional endpoints, authentication, and project scoping.
|
|
151
|
+
|
|
152
|
+
## Export feedback to Mastra Platform
|
|
153
|
+
|
|
154
|
+
[`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) forwards emitted feedback events to Mastra Platform automatically because the hosted query API doesn't provide a creation route.
|
|
155
|
+
|
|
156
|
+
If your application adds feedback after an agent or workflow response using only its `traceId`, configure `MastraStorageExporter` alongside `MastraPlatformExporter`. The storage exporter keeps the trace available for `addFeedback()` to rehydrate, and the Platform exporter forwards the resulting feedback event. Exporting a trace to Platform doesn't make it available to the application's local storage.
|
|
157
|
+
|
|
158
|
+
See [Observability on Mastra Platform](https://mastra.ai/docs/mastra-platform/observability) for the combined exporter configuration.
|
|
159
|
+
|
|
146
160
|
## Export feedback to external platforms
|
|
147
161
|
|
|
148
162
|
Feedback flows through the observability event bus, so exporters that support feedback forward it automatically. The [PostHog exporter](https://mastra.ai/reference/observability/tracing/exporters/posthog) sends feedback as native `$ai_feedback` events that appear on the linked trace in PostHog.
|
|
@@ -73,6 +73,48 @@ Set `{ enabled: false }` on one tool to remove it, or set the top-level `enabled
|
|
|
73
73
|
|
|
74
74
|
See the [sandbox tools reference](https://mastra.ai/reference/workspace/workspace-class) for all generated tools and the [tool configuration reference](https://mastra.ai/reference/workspace/workspace-class) for approvals, output limits, and hooks.
|
|
75
75
|
|
|
76
|
+
### Computer-use tools
|
|
77
|
+
|
|
78
|
+
Sandboxes that run a desktop environment can expose screenshot, mouse, and keyboard control. The workspace registers these tools when a statically configured sandbox supports the computer capability:
|
|
79
|
+
|
|
80
|
+
| Tool | Does |
|
|
81
|
+
| -------------------------- | -------------------------------------------------------------------------------- |
|
|
82
|
+
| `computer_screenshot` | Captures the desktop as a PNG image and returns it to the model as native media. |
|
|
83
|
+
| `computer_click` | Presses and releases the left mouse button at pixel coordinates. |
|
|
84
|
+
| `computer_double_click` | Presses the left mouse button twice at pixel coordinates. |
|
|
85
|
+
| `computer_right_click` | Presses and releases the right mouse button at pixel coordinates. |
|
|
86
|
+
| `computer_move_mouse` | Moves the cursor to pixel coordinates without pressing a button. |
|
|
87
|
+
| `computer_drag` | Presses, drags, and releases between two points. |
|
|
88
|
+
| `computer_type` | Types text into the focused element. |
|
|
89
|
+
| `computer_press_key` | Presses a key or key combination, such as `Enter` or `ctrl+s`. |
|
|
90
|
+
| `computer_scroll` | Scrolls up or down. |
|
|
91
|
+
| `computer_get_screen_info` | Gets the screen dimensions and cursor position. |
|
|
92
|
+
| `computer_wait` | Waits for the interface to settle. |
|
|
93
|
+
|
|
94
|
+
[`DaytonaSandbox`](https://mastra.ai/integrations/sandboxes/daytona) and [`E2BDesktopSandbox`](https://mastra.ai/integrations/sandboxes/e2b-desktop) support this capability. Other sandbox backends don't register the computer tools. Resolver-backed sandboxes don't register them because the workspace can't inspect the resolved sandbox's capabilities when it creates the tool list.
|
|
95
|
+
|
|
96
|
+
Action tools take a screenshot after each action by default. Configure the screenshot behavior for each tool:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { Workspace, WORKSPACE_TOOLS } from '@mastra/core/workspace'
|
|
100
|
+
import { E2BDesktopSandbox } from '@mastra/e2b-desktop'
|
|
101
|
+
|
|
102
|
+
const workspace = new Workspace({
|
|
103
|
+
sandbox: new E2BDesktopSandbox(),
|
|
104
|
+
tools: {
|
|
105
|
+
[WORKSPACE_TOOLS.COMPUTER.CLICK]: {
|
|
106
|
+
screenshotAfterAction: true,
|
|
107
|
+
screenshotDelayMs: 1000,
|
|
108
|
+
},
|
|
109
|
+
[WORKSPACE_TOOLS.COMPUTER.TYPE]: {
|
|
110
|
+
requireApproval: true,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Computer tools accept the same per-tool `enabled` and `requireApproval` configuration as other workspace tools.
|
|
117
|
+
|
|
76
118
|
Authored runtime functions, including tools and workflow steps, can get the live sandbox from their execution context. Use it to execute commands, install dependencies, process files, or spawn a long-running process.
|
|
77
119
|
|
|
78
120
|
```typescript
|
|
@@ -136,6 +178,7 @@ Use a remote or container sandbox when commands need a stronger boundary from th
|
|
|
136
178
|
- [Daytona](https://mastra.ai/integrations/sandboxes/daytona)
|
|
137
179
|
- [Docker](https://mastra.ai/integrations/sandboxes/docker)
|
|
138
180
|
- [E2B](https://mastra.ai/integrations/sandboxes/e2b)
|
|
181
|
+
- [E2B Desktop](https://mastra.ai/integrations/sandboxes/e2b-desktop)
|
|
139
182
|
- [Mastra](https://mastra.ai/reference/workspace/platform-sandbox)
|
|
140
183
|
- [Modal](https://mastra.ai/integrations/sandboxes/modal)
|
|
141
184
|
- [Railway](https://mastra.ai/integrations/sandboxes/railway)
|
|
@@ -58,6 +58,32 @@ registerApiRoute('/my-custom-route', {
|
|
|
58
58
|
|
|
59
59
|
## Common examples
|
|
60
60
|
|
|
61
|
+
### Block built-in route groups
|
|
62
|
+
|
|
63
|
+
Mastra doesn't provide a configuration option to remove or allowlist built-in routes. On Hono-based serving paths, you can make selected route groups unavailable by returning a response without calling `next()`:
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { Mastra } from '@mastra/core'
|
|
67
|
+
|
|
68
|
+
const notFound = async () => new Response('Not Found', { status: 404 })
|
|
69
|
+
|
|
70
|
+
export const mastra = new Mastra({
|
|
71
|
+
server: {
|
|
72
|
+
middleware: [
|
|
73
|
+
{ path: '/api/memory/*', handler: notFound },
|
|
74
|
+
{ path: '/api/logs/*', handler: notFound },
|
|
75
|
+
{ path: '/api/observability/*', handler: notFound },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Each wildcard pattern blocks both the route group itself and its nested routes. For example, `/api/logs/*` blocks `/api/logs` and `/api/logs/transports`. Other route groups remain available.
|
|
82
|
+
|
|
83
|
+
Generated servers pass `server.apiPrefix` to the Hono adapter's [`prefix` constructor option](https://mastra.ai/reference/server/hono-adapter), which prefixes built-in routes. Middleware paths are registered unchanged, so they must explicitly include the configured prefix. For example, with `apiPrefix: '/api/v2'`, use `/api/v2/memory/*`. Custom API routes must live outside the configured API prefix and aren't blocked by these patterns.
|
|
84
|
+
|
|
85
|
+
This approach can't block routes declared public with `requiresAuth: false`, because Mastra skips user middleware for those routes. With a non-Hono server adapter, register equivalent middleware through the server framework instead.
|
|
86
|
+
|
|
61
87
|
### Using `RequestContext`
|
|
62
88
|
|
|
63
89
|
You can populate `RequestContext` in a runtime server middleware by extracting information from the request. In this example, the `temperature-unit` is set based on the Cloudflare `CF-IPCountry` header to ensure responses match the user's locale.
|
package/.docs/docs/subagents.md
CHANGED
|
@@ -159,12 +159,12 @@ const stream = await parentAgent.stream('Research AI trends', {
|
|
|
159
159
|
|
|
160
160
|
The `context` object includes:
|
|
161
161
|
|
|
162
|
-
| Property | Description
|
|
163
|
-
| ------------- |
|
|
164
|
-
| `primitiveId` | The ID of the subagent that ran
|
|
165
|
-
| `result` | The subagent's response
|
|
166
|
-
| `error` | Error if the delegation failed
|
|
167
|
-
| `bail()` | Function to stop the parent agent's loop
|
|
162
|
+
| Property | Description |
|
|
163
|
+
| ------------- | --------------------------------------------------------------------------------------------- |
|
|
164
|
+
| `primitiveId` | The ID of the subagent that ran |
|
|
165
|
+
| `result` | The subagent's response, including `text`, `usage`, `finishReason`, and `subAgentToolResults` |
|
|
166
|
+
| `error` | Error if the delegation failed |
|
|
167
|
+
| `bail()` | Function to stop the parent agent's loop |
|
|
168
168
|
|
|
169
169
|
### Hook errors
|
|
170
170
|
|
|
@@ -74,7 +74,7 @@ export const mastra = new Mastra({
|
|
|
74
74
|
})
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
After the agent has created a memory thread, subscribe that thread to a PR.
|
|
77
|
+
After the agent has created a memory thread, subscribe that thread to a PR. Choose `review` mode when the thread only needs code revisions, authorized latest PR comments, and observable review-thread-state updates:
|
|
78
78
|
|
|
79
79
|
```typescript
|
|
80
80
|
await githubSignals.subscribeThreadToPR({
|
|
@@ -85,19 +85,66 @@ await githubSignals.subscribeThreadToPR({
|
|
|
85
85
|
repo: 'web-app',
|
|
86
86
|
number: 42,
|
|
87
87
|
},
|
|
88
|
+
mode: 'review',
|
|
88
89
|
})
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
The provider syncs the PR immediately, stores the subscription, and starts polling every five minutes. Set `pollIntervalMs` in the `GithubSignals` constructor to change the interval. If the process restarts, call `startPollingForThread()` for each persisted thread subscription to resume polling.
|
|
92
93
|
|
|
93
|
-
|
|
94
|
+
A thread has one current GitHub Signals subscription. Subscribing it to another PR replaces the existing subscription.
|
|
94
95
|
|
|
95
|
-
|
|
96
|
+
## Subscription modes
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
- A change in unresolved review threads.
|
|
99
|
-
- Continuous integration (CI) checks that start, fail, or recover.
|
|
100
|
-
- Merge conflicts that appear or are resolved.
|
|
101
|
-
- A state change to closed, reopened, or merged.
|
|
98
|
+
GitHub Signals supports two subscription modes:
|
|
102
99
|
|
|
103
|
-
|
|
100
|
+
- `review`: Follows new head revisions, authorized latest PR comments, and observable review-thread-state changes, including when all review threads become resolved.
|
|
101
|
+
- `working`: Follows all actionable PR activity detected by the provider. Comment-bearing notifications remain subject to existing authorization gates. This is the default when `mode` is omitted and for stored subscriptions without a valid mode.
|
|
102
|
+
|
|
103
|
+
The following table shows the observable behavior of each mode:
|
|
104
|
+
|
|
105
|
+
| Pull request activity | `working` | `review` |
|
|
106
|
+
| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
107
|
+
| First observation | Sends a baseline notification | Saves all cursors without notifying unless the PR is closed or merged; then notifies and removes the subscription |
|
|
108
|
+
| New commit or force-push | Notifies when the latest comment author is authorized | Notifies without requiring a comment author |
|
|
109
|
+
| New authorized latest PR comment | Notifies | Notifies |
|
|
110
|
+
| Observable review-thread-state change | Notifies while unresolved threads remain | Notifies, including when all review threads become resolved |
|
|
111
|
+
| Continuous integration checks start, fail, or recover | Notifies | Saves the new state without notifying |
|
|
112
|
+
| Merge conflicts appear or resolve | Notifies | Saves the new state without notifying |
|
|
113
|
+
| Other actionable aggregate PR activity | Notifies when applicable authorization checks pass | Saves the new state without notifying |
|
|
114
|
+
| PR closes without merging | Notifies and keeps the subscription | Notifies and removes the subscription |
|
|
115
|
+
| PR reopens | Notifies | Doesn't notify because the earlier close removed the subscription |
|
|
116
|
+
| PR merges | Notifies and removes the subscription | Notifies and removes the subscription |
|
|
117
|
+
|
|
118
|
+
Review mode uses the latest generic PR comment exposed by `gitcrawl`. The snapshot doesn't distinguish general PR conversation from inline review comments. Comment notifications require an authorized author because they include comment content. Review-state notifications contain only provider-generated state summaries and aren't author-gated.
|
|
119
|
+
|
|
120
|
+
The review-state cursor includes the unresolved thread count and the latest unresolved thread timestamp. It reports when the count reaches zero, but it can't report replies on threads that are already resolved.
|
|
121
|
+
|
|
122
|
+
During subscription, a PR already known to be closed or merged isn't stored and doesn't send an activity notification. Otherwise, review mode silently saves its first available non-terminal snapshot, including when the subscribe-time snapshot fails and a later poll supplies the first observation. If the first available poll snapshot or a later snapshot is closed or merged, the provider sends a terminal notification and removes the subscription. It doesn't follow a later reopen unless you subscribe again.
|
|
123
|
+
|
|
124
|
+
## Subscription tools
|
|
125
|
+
|
|
126
|
+
The provider adds `github_subscribe_pr` and `github_unsubscribe_pr` tools to the agent. Pass `mode` when subscribing:
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"owner": "acme",
|
|
131
|
+
"repo": "web-app",
|
|
132
|
+
"number": 42,
|
|
133
|
+
"mode": "review"
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Omitting `mode` selects `working`. Don't subscribe for a one-off PR inspection.
|
|
138
|
+
|
|
139
|
+
## MastraCode commands
|
|
140
|
+
|
|
141
|
+
In MastraCode, use the spaced `--mode` flag with a PR number, `owner/repo#number`, or full GitHub PR URL:
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
/github subscribe 42 --mode review
|
|
145
|
+
/github acme/web-app#42 --mode working
|
|
146
|
+
/github unsubscribe 42
|
|
147
|
+
/github debug
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
MastraCode rejects `--mode=review`, missing or repeated mode values, unknown modes, and mode flags on unsubscribe. `/github debug` shows the stored mode and displays absent or invalid legacy values as `working`.
|
|
@@ -282,6 +282,52 @@ await sandbox.instance.updateNetworkSettings({
|
|
|
282
282
|
})
|
|
283
283
|
```
|
|
284
284
|
|
|
285
|
+
### Secrets
|
|
286
|
+
|
|
287
|
+
Inject credentials without exposing raw values to code running inside the sandbox. Create a [Daytona Secret](https://www.daytona.io/docs/en/secrets/) once for your organization (via the Daytona dashboard or SDK), then map environment variable names to Secret names:
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
const workspace = new Workspace({
|
|
291
|
+
sandbox: new DaytonaSandbox({
|
|
292
|
+
secrets: {
|
|
293
|
+
GITHUB_TOKEN: 'github-token',
|
|
294
|
+
},
|
|
295
|
+
}),
|
|
296
|
+
})
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Inside the sandbox, the environment variable holds an opaque placeholder. Daytona's egress proxy substitutes the real value into HTTPS request headers toward the Secret's allowed hosts, so the raw credential never enters the sandbox. Secrets are applied at sandbox creation and are preserved by `clone()`.
|
|
300
|
+
|
|
301
|
+
### Computer use (desktop)
|
|
302
|
+
|
|
303
|
+
`DaytonaSandbox` exposes the [computer capability](https://mastra.ai/docs/sandbox/overview): screenshot, mouse, and keyboard control of a desktop environment inside the sandbox. When the sandbox is used in a workspace, agents automatically get the `mastra_workspace_computer_*` tools.
|
|
304
|
+
|
|
305
|
+
The desktop processes (Xvfb, xfce4, x11vnc, noVNC) are started lazily on the first computer operation:
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
const sandbox = new DaytonaSandbox()
|
|
309
|
+
await sandbox.start()
|
|
310
|
+
|
|
311
|
+
await sandbox.computer.leftClick(100, 200)
|
|
312
|
+
await sandbox.computer.type('hello')
|
|
313
|
+
const { data } = await sandbox.computer.screenshot() // PNG bytes
|
|
314
|
+
|
|
315
|
+
// Live desktop view via the noVNC preview link
|
|
316
|
+
const url = await sandbox.computer.streamUrl()
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Disable the capability, or manage the desktop processes yourself, with the `computerUse` option:
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
// No computer capability, no computer tools
|
|
323
|
+
new DaytonaSandbox({ computerUse: false })
|
|
324
|
+
|
|
325
|
+
// Capability stays on, but you call sandbox.daytona.computerUse.start() yourself
|
|
326
|
+
new DaytonaSandbox({ computerUse: { autoStart: false } })
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
For Daytona-specific desktop APIs (regions, compressed screenshots, screen recording, accessibility tree), use the [direct SDK access](#direct-sdk-access) escape hatch: `sandbox.daytona.computerUse`.
|
|
330
|
+
|
|
285
331
|
## Constructor parameters
|
|
286
332
|
|
|
287
333
|
**id** (`string`): Unique identifier for this sandbox instance. (Default: `Auto-generated`)
|
|
@@ -328,6 +374,10 @@ await sandbox.instance.updateNetworkSettings({
|
|
|
328
374
|
|
|
329
375
|
**domainAllowList** (`string`): Comma-separated list of allowed domains when network access is restricted. Supports wildcards, for example \*.githubusercontent.com. Use this instead of networkAllowList for services whose IP addresses change.
|
|
330
376
|
|
|
377
|
+
**secrets** (`Record<string, string>`): Daytona Secrets to expose inside the sandbox, mapping environment variable names to Daytona Secret names. The env var holds an opaque placeholder; the real value is substituted into HTTPS request headers at egress toward the Secret's allowed hosts.
|
|
378
|
+
|
|
379
|
+
**computerUse** (`boolean | { autoStart?: boolean; noVncPort?: number }`): Computer-use (desktop) capability configuration. Set to false to disable the capability. Set autoStart to false to manage the desktop processes yourself. noVncPort sets the noVNC viewer port used by computer.streamUrl(). (Default: `true`)
|
|
380
|
+
|
|
331
381
|
## Properties
|
|
332
382
|
|
|
333
383
|
**id** (`string`): Sandbox instance identifier.
|
|
@@ -342,6 +392,8 @@ await sandbox.instance.updateNetworkSettings({
|
|
|
342
392
|
|
|
343
393
|
**processes** (`DaytonaProcessManager`): Background process manager. See SandboxProcessManager reference.
|
|
344
394
|
|
|
395
|
+
**computer** (`SandboxComputer | undefined`): Computer-use capability: screenshot, mouse, keyboard, and stream URL. Undefined when constructed with computerUse: false. See SandboxComputer reference.
|
|
396
|
+
|
|
345
397
|
## Background processes
|
|
346
398
|
|
|
347
399
|
`DaytonaSandbox` includes a built-in process manager for spawning and managing background processes. Processes run in the Daytona cloud sandbox using session-based command execution.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# E2B Desktop
|
|
4
|
+
|
|
5
|
+
Runs a full Linux desktop environment in an isolated [E2B](https://e2b.dev) cloud sandbox with screenshot, mouse, and keyboard control. `E2BDesktopSandbox` extends [`E2BSandbox`](https://mastra.ai/integrations/sandboxes/e2b), so everything the base provider supports (command execution, background processes, file upload, pause/resume reconnection) works against the same desktop machine. For interface details, see [WorkspaceSandbox interface](https://mastra.ai/reference/workspace/sandbox).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
**npm**:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @mastra/e2b-desktop
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**pnpm**:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @mastra/e2b-desktop
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Yarn**:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @mastra/e2b-desktop
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Bun**:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
bun add @mastra/e2b-desktop
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Set your E2B API key with the `E2B_API_KEY` environment variable or the `apiKey` option.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
Add an `E2BDesktopSandbox` to a workspace and assign it to an agent. Because the sandbox supports the [computer capability](https://mastra.ai/docs/sandbox/overview), the workspace registers the `mastra_workspace_computer_*` tools alongside the shell and process tools:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { Agent } from '@mastra/core/agent'
|
|
41
|
+
import { Workspace } from '@mastra/core/workspace'
|
|
42
|
+
import { E2BDesktopSandbox } from '@mastra/e2b-desktop'
|
|
43
|
+
|
|
44
|
+
const workspace = new Workspace({
|
|
45
|
+
sandbox: new E2BDesktopSandbox({
|
|
46
|
+
resolution: [1280, 720],
|
|
47
|
+
}),
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const agent = new Agent({
|
|
51
|
+
id: 'desktop-agent',
|
|
52
|
+
name: 'Desktop Agent',
|
|
53
|
+
instructions: 'You can control a Linux desktop and run shell commands.',
|
|
54
|
+
model: 'anthropic/claude-sonnet-4-6',
|
|
55
|
+
workspace,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const response = await agent.generate(
|
|
59
|
+
'Take a screenshot, then create /tmp/hello.txt with the text "hello" and cat it.',
|
|
60
|
+
)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The agent can mix desktop actions (click, type, screenshot) with shell commands. Both surfaces operate on the same machine.
|
|
64
|
+
|
|
65
|
+
### Direct desktop control
|
|
66
|
+
|
|
67
|
+
Use the `computer` capability programmatically without an agent:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
const sandbox = new E2BDesktopSandbox()
|
|
71
|
+
await sandbox.start()
|
|
72
|
+
|
|
73
|
+
await sandbox.computer.leftClick(100, 200)
|
|
74
|
+
await sandbox.computer.type('hello')
|
|
75
|
+
const { data } = await sandbox.computer.screenshot() // PNG bytes
|
|
76
|
+
|
|
77
|
+
const size = await sandbox.computer.getScreenSize()
|
|
78
|
+
console.log(size) // { width: 1024, height: 768 }
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Live desktop view
|
|
82
|
+
|
|
83
|
+
`streamUrl()` starts an authenticated noVNC stream inside the sandbox and returns a viewer URL. Open it in a browser to watch the agent work:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
const url = await sandbox.computer.streamUrl()
|
|
87
|
+
// https://6080-<sandbox-id>.e2b.app/vnc.html?...&password=<auth-key>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Desktop SDK escape hatch
|
|
91
|
+
|
|
92
|
+
Desktop-only APIs such as `launch`, `open`, window helpers, and custom stream control are available on the underlying [`@e2b/desktop`](https://github.com/e2b-dev/desktop) sandbox:
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
await sandbox.desktop.launch('xfce4-terminal')
|
|
96
|
+
await sandbox.desktop.open('https://mastra.ai')
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Constructor parameters
|
|
100
|
+
|
|
101
|
+
Accepts all [`E2BSandbox` options](https://mastra.ai/integrations/sandboxes/e2b) plus:
|
|
102
|
+
|
|
103
|
+
**resolution** (`[number, number]`): Desktop display resolution as \[width, height] in pixels. Applies to newly created sandboxes only.
|
|
104
|
+
|
|
105
|
+
**dpi** (`number`): Desktop display DPI. Applies to newly created sandboxes only.
|
|
106
|
+
|
|
107
|
+
When no `template` is provided, the E2B-hosted `desktop` template is used instead of the base provider's mountable template.
|
|
108
|
+
|
|
109
|
+
## Properties
|
|
110
|
+
|
|
111
|
+
**computer** (`SandboxComputer`): Computer-use capability: screenshot, mouse, keyboard, and stream URL. See SandboxComputer reference.
|
|
112
|
+
|
|
113
|
+
**desktop** (`Sandbox`): The underlying @e2b/desktop SDK sandbox for desktop-only APIs. Throws if the sandbox has not started.
|
|
114
|
+
|
|
115
|
+
**name** (`string`): Provider name ('E2BDesktopSandbox')
|
|
116
|
+
|
|
117
|
+
**provider** (`string`): Provider identifier ('e2b-desktop')
|
|
118
|
+
|
|
119
|
+
## Cloud storage mounting
|
|
120
|
+
|
|
121
|
+
The default `desktop` template has no FUSE tooling, so [cloud storage mounting](https://mastra.ai/integrations/sandboxes/e2b) requires a custom desktop template with `s3fs` or `gcsfuse` installed. Pass it with the `template` option.
|
|
122
|
+
|
|
123
|
+
## Related
|
|
124
|
+
|
|
125
|
+
- [Computer-use tools](https://mastra.ai/docs/sandbox/overview)
|
|
126
|
+
- [`E2BSandbox` reference](https://mastra.ai/integrations/sandboxes/e2b)
|
|
127
|
+
- [`WorkspaceSandbox` interface](https://mastra.ai/reference/workspace/sandbox)
|
|
128
|
+
- [Sandbox](https://mastra.ai/docs/sandbox/overview)
|
|
@@ -68,6 +68,8 @@ const agent = new Agent({
|
|
|
68
68
|
|
|
69
69
|
**id** (`string`): Unique identifier for this sandbox instance (Default: `Auto-generated`)
|
|
70
70
|
|
|
71
|
+
**sandboxId** (`string`): Persisted E2B provider sandbox ID to reattach to deterministically. When set, start() connects to this exact sandbox (resuming it if paused) instead of discovering by logical id metadata. Only a typed "sandbox gone" error (not found, killed, or not running) falls through to the usual logical-id lookup and create ladder; auth, quota, rate-limit, timeout, and network errors propagate without creating a new sandbox. A sandbox tagged with a different logical id is refused. Read the resolved provider ID from the sandboxId property after start.
|
|
72
|
+
|
|
71
73
|
**domain** (`string`): Domain for self-hosted E2B. Falls back to E2B\_DOMAIN env var.
|
|
72
74
|
|
|
73
75
|
**apiUrl** (`string`): API URL for self-hosted E2B. Falls back to E2B\_API\_URL env var.
|
|
@@ -88,6 +90,8 @@ const agent = new Agent({
|
|
|
88
90
|
|
|
89
91
|
**status** (`ProviderStatus`): 'pending' | 'initializing' | 'ready' | 'starting' | 'running' | 'stopping' | 'stopped' | 'destroying' | 'destroyed' | 'error'
|
|
90
92
|
|
|
93
|
+
**sandboxId** (`string | undefined`): The E2B provider sandbox ID resolved after connect or create. Persist it and pass it back via the sandboxId constructor option (or clone({ sandboxId })) to reattach deterministically. Undefined until the sandbox has been started in this process.
|
|
94
|
+
|
|
91
95
|
**processes** (`E2BProcessManager`): Background process manager. See SandboxProcessManager reference.
|
|
92
96
|
|
|
93
97
|
## Background processes
|
|
@@ -158,7 +158,7 @@ Both callbacks are optional and can be used independently.
|
|
|
158
158
|
|
|
159
159
|
**instructions** (`string | ((opts) => string)`): Override the default instructions returned by getInstructions(). Pass a string to replace them, or a function to extend the defaults.
|
|
160
160
|
|
|
161
|
-
**onStart** (`
|
|
161
|
+
**onStart** (`SandboxStartHook`): Lifecycle hook called after the sandbox reaches running status.
|
|
162
162
|
|
|
163
163
|
**onStop** (`SandboxLifecycleHook`): Lifecycle hook called before the sandbox stops.
|
|
164
164
|
|
|
@@ -303,7 +303,7 @@ const workspace = new Workspace({
|
|
|
303
303
|
|
|
304
304
|
**instructions** (`string | ((opts) => string)`): Custom instructions that override the default instructions returned by getInstructions(). Pass a string to fully replace, or a function to extend the defaults.
|
|
305
305
|
|
|
306
|
-
**onStart** (`
|
|
306
|
+
**onStart** (`SandboxStartHook`): Lifecycle hook called after the sandbox reaches running status.
|
|
307
307
|
|
|
308
308
|
**onStop** (`SandboxLifecycleHook`): Lifecycle hook called before the sandbox stops.
|
|
309
309
|
|
package/.docs/integrations.md
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
- [Daytona](https://mastra.ai/integrations/sandboxes/daytona)
|
|
41
41
|
- [Docker](https://mastra.ai/integrations/sandboxes/docker)
|
|
42
42
|
- [E2B](https://mastra.ai/integrations/sandboxes/e2b)
|
|
43
|
+
- [E2B Desktop](https://mastra.ai/integrations/sandboxes/e2b-desktop)
|
|
43
44
|
- [Mastra](https://mastra.ai/reference/workspace/platform-sandbox)
|
|
44
45
|
- [Modal](https://mastra.ai/integrations/sandboxes/modal)
|
|
45
46
|
- [Railway](https://mastra.ai/integrations/sandboxes/railway)
|
|
@@ -126,6 +126,7 @@ List of required environment variables for each model provider and gateway suppo
|
|
|
126
126
|
| [Opper](https://mastra.ai/models/providers/opper) | `opper/*` | `OPPER_API_KEY` |
|
|
127
127
|
| [OrcaRouter](https://mastra.ai/models/providers/orcarouter) | `orcarouter/*` | `ORCAROUTER_API_KEY` |
|
|
128
128
|
| [OVHcloud AI Endpoints](https://mastra.ai/models/providers/ovhcloud) | `ovhcloud/*` | `OVHCLOUD_API_KEY` |
|
|
129
|
+
| [Pendra](https://mastra.ai/models/providers/pendra) | `pendra/*` | `PENDRA_API_KEY` |
|
|
129
130
|
| [Perplexity](https://mastra.ai/models/providers/perplexity) | `perplexity/*` | `PERPLEXITY_API_KEY` |
|
|
130
131
|
| [Perplexity Agent](https://mastra.ai/models/providers/perplexity-agent) | `perplexity-agent/*` | `PERPLEXITY_API_KEY` |
|
|
131
132
|
| [Pioneer](https://mastra.ai/models/providers/pioneer) | `pioneer/*` | `PIONEER_API_KEY` |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Netlify
|
|
4
4
|
|
|
5
|
-
Netlify AI Gateway provides unified access to multiple providers with built-in caching and observability. Access
|
|
5
|
+
Netlify AI Gateway provides unified access to multiple providers with built-in caching and observability. Access 233 models through Mastra's model router.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Netlify documentation](https://docs.netlify.com/build/ai-gateway/overview/).
|
|
8
8
|
|
|
@@ -137,7 +137,6 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
137
137
|
| `openrouter/google/gemma-3-12b-it` |
|
|
138
138
|
| `openrouter/google/gemma-3-27b-it` |
|
|
139
139
|
| `openrouter/google/gemma-3-4b-it` |
|
|
140
|
-
| `openrouter/google/gemma-3n-e4b-it` |
|
|
141
140
|
| `openrouter/google/gemma-4-26b-a4b-it` |
|
|
142
141
|
| `openrouter/google/gemma-4-31b-it` |
|
|
143
142
|
| `openrouter/gryphe/mythomax-l2-13b` |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# OpenRouter
|
|
4
4
|
|
|
5
|
-
OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access
|
|
5
|
+
OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 355 models through Mastra's model router.
|
|
6
6
|
|
|
7
7
|
Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
|
|
8
8
|
|
|
@@ -131,7 +131,6 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
131
131
|
| `google/gemma-3-12b-it` |
|
|
132
132
|
| `google/gemma-3-27b-it` |
|
|
133
133
|
| `google/gemma-3-4b-it` |
|
|
134
|
-
| `google/gemma-3n-e4b-it` |
|
|
135
134
|
| `google/gemma-4-26b-a4b-it` |
|
|
136
135
|
| `google/gemma-4-26b-a4b-it:free` |
|
|
137
136
|
| `google/gemma-4-31b-it` |
|
|
@@ -295,7 +294,6 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
295
294
|
| `qwen/qwen-2.5-coder-32b-instruct` |
|
|
296
295
|
| `qwen/qwen-plus` |
|
|
297
296
|
| `qwen/qwen-plus-2025-07-28` |
|
|
298
|
-
| `qwen/qwen-plus-2025-07-28:thinking` |
|
|
299
297
|
| `qwen/qwen2.5-vl-72b-instruct` |
|
|
300
298
|
| `qwen/qwen3-14b` |
|
|
301
299
|
| `qwen/qwen3-235b-a22b` |
|
package/.docs/models/index.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Model Providers
|
|
4
4
|
|
|
5
|
-
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to
|
|
5
|
+
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 6846 models from 187 providers through a single API.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|