@mastra/mcp-docs-server 1.3.6-alpha.5 → 1.3.6-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agents/processors.md +6 -5
- package/.docs/docs/browser.md +0 -2
- package/.docs/docs/guides/authentication-identity.md +1 -1
- package/.docs/docs/harness/agent-controller.md +29 -0
- package/.docs/docs/memory/message-history.md +15 -8
- package/.docs/docs/memory/observational-memory.md +33 -4
- package/.docs/integrations/sandboxes/docker.md +61 -0
- package/.docs/integrations/sandboxes/e2b.md +37 -0
- package/.docs/models/gateways/netlify.md +3 -5
- package/.docs/models/gateways/openrouter.md +2 -2
- package/.docs/models/gateways/vercel.md +2 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/cortecs.md +3 -2
- package/.docs/models/providers/deepinfra.md +0 -2
- package/.docs/models/providers/edenai.md +7 -6
- package/.docs/models/providers/hyper.md +4 -6
- package/.docs/models/providers/kilo.md +15 -15
- package/.docs/models/providers/mistral.md +1 -1
- package/.docs/models/providers/nano-gpt.md +3 -1
- package/.docs/models/providers/neuralwatt.md +3 -1
- package/.docs/models/providers/opencode-go.md +3 -2
- package/.docs/models/providers/opencode.md +2 -2
- package/.docs/models/providers/requesty.md +2 -1
- package/.docs/reference/agent-controller/agent-controller-class.md +15 -1
- package/.docs/reference/agent-controller/session.md +17 -6
- package/.docs/reference/agents/inngest-agent.md +1 -1
- package/.docs/reference/coding-agent/create-coding-agent.md +2 -2
- package/.docs/reference/index.md +2 -0
- package/.docs/reference/memory/observational-memory.md +8 -4
- package/.docs/reference/processors/file-upload-processor.md +236 -0
- package/.docs/reference/processors/processor-interface.md +2 -0
- package/.docs/reference/processors/stream-error-retry-processor.md +1 -1
- package/.docs/reference/processors/unsupported-file-handler.md +69 -0
- package/.docs/reference/tools/isolated-vm-transport.md +0 -2
- package/.docs/reference/tools/quickjs-transport.md +0 -2
- package/.docs/reference/workspace/platform-sandbox.md +36 -2
- package/package.json +3 -3
|
@@ -116,13 +116,14 @@ const agent = new Agent({
|
|
|
116
116
|
|
|
117
117
|
### Error processors are enabled by default
|
|
118
118
|
|
|
119
|
-
Every agent adds whichever of these
|
|
119
|
+
Every agent adds whichever of these four your `errorProcessors` list doesn't already contain:
|
|
120
120
|
|
|
121
121
|
1. `ProviderHistoryCompat`: repairs provider-specific history incompatibilities in the outbound prompt
|
|
122
122
|
2. `PrefillErrorHandler`: recovers from assistant-response prefill rejections
|
|
123
|
-
3. `
|
|
123
|
+
3. [`UnsupportedFileHandler`](https://mastra.ai/reference/processors/unsupported-file-handler): takes a file the model rejects out of the prompt, uploads it to the agent's sandbox when there is one, and calls the model again
|
|
124
|
+
4. `StreamErrorRetryProcessor`: retries transient API and stream failures
|
|
124
125
|
|
|
125
|
-
A default is only added when nothing in your list carries its `id`, so your own instance always wins and is never duplicated. An added default is placed at the position its `id` gives it among the defaults, so naming only a later one doesn't invert the pair. Supplying only your own `StreamErrorRetryProcessor` still resolves with `ProviderHistoryCompat` and `
|
|
126
|
+
A default is only added when nothing in your list carries its `id`, so your own instance always wins and is never duplicated. An added default is placed at the position its `id` gives it among the defaults, so naming only a later one doesn't invert the pair. Supplying only your own `StreamErrorRetryProcessor` still resolves with `ProviderHistoryCompat`, `PrefillErrorHandler`, and `UnsupportedFileHandler` ahead of it.
|
|
126
127
|
|
|
127
128
|
Error processors stop at the first one that returns `{ retry: true }`, so that relative order decides which repair runs. The default order puts the repairs ahead of the retrying processor. Placed earlier, an instance with broad matchers (the bad-request matcher matches any `400`, for example) would claim a request the repairs could have fixed and resend it unchanged. The default instance retries only transient failures: connection resets, retryable OpenAI stream errors, and errors the provider marks as retryable. Your own instance can be configured with broader matchers. The order keeps repairs ahead of it too.
|
|
128
129
|
|
|
@@ -144,11 +145,11 @@ const agent = new Agent({
|
|
|
144
145
|
})
|
|
145
146
|
```
|
|
146
147
|
|
|
147
|
-
The `StreamErrorRetryProcessor` above is the only stream-retry processor on the agent, and it resolves in its usual position: last, behind the `ProviderHistoryCompat` and `
|
|
148
|
+
The `StreamErrorRetryProcessor` above is the only stream-retry processor on the agent, and it resolves in its usual position: last, behind the `ProviderHistoryCompat`, `PrefillErrorHandler`, and `UnsupportedFileHandler` defaults your list never names. Pass all four ids to run a completely custom set.
|
|
148
149
|
|
|
149
150
|
A processor's `maxRetries` can't raise the agent's limit. Without `maxProcessorRetries`, error-processor retries stop after `3` (see [Error processor retry limits](#error-processor-retry-limits)), so set it when a processor needs more.
|
|
150
151
|
|
|
151
|
-
An empty `errorProcessors` list merges like any other, so it still gets the
|
|
152
|
+
An empty `errorProcessors` list merges like any other, so it still gets the four defaults. To turn the defaults off, set `errorProcessorDefaults: false`. The agent then runs only the processors you configure, or none when you configure none:
|
|
152
153
|
|
|
153
154
|
```typescript
|
|
154
155
|
new Agent({
|
package/.docs/docs/browser.md
CHANGED
|
@@ -178,8 +178,6 @@ const browser = new AgentBrowser({
|
|
|
178
178
|
|
|
179
179
|
## Record browser sessions
|
|
180
180
|
|
|
181
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
182
|
-
|
|
183
181
|
AgentBrowser and StagehandBrowser can opt into recording for reviewing, sharing, or debugging browser runs. Configure `outputDir` to add the recording tools:
|
|
184
182
|
|
|
185
183
|
```typescript
|
|
@@ -215,7 +215,7 @@ This example uses the default bridge. Mastra first preserves any `req.auth` valu
|
|
|
215
215
|
|
|
216
216
|
Return only the data the model needs. Remove credentials and sensitive upstream fields before returning a tool result.
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
Reserved Mastra keys (those starting with `mastra__` or `__mastra_`, including `MASTRA_AUTH_TOKEN_KEY`) are omitted when request context is attached to tracing spans or saved on score records. Application logs and custom telemetry must apply the same principle to other credentials and sensitive identity fields.
|
|
219
219
|
|
|
220
220
|
## Add authorization after authentication
|
|
221
221
|
|
|
@@ -201,6 +201,35 @@ await session.model.switch('anthropic/claude-sonnet-4-6')
|
|
|
201
201
|
console.log(session.model.get())
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
+
### Select Observational Memory models
|
|
205
|
+
|
|
206
|
+
Observer and reflector model choices are independent. Each role can use an explicit model or an automatic selection that the host resolves from the active main model and session state.
|
|
207
|
+
|
|
208
|
+
Configure automatic selection with a synchronous resolver that returns a concrete model ID:
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
const controller = new AgentController({
|
|
212
|
+
// ...
|
|
213
|
+
omConfig: {
|
|
214
|
+
observerModel: 'auto',
|
|
215
|
+
reflectorModel: 'auto',
|
|
216
|
+
defaultObserverModelId: 'openai/gpt-5-mini',
|
|
217
|
+
defaultReflectorModelId: 'openai/gpt-5-mini',
|
|
218
|
+
resolveAutoModelId: ({ currentModelId }) => currentModelId,
|
|
219
|
+
},
|
|
220
|
+
})
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
`session.om.observer.model()` returns `'auto'` or a concrete model ID. `session.om.observer.modelId()` returns the effective concrete model. A host can therefore change the main model without rewriting automatic role settings.
|
|
224
|
+
|
|
225
|
+
Reset one role to automatic selection without changing the other:
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
await session.om.observer.switchModel({ modelId: 'auto' })
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
If the resolver returns `undefined` or throws, the role uses its concrete `defaultObserverModelId` or `defaultReflectorModelId` fallback. See the [`Session` Observational Memory API](https://mastra.ai/reference/agent-controller/session) for explicit selection.
|
|
232
|
+
|
|
204
233
|
## Manage threads and state
|
|
205
234
|
|
|
206
235
|
List stored conversations with [`session.thread.list()`](https://mastra.ai/reference/agent-controller/session):
|
|
@@ -10,14 +10,6 @@ You can also retrieve message history to display past conversations in your UI.
|
|
|
10
10
|
|
|
11
11
|
> **Note:** Each message belongs to a thread (the conversation) and a resource (the user or entity it's associated with). See [Threads and resources](#threads-and-resources) for more detail.
|
|
12
12
|
|
|
13
|
-
> **Warning:** When you use memory with a client application, send **only the new message** from the client instead of the full conversation history.
|
|
14
|
-
>
|
|
15
|
-
> Sending the full history is redundant because Mastra loads messages from storage. Mastra filters client-echoed history before loading stored messages and uses the stored copy as the base when message IDs match, preserving stored timestamps and provider metadata while retaining new tool results.
|
|
16
|
-
>
|
|
17
|
-
> If you assemble the request input yourself and need it processed exactly as sent, set `retainFullInput: true` on `memory.options` for that call, or in the memory constructor options to apply it agent-wide. This disables the filtering described above. History still loads underneath. Every input message that isn't already stored is saved to the thread, including few-shot examples.
|
|
18
|
-
>
|
|
19
|
-
> For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/integrations/agentic-ui/ai-sdk-ui).
|
|
20
|
-
|
|
21
13
|
## Threads and resources
|
|
22
14
|
|
|
23
15
|
Mastra organizes conversations using two identifiers:
|
|
@@ -126,6 +118,21 @@ You can use this history in two ways:
|
|
|
126
118
|
|
|
127
119
|
> **Note:** `lastMessages` counts every stored message, including tool calls, tool results, and [signals](https://mastra.ai/docs/harness/signals) of any kind, so a single turn can add several messages to the count. The window also slides forward on every request: once a thread grows past the limit, the oldest message leaves context on each turn, which changes the start of the prompt and invalidates the provider prompt cache. For long-running conversations, use [Observational Memory](https://mastra.ai/docs/memory/observational-memory), which keeps the prompt prefix stable.
|
|
128
120
|
|
|
121
|
+
### Sending messages from a client
|
|
122
|
+
|
|
123
|
+
When you use memory with a client application, send **only the new message** instead of the full conversation history. Mastra loads previous messages from storage.
|
|
124
|
+
|
|
125
|
+
For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/integrations/agentic-ui/ai-sdk-ui).
|
|
126
|
+
|
|
127
|
+
<details>
|
|
128
|
+
**Passing a full input history**
|
|
129
|
+
|
|
130
|
+
Mastra filters client-echoed history before loading stored messages. When message IDs match, it uses the stored copy as the base, preserving stored timestamps and provider metadata while retaining new tool results.
|
|
131
|
+
|
|
132
|
+
If you assemble the request input yourself and need it processed exactly as sent, set `retainFullInput: true` on `memory.options` for that call, or in the memory constructor options to apply it agent-wide. This disables input filtering, but stored history still loads. Every input message that isn't already stored is saved to the thread, including few-shot examples.
|
|
133
|
+
|
|
134
|
+
</details>
|
|
135
|
+
|
|
129
136
|
### Limit history by tokens
|
|
130
137
|
|
|
131
138
|
Message count is a poor proxy for context size: a tool result can be a few tokens or thousands. Use `messageHistory` to keep recent history within a token budget instead:
|
|
@@ -76,7 +76,7 @@ console.log(secondResponse.text)
|
|
|
76
76
|
|
|
77
77
|
The `resource` identifies the user or entity, while the `thread` identifies the conversation. Reuse both values to continue the same conversation. Observational Memory processes the stored history as it grows and replaces older messages with observations when its activation conditions are met.
|
|
78
78
|
|
|
79
|
-
The agent now has humanlike long-term memory that persists across conversations. Setting `observationalMemory: true` uses
|
|
79
|
+
The agent now has humanlike long-term memory that persists across conversations. Setting `observationalMemory: true` uses automatic model selection. To use a specific model, pass it in the config object:
|
|
80
80
|
|
|
81
81
|
```typescript
|
|
82
82
|
const memory = new Memory({
|
|
@@ -98,7 +98,17 @@ See [configuration options](https://mastra.ai/reference/memory/observational-mem
|
|
|
98
98
|
>
|
|
99
99
|
> For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/integrations/agentic-ui/ai-sdk-ui).
|
|
100
100
|
|
|
101
|
-
> **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, `@mastra/mysql`, `@mastra/mongodb`, `@mastra/convex`, and `@mastra/oracledb` storage adapters. It uses background agents for managing memory. When no model is set, the default
|
|
101
|
+
> **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, `@mastra/mysql`, `@mastra/mongodb`, `@mastra/convex`, and `@mastra/oracledb` storage adapters. It uses background agents for managing memory. When no model is set, the default is `model: 'auto'`.
|
|
102
|
+
|
|
103
|
+
### Automatic models in Mastra Code and Factory
|
|
104
|
+
|
|
105
|
+
Mastra Code and Factory surface the same automatic selection as a per-role **Auto** option in their settings.
|
|
106
|
+
|
|
107
|
+
An automatic Observer or Reflector follows the active main model provider. Mastra Code uses that provider's built-in low-cost Observational Memory model when one is configured. For custom providers and providers without a built-in choice, it uses the active main model. The effective model is resolved when the role runs, so changing the main model doesn't rewrite the saved automatic selection.
|
|
108
|
+
|
|
109
|
+
Select an explicit model to pin one role independently. Reset that role to **Auto** to resume following the main model provider. Existing saved concrete model IDs remain explicit until you reset them.
|
|
110
|
+
|
|
111
|
+
Factory stores automatic intent separately from the effective model shown in settings. A missing provider credential can mark that effective model unavailable, but it doesn't replace the saved selection or prevent Factory from starting.
|
|
102
112
|
|
|
103
113
|
## Temporal gap markers
|
|
104
114
|
|
|
@@ -570,11 +580,30 @@ The progress bars update live while the agent is observing or reflecting, showin
|
|
|
570
580
|
|
|
571
581
|
## Models
|
|
572
582
|
|
|
573
|
-
The Observer and Reflector run in the background. Any model that works with Mastra's [model routing](https://mastra.ai/models) (`provider/model`) can be used. When no model is set, the default
|
|
583
|
+
The Observer and Reflector run in the background. Any model that works with Mastra's [model routing](https://mastra.ai/models) (`provider/model`) can be used. When no model is set, the default is `model: 'auto'`.
|
|
584
|
+
|
|
585
|
+
Automatic selection uses `google/gemini-2.5-flash` when `GOOGLE_GENERATIVE_AI_API_KEY` is configured. Otherwise, it selects a low-cost model for the active main model's provider, then falls back to the active main model. Observer and Reflector resolve independently before each invocation.
|
|
586
|
+
|
|
587
|
+
Automatic selection reads the main model's `provider/model` ID. Models created from a plain model string carry that ID, and a dynamic model function can label a custom model by returning `{ model, id }`. When the ID is unknown, such as a model with a custom URL, API key, headers, or gateway, automatic selection reuses the main model itself because a sibling model isn't known to share that route. Pass a concrete model ID to the role to override either behavior.
|
|
588
|
+
|
|
589
|
+
Use `autoModels` to change the model picked for a provider, and `resolveModel` to create the picked model with your own credentials or routing:
|
|
590
|
+
|
|
591
|
+
```typescript
|
|
592
|
+
const memory = new Memory({
|
|
593
|
+
options: {
|
|
594
|
+
observationalMemory: {
|
|
595
|
+
autoModels: { openai: 'openai/gpt-5-nano' },
|
|
596
|
+
resolveModel: (modelId, { requestContext }) => createRoutedModel(modelId, requestContext),
|
|
597
|
+
},
|
|
598
|
+
},
|
|
599
|
+
})
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
`resolveAutoModelId(mainModelId, { autoModels })` from `@mastra/memory` returns the model automatic selection would pick, which is useful for showing the effective model in a settings UI.
|
|
574
603
|
|
|
575
604
|
Mastra recommends using a model that has a large context window (128K+ tokens) and is fast enough to run in the background without slowing down your actions.
|
|
576
605
|
|
|
577
|
-
|
|
606
|
+
To pin a model instead, set a concrete model ID. We've also successfully tested `openai/gpt-5-mini`, `anthropic/claude-haiku-4-5`, `deepseek/deepseek-reasoner`, `deepseek/deepseek-v4-pro`, `deepseek/deepseek-v4-flash`, `xai/grok-4-1-fast`, `qwen3`, and `glm-4.7`.
|
|
578
607
|
|
|
579
608
|
```typescript
|
|
580
609
|
const memory = new Memory({
|
|
@@ -57,6 +57,67 @@ const agent = new Agent({
|
|
|
57
57
|
})
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
### Repository templates
|
|
61
|
+
|
|
62
|
+
`createDockerRepoTemplate` builds an image that already holds a checkout of a repository and the output of its setup command, so a session starts from installed dependencies instead of a cold clone:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { DockerSandbox, createDockerRepoTemplate } from '@mastra/docker'
|
|
66
|
+
|
|
67
|
+
const sandbox = new DockerSandbox({
|
|
68
|
+
id: sessionId,
|
|
69
|
+
template: createDockerRepoTemplate({
|
|
70
|
+
getRepositoryAccess: async () => ({
|
|
71
|
+
cloneUrl: 'https://github.com/octocat/hello-world.git',
|
|
72
|
+
}),
|
|
73
|
+
setupCommand: 'npm ci',
|
|
74
|
+
}),
|
|
75
|
+
})
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`getRepositoryAccess` supplies the clone URL and, for private repositories, a short-lived credential. The credential is passed to the clone step as a build secret and never enters the image, its layers or the image identity. When `getRepositoryAccess` is `undefined`, `createDockerRepoTemplate` returns `undefined`, which selects the provider's default image without a conditional at the call site.
|
|
79
|
+
|
|
80
|
+
The repository is cloned to `<workingDirectory>/<repo>` (default `/workspace`), which becomes the working directory of the sandbox. Pass `ref` to prepare a branch, tag or commit other than the default branch. Right before the build the resolver runs `git ls-remote` to pin the ref to a commit, which is part of the image identity: a moved branch yields a fresh image on the next new sandbox and an unmoved one reuses the cached image. If the head can't be resolved the resolver rejects rather than caching an unpinned clone.
|
|
81
|
+
|
|
82
|
+
`setupCommand` also accepts an array. Each entry runs as its own cached build step. A command cannot contain a bare newline, which would start a new Dockerfile instruction. End the line with `\` or pass separate commands instead.
|
|
83
|
+
|
|
84
|
+
#### Several repositories in one image
|
|
85
|
+
|
|
86
|
+
Pass `repos` instead of `getRepositoryAccess` to clone several repositories into one image, each with its own access resolver, `ref` and setup command (a string or an array, each entry its own build step):
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const sandbox = new DockerSandbox({
|
|
90
|
+
id: sessionId,
|
|
91
|
+
template: createDockerRepoTemplate({
|
|
92
|
+
repos: [
|
|
93
|
+
{
|
|
94
|
+
getRepositoryAccess: async () => ({
|
|
95
|
+
cloneUrl: 'https://github.com/mastra-ai/template-docs-expert.git',
|
|
96
|
+
}),
|
|
97
|
+
setupCommand: 'npm install',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
getRepositoryAccess: async () => ({
|
|
101
|
+
cloneUrl: 'https://github.com/mastra-ai/good-issue.git',
|
|
102
|
+
}),
|
|
103
|
+
ref: 'main',
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
workspaceSetupCommand: 'npm install --global @mastra/mcp-docs-server',
|
|
107
|
+
continueOnSetupFailure: true,
|
|
108
|
+
workingDirectory: '/workspace',
|
|
109
|
+
}),
|
|
110
|
+
})
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Every repository is cloned to `<workingDirectory>/<repo>` and the working directory becomes the sandbox cwd. Public repositories are built before private ones, keeping the caller's order within each group. Each private credential is passed as a build secret to that repository's clone step only, so setup commands never see it.
|
|
114
|
+
|
|
115
|
+
`workspaceSetupCommand` runs at the working directory after every repository is set up. `continueOnSetupFailure` (default `false`) lets a failing setup command record its repository in `.mastra-sandbox/setup-failed` and continue instead of failing the build.
|
|
116
|
+
|
|
117
|
+
Markers tell a session what the image already ran: `.mastra-sandbox/repos/<repo>` per repository and `.mastra-sandbox/workspace-setup` after the workspace commands, all under the working directory. With `continueOnSetupFailure`, check `.mastra-sandbox/setup-failed` first.
|
|
118
|
+
|
|
119
|
+
If any entry's access or head can't be resolved, the whole resolution rejects and the sandbox falls back to its default template.
|
|
120
|
+
|
|
60
121
|
## Constructor parameters
|
|
61
122
|
|
|
62
123
|
**id** (`string`): Unique identifier for this sandbox instance. Used for label-based reconnection. (Default: `Auto-generated`)
|
|
@@ -285,6 +285,43 @@ Resolution is lazy and only ever blocks on a template's very first build. Every
|
|
|
285
285
|
|
|
286
286
|
`setupCommand` also accepts an array. Each entry runs as its own cached build step. `workingDirectory` sets the cwd for the build and the sandbox, and the repository is cloned to `<workingDirectory>/<repo>`.
|
|
287
287
|
|
|
288
|
+
#### Several repositories in one template
|
|
289
|
+
|
|
290
|
+
Pass `repos` instead of `getRepositoryAccess` to clone several repositories into one template, each with its own credential resolver and setup command (a string or an array, each entry its own build step):
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
const sandbox = new E2BSandbox({
|
|
294
|
+
id: sessionId,
|
|
295
|
+
template: createRepoTemplate({
|
|
296
|
+
repos: [
|
|
297
|
+
{
|
|
298
|
+
getRepositoryAccess: async () => ({
|
|
299
|
+
cloneUrl: 'https://github.com/mastra-ai/mastra.git',
|
|
300
|
+
}),
|
|
301
|
+
setupCommand: 'pnpm install --frozen-lockfile',
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
getRepositoryAccess: async () => ({
|
|
305
|
+
cloneUrl: 'https://github.com/mastra-ai/template-docs-expert.git',
|
|
306
|
+
}),
|
|
307
|
+
setupCommand: 'npm install',
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
workspaceSetupCommand: 'npm install --global @mastra/mcp-docs-server',
|
|
311
|
+
continueOnSetupFailure: true,
|
|
312
|
+
workingDirectory: '/home/user/repos',
|
|
313
|
+
}),
|
|
314
|
+
})
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Every repository is cloned to `<workingDirectory>/<repo>`. Public repositories are built before private ones, keeping the caller's order within each group. Private credentials are build envs visible to every build step, so any repository's setup command can read every other repository's token: only list repositories whose setup commands you trust together.
|
|
318
|
+
|
|
319
|
+
`workspaceSetupCommand` runs at the working directory after every repository is set up. `continueOnSetupFailure` (default `false`) lets a failing setup command record its repository in `.mastra-sandbox/setup-failed` and continue instead of failing the build.
|
|
320
|
+
|
|
321
|
+
Markers tell a session what the image already ran: `.mastra-sandbox/repos/<repo>` per repository and `.mastra-sandbox/workspace-setup` after the workspace commands, all under the working directory. With `continueOnSetupFailure`, check `.mastra-sandbox/setup-failed` first.
|
|
322
|
+
|
|
323
|
+
Adding or removing a repository starts a new template, as does editing a setup command, while a rotated credential reuses the existing one. If any entry's access can't be resolved the sandbox falls back to its default template. A repository whose head can't be resolved is cloned unpinned while the others keep their pins.
|
|
324
|
+
|
|
288
325
|
Templates build at E2B's default machine size (2 vCPU, 1024 MB) unless the spec asks for more. Pass `cpuCount` and `memoryMB` to size the machine the template's sandboxes run on:
|
|
289
326
|
|
|
290
327
|
```typescript
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Netlify
|
|
6
6
|
|
|
7
|
-
Netlify AI Gateway provides unified access to multiple providers with built-in caching and observability. Access
|
|
7
|
+
Netlify AI Gateway provides unified access to multiple providers with built-in caching and observability. Access 270 models through Mastra's model router.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Netlify documentation](https://docs.netlify.com/build/ai-gateway/overview/).
|
|
10
10
|
|
|
@@ -133,7 +133,6 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
133
133
|
| `openrouter/~z-ai/glm-latest` |
|
|
134
134
|
| `openrouter/anthracite-org/magnum-v4-72b` |
|
|
135
135
|
| `openrouter/apodex/apodex-1.1-mini:free` |
|
|
136
|
-
| `openrouter/baidu/ernie-4.5-vl-424b-a47b` |
|
|
137
136
|
| `openrouter/bytedance-seed/seed-1.6` |
|
|
138
137
|
| `openrouter/bytedance-seed/seed-1.6-flash` |
|
|
139
138
|
| `openrouter/bytedance-seed/seed-2-1-turbo` |
|
|
@@ -167,7 +166,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
167
166
|
| `openrouter/inception/mercury-2.5` |
|
|
168
167
|
| `openrouter/inclusionai/ling-3.0-flash` |
|
|
169
168
|
| `openrouter/inclusionai/ling-3.0-flash-fin` |
|
|
170
|
-
| `openrouter/inclusionai/ling-3.0-flash-sante
|
|
169
|
+
| `openrouter/inclusionai/ling-3.0-flash-sante` |
|
|
171
170
|
| `openrouter/inclusionai/ling-3.0-flash-vl` |
|
|
172
171
|
| `openrouter/inclusionai/ling-3.1-flash` |
|
|
173
172
|
| `openrouter/inference-net/schematron-v2-small` |
|
|
@@ -195,6 +194,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
195
194
|
| `openrouter/mistralai/ministral-8b-2512` |
|
|
196
195
|
| `openrouter/mistralai/mistral-large-2407` |
|
|
197
196
|
| `openrouter/mistralai/mistral-large-2512` |
|
|
197
|
+
| `openrouter/mistralai/mistral-large-4-0` |
|
|
198
198
|
| `openrouter/mistralai/mistral-medium-3` |
|
|
199
199
|
| `openrouter/mistralai/mistral-medium-3-5` |
|
|
200
200
|
| `openrouter/mistralai/mistral-medium-3.1` |
|
|
@@ -247,11 +247,9 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
247
247
|
| `openrouter/qwen/qwen3-30b-a3b-instruct-2507` |
|
|
248
248
|
| `openrouter/qwen/qwen3-32b` |
|
|
249
249
|
| `openrouter/qwen/qwen3-coder` |
|
|
250
|
-
| `openrouter/qwen/qwen3-coder-30b-a3b-instruct` |
|
|
251
250
|
| `openrouter/qwen/qwen3-coder-next` |
|
|
252
251
|
| `openrouter/qwen/qwen3-next-80b-a3b-instruct` |
|
|
253
252
|
| `openrouter/qwen/qwen3-vl-235b-a22b-instruct` |
|
|
254
|
-
| `openrouter/qwen/qwen3-vl-235b-a22b-thinking` |
|
|
255
253
|
| `openrouter/qwen/qwen3-vl-30b-a3b-instruct` |
|
|
256
254
|
| `openrouter/qwen/qwen3-vl-8b-instruct` |
|
|
257
255
|
| `openrouter/qwen/qwen3.5-122b-a10b` |
|
|
@@ -86,7 +86,6 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
86
86
|
| `anthropic/claude-sonnet-5.5` |
|
|
87
87
|
| `apodex/apodex-1.1-mini:free` |
|
|
88
88
|
| `arcee-ai/trinity-large-thinking` |
|
|
89
|
-
| `baidu/ernie-4.5-vl-424b-a47b` |
|
|
90
89
|
| `bytedance-seed/seed-1.6` |
|
|
91
90
|
| `bytedance-seed/seed-1.6-flash` |
|
|
92
91
|
| `bytedance-seed/seed-2-1-turbo` |
|
|
@@ -155,7 +154,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
155
154
|
| `inception/mercury-2.5` |
|
|
156
155
|
| `inclusionai/ling-3.0-flash` |
|
|
157
156
|
| `inclusionai/ling-3.0-flash-fin` |
|
|
158
|
-
| `inclusionai/ling-3.0-flash-sante
|
|
157
|
+
| `inclusionai/ling-3.0-flash-sante` |
|
|
159
158
|
| `inclusionai/ling-3.0-flash-vl` |
|
|
160
159
|
| `inclusionai/ling-3.1-flash` |
|
|
161
160
|
| `inference-net/schematron-v2-small` |
|
|
@@ -379,6 +378,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
379
378
|
| `sao10k/l3.3-euryale-70b` |
|
|
380
379
|
| `stepfun/step-3.5-flash` |
|
|
381
380
|
| `stepfun/step-3.7-flash` |
|
|
381
|
+
| `stepfun/step-5-preview` |
|
|
382
382
|
| `tencent/hunyuan-a13b-instruct` |
|
|
383
383
|
| `tencent/hy-mt2-1.8b` |
|
|
384
384
|
| `tencent/hy-mt2-30b-a3b` |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Vercel
|
|
6
6
|
|
|
7
|
-
Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access
|
|
7
|
+
Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 408 models through Mastra's model router.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Vercel documentation](https://ai-sdk.dev/providers/ai-sdk-providers).
|
|
10
10
|
|
|
@@ -135,6 +135,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
135
135
|
| `bytedance/seedream-4.5` |
|
|
136
136
|
| `bytedance/seedream-5.0-lite` |
|
|
137
137
|
| `bytedance/seedream-5.0-pro` |
|
|
138
|
+
| `callstack/apex` |
|
|
138
139
|
| `cohere/command-a` |
|
|
139
140
|
| `cohere/embed-v4.0` |
|
|
140
141
|
| `cohere/embed-v5.0-fast` |
|
package/.docs/models/index.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Model Providers
|
|
6
6
|
|
|
7
|
-
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to
|
|
7
|
+
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 7823 models from 213 providers through a single API.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Cortecs
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 106 Cortecs models through Mastra's model router. Authentication is handled automatically using the `CORTECS_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Cortecs documentation](https://cortecs.ai).
|
|
10
10
|
|
|
@@ -42,6 +42,7 @@ for await (const chunk of stream) {
|
|
|
42
42
|
| `cortecs/claude-4-5-sonnet` | 200K | | | | | | $3 | $15 |
|
|
43
43
|
| `cortecs/claude-4-6-sonnet` | 1.0M | | | | | | $3 | $16 |
|
|
44
44
|
| `cortecs/claude-haiku-4-5` | 200K | | | | | | $1.00 | $5 |
|
|
45
|
+
| `cortecs/claude-haiku-5.5` | 1.0M | | | | | | $0.11 | $0.56 |
|
|
45
46
|
| `cortecs/claude-opus-5` | 1.0M | | | | | | $6 | $27 |
|
|
46
47
|
| `cortecs/claude-opus-5.5` | 1.0M | | | | | | $4 | $22 |
|
|
47
48
|
| `cortecs/claude-opus4-5` | 200K | | | | | | $5 | $27 |
|
|
@@ -130,7 +131,7 @@ for await (const chunk of stream) {
|
|
|
130
131
|
| `cortecs/qwen3-235b-a22b-instruct-2507` | 262K | | | | | | $0.20 | $0.60 |
|
|
131
132
|
| `cortecs/qwen3-30b-a3b-instruct-2507` | 262K | | | | | | $0.10 | $0.30 |
|
|
132
133
|
| `cortecs/qwen3-32b` | 16K | | | | | | $0.18 | $0.70 |
|
|
133
|
-
| `cortecs/qwen3-coder-30b-a3b-instruct` | 262K | | | | | | $0.
|
|
134
|
+
| `cortecs/qwen3-coder-30b-a3b-instruct` | 262K | | | | | | $0.18 | $0.70 |
|
|
134
135
|
| `cortecs/qwen3-coder-next` | 256K | | | | | | $0.17 | $0.89 |
|
|
135
136
|
| `cortecs/qwen3-vl-235b-a22b` | 256K | | | | | | $0.62 | $3 |
|
|
136
137
|
| `cortecs/qwen3.5-397b-a17b` | 262K | | | | | | $0.67 | $4 |
|
|
@@ -59,7 +59,6 @@ for await (const chunk of stream) {
|
|
|
59
59
|
| `deepinfra/MiniMaxAI/MiniMax-M3` | 524K | | | | | | $0.28 | $1 |
|
|
60
60
|
| `deepinfra/moonshotai/Kimi-K2.6` | 262K | | | | | | $0.75 | $4 |
|
|
61
61
|
| `deepinfra/moonshotai/Kimi-K3` | 1.0M | | | | | | $3 | $14 |
|
|
62
|
-
| `deepinfra/nvidia/Nemotron-3-Nano-30B-A3B` | 262K | | | | | | $0.05 | $0.20 |
|
|
63
62
|
| `deepinfra/openai/gpt-oss-120b` | 131K | | | | | | $0.04 | $0.17 |
|
|
64
63
|
| `deepinfra/openai/gpt-oss-20b` | 131K | | | | | | $0.03 | $0.14 |
|
|
65
64
|
| `deepinfra/Qwen/Qwen3-235B-A22B-Instruct-2507` | 262K | | | | | | $0.09 | $0.55 |
|
|
@@ -80,7 +79,6 @@ for await (const chunk of stream) {
|
|
|
80
79
|
| `deepinfra/Qwen/Qwen3.8-27B` | 262K | | | | | | $0.20 | $3 |
|
|
81
80
|
| `deepinfra/Qwen/Qwen3.8-Flash` | 1.0M | | | | | | $0.11 | $0.38 |
|
|
82
81
|
| `deepinfra/Qwen/Qwen3.8-Max` | 256K | | | | | | $2 | $5 |
|
|
83
|
-
| `deepinfra/tencent/Hy3` | 262K | | | | | | $0.13 | $0.53 |
|
|
84
82
|
| `deepinfra/tencent/Hy4-preview` | 1.0M | | | | | | $0.83 | $3 |
|
|
85
83
|
| `deepinfra/thinkingmachines/Inkling` | 524K | | | | | | $0.95 | $4 |
|
|
86
84
|
| `deepinfra/thinkingmachines/Inkling-Small` | 524K | | | | | | $0.45 | $1 |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Eden AI
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 297 Eden AI models through Mastra's model router. Authentication is handled automatically using the `EDENAI_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Eden AI documentation](https://docs.edenai.co).
|
|
10
10
|
|
|
@@ -52,10 +52,10 @@ for await (const chunk of stream) {
|
|
|
52
52
|
| `edenai/amazon/google.gemma-3-4b-it@us` | 128K | | | | | | $0.04 | $0.08 |
|
|
53
53
|
| `edenai/amazon/mistral.pixtral-large-2502-v1:0` | 128K | | | | | | $2 | $6 |
|
|
54
54
|
| `edenai/amazon/mistral.pixtral-large-2502-v1:0@us` | 128K | | | | | | $2 | $6 |
|
|
55
|
-
| `edenai/amazon/mistral.voxtral-mini-3b-2507` |
|
|
56
|
-
| `edenai/amazon/mistral.voxtral-mini-3b-2507@us` |
|
|
57
|
-
| `edenai/amazon/mistral.voxtral-small-24b-2507` |
|
|
58
|
-
| `edenai/amazon/mistral.voxtral-small-24b-2507@us` |
|
|
55
|
+
| `edenai/amazon/mistral.voxtral-mini-3b-2507` | 33K | | | | | | $0.04 | $0.04 |
|
|
56
|
+
| `edenai/amazon/mistral.voxtral-mini-3b-2507@us` | 33K | | | | | | $0.04 | $0.04 |
|
|
57
|
+
| `edenai/amazon/mistral.voxtral-small-24b-2507` | 33K | | | | | | $0.10 | $0.30 |
|
|
58
|
+
| `edenai/amazon/mistral.voxtral-small-24b-2507@us` | 33K | | | | | | $0.10 | $0.30 |
|
|
59
59
|
| `edenai/amazon/moonshot.kimi-k2-thinking` | 256K | | | | | | $0.60 | $3 |
|
|
60
60
|
| `edenai/amazon/moonshotai.kimi-k2.5` | 262K | | | | | | $0.60 | $3 |
|
|
61
61
|
| `edenai/amazon/openai.gpt-oss-safeguard-20b` | 128K | | | | | | $0.07 | $0.20 |
|
|
@@ -162,6 +162,7 @@ for await (const chunk of stream) {
|
|
|
162
162
|
| `edenai/google/gemini-3.7-flash` | 1.0M | | | | | | $2 | $8 |
|
|
163
163
|
| `edenai/google/gemini-3.8-flash` | 1.0M | | | | | | $2 | $8 |
|
|
164
164
|
| `edenai/google/gemini-flash-latest` | 1.0M | | | | | | $2 | $8 |
|
|
165
|
+
| `edenai/google/gemini-nano-banana-2.1` | 66K | | | | | | $2 | $8 |
|
|
165
166
|
| `edenai/google/gemini-pro-latest` | 1.0M | | | | | | $2 | $12 |
|
|
166
167
|
| `edenai/greenference/deepseek-v4.1-flash` | 1.0M | | | | | | $0.22 | $0.88 |
|
|
167
168
|
| `edenai/greenference/gpt-oss-20b` | 131K | | | | | | $0.01 | $0.04 |
|
|
@@ -279,7 +280,6 @@ for await (const chunk of stream) {
|
|
|
279
280
|
| `edenai/tencent/deepseek-v4-pro-0813` | 1.0M | | | | | | $0.66 | $2 |
|
|
280
281
|
| `edenai/tencent/hy3` | 256K | | | | | | $0.13 | $0.53 |
|
|
281
282
|
| `edenai/tencent/hy4-preview` | 1.0M | | | | | | $0.83 | $3 |
|
|
282
|
-
| `edenai/tencent/step-5-preview` | 1.0M | | | | | | $1 | $3 |
|
|
283
283
|
| `edenai/tensorx/deepseek/deepseek-v4-flash-0731` | 1.0M | | | | | | $0.25 | $0.30 |
|
|
284
284
|
| `edenai/tensorx/deepseek/deepseek-v4-pro-0813` | 1.0M | | | | | | $2 | $4 |
|
|
285
285
|
| `edenai/tensorx/deepseek/deepseek-v4.1-flash` | 1.0M | | | | | | $0.50 | $2 |
|
|
@@ -315,6 +315,7 @@ for await (const chunk of stream) {
|
|
|
315
315
|
| `edenai/vertex/gemini-3.8-flash@eu` | 1.0M | | | | | | $2 | $8 |
|
|
316
316
|
| `edenai/vertex/gemini-3.8-flash@us` | 1.0M | | | | | | $2 | $8 |
|
|
317
317
|
| `edenai/vertex/gemini-flash-latest` | 1.0M | | | | | | $2 | $8 |
|
|
318
|
+
| `edenai/vertex/gemini-nano-banana-2.1` | 131K | | | | | | $2 | $8 |
|
|
318
319
|
| `edenai/vertex/gemini-pro-latest` | 1.0M | | | | | | $2 | $12 |
|
|
319
320
|
| `edenai/xai/grok-4.20-0309-non-reasoning` | 1.0M | | | | | | $1 | $3 |
|
|
320
321
|
| `edenai/xai/grok-4.20-0309-reasoning` | 1.0M | | | | | | $1 | $3 |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Charm Hyper
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 21 Charm Hyper models through Mastra's model router. Authentication is handled automatically using the `HYPER_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Charm Hyper documentation](https://hyper.charm.land).
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ const agent = new Agent({
|
|
|
19
19
|
id: "my-agent",
|
|
20
20
|
name: "My Agent",
|
|
21
21
|
instructions: "You are a helpful assistant",
|
|
22
|
-
model: "hyper/deepseek-v4-flash"
|
|
22
|
+
model: "hyper/deepseek-v4-flash-0731"
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
// Generate a response
|
|
@@ -38,9 +38,7 @@ for await (const chunk of stream) {
|
|
|
38
38
|
|
|
39
39
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
40
|
| ------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
|
-
| `hyper/deepseek-v4-flash` | 1.0M | | | | | | $0.20 | $0.40 |
|
|
42
41
|
| `hyper/deepseek-v4-flash-0731` | 1.0M | | | | | | $0.44 | $1 |
|
|
43
|
-
| `hyper/deepseek-v4-pro` | 1.0M | | | | | | $2 | $5 |
|
|
44
42
|
| `hyper/deepseek-v4-pro-0813` | 1.0M | | | | | | $1 | $4 |
|
|
45
43
|
| `hyper/deepseek-v4.1-flash` | 1.0M | | | | | | $0.33 | $1 |
|
|
46
44
|
| `hyper/gemma-4-26b-a4b-it` | 256K | | | | | | $0.10 | $0.33 |
|
|
@@ -74,7 +72,7 @@ const agent = new Agent({
|
|
|
74
72
|
name: "custom-agent",
|
|
75
73
|
model: {
|
|
76
74
|
url: "https://hyper.charm.land/v1",
|
|
77
|
-
id: "hyper/deepseek-v4-flash",
|
|
75
|
+
id: "hyper/deepseek-v4-flash-0731",
|
|
78
76
|
apiKey: process.env.HYPER_API_KEY,
|
|
79
77
|
headers: {
|
|
80
78
|
"X-Custom-Header": "value"
|
|
@@ -93,7 +91,7 @@ const agent = new Agent({
|
|
|
93
91
|
const useAdvanced = requestContext.task === "complex";
|
|
94
92
|
return useAdvanced
|
|
95
93
|
? "hyper/qwen3.8-max"
|
|
96
|
-
: "hyper/deepseek-v4-flash";
|
|
94
|
+
: "hyper/deepseek-v4-flash-0731";
|
|
97
95
|
}
|
|
98
96
|
});
|
|
99
97
|
```
|