@mastra/mcp-docs-server 1.2.13-alpha.6 → 1.2.13-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/agent-approval.md +2 -2
- package/.docs/docs/deployment/workers.md +14 -14
- package/.docs/docs/evals/datasets/running-experiments.md +1 -1
- package/.docs/docs/index.md +1 -1
- package/.docs/docs/long-running-agents/durable-agents.md +2 -2
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/mastra-platform/{workspace.md → workspaces.md} +48 -7
- package/.docs/docs/memory/observational-memory.md +5 -5
- package/.docs/docs/memory/overview.md +1 -1
- package/.docs/docs/server/auth/workers.md +7 -5
- package/.docs/docs/server/mastra-client.md +60 -0
- package/.docs/docs/server/pubsub.md +2 -2
- package/.docs/docs/what-is-mastra.md +10 -10
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/docs/workflows/scheduled-workflows.md +1 -0
- package/.docs/guides/deployment/kubernetes.md +2 -0
- package/.docs/guides/deployment/mastra-workers.md +350 -6
- package/.docs/guides/deployment/vercel.md +2 -0
- package/.docs/models/gateways/openrouter.md +3 -6
- package/.docs/models/gateways/vercel.md +3 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/crossmodel.md +4 -3
- package/.docs/models/providers/hyper.md +7 -6
- package/.docs/models/providers/llmgateway.md +4 -3
- package/.docs/models/providers/openai.md +2 -2
- package/.docs/models/providers/opencode-go.md +2 -1
- package/.docs/models/providers/opencode.md +1 -1
- package/.docs/models/providers/zai-coding-plan.md +11 -13
- package/.docs/models/providers/zhipuai-coding-plan.md +12 -12
- package/.docs/reference/agents/durable-agent.md +3 -3
- package/.docs/reference/cli/mastra.md +30 -14
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/evals/summarization.md +5 -5
- package/.docs/reference/processors/regex-filter-processor.md +1 -1
- package/.docs/reference/tools/isolated-vm-transport.md +1 -1
- package/.docs/reference/vectors/mongodb.md +13 -13
- package/.docs/reference/workers/overview.md +10 -8
- package/.docs/reference/workspace/platform-filesystem.md +5 -2
- package/.docs/reference/workspace/platform-sandbox.md +58 -4
- package/CHANGELOG.md +15 -0
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Deploy Mastra workers
|
|
4
4
|
|
|
5
|
-
Run [Mastra workers](https://mastra.ai/docs/deployment/workers) as separate processes so you can scale orchestration, scheduling, and background tasks independently from the API. This guide walks through a fully split deployment using Docker Compose.
|
|
5
|
+
Run [Mastra workers](https://mastra.ai/docs/deployment/workers) as separate processes so you can scale orchestration, scheduling, and background tasks independently from the API. This guide walks through a fully split deployment using Docker Compose or Kubernetes.
|
|
6
6
|
|
|
7
7
|
> **Info:** This guide covers splitting workers into their own containers. If you only need workers to run in-process alongside the API, see [Workers](https://mastra.ai/docs/deployment/workers). No extra setup is required.
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ Run [Mastra workers](https://mastra.ai/docs/deployment/workers) as separate proc
|
|
|
11
11
|
You'll need:
|
|
12
12
|
|
|
13
13
|
- A [Mastra application](https://mastra.ai/guides/getting-started/quickstart)
|
|
14
|
-
- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/)
|
|
14
|
+
- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/), or a [Kubernetes](https://kubernetes.io/docs/setup/) cluster with [`kubectl`](https://kubernetes.io/docs/tasks/tools/)
|
|
15
15
|
- A distributed PubSub backend: [Redis](https://redis.io/) for [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), or a [Google Cloud](https://cloud.google.com/) project for [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub)
|
|
16
16
|
- A shared database reachable from every container. See [supported storage backends](https://mastra.ai/reference/workers/overview) for the full list.
|
|
17
17
|
|
|
@@ -83,9 +83,13 @@ Any [supported storage backend](https://mastra.ai/reference/workers/overview) wo
|
|
|
83
83
|
CMD ["node", "index.mjs"]
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
3.
|
|
86
|
+
3. Define the fully split topology. The setup runs six services: a database, a PubSub backend, the API server, and three workers. Each worker runs the same image with a different `MASTRA_WORKERS` value to control which worker starts.
|
|
87
87
|
|
|
88
|
-
The API
|
|
88
|
+
The API sets `MASTRA_WORKERS: "false"` to disable all event processing. The orchestration worker sets `MASTRA_STEP_EXECUTION_URL` to point step execution requests at the API's internal URL. See [step execution URL](#step-execution-url) for details.
|
|
89
|
+
|
|
90
|
+
All services share a `MASTRA_WORKER_AUTH_TOKEN`. Workers include this token in requests to the API so the API can verify the caller is a trusted internal service. See [worker authentication](https://mastra.ai/docs/server/auth/workers) for details.
|
|
91
|
+
|
|
92
|
+
**Docker Compose**:
|
|
89
93
|
|
|
90
94
|
```yaml
|
|
91
95
|
services:
|
|
@@ -123,6 +127,7 @@ Any [supported storage backend](https://mastra.ai/reference/workers/overview) wo
|
|
|
123
127
|
DATABASE_URL: postgres://mastra:${POSTGRES_PASSWORD}@postgres:5432/mastra
|
|
124
128
|
REDIS_URL: redis://redis:6379
|
|
125
129
|
MASTRA_WORKERS: 'false'
|
|
130
|
+
MASTRA_WORKER_AUTH_TOKEN: ${MASTRA_WORKER_AUTH_TOKEN}
|
|
126
131
|
depends_on:
|
|
127
132
|
postgres:
|
|
128
133
|
condition: service_healthy
|
|
@@ -141,6 +146,7 @@ Any [supported storage backend](https://mastra.ai/reference/workers/overview) wo
|
|
|
141
146
|
REDIS_URL: redis://redis:6379
|
|
142
147
|
MASTRA_WORKERS: orchestration
|
|
143
148
|
MASTRA_STEP_EXECUTION_URL: http://api:4111/api
|
|
149
|
+
MASTRA_WORKER_AUTH_TOKEN: ${MASTRA_WORKER_AUTH_TOKEN}
|
|
144
150
|
depends_on:
|
|
145
151
|
api:
|
|
146
152
|
condition: service_healthy
|
|
@@ -151,6 +157,7 @@ Any [supported storage backend](https://mastra.ai/reference/workers/overview) wo
|
|
|
151
157
|
DATABASE_URL: postgres://mastra:${POSTGRES_PASSWORD}@postgres:5432/mastra
|
|
152
158
|
REDIS_URL: redis://redis:6379
|
|
153
159
|
MASTRA_WORKERS: scheduler
|
|
160
|
+
MASTRA_WORKER_AUTH_TOKEN: ${MASTRA_WORKER_AUTH_TOKEN}
|
|
154
161
|
depends_on:
|
|
155
162
|
api:
|
|
156
163
|
condition: service_healthy
|
|
@@ -161,6 +168,7 @@ Any [supported storage backend](https://mastra.ai/reference/workers/overview) wo
|
|
|
161
168
|
DATABASE_URL: postgres://mastra:${POSTGRES_PASSWORD}@postgres:5432/mastra
|
|
162
169
|
REDIS_URL: redis://redis:6379
|
|
163
170
|
MASTRA_WORKERS: backgroundTasks
|
|
171
|
+
MASTRA_WORKER_AUTH_TOKEN: ${MASTRA_WORKER_AUTH_TOKEN}
|
|
164
172
|
depends_on:
|
|
165
173
|
api:
|
|
166
174
|
condition: service_healthy
|
|
@@ -173,11 +181,296 @@ Any [supported storage backend](https://mastra.ai/reference/workers/overview) wo
|
|
|
173
181
|
|
|
174
182
|
```bash
|
|
175
183
|
POSTGRES_PASSWORD=your-secure-password
|
|
184
|
+
MASTRA_WORKER_AUTH_TOKEN=your-shared-secret-token
|
|
176
185
|
```
|
|
177
186
|
|
|
178
187
|
> **Note:** Remember to set any other environment variables your application needs (e.g., your [model provider](https://mastra.ai/models/providers) API key).
|
|
179
188
|
|
|
180
|
-
|
|
189
|
+
**Kubernetes**:
|
|
190
|
+
|
|
191
|
+
Create a namespace and a Secret with your connection strings:
|
|
192
|
+
|
|
193
|
+
```yaml
|
|
194
|
+
apiVersion: v1
|
|
195
|
+
kind: Namespace
|
|
196
|
+
metadata:
|
|
197
|
+
name: mastra-workers
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
kubectl apply -f k8s/namespace.yaml
|
|
202
|
+
kubectl create secret generic mastra-secrets -n mastra-workers \
|
|
203
|
+
--from-literal=POSTGRES_PASSWORD='your-password' \
|
|
204
|
+
--from-literal=DATABASE_URL='postgresql://mastra:your-password@postgres:5432/mastra' \
|
|
205
|
+
--from-literal=REDIS_URL='redis://redis:6379' \
|
|
206
|
+
--from-literal=MASTRA_WORKER_AUTH_TOKEN='your-shared-token'
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
> **Note:** Add any other environment variables your application needs (e.g., your [model provider](https://mastra.ai/models/providers) API key) to the Secret or as additional `--from-literal` entries.
|
|
210
|
+
|
|
211
|
+
Build and push the Docker image to a registry your cluster can pull from:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
docker build -t your-registry/mastra-workers:latest ./app
|
|
215
|
+
docker push your-registry/mastra-workers:latest
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Apply Deployments and Services for the database, PubSub backend, API, and three workers. The example below uses in-cluster Postgres and Redis. In production, use managed services (e.g., Amazon RDS, Cloud SQL, ElastiCache, Memorystore).
|
|
219
|
+
|
|
220
|
+
```yaml
|
|
221
|
+
apiVersion: apps/v1
|
|
222
|
+
kind: Deployment
|
|
223
|
+
metadata:
|
|
224
|
+
name: postgres
|
|
225
|
+
namespace: mastra-workers
|
|
226
|
+
spec:
|
|
227
|
+
replicas: 1
|
|
228
|
+
selector:
|
|
229
|
+
matchLabels:
|
|
230
|
+
app: postgres
|
|
231
|
+
template:
|
|
232
|
+
metadata:
|
|
233
|
+
labels:
|
|
234
|
+
app: postgres
|
|
235
|
+
spec:
|
|
236
|
+
containers:
|
|
237
|
+
- name: postgres
|
|
238
|
+
image: postgres:16-alpine
|
|
239
|
+
ports:
|
|
240
|
+
- containerPort: 5432
|
|
241
|
+
env:
|
|
242
|
+
- name: POSTGRES_USER
|
|
243
|
+
value: mastra
|
|
244
|
+
- name: POSTGRES_PASSWORD
|
|
245
|
+
valueFrom:
|
|
246
|
+
secretKeyRef:
|
|
247
|
+
name: mastra-secrets
|
|
248
|
+
key: POSTGRES_PASSWORD
|
|
249
|
+
- name: POSTGRES_DB
|
|
250
|
+
value: mastra
|
|
251
|
+
volumeMounts:
|
|
252
|
+
- name: pgdata
|
|
253
|
+
mountPath: /var/lib/postgresql/data
|
|
254
|
+
volumes:
|
|
255
|
+
- name: pgdata
|
|
256
|
+
emptyDir: {}
|
|
257
|
+
---
|
|
258
|
+
apiVersion: v1
|
|
259
|
+
kind: Service
|
|
260
|
+
metadata:
|
|
261
|
+
name: postgres
|
|
262
|
+
namespace: mastra-workers
|
|
263
|
+
spec:
|
|
264
|
+
selector:
|
|
265
|
+
app: postgres
|
|
266
|
+
ports:
|
|
267
|
+
- port: 5432
|
|
268
|
+
targetPort: 5432
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
> **Caution:** The Postgres example above uses `emptyDir` for storage, which means data is lost when the pod restarts. In production, replace it with a `PersistentVolumeClaim` or use a managed database service.
|
|
272
|
+
|
|
273
|
+
```yaml
|
|
274
|
+
apiVersion: apps/v1
|
|
275
|
+
kind: Deployment
|
|
276
|
+
metadata:
|
|
277
|
+
name: redis
|
|
278
|
+
namespace: mastra-workers
|
|
279
|
+
spec:
|
|
280
|
+
replicas: 1
|
|
281
|
+
selector:
|
|
282
|
+
matchLabels:
|
|
283
|
+
app: redis
|
|
284
|
+
template:
|
|
285
|
+
metadata:
|
|
286
|
+
labels:
|
|
287
|
+
app: redis
|
|
288
|
+
spec:
|
|
289
|
+
containers:
|
|
290
|
+
- name: redis
|
|
291
|
+
image: redis:7-alpine
|
|
292
|
+
args: ['--appendonly', 'yes']
|
|
293
|
+
ports:
|
|
294
|
+
- containerPort: 6379
|
|
295
|
+
---
|
|
296
|
+
apiVersion: v1
|
|
297
|
+
kind: Service
|
|
298
|
+
metadata:
|
|
299
|
+
name: redis
|
|
300
|
+
namespace: mastra-workers
|
|
301
|
+
spec:
|
|
302
|
+
selector:
|
|
303
|
+
app: redis
|
|
304
|
+
ports:
|
|
305
|
+
- port: 6379
|
|
306
|
+
targetPort: 6379
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
```yaml
|
|
310
|
+
apiVersion: apps/v1
|
|
311
|
+
kind: Deployment
|
|
312
|
+
metadata:
|
|
313
|
+
name: api
|
|
314
|
+
namespace: mastra-workers
|
|
315
|
+
spec:
|
|
316
|
+
replicas: 1
|
|
317
|
+
selector:
|
|
318
|
+
matchLabels:
|
|
319
|
+
app: api
|
|
320
|
+
template:
|
|
321
|
+
metadata:
|
|
322
|
+
labels:
|
|
323
|
+
app: api
|
|
324
|
+
spec:
|
|
325
|
+
containers:
|
|
326
|
+
- name: api
|
|
327
|
+
image: your-registry/mastra-workers:latest
|
|
328
|
+
ports:
|
|
329
|
+
- containerPort: 4111
|
|
330
|
+
env:
|
|
331
|
+
- name: MASTRA_WORKERS
|
|
332
|
+
value: 'false'
|
|
333
|
+
envFrom:
|
|
334
|
+
- secretRef:
|
|
335
|
+
name: mastra-secrets
|
|
336
|
+
readinessProbe:
|
|
337
|
+
httpGet:
|
|
338
|
+
path: /api/agents
|
|
339
|
+
port: 4111
|
|
340
|
+
initialDelaySeconds: 10
|
|
341
|
+
periodSeconds: 5
|
|
342
|
+
livenessProbe:
|
|
343
|
+
httpGet:
|
|
344
|
+
path: /api/agents
|
|
345
|
+
port: 4111
|
|
346
|
+
initialDelaySeconds: 15
|
|
347
|
+
periodSeconds: 10
|
|
348
|
+
resources:
|
|
349
|
+
requests:
|
|
350
|
+
cpu: 500m
|
|
351
|
+
memory: 512Mi
|
|
352
|
+
---
|
|
353
|
+
apiVersion: v1
|
|
354
|
+
kind: Service
|
|
355
|
+
metadata:
|
|
356
|
+
name: api
|
|
357
|
+
namespace: mastra-workers
|
|
358
|
+
spec:
|
|
359
|
+
selector:
|
|
360
|
+
app: api
|
|
361
|
+
ports:
|
|
362
|
+
- port: 4111
|
|
363
|
+
targetPort: 4111
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
```yaml
|
|
367
|
+
apiVersion: apps/v1
|
|
368
|
+
kind: Deployment
|
|
369
|
+
metadata:
|
|
370
|
+
name: orchestration-worker
|
|
371
|
+
namespace: mastra-workers
|
|
372
|
+
spec:
|
|
373
|
+
replicas: 1
|
|
374
|
+
selector:
|
|
375
|
+
matchLabels:
|
|
376
|
+
app: orchestration-worker
|
|
377
|
+
template:
|
|
378
|
+
metadata:
|
|
379
|
+
labels:
|
|
380
|
+
app: orchestration-worker
|
|
381
|
+
spec:
|
|
382
|
+
containers:
|
|
383
|
+
- name: worker
|
|
384
|
+
image: your-registry/mastra-workers:latest
|
|
385
|
+
env:
|
|
386
|
+
- name: MASTRA_WORKERS
|
|
387
|
+
value: orchestration
|
|
388
|
+
- name: MASTRA_STEP_EXECUTION_URL
|
|
389
|
+
value: http://api:4111/api
|
|
390
|
+
envFrom:
|
|
391
|
+
- secretRef:
|
|
392
|
+
name: mastra-secrets
|
|
393
|
+
resources:
|
|
394
|
+
requests:
|
|
395
|
+
cpu: 250m
|
|
396
|
+
memory: 256Mi
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
```yaml
|
|
400
|
+
apiVersion: apps/v1
|
|
401
|
+
kind: Deployment
|
|
402
|
+
metadata:
|
|
403
|
+
name: scheduler-worker
|
|
404
|
+
namespace: mastra-workers
|
|
405
|
+
spec:
|
|
406
|
+
replicas: 1
|
|
407
|
+
selector:
|
|
408
|
+
matchLabels:
|
|
409
|
+
app: scheduler-worker
|
|
410
|
+
template:
|
|
411
|
+
metadata:
|
|
412
|
+
labels:
|
|
413
|
+
app: scheduler-worker
|
|
414
|
+
spec:
|
|
415
|
+
containers:
|
|
416
|
+
- name: worker
|
|
417
|
+
image: your-registry/mastra-workers:latest
|
|
418
|
+
env:
|
|
419
|
+
- name: MASTRA_WORKERS
|
|
420
|
+
value: scheduler
|
|
421
|
+
envFrom:
|
|
422
|
+
- secretRef:
|
|
423
|
+
name: mastra-secrets
|
|
424
|
+
resources:
|
|
425
|
+
requests:
|
|
426
|
+
cpu: 250m
|
|
427
|
+
memory: 256Mi
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
```yaml
|
|
431
|
+
apiVersion: apps/v1
|
|
432
|
+
kind: Deployment
|
|
433
|
+
metadata:
|
|
434
|
+
name: background-task-worker
|
|
435
|
+
namespace: mastra-workers
|
|
436
|
+
spec:
|
|
437
|
+
replicas: 1
|
|
438
|
+
selector:
|
|
439
|
+
matchLabels:
|
|
440
|
+
app: background-task-worker
|
|
441
|
+
template:
|
|
442
|
+
metadata:
|
|
443
|
+
labels:
|
|
444
|
+
app: background-task-worker
|
|
445
|
+
spec:
|
|
446
|
+
containers:
|
|
447
|
+
- name: worker
|
|
448
|
+
image: your-registry/mastra-workers:latest
|
|
449
|
+
env:
|
|
450
|
+
- name: MASTRA_WORKERS
|
|
451
|
+
value: backgroundTasks
|
|
452
|
+
envFrom:
|
|
453
|
+
- secretRef:
|
|
454
|
+
name: mastra-secrets
|
|
455
|
+
resources:
|
|
456
|
+
requests:
|
|
457
|
+
cpu: 250m
|
|
458
|
+
memory: 256Mi
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
Apply all manifests and wait for the API to become ready:
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
kubectl apply -f k8s/
|
|
465
|
+
kubectl wait -n mastra-workers --for=condition=ready pod -l app=api --timeout=90s
|
|
466
|
+
kubectl wait -n mastra-workers --for=condition=ready pod -l app=orchestration-worker --timeout=60s
|
|
467
|
+
kubectl wait -n mastra-workers --for=condition=ready pod -l app=scheduler-worker --timeout=60s
|
|
468
|
+
kubectl wait -n mastra-workers --for=condition=ready pod -l app=background-task-worker --timeout=60s
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
4. Verify the stack is running and the API responds:
|
|
472
|
+
|
|
473
|
+
**Docker Compose**:
|
|
181
474
|
|
|
182
475
|
```bash
|
|
183
476
|
docker compose up -d
|
|
@@ -185,6 +478,21 @@ Any [supported storage backend](https://mastra.ai/reference/workers/overview) wo
|
|
|
185
478
|
curl http://localhost:4111/api/agents
|
|
186
479
|
```
|
|
187
480
|
|
|
481
|
+
**Kubernetes**:
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
kubectl get pods -n mastra-workers
|
|
485
|
+
kubectl port-forward -n mastra-workers svc/api 4111:4111
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
In a separate terminal:
|
|
489
|
+
|
|
490
|
+
```bash
|
|
491
|
+
curl http://localhost:4111/api/agents
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
A JSON list of your agents confirms the API and workers are running.
|
|
495
|
+
|
|
188
496
|
## Step execution URL
|
|
189
497
|
|
|
190
498
|
In a fully split deployment, the orchestration worker runs in a separate container from the API. When it processes a workflow event, it delegates step execution to the API over HTTP.
|
|
@@ -203,11 +511,46 @@ Without this variable, the orchestration worker attempts to execute steps in-pro
|
|
|
203
511
|
|
|
204
512
|
The orchestration and background task workers are safe to scale horizontally. PubSub consumer groups distribute events across instances, so each event is processed once:
|
|
205
513
|
|
|
514
|
+
**Docker Compose**:
|
|
515
|
+
|
|
206
516
|
```bash
|
|
207
517
|
docker compose up -d --scale orchestration-worker=3
|
|
208
518
|
docker compose up -d --scale background-task-worker=2
|
|
209
519
|
```
|
|
210
520
|
|
|
521
|
+
**Kubernetes**:
|
|
522
|
+
|
|
523
|
+
```bash
|
|
524
|
+
kubectl scale deployment/orchestration-worker -n mastra-workers --replicas=3
|
|
525
|
+
kubectl scale deployment/background-task-worker -n mastra-workers --replicas=2
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
For automatic scaling, add a HorizontalPodAutoscaler:
|
|
529
|
+
|
|
530
|
+
```yaml
|
|
531
|
+
apiVersion: autoscaling/v2
|
|
532
|
+
kind: HorizontalPodAutoscaler
|
|
533
|
+
metadata:
|
|
534
|
+
name: orchestration-worker
|
|
535
|
+
namespace: mastra-workers
|
|
536
|
+
spec:
|
|
537
|
+
scaleTargetRef:
|
|
538
|
+
apiVersion: apps/v1
|
|
539
|
+
kind: Deployment
|
|
540
|
+
name: orchestration-worker
|
|
541
|
+
minReplicas: 1
|
|
542
|
+
maxReplicas: 10
|
|
543
|
+
metrics:
|
|
544
|
+
- type: Resource
|
|
545
|
+
resource:
|
|
546
|
+
name: cpu
|
|
547
|
+
target:
|
|
548
|
+
type: Utilization
|
|
549
|
+
averageUtilization: 70
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
> **Note:** CPU-based autoscaling needs the [metrics-server](https://github.com/kubernetes-sigs/metrics-server) running in the cluster. Managed clusters like GKE, EKS, and AKS include it by default.
|
|
553
|
+
|
|
211
554
|
The API can also scale horizontally behind a load balancer.
|
|
212
555
|
|
|
213
556
|
**Don't scale the scheduler worker.** Run exactly one instance. Multiple schedulers polling the same storage fire duplicate events for the same schedule.
|
|
@@ -229,4 +572,5 @@ Workers recover from crashes because the distributed PubSub backend persists una
|
|
|
229
572
|
- [Workers reference](https://mastra.ai/reference/workers/overview): Configuration details for all worker types
|
|
230
573
|
- [CLI reference](https://mastra.ai/reference/cli/mastra): `mastra worker build` and `mastra worker start`
|
|
231
574
|
- [PubSub](https://mastra.ai/docs/server/pubsub): Event delivery backends
|
|
232
|
-
- [Deploy a Mastra server](https://mastra.ai/docs/deployment/mastra-server): Build output and server configuration
|
|
575
|
+
- [Deploy a Mastra server](https://mastra.ai/docs/deployment/mastra-server): Build output and server configuration
|
|
576
|
+
- [Deploy Mastra to Kubernetes](https://mastra.ai/guides/deployment/kubernetes): Multi-pod deployment with durable agents
|
|
@@ -86,6 +86,8 @@ export const mastra = new Mastra({
|
|
|
86
86
|
|
|
87
87
|
After deploying, Studio is available at the root URL (`https://<your-project>.vercel.app/`) and the API remains at `/api/*`. Studio automatically connects to the API on the same origin, so you don't need additional environment variables.
|
|
88
88
|
|
|
89
|
+
Studio serves its own pages from the CDN, and every other path goes to your server, so routes you add with [`registerApiRoute()`](https://mastra.ai/docs/server/custom-api-routes) stay reachable at their own paths. Avoid giving a custom route a path that Studio already uses (for example `/agents` or `/workflows`), since Studio claims those first.
|
|
90
|
+
|
|
89
91
|
> **Warning:** Once Studio is connected to your Mastra server, it has full access to your agents, workflows, and tools. Be sure to secure it properly in production (e.g. behind authentication, VPN, etc.) to prevent unauthorized access.
|
|
90
92
|
|
|
91
93
|
## Optional overrides
|
|
@@ -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 335 models through Mastra's model router.
|
|
6
6
|
|
|
7
7
|
Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
|
|
8
8
|
|
|
@@ -100,6 +100,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
100
100
|
| `deepseek/deepseek-v3.2` |
|
|
101
101
|
| `deepseek/deepseek-v3.2-exp` |
|
|
102
102
|
| `deepseek/deepseek-v4-flash` |
|
|
103
|
+
| `deepseek/deepseek-v4-flash-0731` |
|
|
103
104
|
| `deepseek/deepseek-v4-pro` |
|
|
104
105
|
| `google/gemini-2.5-flash` |
|
|
105
106
|
| `google/gemini-2.5-flash-image` |
|
|
@@ -164,7 +165,6 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
164
165
|
| `minimax/minimax-m2.7` |
|
|
165
166
|
| `minimax/minimax-m3` |
|
|
166
167
|
| `mistralai/codestral-2508` |
|
|
167
|
-
| `mistralai/devstral-2512` |
|
|
168
168
|
| `mistralai/ministral-14b-2512` |
|
|
169
169
|
| `mistralai/ministral-3b-2512` |
|
|
170
170
|
| `mistralai/ministral-8b-2512` |
|
|
@@ -224,14 +224,12 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
224
224
|
| `openai/gpt-4o-mini` |
|
|
225
225
|
| `openai/gpt-4o-mini-2024-07-18` |
|
|
226
226
|
| `openai/gpt-5` |
|
|
227
|
-
| `openai/gpt-5-codex` |
|
|
228
227
|
| `openai/gpt-5-image` |
|
|
229
228
|
| `openai/gpt-5-image-mini` |
|
|
230
229
|
| `openai/gpt-5-mini` |
|
|
231
230
|
| `openai/gpt-5-nano` |
|
|
232
231
|
| `openai/gpt-5-pro` |
|
|
233
232
|
| `openai/gpt-5.1` |
|
|
234
|
-
| `openai/gpt-5.1-chat` |
|
|
235
233
|
| `openai/gpt-5.1-codex` |
|
|
236
234
|
| `openai/gpt-5.1-codex-max` |
|
|
237
235
|
| `openai/gpt-5.1-codex-mini` |
|
|
@@ -264,12 +262,10 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
264
262
|
| `openai/o1` |
|
|
265
263
|
| `openai/o1-pro` |
|
|
266
264
|
| `openai/o3` |
|
|
267
|
-
| `openai/o3-deep-research` |
|
|
268
265
|
| `openai/o3-mini` |
|
|
269
266
|
| `openai/o3-mini-high` |
|
|
270
267
|
| `openai/o3-pro` |
|
|
271
268
|
| `openai/o4-mini` |
|
|
272
|
-
| `openai/o4-mini-deep-research` |
|
|
273
269
|
| `openai/o4-mini-high` |
|
|
274
270
|
| `openrouter/auto` |
|
|
275
271
|
| `openrouter/bodybuilder` |
|
|
@@ -352,6 +348,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
352
348
|
| `thedrummer/skyfall-36b-v2` |
|
|
353
349
|
| `thedrummer/unslopnemo-12b` |
|
|
354
350
|
| `thinkingmachines/inkling` |
|
|
351
|
+
| `thinkingmachines/inkling-small` |
|
|
355
352
|
| `undi95/remm-slerp-l2-13b` |
|
|
356
353
|
| `upstage/solar-pro-3` |
|
|
357
354
|
| `writer/palmyra-x5` |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Vercel
|
|
4
4
|
|
|
5
|
-
Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access
|
|
5
|
+
Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 310 models through Mastra's model router.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Vercel documentation](https://ai-sdk.dev/providers/ai-sdk-providers).
|
|
8
8
|
|
|
@@ -179,6 +179,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
179
179
|
| `meta/llama-4-maverick` |
|
|
180
180
|
| `meta/llama-4-scout` |
|
|
181
181
|
| `meta/muse-spark-1.1` |
|
|
182
|
+
| `minimax/minimax-h3` |
|
|
182
183
|
| `minimax/minimax-m2` |
|
|
183
184
|
| `minimax/minimax-m2.1` |
|
|
184
185
|
| `minimax/minimax-m2.1-lightning` |
|
|
@@ -296,6 +297,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
296
297
|
| `stepfun/step-3.7-flash` |
|
|
297
298
|
| `tencent/hy3` |
|
|
298
299
|
| `thinkingmachines/inkling` |
|
|
300
|
+
| `thinkingmachines/inkling-small` |
|
|
299
301
|
| `voyage/rerank-2.5` |
|
|
300
302
|
| `voyage/rerank-2.5-lite` |
|
|
301
303
|
| `voyage/voyage-3-large` |
|
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 5154 models from 164 providers through a single API.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# CrossModel
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 47 CrossModel models through Mastra's model router. Authentication is handled automatically using the `CROSSMODEL_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [CrossModel documentation](https://www.crossmodel.ai/docs).
|
|
8
8
|
|
|
@@ -51,6 +51,7 @@ for await (const chunk of stream) {
|
|
|
51
51
|
| `crossmodel/gemini/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 |
|
|
52
52
|
| `crossmodel/gemini/gemini-3.1-pro-preview` | 1.0M | | | | | | $2 | $12 |
|
|
53
53
|
| `crossmodel/gemini/gemini-3.5-flash` | 1.0M | | | | | | $2 | $9 |
|
|
54
|
+
| `crossmodel/gemini/gemini-3.6-flash` | 1.0M | | | | | | $2 | $8 |
|
|
54
55
|
| `crossmodel/minimax/minimax-m2.7` | 205K | | | | | | $0.33 | $1 |
|
|
55
56
|
| `crossmodel/minimax/minimax-m3` | 1.0M | | | | | | $0.33 | $1 |
|
|
56
57
|
| `crossmodel/moonshot/kimi-k2.5` | 262K | | | | | | $0.62 | $3 |
|
|
@@ -63,9 +64,9 @@ for await (const chunk of stream) {
|
|
|
63
64
|
| `crossmodel/openai/gpt-5.4-nano` | 400K | | | | | | $0.20 | $1 |
|
|
64
65
|
| `crossmodel/openai/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
|
|
65
66
|
| `crossmodel/openai/gpt-5.5-pro` | 1.1M | | | | | | $30 | $180 |
|
|
66
|
-
| `crossmodel/openai/gpt-5.6-luna` | 1.1M | | | | | | $
|
|
67
|
+
| `crossmodel/openai/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
|
|
67
68
|
| `crossmodel/openai/gpt-5.6-sol` | 1.1M | | | | | | $5 | $30 |
|
|
68
|
-
| `crossmodel/openai/gpt-5.6-terra` | 1.1M | | | | | | $
|
|
69
|
+
| `crossmodel/openai/gpt-5.6-terra` | 1.1M | | | | | | $2 | $12 |
|
|
69
70
|
| `crossmodel/qwen/qwen3.6-flash` | 1.0M | | | | | | $0.19 | $1 |
|
|
70
71
|
| `crossmodel/qwen/qwen3.6-plus` | 1.0M | | | | | | $0.32 | $2 |
|
|
71
72
|
| `crossmodel/qwen/qwen3.7-max` | 1.0M | | | | | | $2 | $5 |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Charm Hyper
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 23 Charm Hyper models through Mastra's model router. Authentication is handled automatically using the `HYPER_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Charm Hyper documentation](https://hyper.charm.land).
|
|
8
8
|
|
|
@@ -38,19 +38,20 @@ for await (const chunk of stream) {
|
|
|
38
38
|
| ---------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
39
|
| `hyper/deepseek-v4-flash` | 1.0M | | | | | | $0.20 | $0.40 |
|
|
40
40
|
| `hyper/deepseek-v4-pro` | 1.0M | | | | | | $2 | $5 |
|
|
41
|
-
| `hyper/gemma-4-26b-a4b-it` | 256K | | | | | | $0.12 | $0.
|
|
42
|
-
| `hyper/glm-5` | 203K | | | | | | $0.
|
|
41
|
+
| `hyper/gemma-4-26b-a4b-it` | 256K | | | | | | $0.12 | $0.39 |
|
|
42
|
+
| `hyper/glm-5` | 203K | | | | | | $0.86 | $3 |
|
|
43
43
|
| `hyper/glm-5.1` | 203K | | | | | | $2 | $5 |
|
|
44
44
|
| `hyper/glm-5.2` | 1.0M | | | | | | $1 | $4 |
|
|
45
|
-
| `hyper/gpt-oss-120b` | 131K | | | | | | $0.
|
|
45
|
+
| `hyper/gpt-oss-120b` | 131K | | | | | | $0.19 | $0.70 |
|
|
46
46
|
| `hyper/kimi-k2.5` | 262K | | | | | | $0.53 | $3 |
|
|
47
47
|
| `hyper/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
|
|
48
48
|
| `hyper/kimi-k2.7-code` | 256K | | | | | | $0.95 | $4 |
|
|
49
49
|
| `hyper/kimi-k3` | 1.0M | | | | | | $3 | $16 |
|
|
50
50
|
| `hyper/llama-3.3-70b-instruct` | 128K | | | | | | $0.51 | $1 |
|
|
51
51
|
| `hyper/llama-4-maverick-17b-128e-instruct-fp8` | 430K | | | | | | $0.28 | $0.93 |
|
|
52
|
-
| `hyper/minimax-m2.7` | 205K | | | | | | $0.
|
|
53
|
-
| `hyper/
|
|
52
|
+
| `hyper/minimax-m2.7` | 205K | | | | | | $0.42 | $2 |
|
|
53
|
+
| `hyper/minimax-m3` | 512K | | | | | | $0.33 | $1 |
|
|
54
|
+
| `hyper/qwen3-coder-480b-a35b-instruct-int4-mixed-ar` | 106K | | | | | | $0.58 | $2 |
|
|
54
55
|
| `hyper/qwen3-next-80b-a3b-instruct` | 262K | | | | | | $0.12 | $1 |
|
|
55
56
|
| `hyper/qwen3.6-flash` | 1.0M | | | | | | $1 | $4 |
|
|
56
57
|
| `hyper/qwen3.6-max` | 256K | | | | | | $2 | $12 |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# LLM Gateway
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 187 LLM Gateway models through Mastra's model router. Authentication is handled automatically using the `LLMGATEWAY_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [LLM Gateway documentation](https://llmgateway.io/docs).
|
|
8
8
|
|
|
@@ -119,9 +119,9 @@ for await (const chunk of stream) {
|
|
|
119
119
|
| `llmgateway/gpt-5.4-pro` | 1.1M | | | | | | $30 | $180 |
|
|
120
120
|
| `llmgateway/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
|
|
121
121
|
| `llmgateway/gpt-5.5-pro` | 1.1M | | | | | | $30 | $180 |
|
|
122
|
-
| `llmgateway/gpt-5.6-luna` | 1.1M | | | | | | $
|
|
122
|
+
| `llmgateway/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
|
|
123
123
|
| `llmgateway/gpt-5.6-sol` | 1.1M | | | | | | $5 | $30 |
|
|
124
|
-
| `llmgateway/gpt-5.6-terra` | 1.1M | | | | | | $
|
|
124
|
+
| `llmgateway/gpt-5.6-terra` | 1.1M | | | | | | $2 | $12 |
|
|
125
125
|
| `llmgateway/gpt-oss-120b` | 131K | | | | | | $0.03 | $0.14 |
|
|
126
126
|
| `llmgateway/gpt-oss-20b` | 131K | | | | | | $0.04 | $0.15 |
|
|
127
127
|
| `llmgateway/grok-4` | 256K | | | | | | $3 | $15 |
|
|
@@ -136,6 +136,7 @@ for await (const chunk of stream) {
|
|
|
136
136
|
| `llmgateway/grok-build-0-1` | 256K | | | | | | $1 | $2 |
|
|
137
137
|
| `llmgateway/hermes-4-405b` | 131K | | | | | | $1 | $3 |
|
|
138
138
|
| `llmgateway/hermes-4-70b` | 131K | | | | | | $0.13 | $0.40 |
|
|
139
|
+
| `llmgateway/hy3` | 262K | | | | | | $0.14 | $0.58 |
|
|
139
140
|
| `llmgateway/kimi-k2` | 256K | | | | | | $0.57 | $2 |
|
|
140
141
|
| `llmgateway/kimi-k2-thinking` | 262K | | | | | | $0.60 | $3 |
|
|
141
142
|
| `llmgateway/kimi-k2.5` | 262K | | | | | | $0.41 | $2 |
|
|
@@ -59,9 +59,9 @@ for await (const chunk of stream) {
|
|
|
59
59
|
| `openai/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
|
|
60
60
|
| `openai/gpt-5.5-pro` | 1.1M | | | | | | $30 | $180 |
|
|
61
61
|
| `openai/gpt-5.6` | 1.1M | | | | | | $5 | $30 |
|
|
62
|
-
| `openai/gpt-5.6-luna` | 1.1M | | | | | | $
|
|
62
|
+
| `openai/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
|
|
63
63
|
| `openai/gpt-5.6-sol` | 1.1M | | | | | | $5 | $30 |
|
|
64
|
-
| `openai/gpt-5.6-terra` | 1.1M | | | | | | $
|
|
64
|
+
| `openai/gpt-5.6-terra` | 1.1M | | | | | | $2 | $12 |
|
|
65
65
|
| `openai/gpt-image-1-mini` | — | | | | | | — | — |
|
|
66
66
|
| `openai/gpt-image-1.5` | — | | | | | | — | — |
|
|
67
67
|
| `openai/gpt-image-2` | — | | | | | | $5 | $30 |
|