@mastra/mcp-docs-server 1.2.10 → 1.2.11-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agent-controller/channels.md +109 -0
- package/.docs/docs/capabilities/channels/overview.md +1 -0
- package/.docs/docs/deployment/cloud-providers.md +1 -0
- package/.docs/docs/deployment/overview.md +1 -0
- package/.docs/guides/deployment/kubernetes.md +298 -0
- package/.docs/models/gateways/openrouter.md +2 -1
- package/.docs/models/gateways/vercel.md +8 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/ambient.md +2 -2
- package/.docs/models/providers/anthropic.md +1 -1
- package/.docs/models/providers/anyapi.md +1 -1
- package/.docs/models/providers/baseten.md +5 -4
- package/.docs/models/providers/deepinfra.md +5 -4
- package/.docs/models/providers/digitalocean.md +1 -1
- package/.docs/models/providers/fireworks-ai.md +4 -2
- package/.docs/models/providers/google.md +1 -1
- package/.docs/models/providers/huggingface.md +2 -1
- package/.docs/models/providers/llmgateway.md +7 -5
- package/.docs/models/providers/mistral.md +1 -1
- package/.docs/models/providers/nebius.md +2 -1
- package/.docs/models/providers/nvidia.md +1 -1
- package/.docs/models/providers/ollama-cloud.md +2 -1
- package/.docs/models/providers/openai.md +1 -1
- package/.docs/models/providers/opencode-go.md +1 -1
- package/.docs/models/providers/opencode.md +3 -2
- package/.docs/models/providers/poe.md +1 -1
- package/.docs/models/providers/scaleway.md +1 -1
- package/.docs/models/providers/togetherai.md +2 -1
- package/.docs/models/providers/wandb.md +1 -1
- package/.docs/models/providers/xiaomi-token-plan-ams.md +4 -4
- package/.docs/models/providers/xiaomi-token-plan-cn.md +4 -4
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +4 -4
- package/.docs/models/providers/xiaomi.md +4 -4
- package/.docs/reference/agents/channels.md +10 -0
- package/.docs/reference/evals/mastra-scorer.md +56 -0
- package/.docs/reference/storage/duckdb.md +4 -0
- package/CHANGELOG.md +14 -0
- package/package.json +3 -3
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Channels
|
|
4
|
+
|
|
5
|
+
Channels connect an AgentController to messaging platforms like Slack, Discord, and Telegram, so a controller-backed session runs inside a chat thread. Inbound platform messages route into a controller [`Session`](https://mastra.ai/docs/agent-controller/session), and the agent's streamed output renders back to the platform with native streaming, tool approval cards, and typing status.
|
|
6
|
+
|
|
7
|
+
AgentController channels build on the same channel layer as [agent channels](https://mastra.ai/docs/capabilities/channels/overview): the same adapters, the same configuration shape, and the same rendering pipeline. The difference is what receives the message. On an agent, the message goes straight into the agent loop. On an AgentController, the message goes into a durable session that tracks the active mode, model, permission grants, and state across the whole conversation.
|
|
8
|
+
|
|
9
|
+
## Configure a controller
|
|
10
|
+
|
|
11
|
+
Pass a `channels` configuration to the AgentController constructor. It accepts the same shape as the [`Agent` channels option](https://mastra.ai/docs/capabilities/channels/overview):
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
|
+
import { AgentController } from '@mastra/core/agent-controller'
|
|
16
|
+
import { createSlackAdapter } from '@chat-adapter/slack'
|
|
17
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
18
|
+
|
|
19
|
+
const agent = new Agent({
|
|
20
|
+
id: 'assistant',
|
|
21
|
+
name: 'assistant',
|
|
22
|
+
instructions: 'Help the user plan and complete tasks.',
|
|
23
|
+
model: 'anthropic/claude-sonnet-4-6',
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
export const agentController = new AgentController({
|
|
27
|
+
id: 'my-agent-controller',
|
|
28
|
+
agent,
|
|
29
|
+
storage: new LibSQLStore({ url: 'file:./data.db' }),
|
|
30
|
+
modes: [
|
|
31
|
+
{
|
|
32
|
+
id: 'plan',
|
|
33
|
+
name: 'Plan',
|
|
34
|
+
metadata: { default: true },
|
|
35
|
+
instructions: 'Reason about changes before making them.',
|
|
36
|
+
},
|
|
37
|
+
{ id: 'build', name: 'Build', instructions: 'Implement the approved plan.' },
|
|
38
|
+
],
|
|
39
|
+
channels: {
|
|
40
|
+
adapters: {
|
|
41
|
+
slack: createSlackAdapter(),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Register the controller on the Mastra instance. Mastra registers the webhook routes and initializes the channel layer:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { Mastra } from '@mastra/core'
|
|
51
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
52
|
+
import { agentController } from './agent-controller'
|
|
53
|
+
|
|
54
|
+
export const mastra = new Mastra({
|
|
55
|
+
agentControllers: { agentController },
|
|
56
|
+
storage: new LibSQLStore({
|
|
57
|
+
url: process.env.DATABASE_URL,
|
|
58
|
+
}),
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Webhook routes
|
|
63
|
+
|
|
64
|
+
Controller channel webhooks follow the same pattern as agent channels, under an `agent-controllers` path:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
/api/agent-controllers/<CONTROLLER_ID>/channels/<PLATFORM>/webhook
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For example, a Slack adapter on a controller with the `my-agent-controller` ID uses:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
/api/agent-controllers/my-agent-controller/channels/slack/webhook
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Point the platform's webhook, event, or interactions URL to this path. See [Webhook routes](https://mastra.ai/docs/capabilities/channels/overview) for local tunneling and platform setup.
|
|
77
|
+
|
|
78
|
+
## One session per chat thread
|
|
79
|
+
|
|
80
|
+
Each chat thread maps to one durable controller session. The first message in a Slack or Discord thread creates a Mastra thread and a controller session keyed to it; every later message in that chat thread reuses both. The session carries the active mode, model, permission grants, and state for the life of the conversation, just like a session driven from a terminal or web UI.
|
|
81
|
+
|
|
82
|
+
By default the session key derives from the platform and the external thread ID (`channel:slack:<THREAD_ID>`). Pass `resolveResourceId` in the channels configuration to control the mapping yourself.
|
|
83
|
+
|
|
84
|
+
Avoid mapping multiple active chat threads to one session. A session works on one Mastra thread at a time, and a message arriving from a different chat thread rebinds the session to that thread, which cancels any run still in flight on the previous one.
|
|
85
|
+
|
|
86
|
+
## Tool approvals
|
|
87
|
+
|
|
88
|
+
Tools that require approval render as interactive cards with Approve and Deny buttons, the same as [agent channel tool approvals](https://mastra.ai/docs/capabilities/channels/overview). The controller run pauses at the session's approval gate until a user acts on the card, then resumes and streams the continuation back to the thread.
|
|
89
|
+
|
|
90
|
+
Two behaviors follow from routing approvals through the session:
|
|
91
|
+
|
|
92
|
+
- A new message in the thread while an approval is pending declines that approval, the same as sending a new message in a terminal session. The new message supersedes the pending ask.
|
|
93
|
+
- On adapters that can't render approval buttons (`toolDisplay: 'text'`), tools run without approval prompts so runs can't stall on a card nobody can act on.
|
|
94
|
+
|
|
95
|
+
See [Tool approvals and permissions](https://mastra.ai/docs/agent-controller/tool-approvals) for policies, categories, and session grants.
|
|
96
|
+
|
|
97
|
+
## Limits
|
|
98
|
+
|
|
99
|
+
- Adapters can be constructed manually as shown above. The managed connect flow (`mastra.channels.slack.connect(...)`) also supports controller-owned installations — call it with an options object (`connect({ id, name })`) to connect a controller that has no registered agent. Adapters without controller support must still be constructed manually.
|
|
100
|
+
- Controller sessions are in-memory objects, so channels-backed controllers need a long-lived server. Serverless deployment isn't supported for controller channels; agent channels support it as described in [Serverless deployment](https://mastra.ai/docs/capabilities/channels/overview).
|
|
101
|
+
- Pending tool approvals don't survive a server restart. An approval card acted on after a restart is ignored as stale.
|
|
102
|
+
- Mode switching from chat (for example, a `/mode` slash command) isn't available yet.
|
|
103
|
+
|
|
104
|
+
## Related
|
|
105
|
+
|
|
106
|
+
- [Channels overview](https://mastra.ai/docs/capabilities/channels/overview)
|
|
107
|
+
- [Session](https://mastra.ai/docs/agent-controller/session)
|
|
108
|
+
- [Tool approvals and permissions](https://mastra.ai/docs/agent-controller/tool-approvals)
|
|
109
|
+
- [Channels reference](https://mastra.ai/reference/agents/channels)
|
|
@@ -253,4 +253,5 @@ Vercel's managed Redis integration and Upstash Redis both work well. For more on
|
|
|
253
253
|
## Related
|
|
254
254
|
|
|
255
255
|
- [Channels reference](https://mastra.ai/reference/agents/channels)
|
|
256
|
+
- [AgentController channels](https://mastra.ai/docs/agent-controller/channels)
|
|
256
257
|
- 📹 [Mastra channels workshop](https://www.youtube.com/watch?v=E9KFsZEnQO8\&t=5s)
|
|
@@ -18,5 +18,6 @@ The following guides show how to deploy Mastra to specific cloud providers:
|
|
|
18
18
|
- [Azure App Services](https://mastra.ai/guides/deployment/azure-app-services)
|
|
19
19
|
- [Cloudflare](https://mastra.ai/guides/deployment/cloudflare)
|
|
20
20
|
- [Digital Ocean](https://mastra.ai/guides/deployment/digital-ocean)
|
|
21
|
+
- [Kubernetes](https://mastra.ai/guides/deployment/kubernetes)
|
|
21
22
|
- [Netlify](https://mastra.ai/guides/deployment/netlify)
|
|
22
23
|
- [Vercel](https://mastra.ai/guides/deployment/vercel)
|
|
@@ -48,6 +48,7 @@ Use this option for auto-scaling, minimal infrastructure management, or when you
|
|
|
48
48
|
- [Azure App Services](https://mastra.ai/guides/deployment/azure-app-services)
|
|
49
49
|
- [Cloudflare](https://mastra.ai/guides/deployment/cloudflare)
|
|
50
50
|
- [Digital Ocean](https://mastra.ai/guides/deployment/digital-ocean)
|
|
51
|
+
- [Kubernetes](https://mastra.ai/guides/deployment/kubernetes)
|
|
51
52
|
- [Netlify](https://mastra.ai/guides/deployment/netlify)
|
|
52
53
|
- [Vercel](https://mastra.ai/guides/deployment/vercel)
|
|
53
54
|
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Deploy Mastra to Kubernetes
|
|
4
|
+
|
|
5
|
+
Run a Mastra application across multiple pods on [Kubernetes](https://kubernetes.io/), so it scales horizontally behind a load balancer. Because each pod is a separate process, the pods must share a pub/sub backend and a database, otherwise work started on one pod is invisible to the others.
|
|
6
|
+
|
|
7
|
+
> **Info:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/mastra-server). If you're using a [server adapter](https://mastra.ai/docs/server/server-adapters) or [web framework](https://mastra.ai/docs/deployment/web-framework), deploy the way you normally would for that framework.
|
|
8
|
+
|
|
9
|
+
> **Warning:** Multi-pod support relies on [durable agents](https://mastra.ai/docs/long-running-agents/durable-agents), which are currently in **beta**. APIs may change in minor versions. Read [Known limitations](#known-limitations) before you rely on this in production.
|
|
10
|
+
|
|
11
|
+
## Before you begin
|
|
12
|
+
|
|
13
|
+
You'll need:
|
|
14
|
+
|
|
15
|
+
- A [Mastra application](https://mastra.ai/guides/getting-started/quickstart)
|
|
16
|
+
- A [Kubernetes](https://kubernetes.io/docs/setup/) cluster and [`kubectl`](https://kubernetes.io/docs/tasks/tools/)
|
|
17
|
+
- A container registry your cluster can pull from
|
|
18
|
+
- A shared [Redis](https://redis.io/) instance, reachable from every pod
|
|
19
|
+
- A shared [PostgreSQL](https://www.postgresql.org/) database, reachable from every pod
|
|
20
|
+
|
|
21
|
+
## Why multiple pods need shared infrastructure
|
|
22
|
+
|
|
23
|
+
A single pod keeps run state in its own memory. With one pod that's fine, because every request reaches the same process. Across pods it breaks: a browser might stream from pod A while the user's next request is routed to pod B, and pod B has no record of the run on pod A.
|
|
24
|
+
|
|
25
|
+
Redis and Postgres close that gap:
|
|
26
|
+
|
|
27
|
+
- **Pub/sub** carries events between pods. When an event is published on one pod, the others receive it. Mastra uses [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), which also provides the per-thread leasing that keeps a single pod as the owner of a conversation at a time. See [PubSub](https://mastra.ai/docs/server/pubsub).
|
|
28
|
+
- **Storage** persists run state. [Durable agents](https://mastra.ai/docs/long-running-agents/durable-agents) save each run as a workflow snapshot, so any pod can resume a run from the database after a restart or when a request is routed elsewhere.
|
|
29
|
+
|
|
30
|
+
## Configure shared infrastructure
|
|
31
|
+
|
|
32
|
+
Point the `Mastra` instance at Redis and Postgres. Read the connection details from environment variables so the same image runs in every pod.
|
|
33
|
+
|
|
34
|
+
Install the backends:
|
|
35
|
+
|
|
36
|
+
**npm**:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install @mastra/redis-streams @mastra/pg @mastra/redis ioredis
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**pnpm**:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pnpm add @mastra/redis-streams @mastra/pg @mastra/redis ioredis
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Yarn**:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
yarn add @mastra/redis-streams @mastra/pg @mastra/redis ioredis
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Bun**:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
bun add @mastra/redis-streams @mastra/pg @mastra/redis ioredis
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Configure pub/sub, storage, and a shared cache on the `Mastra` instance:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { Mastra } from '@mastra/core'
|
|
64
|
+
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
65
|
+
import { RedisServerCache } from '@mastra/redis'
|
|
66
|
+
import { PostgresStore } from '@mastra/pg'
|
|
67
|
+
import Redis from 'ioredis'
|
|
68
|
+
|
|
69
|
+
export const mastra = new Mastra({
|
|
70
|
+
// Carries events between pods, and provides
|
|
71
|
+
// per-thread leases so one pod owns a conversation at a time.
|
|
72
|
+
pubsub: new RedisStreamsPubSub({
|
|
73
|
+
url: process.env.REDIS_URL!,
|
|
74
|
+
}),
|
|
75
|
+
// Persists run state so any pod can resume a run.
|
|
76
|
+
storage: new PostgresStore({
|
|
77
|
+
id: 'mastra-storage',
|
|
78
|
+
connectionString: process.env.DATABASE_URL!,
|
|
79
|
+
}),
|
|
80
|
+
// Shared event cache so a reconnecting client can replay missed chunks
|
|
81
|
+
// from any pod, not only the one that started the run.
|
|
82
|
+
cache: new RedisServerCache({ client: new Redis(process.env.REDIS_URL!) }),
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The `cache` is what makes resumable streams work across pods. A reconnecting client replays missed events from this cache, so it must be shared. The default in-memory cache only serves replays within one process.
|
|
87
|
+
|
|
88
|
+
## Use durable agents
|
|
89
|
+
|
|
90
|
+
A plain [`Agent`](https://mastra.ai/docs/agents/overview) keeps its stream and approval state in one pod's memory, so those don't survive a request landing on another pod. A [durable agent](https://mastra.ai/docs/long-running-agents/durable-agents) runs the agentic loop inside a workflow and persists its state, so any pod can observe or resume the same run.
|
|
91
|
+
|
|
92
|
+
Wrap the agent with `createDurableAgent()`:
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import { Agent } from '@mastra/core/agent'
|
|
96
|
+
import { createDurableAgent } from '@mastra/core/agent/durable'
|
|
97
|
+
|
|
98
|
+
const agent = new Agent({
|
|
99
|
+
id: 'assistant',
|
|
100
|
+
name: 'Assistant',
|
|
101
|
+
instructions: 'You are a helpful assistant.',
|
|
102
|
+
model: 'openai/gpt-5.5',
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
export const durableAssistant = createDurableAgent({ agent })
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Register the durable agent with the `Mastra` instance above. Its run state now lives in Postgres and its events flow through Redis, so the run is reachable from every pod.
|
|
109
|
+
|
|
110
|
+
## Deploy
|
|
111
|
+
|
|
112
|
+
1. Build and containerize the Mastra server, then push the image to your registry. Follow the [Mastra server](https://mastra.ai/docs/server/mastra-server) guide for the build, and ensure the server reads `process.env.PORT` and listens on `0.0.0.0`.
|
|
113
|
+
|
|
114
|
+
2. Store the shared connection strings as a Secret:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
kubectl create secret generic mastra-secrets \
|
|
118
|
+
--from-literal=REDIS_URL='redis://redis:6379' \
|
|
119
|
+
--from-literal=DATABASE_URL='postgresql://user:pass@postgres:5432/mastra'
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
3. Apply a Deployment that runs the image, reading the shared Secret. Start with one replica so the first pod creates the database schema on its own, then scale up in the next step:
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
apiVersion: apps/v1
|
|
126
|
+
kind: Deployment
|
|
127
|
+
metadata:
|
|
128
|
+
name: mastra
|
|
129
|
+
spec:
|
|
130
|
+
replicas: 1
|
|
131
|
+
selector:
|
|
132
|
+
matchLabels:
|
|
133
|
+
app: mastra
|
|
134
|
+
template:
|
|
135
|
+
metadata:
|
|
136
|
+
labels:
|
|
137
|
+
app: mastra
|
|
138
|
+
spec:
|
|
139
|
+
containers:
|
|
140
|
+
- name: mastra
|
|
141
|
+
image: your-registry/mastra:latest
|
|
142
|
+
ports:
|
|
143
|
+
- containerPort: 8080
|
|
144
|
+
env:
|
|
145
|
+
- name: PORT
|
|
146
|
+
value: '8080'
|
|
147
|
+
envFrom:
|
|
148
|
+
- secretRef:
|
|
149
|
+
name: mastra-secrets
|
|
150
|
+
readinessProbe:
|
|
151
|
+
tcpSocket:
|
|
152
|
+
port: 8080
|
|
153
|
+
livenessProbe:
|
|
154
|
+
tcpSocket:
|
|
155
|
+
port: 8080
|
|
156
|
+
resources:
|
|
157
|
+
requests:
|
|
158
|
+
cpu: 500m
|
|
159
|
+
memory: 512Mi
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The `resources.requests.cpu` value is required for the HorizontalPodAutoscaler below. Kubernetes calculates CPU utilization as usage divided by the requested amount, so without a CPU request the autoscaler can't compute a target and won't scale.
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
kubectl apply -f deployment.yaml
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Once the first pod is ready, scale up:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
kubectl wait --for=condition=available deployment/mastra
|
|
172
|
+
kubectl scale deployment/mastra --replicas=3
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
> **Note:** Every replica runs the same image and connects to the same Redis and Postgres. That shared infrastructure, not the pod count, is what lets runs cross pods.
|
|
176
|
+
|
|
177
|
+
4. Expose the Deployment with a Service:
|
|
178
|
+
|
|
179
|
+
```yaml
|
|
180
|
+
apiVersion: v1
|
|
181
|
+
kind: Service
|
|
182
|
+
metadata:
|
|
183
|
+
name: mastra
|
|
184
|
+
spec:
|
|
185
|
+
selector:
|
|
186
|
+
app: mastra
|
|
187
|
+
ports:
|
|
188
|
+
- port: 80
|
|
189
|
+
targetPort: 8080
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
kubectl apply -f service.yaml
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
5. Scale the replicas automatically with a HorizontalPodAutoscaler:
|
|
197
|
+
|
|
198
|
+
```yaml
|
|
199
|
+
apiVersion: autoscaling/v2
|
|
200
|
+
kind: HorizontalPodAutoscaler
|
|
201
|
+
metadata:
|
|
202
|
+
name: mastra
|
|
203
|
+
spec:
|
|
204
|
+
scaleTargetRef:
|
|
205
|
+
apiVersion: apps/v1
|
|
206
|
+
kind: Deployment
|
|
207
|
+
name: mastra
|
|
208
|
+
minReplicas: 3
|
|
209
|
+
maxReplicas: 10
|
|
210
|
+
metrics:
|
|
211
|
+
- type: Resource
|
|
212
|
+
resource:
|
|
213
|
+
name: cpu
|
|
214
|
+
target:
|
|
215
|
+
type: Utilization
|
|
216
|
+
averageUtilization: 70
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
kubectl apply -f hpa.yaml
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
> **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. Local clusters like kind and minikube don't, so enable it there first (for example, `minikube addons enable metrics-server`).
|
|
224
|
+
|
|
225
|
+
6. Verify the pods are running:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
kubectl get pods -l app=mastra
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Forward the service in one terminal. This command stays in the foreground:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
kubectl port-forward service/mastra 8080:80
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
In a second terminal, call the API:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
curl http://localhost:8080/api/agents
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
A JSON list of your agents means the deployment is serving.
|
|
244
|
+
|
|
245
|
+
> **Warning:** Set up [authentication](https://mastra.ai/docs/server/auth) before exposing your endpoints publicly.
|
|
246
|
+
|
|
247
|
+
## Streaming and reconnection
|
|
248
|
+
|
|
249
|
+
A durable agent publishes stream chunks to a per-run topic through the shared pub/sub. A client that disconnects reconnects by calling `observe()` with the run's ID, and replays the chunks it missed from the shared cache:
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
const { output, cleanup } = await durableAssistant.observe(runId)
|
|
253
|
+
|
|
254
|
+
for await (const chunk of output.fullStream) {
|
|
255
|
+
// Chunks from the run, including any missed while disconnected
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
cleanup()
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Because the run state is in Postgres and the events are in Redis, the reconnecting request can be served by any pod, not only the one that started the run. See [Resumable streams](https://mastra.ai/docs/long-running-agents/durable-agents).
|
|
262
|
+
|
|
263
|
+
Multiple clients can observe the same run at once. Each `observe()` call receives the full stream, so a user watching from two devices, or two people following the same run, stay in sync.
|
|
264
|
+
|
|
265
|
+
## Tool approval across pods
|
|
266
|
+
|
|
267
|
+
A durable agent pauses on a tool call until a human approves it. Because the suspended run is saved to Postgres, the approval can arrive on any pod, not only the one that started the run.
|
|
268
|
+
|
|
269
|
+
Start a run that requires approval:
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
const { runId } = await durableAssistant.stream('Delete the archived records', {
|
|
273
|
+
requireToolApproval: true,
|
|
274
|
+
memory: { thread: 'thread-1', resource: 'user-1' },
|
|
275
|
+
})
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
The run suspends before the tool runs. Approve it later, from any pod:
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
await durableAssistant.resume(runId, { approved: true })
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
The pod that handles the approval loads the suspended run from Postgres. It then runs the approved tool and publishes the result over the shared pub/sub, so a client observing the run receives the continuation. See [Tool approval](https://mastra.ai/docs/long-running-agents/durable-agents).
|
|
285
|
+
|
|
286
|
+
## Known limitations
|
|
287
|
+
|
|
288
|
+
- The default in-process setup keeps run state in one pod's memory and doesn't share it across pods. Use [durable agents](https://mastra.ai/docs/long-running-agents/durable-agents) with shared Redis and Postgres so streaming, approvals, and reconnection work across pods.
|
|
289
|
+
- Cross-pod streaming, approvals, and reconnection require the durable-agent path. A plain agent keeps run state in memory and doesn't resume on another pod.
|
|
290
|
+
- When multiple pods start at once against an uninitialized database, they can race to create the schema and a pod may fail to start. Start with one replica so the schema is created once, then scale up.
|
|
291
|
+
- For a stricter setup, initialize the schema outside the app (for example, a one-off Kubernetes Job) and set `disableInit: true` on the `PostgresStore` in every pod.
|
|
292
|
+
|
|
293
|
+
## Related
|
|
294
|
+
|
|
295
|
+
- [PubSub](https://mastra.ai/docs/server/pubsub)
|
|
296
|
+
- [Durable agents](https://mastra.ai/docs/long-running-agents/durable-agents)
|
|
297
|
+
- [Mastra server](https://mastra.ai/docs/server/mastra-server)
|
|
298
|
+
- [Deployment overview](https://mastra.ai/docs/deployment/overview)
|
|
@@ -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 341 models through Mastra's model router.
|
|
6
6
|
|
|
7
7
|
Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
|
|
8
8
|
|
|
@@ -164,6 +164,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
164
164
|
| `minimax/minimax-m2.7` |
|
|
165
165
|
| `minimax/minimax-m3` |
|
|
166
166
|
| `mistralai/codestral-2508` |
|
|
167
|
+
| `mistralai/devstral-2512` |
|
|
167
168
|
| `mistralai/ministral-14b-2512` |
|
|
168
169
|
| `mistralai/ministral-3b-2512` |
|
|
169
170
|
| `mistralai/ministral-8b-2512` |
|
|
@@ -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 307 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
|
|
|
@@ -80,6 +80,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
80
80
|
| `anthropic/claude-fable-5` |
|
|
81
81
|
| `anthropic/claude-haiku-4.5` |
|
|
82
82
|
| `anthropic/claude-opus-4` |
|
|
83
|
+
| `anthropic/claude-opus-4.1` |
|
|
83
84
|
| `anthropic/claude-opus-4.5` |
|
|
84
85
|
| `anthropic/claude-opus-4.6` |
|
|
85
86
|
| `anthropic/claude-opus-4.7` |
|
|
@@ -209,6 +210,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
209
210
|
| `moonshotai/kimi-k2.7-code` |
|
|
210
211
|
| `moonshotai/kimi-k2.7-code-highspeed` |
|
|
211
212
|
| `moonshotai/kimi-k3` |
|
|
213
|
+
| `moonshotai/kimi-k3-fast` |
|
|
212
214
|
| `morph/morph-v3-fast` |
|
|
213
215
|
| `morph/morph-v3-large` |
|
|
214
216
|
| `nvidia/nemotron-3-nano-30b-a3b` |
|
|
@@ -217,8 +219,10 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
217
219
|
| `nvidia/nemotron-nano-12b-v2-vl` |
|
|
218
220
|
| `nvidia/nemotron-nano-9b-v2` |
|
|
219
221
|
| `openai/gpt-3.5-turbo` |
|
|
222
|
+
| `openai/gpt-4-turbo` |
|
|
220
223
|
| `openai/gpt-4.1` |
|
|
221
224
|
| `openai/gpt-4.1-mini` |
|
|
225
|
+
| `openai/gpt-4.1-nano` |
|
|
222
226
|
| `openai/gpt-4o` |
|
|
223
227
|
| `openai/gpt-4o-mini` |
|
|
224
228
|
| `openai/gpt-4o-mini-search-preview` |
|
|
@@ -260,9 +264,12 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
260
264
|
| `openai/gpt-realtime-2.1` |
|
|
261
265
|
| `openai/gpt-realtime-mini` |
|
|
262
266
|
| `openai/gpt-realtime-whisper` |
|
|
267
|
+
| `openai/o1` |
|
|
263
268
|
| `openai/o3` |
|
|
264
269
|
| `openai/o3-deep-research` |
|
|
270
|
+
| `openai/o3-mini` |
|
|
265
271
|
| `openai/o3-pro` |
|
|
272
|
+
| `openai/o4-mini` |
|
|
266
273
|
| `openai/text-embedding-3-large` |
|
|
267
274
|
| `openai/text-embedding-3-small` |
|
|
268
275
|
| `openai/text-embedding-ada-002` |
|
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 5070 models from 161 providers through a single API.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -36,13 +36,13 @@ for await (const chunk of stream) {
|
|
|
36
36
|
|
|
37
37
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
38
|
| ------------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
-
| `ambient/ambient/large` | 101K | | | | | | $
|
|
39
|
+
| `ambient/ambient/large` | 101K | | | | | | $1 | $4 |
|
|
40
40
|
| `ambient/deepseek/deepseek-v4-flash` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
41
41
|
| `ambient/moonshotai/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
|
|
42
42
|
| `ambient/moonshotai/kimi-k2.7-code` | 262K | | | | | | $0.73 | $4 |
|
|
43
43
|
| `ambient/stepfun/step-3.7-flash` | 262K | | | | | | $0.19 | $1 |
|
|
44
44
|
| `ambient/xiaomi/mimo-v2.5` | 1.0M | | | | | | $0.40 | $2 |
|
|
45
|
-
| `ambient/z-ai/glm-5.2` | 101K | | | | | | $
|
|
45
|
+
| `ambient/z-ai/glm-5.2` | 101K | | | | | | $1 | $4 |
|
|
46
46
|
| `ambient/zai-org/GLM-5.1-FP8` | 203K | | | | | | $1 | $4 |
|
|
47
47
|
| `ambient/zai-org/GLM-5.2-FP8` | 203K | | | | | | $1 | $4 |
|
|
48
48
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Anthropic
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 15 Anthropic models through Mastra's model router. Authentication is handled automatically using the `ANTHROPIC_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Anthropic documentation](https://docs.anthropic.com/en/docs/about-claude/models).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# AnyAPI
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 30 AnyAPI models through Mastra's model router. Authentication is handled automatically using the `ANYAPI_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [AnyAPI documentation](https://docs.anyapi.ai).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Baseten
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 16 Baseten models through Mastra's model router. Authentication is handled automatically using the `BASETEN_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Baseten documentation](https://docs.baseten.co).
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ const agent = new Agent({
|
|
|
17
17
|
id: "my-agent",
|
|
18
18
|
name: "My Agent",
|
|
19
19
|
instructions: "You are a helpful assistant",
|
|
20
|
-
model: "baseten/
|
|
20
|
+
model: "baseten/MiniMaxAI/MiniMax-M2.5"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -40,6 +40,7 @@ for await (const chunk of stream) {
|
|
|
40
40
|
| `baseten/moonshotai/Kimi-K2.5` | 262K | | | | | | $0.60 | $3 |
|
|
41
41
|
| `baseten/moonshotai/Kimi-K2.6` | 262K | | | | | | $0.95 | $4 |
|
|
42
42
|
| `baseten/moonshotai/Kimi-K2.7-Code` | 262K | | | | | | $0.95 | $4 |
|
|
43
|
+
| `baseten/moonshotai/Kimi-K3` | 1.0M | | | | | | $3 | $15 |
|
|
43
44
|
| `baseten/nvidia/Nemotron-120B-A12B` | 203K | | | | | | $0.30 | $0.75 |
|
|
44
45
|
| `baseten/nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B` | 203K | | | | | | $0.60 | $2 |
|
|
45
46
|
| `baseten/openai/gpt-oss-120b` | 128K | | | | | | $0.10 | $0.50 |
|
|
@@ -60,7 +61,7 @@ const agent = new Agent({
|
|
|
60
61
|
name: "custom-agent",
|
|
61
62
|
model: {
|
|
62
63
|
url: "https://inference.baseten.co/v1",
|
|
63
|
-
id: "baseten/
|
|
64
|
+
id: "baseten/MiniMaxAI/MiniMax-M2.5",
|
|
64
65
|
apiKey: process.env.BASETEN_API_KEY,
|
|
65
66
|
headers: {
|
|
66
67
|
"X-Custom-Header": "value"
|
|
@@ -79,7 +80,7 @@ const agent = new Agent({
|
|
|
79
80
|
const useAdvanced = requestContext.task === "complex";
|
|
80
81
|
return useAdvanced
|
|
81
82
|
? "baseten/zai-org/GLM-5.2-Fast"
|
|
82
|
-
: "baseten/
|
|
83
|
+
: "baseten/MiniMaxAI/MiniMax-M2.5";
|
|
83
84
|
}
|
|
84
85
|
});
|
|
85
86
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Deep Infra
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 41 Deep Infra models through Mastra's model router. Authentication is handled automatically using the `DEEPINFRA_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Deep Infra documentation](https://deepinfra.com/models).
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ const agent = new Agent({
|
|
|
17
17
|
id: "my-agent",
|
|
18
18
|
name: "My Agent",
|
|
19
19
|
instructions: "You are a helpful assistant",
|
|
20
|
-
model: "deepinfra/MiniMaxAI/MiniMax-M2.
|
|
20
|
+
model: "deepinfra/MiniMaxAI/MiniMax-M2.5"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -48,6 +48,7 @@ for await (const chunk of stream) {
|
|
|
48
48
|
| `deepinfra/moonshotai/Kimi-K2.5` | 262K | | | | | | $0.45 | $2 |
|
|
49
49
|
| `deepinfra/moonshotai/Kimi-K2.6` | 262K | | | | | | $0.75 | $4 |
|
|
50
50
|
| `deepinfra/moonshotai/Kimi-K2.7-Code` | 262K | | | | | | $0.74 | $4 |
|
|
51
|
+
| `deepinfra/moonshotai/Kimi-K3` | 1.0M | | | | | | $3 | $14 |
|
|
51
52
|
| `deepinfra/nvidia/Nemotron-3-Nano-30B-A3B` | 262K | | | | | | $0.05 | $0.20 |
|
|
52
53
|
| `deepinfra/openai/gpt-oss-120b` | 131K | | | | | | $0.04 | $0.17 |
|
|
53
54
|
| `deepinfra/openai/gpt-oss-20b` | 131K | | | | | | $0.03 | $0.14 |
|
|
@@ -81,7 +82,7 @@ const agent = new Agent({
|
|
|
81
82
|
id: "custom-agent",
|
|
82
83
|
name: "custom-agent",
|
|
83
84
|
model: {
|
|
84
|
-
id: "deepinfra/MiniMaxAI/MiniMax-M2.
|
|
85
|
+
id: "deepinfra/MiniMaxAI/MiniMax-M2.5",
|
|
85
86
|
apiKey: process.env.DEEPINFRA_API_KEY,
|
|
86
87
|
headers: {
|
|
87
88
|
"X-Custom-Header": "value"
|
|
@@ -100,7 +101,7 @@ const agent = new Agent({
|
|
|
100
101
|
const useAdvanced = requestContext.task === "complex";
|
|
101
102
|
return useAdvanced
|
|
102
103
|
? "deepinfra/zai-org/GLM-5.2"
|
|
103
|
-
: "deepinfra/MiniMaxAI/MiniMax-M2.
|
|
104
|
+
: "deepinfra/MiniMaxAI/MiniMax-M2.5";
|
|
104
105
|
}
|
|
105
106
|
});
|
|
106
107
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# DigitalOcean
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 82 DigitalOcean models through Mastra's model router. Authentication is handled automatically using the `DIGITALOCEAN_ACCESS_TOKEN` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [DigitalOcean documentation](https://docs.digitalocean.com/products/gradient-ai-platform/details/models/).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Fireworks AI
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 16 Fireworks AI models through Mastra's model router. Authentication is handled automatically using the `FIREWORKS_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Fireworks AI documentation](https://fireworks.ai/docs/).
|
|
8
8
|
|
|
@@ -43,6 +43,7 @@ for await (const chunk of stream) {
|
|
|
43
43
|
| `fireworks-ai/accounts/fireworks/models/gpt-oss-20b` | 131K | | | | | | $0.07 | $0.30 |
|
|
44
44
|
| `fireworks-ai/accounts/fireworks/models/kimi-k2p6` | 262K | | | | | | $0.95 | $4 |
|
|
45
45
|
| `fireworks-ai/accounts/fireworks/models/kimi-k2p7-code` | 262K | | | | | | $0.95 | $4 |
|
|
46
|
+
| `fireworks-ai/accounts/fireworks/models/kimi-k3` | 1.0M | | | | | | $3 | $15 |
|
|
46
47
|
| `fireworks-ai/accounts/fireworks/models/minimax-m2p7` | 197K | | | | | | $0.30 | $1 |
|
|
47
48
|
| `fireworks-ai/accounts/fireworks/models/minimax-m3` | 512K | | | | | | $0.30 | $1 |
|
|
48
49
|
| `fireworks-ai/accounts/fireworks/models/qwen3p7-plus` | 262K | | | | | | $0.40 | $2 |
|
|
@@ -50,6 +51,7 @@ for await (const chunk of stream) {
|
|
|
50
51
|
| `fireworks-ai/accounts/fireworks/routers/kimi-k2p6-fast` | 262K | | | | | | $2 | $8 |
|
|
51
52
|
| `fireworks-ai/accounts/fireworks/routers/kimi-k2p6-turbo` | 262K | | | | | | $2 | $8 |
|
|
52
53
|
| `fireworks-ai/accounts/fireworks/routers/kimi-k2p7-code-fast` | 262K | | | | | | $2 | $8 |
|
|
54
|
+
| `fireworks-ai/accounts/fireworks/routers/kimi-k3-fast` | 1.0M | | | | | | $5 | $23 |
|
|
53
55
|
|
|
54
56
|
## Advanced configuration
|
|
55
57
|
|
|
@@ -79,7 +81,7 @@ const agent = new Agent({
|
|
|
79
81
|
model: ({ requestContext }) => {
|
|
80
82
|
const useAdvanced = requestContext.task === "complex";
|
|
81
83
|
return useAdvanced
|
|
82
|
-
? "fireworks-ai/accounts/fireworks/routers/kimi-
|
|
84
|
+
? "fireworks-ai/accounts/fireworks/routers/kimi-k3-fast"
|
|
83
85
|
: "fireworks-ai/accounts/fireworks/models/deepseek-v4-flash";
|
|
84
86
|
}
|
|
85
87
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Google
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 41 Google models through Mastra's model router. Authentication is handled automatically using one of the following environment variables: `GOOGLE_API_KEY`, `GOOGLE_GENERATIVE_AI_API_KEY`.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Google documentation](https://ai.google.dev/gemini-api/docs/models).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Hugging Face
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 53 Hugging Face models through Mastra's model router. Authentication is handled automatically using the `HF_TOKEN` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Hugging Face documentation](https://huggingface.co).
|
|
8
8
|
|
|
@@ -55,6 +55,7 @@ for await (const chunk of stream) {
|
|
|
55
55
|
| `huggingface/moonshotai/Kimi-K2.5` | 262K | | | | | | $0.60 | $3 |
|
|
56
56
|
| `huggingface/moonshotai/Kimi-K2.6` | 262K | | | | | | $0.95 | $4 |
|
|
57
57
|
| `huggingface/moonshotai/Kimi-K2.7-Code` | 262K | | | | | | $0.95 | $4 |
|
|
58
|
+
| `huggingface/moonshotai/Kimi-K3` | 1.0M | | | | | | $3 | $15 |
|
|
58
59
|
| `huggingface/openai/gpt-oss-120b` | 131K | | | | | | $0.25 | $0.69 |
|
|
59
60
|
| `huggingface/openai/gpt-oss-20b` | 131K | | | | | | $0.10 | $0.50 |
|
|
60
61
|
| `huggingface/Qwen/Qwen3-235B-A22B` | 41K | | | | | | $0.20 | $0.80 |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# LLM Gateway
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 185 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
|
|
|
@@ -56,7 +56,7 @@ for await (const chunk of stream) {
|
|
|
56
56
|
| `llmgateway/cosmos3-super-reasoner` | 262K | | | | | | $0.10 | $0.30 |
|
|
57
57
|
| `llmgateway/custom` | 128K | | | | | | — | — |
|
|
58
58
|
| `llmgateway/deepseek-v3.2` | 164K | | | | | | $0.26 | $0.38 |
|
|
59
|
-
| `llmgateway/deepseek-v4-flash` | 1.1M | | | | | | $0.
|
|
59
|
+
| `llmgateway/deepseek-v4-flash` | 1.1M | | | | | | $0.08 | $0.15 |
|
|
60
60
|
| `llmgateway/deepseek-v4-pro` | 1.1M | | | | | | $0.43 | $0.87 |
|
|
61
61
|
| `llmgateway/fugu-ultra` | 1.0M | | | | | | $5 | $30 |
|
|
62
62
|
| `llmgateway/gemini-2.5-flash` | 1.0M | | | | | | $0.30 | $3 |
|
|
@@ -71,7 +71,7 @@ for await (const chunk of stream) {
|
|
|
71
71
|
| `llmgateway/gemini-pro-latest` | 1.0M | | | | | | $2 | $12 |
|
|
72
72
|
| `llmgateway/gemma-3-27b` | 110K | | | | | | $0.10 | $0.30 |
|
|
73
73
|
| `llmgateway/gemma-4-26b-a4b-it` | 262K | | | | | | $0.07 | $0.34 |
|
|
74
|
-
| `llmgateway/gemma-4-31b-it` | 262K | | | | | | $0.
|
|
74
|
+
| `llmgateway/gemma-4-31b-it` | 262K | | | | | | $0.10 | $0.30 |
|
|
75
75
|
| `llmgateway/glm-4-32b-0414-128k` | 128K | | | | | | $0.10 | $0.10 |
|
|
76
76
|
| `llmgateway/glm-4.5` | 131K | | | | | | $0.60 | $2 |
|
|
77
77
|
| `llmgateway/glm-4.5-air` | 131K | | | | | | $0.13 | $0.85 |
|
|
@@ -86,7 +86,7 @@ for await (const chunk of stream) {
|
|
|
86
86
|
| `llmgateway/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.40 |
|
|
87
87
|
| `llmgateway/glm-5` | 203K | | | | | | $0.72 | $2 |
|
|
88
88
|
| `llmgateway/glm-5.1` | 205K | | | | | | $0.93 | $3 |
|
|
89
|
-
| `llmgateway/glm-5.2` | 1.0M | | | | | | $
|
|
89
|
+
| `llmgateway/glm-5.2` | 1.0M | | | | | | $0.80 | $3 |
|
|
90
90
|
| `llmgateway/gpt-3.5-turbo` | 16K | | | | | | $0.50 | $2 |
|
|
91
91
|
| `llmgateway/gpt-4` | 8K | | | | | | $30 | $60 |
|
|
92
92
|
| `llmgateway/gpt-4-turbo` | 128K | | | | | | $10 | $30 |
|
|
@@ -96,7 +96,9 @@ for await (const chunk of stream) {
|
|
|
96
96
|
| `llmgateway/gpt-4o` | 128K | | | | | | $3 | $10 |
|
|
97
97
|
| `llmgateway/gpt-4o-mini` | 128K | | | | | | $0.15 | $0.60 |
|
|
98
98
|
| `llmgateway/gpt-4o-mini-search-preview` | 128K | | | | | | $0.15 | $0.60 |
|
|
99
|
+
| `llmgateway/gpt-4o-mini-transcribe` | 16K | | | | | | $1 | $5 |
|
|
99
100
|
| `llmgateway/gpt-4o-search-preview` | 128K | | | | | | $3 | $10 |
|
|
101
|
+
| `llmgateway/gpt-4o-transcribe` | 16K | | | | | | $3 | $10 |
|
|
100
102
|
| `llmgateway/gpt-5` | 400K | | | | | | $1 | $10 |
|
|
101
103
|
| `llmgateway/gpt-5-chat-latest` | 400K | | | | | | $1 | $10 |
|
|
102
104
|
| `llmgateway/gpt-5-mini` | 400K | | | | | | $0.25 | $2 |
|
|
@@ -120,7 +122,7 @@ for await (const chunk of stream) {
|
|
|
120
122
|
| `llmgateway/gpt-5.6-luna` | 1.1M | | | | | | $1 | $6 |
|
|
121
123
|
| `llmgateway/gpt-5.6-sol` | 1.1M | | | | | | $5 | $30 |
|
|
122
124
|
| `llmgateway/gpt-5.6-terra` | 1.1M | | | | | | $3 | $15 |
|
|
123
|
-
| `llmgateway/gpt-oss-120b` | 131K | | | | | | $0.
|
|
125
|
+
| `llmgateway/gpt-oss-120b` | 131K | | | | | | $0.03 | $0.14 |
|
|
124
126
|
| `llmgateway/gpt-oss-20b` | 131K | | | | | | $0.04 | $0.15 |
|
|
125
127
|
| `llmgateway/grok-4` | 256K | | | | | | $3 | $15 |
|
|
126
128
|
| `llmgateway/grok-4-1-fast-non-reasoning` | 2.0M | | | | | | $0.20 | $0.50 |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Mistral
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 30 Mistral models through Mastra's model router. Authentication is handled automatically using the `MISTRAL_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Mistral documentation](https://docs.mistral.ai/getting-started/models/).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Nebius Token Factory
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 33 Nebius Token Factory models through Mastra's model router. Authentication is handled automatically using the `NEBIUS_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Nebius Token Factory documentation](https://docs.tokenfactory.nebius.com/).
|
|
8
8
|
|
|
@@ -42,6 +42,7 @@ for await (const chunk of stream) {
|
|
|
42
42
|
| `nebius/MiniMaxAI/MiniMax-M2.5` | 197K | | | | | | $0.30 | $1 |
|
|
43
43
|
| `nebius/MiniMaxAI/MiniMax-M3` | 1.0M | | | | | | $0.30 | $1 |
|
|
44
44
|
| `nebius/moonshotai/Kimi-K2.7-Code` | 262K | | | | | | $0.95 | $4 |
|
|
45
|
+
| `nebius/moonshotai/Kimi-K3` | 1.0M | | | | | | $3 | $15 |
|
|
45
46
|
| `nebius/NousResearch/Hermes-4-405B` | 128K | | | | | | $1 | $3 |
|
|
46
47
|
| `nebius/NousResearch/Hermes-4-70B` | 128K | | | | | | $0.13 | $0.40 |
|
|
47
48
|
| `nebius/nvidia/Llama-3_1-Nemotron-Ultra-253B-v1` | 128K | | | | | | $0.60 | $2 |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Nvidia
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 84 Nvidia models through Mastra's model router. Authentication is handled automatically using the `NVIDIA_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Nvidia documentation](https://docs.api.nvidia.com/nim/).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Ollama Cloud
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 19 Ollama Cloud models through Mastra's model router. Authentication is handled automatically using the `OLLAMA_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Ollama Cloud documentation](https://docs.ollama.com/cloud).
|
|
8
8
|
|
|
@@ -46,6 +46,7 @@ for await (const chunk of stream) {
|
|
|
46
46
|
| `ollama-cloud/kimi-k2.5` | 262K | | | | | | — | — |
|
|
47
47
|
| `ollama-cloud/kimi-k2.6` | 262K | | | | | | — | — |
|
|
48
48
|
| `ollama-cloud/kimi-k2.7-code` | 262K | | | | | | — | — |
|
|
49
|
+
| `ollama-cloud/kimi-k3` | 1.0M | | | | | | — | — |
|
|
49
50
|
| `ollama-cloud/minimax-m2.5` | 205K | | | | | | — | — |
|
|
50
51
|
| `ollama-cloud/minimax-m2.7` | 197K | | | | | | — | — |
|
|
51
52
|
| `ollama-cloud/minimax-m3` | 512K | | | | | | — | — |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# OpenAI
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 47 OpenAI models through Mastra's model router. Authentication is handled automatically using the `OPENAI_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [OpenAI documentation](https://platform.openai.com/docs/models).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# OpenCode Go
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 22 OpenCode Go models through Mastra's model router. Authentication is handled automatically using the `OPENCODE_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [OpenCode Go documentation](https://opencode.ai/docs/zen).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# OpenCode Zen
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 85 OpenCode Zen models through Mastra's model router. Authentication is handled automatically using the `OPENCODE_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [OpenCode Zen documentation](https://opencode.ai/docs/zen).
|
|
8
8
|
|
|
@@ -85,6 +85,7 @@ for await (const chunk of stream) {
|
|
|
85
85
|
| `opencode/kimi-k2.5` | 262K | | | | | | $0.60 | $3 |
|
|
86
86
|
| `opencode/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
|
|
87
87
|
| `opencode/kimi-k2.7-code` | 262K | | | | | | $0.95 | $4 |
|
|
88
|
+
| `opencode/kimi-k3` | 1.0M | | | | | | $3 | $15 |
|
|
88
89
|
| `opencode/laguna-s-2.1-free` | 256K | | | | | | — | — |
|
|
89
90
|
| `opencode/ling-3.0-flash-free` | 262K | | | | | | — | — |
|
|
90
91
|
| `opencode/mimo-v2.5-free` | 200K | | | | | | — | — |
|
|
@@ -124,7 +125,7 @@ const agent = new Agent({
|
|
|
124
125
|
model: ({ requestContext }) => {
|
|
125
126
|
const useAdvanced = requestContext.task === "complex";
|
|
126
127
|
return useAdvanced
|
|
127
|
-
? "opencode/
|
|
128
|
+
? "opencode/trinity-large-preview-free"
|
|
128
129
|
: "opencode/big-pickle";
|
|
129
130
|
}
|
|
130
131
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Poe
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 137 Poe models through Mastra's model router. Authentication is handled automatically using the `POE_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Poe documentation](https://creator.poe.com/docs/external-applications/openai-compatible-api).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Scaleway
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 17 Scaleway models through Mastra's model router. Authentication is handled automatically using the `SCALEWAY_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Scaleway documentation](https://www.scaleway.com/en/docs/generative-apis/).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Together AI
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 34 Together AI models through Mastra's model router. Authentication is handled automatically using the `TOGETHER_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Together AI documentation](https://docs.together.ai/docs/serverless-models).
|
|
8
8
|
|
|
@@ -45,6 +45,7 @@ for await (const chunk of stream) {
|
|
|
45
45
|
| `togetherai/MiniMaxAI/MiniMax-M3` | 524K | | | | | | $0.30 | $1 |
|
|
46
46
|
| `togetherai/moonshotai/Kimi-K2.6` | 262K | | | | | | $1 | $5 |
|
|
47
47
|
| `togetherai/moonshotai/Kimi-K2.7-Code` | 262K | | | | | | $0.95 | $4 |
|
|
48
|
+
| `togetherai/moonshotai/Kimi-K3` | 1.0M | | | | | | $3 | $15 |
|
|
48
49
|
| `togetherai/nvidia/nemotron-3-ultra-550b-a55b` | 512K | | | | | | $0.60 | $4 |
|
|
49
50
|
| `togetherai/openai/gpt-oss-120b` | 131K | | | | | | $0.15 | $0.60 |
|
|
50
51
|
| `togetherai/openai/gpt-oss-20b` | 131K | | | | | | $0.05 | $0.20 |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Weights & Biases
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 30 Weights & Biases models through Mastra's model router. Authentication is handled automatically using the `WANDB_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Weights & Biases documentation](https://docs.wandb.ai).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Xiaomi Token Plan (Europe)
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 7 Xiaomi Token Plan (Europe) models through Mastra's model router. Authentication is handled automatically using the `XIAOMI_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Xiaomi Token Plan (Europe) documentation](https://platform.xiaomimimo.com/#/docs).
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ const agent = new Agent({
|
|
|
17
17
|
id: "my-agent",
|
|
18
18
|
name: "My Agent",
|
|
19
19
|
instructions: "You are a helpful assistant",
|
|
20
|
-
model: "xiaomi-token-plan-ams/mimo-v2-
|
|
20
|
+
model: "xiaomi-token-plan-ams/mimo-v2-pro"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -53,7 +53,7 @@ const agent = new Agent({
|
|
|
53
53
|
name: "custom-agent",
|
|
54
54
|
model: {
|
|
55
55
|
url: "https://token-plan-ams.xiaomimimo.com/v1",
|
|
56
|
-
id: "xiaomi-token-plan-ams/mimo-v2-
|
|
56
|
+
id: "xiaomi-token-plan-ams/mimo-v2-pro",
|
|
57
57
|
apiKey: process.env.XIAOMI_API_KEY,
|
|
58
58
|
headers: {
|
|
59
59
|
"X-Custom-Header": "value"
|
|
@@ -72,7 +72,7 @@ const agent = new Agent({
|
|
|
72
72
|
const useAdvanced = requestContext.task === "complex";
|
|
73
73
|
return useAdvanced
|
|
74
74
|
? "xiaomi-token-plan-ams/mimo-v2.5-tts-voicedesign"
|
|
75
|
-
: "xiaomi-token-plan-ams/mimo-v2-
|
|
75
|
+
: "xiaomi-token-plan-ams/mimo-v2-pro";
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Xiaomi Token Plan (China)
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 7 Xiaomi Token Plan (China) models through Mastra's model router. Authentication is handled automatically using the `XIAOMI_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Xiaomi Token Plan (China) documentation](https://platform.xiaomimimo.com/#/docs).
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ const agent = new Agent({
|
|
|
17
17
|
id: "my-agent",
|
|
18
18
|
name: "My Agent",
|
|
19
19
|
instructions: "You are a helpful assistant",
|
|
20
|
-
model: "xiaomi-token-plan-cn/mimo-v2-
|
|
20
|
+
model: "xiaomi-token-plan-cn/mimo-v2-pro"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -53,7 +53,7 @@ const agent = new Agent({
|
|
|
53
53
|
name: "custom-agent",
|
|
54
54
|
model: {
|
|
55
55
|
url: "https://token-plan-cn.xiaomimimo.com/v1",
|
|
56
|
-
id: "xiaomi-token-plan-cn/mimo-v2-
|
|
56
|
+
id: "xiaomi-token-plan-cn/mimo-v2-pro",
|
|
57
57
|
apiKey: process.env.XIAOMI_API_KEY,
|
|
58
58
|
headers: {
|
|
59
59
|
"X-Custom-Header": "value"
|
|
@@ -72,7 +72,7 @@ const agent = new Agent({
|
|
|
72
72
|
const useAdvanced = requestContext.task === "complex";
|
|
73
73
|
return useAdvanced
|
|
74
74
|
? "xiaomi-token-plan-cn/mimo-v2.5-tts-voicedesign"
|
|
75
|
-
: "xiaomi-token-plan-cn/mimo-v2-
|
|
75
|
+
: "xiaomi-token-plan-cn/mimo-v2-pro";
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Xiaomi Token Plan (Singapore)
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 7 Xiaomi Token Plan (Singapore) models through Mastra's model router. Authentication is handled automatically using the `XIAOMI_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Xiaomi Token Plan (Singapore) documentation](https://platform.xiaomimimo.com/#/docs).
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ const agent = new Agent({
|
|
|
17
17
|
id: "my-agent",
|
|
18
18
|
name: "My Agent",
|
|
19
19
|
instructions: "You are a helpful assistant",
|
|
20
|
-
model: "xiaomi-token-plan-sgp/mimo-v2-
|
|
20
|
+
model: "xiaomi-token-plan-sgp/mimo-v2-pro"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -53,7 +53,7 @@ const agent = new Agent({
|
|
|
53
53
|
name: "custom-agent",
|
|
54
54
|
model: {
|
|
55
55
|
url: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
56
|
-
id: "xiaomi-token-plan-sgp/mimo-v2-
|
|
56
|
+
id: "xiaomi-token-plan-sgp/mimo-v2-pro",
|
|
57
57
|
apiKey: process.env.XIAOMI_API_KEY,
|
|
58
58
|
headers: {
|
|
59
59
|
"X-Custom-Header": "value"
|
|
@@ -72,7 +72,7 @@ const agent = new Agent({
|
|
|
72
72
|
const useAdvanced = requestContext.task === "complex";
|
|
73
73
|
return useAdvanced
|
|
74
74
|
? "xiaomi-token-plan-sgp/mimo-v2.5-tts-voicedesign"
|
|
75
|
-
: "xiaomi-token-plan-sgp/mimo-v2-
|
|
75
|
+
: "xiaomi-token-plan-sgp/mimo-v2-pro";
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Xiaomi
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 6 Xiaomi models through Mastra's model router. Authentication is handled automatically using the `XIAOMI_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Xiaomi documentation](https://platform.xiaomimimo.com/#/docs).
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ const agent = new Agent({
|
|
|
17
17
|
id: "my-agent",
|
|
18
18
|
name: "My Agent",
|
|
19
19
|
instructions: "You are a helpful assistant",
|
|
20
|
-
model: "xiaomi/mimo-v2
|
|
20
|
+
model: "xiaomi/mimo-v2-flash"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -50,7 +50,7 @@ const agent = new Agent({
|
|
|
50
50
|
name: "custom-agent",
|
|
51
51
|
model: {
|
|
52
52
|
url: "https://api.xiaomimimo.com/v1",
|
|
53
|
-
id: "xiaomi/mimo-v2
|
|
53
|
+
id: "xiaomi/mimo-v2-flash",
|
|
54
54
|
apiKey: process.env.XIAOMI_API_KEY,
|
|
55
55
|
headers: {
|
|
56
56
|
"X-Custom-Header": "value"
|
|
@@ -69,7 +69,7 @@ const agent = new Agent({
|
|
|
69
69
|
const useAdvanced = requestContext.task === "complex";
|
|
70
70
|
return useAdvanced
|
|
71
71
|
? "xiaomi/mimo-v2.5-pro-ultraspeed"
|
|
72
|
-
: "xiaomi/mimo-v2
|
|
72
|
+
: "xiaomi/mimo-v2-flash";
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
```
|
|
@@ -216,9 +216,19 @@ type ChannelHandler = (
|
|
|
216
216
|
thread: Thread,
|
|
217
217
|
message: Message,
|
|
218
218
|
defaultHandler: (thread: Thread, message: Message) => Promise<void>,
|
|
219
|
+
ctx?: ChannelHandlerContext,
|
|
219
220
|
) => Promise<void>
|
|
220
221
|
```
|
|
221
222
|
|
|
223
|
+
`ctx` carries the resolved `mastra` instance, so a handler can reach storage or other registered primitives without being passed an external accessor:
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
onDirectMessage: async (thread, message, defaultHandler, ctx) => {
|
|
227
|
+
const store = await ctx?.mastra?.getStorage()?.getStore('memory')
|
|
228
|
+
await defaultHandler(thread, message)
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
222
232
|
## Resource ID resolution
|
|
223
233
|
|
|
224
234
|
By default a channel thread's memory `resourceId` is `${platform}:${message.author.userId}`. The sender owns the memory, scoped per platform. For apps with a shared identity, such as single sign-on (SSO), this splits memory: the same user gets `feishu:user_123` in a Feishu DM but `user_123` on the web.
|
|
@@ -69,6 +69,62 @@ const result = await scorer.run({
|
|
|
69
69
|
|
|
70
70
|
**generateReasonPrompt** (`string`): Generate reason prompt, if defined (optional).
|
|
71
71
|
|
|
72
|
+
**judge** (`ScorerJudgeResults`): Execution details for prompt-based scorer steps, if any (optional).
|
|
73
|
+
|
|
74
|
+
### Judge results
|
|
75
|
+
|
|
76
|
+
The optional `judge` record contains details about the judge model calls made by prompt-based scorer steps. Its known keys are `preprocess`, `analyze`, `generateScore`, and `generateReason`. Each key contains an ordered `executions` array.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
interface ScorerJudgeExecution {
|
|
80
|
+
prompt: string
|
|
81
|
+
output: JSONValue
|
|
82
|
+
judgeModelId: string
|
|
83
|
+
judgeProvider?: string
|
|
84
|
+
usage: ScorerJudgeUsage
|
|
85
|
+
attemptCount: number
|
|
86
|
+
modelCallCount: number
|
|
87
|
+
durationMs: number
|
|
88
|
+
cost?: {
|
|
89
|
+
amount: number
|
|
90
|
+
unit: string
|
|
91
|
+
source: string
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface ScorerJudgeUsage {
|
|
96
|
+
inputTokens?: number
|
|
97
|
+
outputTokens?: number
|
|
98
|
+
totalTokens?: number
|
|
99
|
+
reasoningTokens?: number
|
|
100
|
+
cachedInputTokens?: number
|
|
101
|
+
cacheCreationInputTokens?: number
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
type ScorerJudgeResults = Partial<
|
|
105
|
+
Record<
|
|
106
|
+
'preprocess' | 'analyze' | 'generateScore' | 'generateReason',
|
|
107
|
+
{ executions: ScorerJudgeExecution[] }
|
|
108
|
+
>
|
|
109
|
+
>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Use the step key to access its judge execution details:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const execution = result.judge?.generateScore?.executions[0]
|
|
116
|
+
|
|
117
|
+
console.log(execution?.judgeModelId)
|
|
118
|
+
console.log(execution?.usage.totalTokens)
|
|
119
|
+
console.log(execution?.durationMs)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`attemptCount` counts judge invocations, including a structured-output fallback. `modelCallCount` counts the completed model steps across those attempts. `durationMs` covers the full prompt-step execution.
|
|
123
|
+
|
|
124
|
+
Function steps don't create `judge` entries. Usage in this record belongs to the scorer's judge model, not the agent or workflow being evaluated. The optional `cost` field is present only when the execution directly reports an authoritative cost, source, and unit.
|
|
125
|
+
|
|
126
|
+
Use Mastra metrics to query aggregate usage, latency, and estimated cost across scorer runs. The `judge` record describes one scorer run and doesn't query metrics or traces.
|
|
127
|
+
|
|
72
128
|
## Step execution flow
|
|
73
129
|
|
|
74
130
|
When you call `.run()`, the MastraScorer executes the defined steps in this order:
|
|
@@ -110,6 +110,10 @@ const duckdb = new DuckDBStore({ path: ':memory:' })
|
|
|
110
110
|
|
|
111
111
|
**path** (`string`): Path to the DuckDB database file. Use :memory: for an ephemeral in-memory database. (Default: `'mastra.duckdb'`)
|
|
112
112
|
|
|
113
|
+
**memoryLimit** (`string`): Maximum memory DuckDB may use, such as '2GB' or '512MB'. Larger-than-memory operations spill to disk for file-backed databases. Raise this for dedicated analytical workloads. (Default: `'2GB'`)
|
|
114
|
+
|
|
115
|
+
**threads** (`number`): Number of threads DuckDB may use. Lower this to keep queries from monopolizing all cores of a shared application server. (Default: `one per CPU core`)
|
|
116
|
+
|
|
113
117
|
### Lower-level types
|
|
114
118
|
|
|
115
119
|
`@mastra/duckdb` also exports `DuckDBConnection` for sharing a single underlying database across multiple Mastra storage instances, and the corresponding `DuckDBStorageConfig` type. Most applications won't need these directly.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.2.11-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`ce93a3c`](https://github.com/mastra-ai/mastra/commit/ce93a3c114ea1cbfbd576f3db41d7c26c9844f5b), [`5718a22`](https://github.com/mastra-ai/mastra/commit/5718a229281dcfd36bcd1f42a242e3717e510a33), [`5807d3a`](https://github.com/mastra-ai/mastra/commit/5807d3ae1d259b8b7d6df7e5bf2b485c694af9c8), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`5718a22`](https://github.com/mastra-ai/mastra/commit/5718a229281dcfd36bcd1f42a242e3717e510a33), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`d1b7e3a`](https://github.com/mastra-ai/mastra/commit/d1b7e3a978a309a5653eeaa490d2d6c7c53bd093), [`c093146`](https://github.com/mastra-ai/mastra/commit/c0931466404d3c521308ea119cb165bb7e695155)]:
|
|
8
|
+
- @mastra/core@1.54.0-alpha.1
|
|
9
|
+
|
|
10
|
+
## 1.2.11-alpha.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`0dca9d0`](https://github.com/mastra-ai/mastra/commit/0dca9d0b1356024a53b72ea6f040db528b126caa)]:
|
|
15
|
+
- @mastra/core@1.54.0-alpha.0
|
|
16
|
+
|
|
3
17
|
## 1.2.10
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.11-alpha.3",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"jsdom": "^26.1.0",
|
|
29
29
|
"local-pkg": "^1.1.2",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@mastra/core": "1.
|
|
31
|
+
"@mastra/core": "1.54.0-alpha.1",
|
|
32
32
|
"@mastra/mcp": "^1.15.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"vitest": "4.1.10",
|
|
48
48
|
"@internal/types-builder": "0.0.92",
|
|
49
49
|
"@internal/lint": "0.0.117",
|
|
50
|
-
"@mastra/core": "1.
|
|
50
|
+
"@mastra/core": "1.54.0-alpha.1"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://mastra.ai",
|
|
53
53
|
"repository": {
|