@mastra/mcp-docs-server 1.3.6-alpha.1 → 1.3.6-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/agents/human-in-the-loop.md +5 -3
- package/.docs/docs/agents/processors.md +7 -3
- package/.docs/docs/agents/tools.md +24 -0
- package/.docs/docs/memory/memory-processors.md +2 -5
- package/.docs/docs/memory/semantic-recall.md +2 -2
- package/.docs/docs/memory/working-memory.md +16 -0
- package/.docs/docs/subagents.md +10 -8
- package/.docs/docs/workflows/control-flow.md +1 -1
- package/.docs/integrations/agentic-ui/ai-sdk-ui.md +60 -0
- package/.docs/models/gateways/merge-gateway.md +2 -1
- package/.docs/models/gateways/netlify.md +2 -1
- package/.docs/models/gateways/openrouter.md +2 -1
- package/.docs/models/gateways/vercel.md +3 -4
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba.md +1 -1
- package/.docs/models/providers/anthropic.md +4 -3
- package/.docs/models/providers/berget.md +1 -1
- package/.docs/models/providers/coralbricks.md +1 -2
- package/.docs/models/providers/cortecs.md +3 -1
- package/.docs/models/providers/edenai.md +5 -3
- package/.docs/models/providers/kilo.md +12 -11
- package/.docs/models/providers/llmgateway-providers.md +4 -1
- package/.docs/models/providers/llmgateway.md +2 -1
- package/.docs/models/providers/mistral.md +9 -16
- package/.docs/models/providers/nano-gpt.md +3 -3
- package/.docs/models/providers/ollama-cloud.md +2 -1
- package/.docs/models/providers/opencode-go.md +5 -4
- package/.docs/models/providers/opencode.md +2 -1
- package/.docs/models/providers/requesty.md +2 -2
- package/.docs/reference/agents/generate.md +1 -1
- package/.docs/reference/classifier/classifier.md +35 -35
- package/.docs/reference/client-js/memory.md +12 -0
- package/.docs/reference/configuration.md +2 -2
- package/.docs/reference/connect/providers.md +118 -112
- package/.docs/reference/core/getClassifier.md +1 -1
- package/.docs/reference/editor/processor-provider.md +2 -2
- package/.docs/reference/evals/create-classifier-scorer.md +5 -5
- package/.docs/reference/logging/pino-logger.md +1 -1
- package/.docs/reference/memory/deleteMessages.md +1 -1
- package/.docs/reference/memory/memory-class.md +2 -2
- package/.docs/reference/migrations/upgrade-to-v1/memory.md +1 -1
- package/.docs/reference/processors/classifier-processor.md +6 -6
- package/.docs/reference/processors/message-history-processor.md +3 -2
- package/.docs/reference/processors/model-selection-processor.md +11 -11
- package/.docs/reference/processors/response-cache.md +1 -1
- package/.docs/reference/processors/semantic-recall-processor.md +2 -3
- package/.docs/reference/processors/working-memory-processor.md +3 -2
- package/.docs/reference/pubsub/unix-socket-pubsub.md +6 -2
- package/.docs/reference/rag/metadata-filters.md +1 -1
- package/.docs/reference/rag/vector-databases.md +1 -1
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/workflows/step.md +1 -1
- package/package.json +6 -6
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# LLM Gateway
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 447 LLM Gateway models through Mastra's model router. Authentication is handled automatically using the `LLMGATEWAY_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [LLM Gateway documentation](https://llmgateway.io/docs).
|
|
10
10
|
|
|
@@ -74,6 +74,7 @@ for await (const chunk of stream) {
|
|
|
74
74
|
| `llmgateway-providers/anthropic/claude-fable-5-1` | 1.0M | | | | | | $10 | $50 |
|
|
75
75
|
| `llmgateway-providers/anthropic/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
|
|
76
76
|
| `llmgateway-providers/anthropic/claude-haiku-4-5-20251001` | 200K | | | | | | $1 | $5 |
|
|
77
|
+
| `llmgateway-providers/anthropic/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
|
|
77
78
|
| `llmgateway-providers/anthropic/claude-opus-4-5-20251101` | 200K | | | | | | $5 | $25 |
|
|
78
79
|
| `llmgateway-providers/anthropic/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 |
|
|
79
80
|
| `llmgateway-providers/anthropic/claude-opus-4-7` | 1.0M | | | | | | $5 | $25 |
|
|
@@ -90,6 +91,7 @@ for await (const chunk of stream) {
|
|
|
90
91
|
| `llmgateway-providers/aws-bedrock/claude-fable-5-1` | 1.0M | | | | | | $10 | $50 |
|
|
91
92
|
| `llmgateway-providers/aws-bedrock/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
|
|
92
93
|
| `llmgateway-providers/aws-bedrock/claude-haiku-4-5-20251001` | 200K | | | | | | $1 | $5 |
|
|
94
|
+
| `llmgateway-providers/aws-bedrock/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
|
|
93
95
|
| `llmgateway-providers/aws-bedrock/claude-opus-4-1-20250805` | 200K | | | | | | $15 | $75 |
|
|
94
96
|
| `llmgateway-providers/aws-bedrock/claude-opus-4-5-20251101` | 200K | | | | | | $5 | $25 |
|
|
95
97
|
| `llmgateway-providers/aws-bedrock/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 |
|
|
@@ -220,6 +222,7 @@ for await (const chunk of stream) {
|
|
|
220
222
|
| `llmgateway-providers/embercloud/kimi-k2.5` | 262K | | | | | | $0.41 | $2 |
|
|
221
223
|
| `llmgateway-providers/embercloud/qwen3-coder-next` | 262K | | | | | | $0.11 | $0.68 |
|
|
222
224
|
| `llmgateway-providers/entrim/deepseek-v4.1-flash` | 1.0M | | | | | | $0.20 | $0.60 |
|
|
225
|
+
| `llmgateway-providers/entrim/glm-5.3-flash` | 1.0M | | | | | | $0.10 | $0.35 |
|
|
223
226
|
| `llmgateway-providers/fireworks/deepseek-v4-flash` | 1.0M | | | | | | $0.22 | $0.66 |
|
|
224
227
|
| `llmgateway-providers/fireworks/deepseek-v4-pro` | 1.0M | | | | | | $1 | $4 |
|
|
225
228
|
| `llmgateway-providers/fireworks/deepseek-v4.1-flash` | 1.0M | | | | | | $0.22 | $0.66 |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# DevPass (LLM Gateway)
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 218 DevPass (LLM Gateway) models through Mastra's model router. Authentication is handled automatically using the `LLMGATEWAY_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [DevPass (LLM Gateway) documentation](https://llmgateway.io/docs).
|
|
10
10
|
|
|
@@ -44,6 +44,7 @@ for await (const chunk of stream) {
|
|
|
44
44
|
| `llmgateway/claude-fable-5-1` | 1.0M | | | | | | $10 | $50 |
|
|
45
45
|
| `llmgateway/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
|
|
46
46
|
| `llmgateway/claude-haiku-4-5-20251001` | 200K | | | | | | $1 | $5 |
|
|
47
|
+
| `llmgateway/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
|
|
47
48
|
| `llmgateway/claude-opus-4-1-20250805` | 200K | | | | | | $15 | $75 |
|
|
48
49
|
| `llmgateway/claude-opus-4-5-20251101` | 200K | | | | | | $5 | $25 |
|
|
49
50
|
| `llmgateway/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Mistral
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 42 Mistral models through Mastra's model router. Authentication is handled automatically using the `MISTRAL_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Mistral documentation](https://docs.mistral.ai/getting-started/models/).
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ const agent = new Agent({
|
|
|
19
19
|
id: "my-agent",
|
|
20
20
|
name: "My Agent",
|
|
21
21
|
instructions: "You are a helpful assistant",
|
|
22
|
-
model: "mistral/codestral-
|
|
22
|
+
model: "mistral/codestral-2508"
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
// Generate a response
|
|
@@ -36,32 +36,25 @@ for await (const chunk of stream) {
|
|
|
36
36
|
|
|
37
37
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
38
|
| --------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `mistral/codestral-2508` | 256K | | | | | | $0.30 | $0.90 |
|
|
39
40
|
| `mistral/codestral-latest` | 256K | | | | | | $0.30 | $0.90 |
|
|
40
|
-
| `mistral/
|
|
41
|
+
| `mistral/ministral-14b-2512` | 262K | | | | | | $0.20 | $0.20 |
|
|
42
|
+
| `mistral/ministral-3b-2512` | 131K | | | | | | $0.10 | $0.10 |
|
|
41
43
|
| `mistral/ministral-3b-latest` | 131K | | | | | | $0.04 | $0.04 |
|
|
44
|
+
| `mistral/ministral-8b-2512` | 262K | | | | | | $0.15 | $0.15 |
|
|
42
45
|
| `mistral/ministral-8b-latest` | 262K | | | | | | $0.10 | $0.10 |
|
|
43
46
|
| `mistral/mistral-embed` | 8K | | | | | | $0.10 | — |
|
|
44
|
-
| `mistral/mistral-large-2411` | 131K | | | | | | $2 | $6 |
|
|
45
47
|
| `mistral/mistral-large-2512` | 262K | | | | | | $0.50 | $2 |
|
|
46
48
|
| `mistral/mistral-large-4` | 524K | | | | | | $0.68 | $2 |
|
|
47
49
|
| `mistral/mistral-large-latest` | 262K | | | | | | $0.50 | $2 |
|
|
48
|
-
| `mistral/mistral-medium-2505` | 131K | | | | | | $0.40 | $2 |
|
|
49
|
-
| `mistral/mistral-medium-2508` | 262K | | | | | | $0.40 | $2 |
|
|
50
50
|
| `mistral/mistral-medium-2604` | 262K | | | | | | $2 | $8 |
|
|
51
51
|
| `mistral/mistral-medium-latest` | 262K | | | | | | $2 | $8 |
|
|
52
|
-
| `mistral/mistral-nemo` | 128K | | | | | | $0.15 | $0.15 |
|
|
53
|
-
| `mistral/mistral-small-2506` | 128K | | | | | | $0.10 | $0.30 |
|
|
54
52
|
| `mistral/mistral-small-2603` | 262K | | | | | | $0.15 | $0.60 |
|
|
55
53
|
| `mistral/mistral-small-latest` | 262K | | | | | | $0.15 | $0.60 |
|
|
56
|
-
| `mistral/open-mistral-7b` | 8K | | | | | | $0.25 | $0.25 |
|
|
57
|
-
| `mistral/open-mixtral-8x22b` | 64K | | | | | | $2 | $6 |
|
|
58
|
-
| `mistral/open-mixtral-8x7b` | 32K | | | | | | $0.70 | $0.70 |
|
|
59
|
-
| `mistral/pixtral-12b` | 128K | | | | | | $0.15 | $0.15 |
|
|
60
|
-
| `mistral/pixtral-large-latest` | 128K | | | | | | $2 | $6 |
|
|
61
54
|
| `mistral/voxtral-mini-latest` | — | | | | | | — | — |
|
|
62
55
|
| `mistral/voxtral-mini-tts-latest` | — | | | | | | — | — |
|
|
56
|
+
| `mistral/voxtral-small-2507` | 33K | | | | | | $0.10 | $0.40 |
|
|
63
57
|
| `mistral/voxtral-small-latest` | 33K | | | | | | $0.10 | $0.30 |
|
|
64
|
-
| `mistral/zai-glm-5-2` | 1.0M | | | | | | $1 | $4 |
|
|
65
58
|
| `mistral/zai-glm-5-3` | 1.0M | | | | | | $1 | $4 |
|
|
66
59
|
|
|
67
60
|
Model availability, capabilities, context windows, and pricing are sourced from [models.dev](https://models.dev) and may change.
|
|
@@ -76,7 +69,7 @@ const agent = new Agent({
|
|
|
76
69
|
name: "custom-agent",
|
|
77
70
|
model: {
|
|
78
71
|
url: "https://api.mistral.ai/v1",
|
|
79
|
-
id: "mistral/codestral-
|
|
72
|
+
id: "mistral/codestral-2508",
|
|
80
73
|
apiKey: process.env.MISTRAL_API_KEY,
|
|
81
74
|
headers: {
|
|
82
75
|
"X-Custom-Header": "value"
|
|
@@ -95,7 +88,7 @@ const agent = new Agent({
|
|
|
95
88
|
const useAdvanced = requestContext.task === "complex";
|
|
96
89
|
return useAdvanced
|
|
97
90
|
? "mistral/zai-glm-5-3"
|
|
98
|
-
: "mistral/codestral-
|
|
91
|
+
: "mistral/codestral-2508";
|
|
99
92
|
}
|
|
100
93
|
});
|
|
101
94
|
```
|
|
@@ -59,6 +59,7 @@ for await (const chunk of stream) {
|
|
|
59
59
|
| `nano-gpt/anthropic/claude-fable-latest` | 1.0M | | | | | | $10 | $50 |
|
|
60
60
|
| `nano-gpt/anthropic/claude-haiku-4.5` | 200K | | | | | | $1 | $5 |
|
|
61
61
|
| `nano-gpt/anthropic/claude-haiku-4.5:thinking` | 200K | | | | | | $1 | $5 |
|
|
62
|
+
| `nano-gpt/anthropic/claude-haiku-5.5` | 1.0M | | | | | | $0.10 | $0.50 |
|
|
62
63
|
| `nano-gpt/anthropic/claude-haiku-latest` | 200K | | | | | | $1 | $5 |
|
|
63
64
|
| `nano-gpt/anthropic/claude-opus-4.1` | 200K | | | | | | $15 | $75 |
|
|
64
65
|
| `nano-gpt/anthropic/claude-opus-4.1:thinking` | 200K | | | | | | $15 | $75 |
|
|
@@ -132,6 +133,8 @@ for await (const chunk of stream) {
|
|
|
132
133
|
| `nano-gpt/deepseek/deepseek-v3.2` | 163K | | | | | | $0.28 | $0.42 |
|
|
133
134
|
| `nano-gpt/deepseek/deepseek-v3.2:thinking` | 163K | | | | | | $0.28 | $0.42 |
|
|
134
135
|
| `nano-gpt/deepseek/deepseek-v4-flash` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
136
|
+
| `nano-gpt/deepseek/deepseek-v4-flash-0423` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
137
|
+
| `nano-gpt/deepseek/deepseek-v4-flash-0423:thinking` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
135
138
|
| `nano-gpt/deepseek/deepseek-v4-flash-0731` | 1.0M | | | | | | $0.05 | $0.16 |
|
|
136
139
|
| `nano-gpt/deepseek/deepseek-v4-flash-0731:thinking` | 1.0M | | | | | | $0.05 | $0.16 |
|
|
137
140
|
| `nano-gpt/deepseek/deepseek-v4-flash-latest` | 1.0M | | | | | | $0.05 | $0.16 |
|
|
@@ -147,8 +150,6 @@ for await (const chunk of stream) {
|
|
|
147
150
|
| `nano-gpt/doubao-1.5-pro-256k` | 256K | | | | | | $0.80 | $1 |
|
|
148
151
|
| `nano-gpt/doubao-1.5-pro-32k` | 32K | | | | | | $0.13 | $0.33 |
|
|
149
152
|
| `nano-gpt/doubao-1.5-vision-pro-32k` | 32K | | | | | | $0.46 | $1 |
|
|
150
|
-
| `nano-gpt/doubao-seed-1-6-250615` | 256K | | | | | | $0.20 | $0.51 |
|
|
151
|
-
| `nano-gpt/doubao-seed-1-6-flash-250615` | 256K | | | | | | $0.04 | $0.37 |
|
|
152
153
|
| `nano-gpt/doubao-seed-2-0-code-preview-260215` | 256K | | | | | | $0.78 | $4 |
|
|
153
154
|
| `nano-gpt/doubao-seed-2-0-lite-260215` | 256K | | | | | | $0.15 | $0.87 |
|
|
154
155
|
| `nano-gpt/doubao-seed-2-0-mini-260215` | 256K | | | | | | $0.05 | $0.48 |
|
|
@@ -158,7 +159,6 @@ for await (const chunk of stream) {
|
|
|
158
159
|
| `nano-gpt/ernie-5.0-thinking-preview` | 128K | | | | | | $1 | $4 |
|
|
159
160
|
| `nano-gpt/ernie-5.1` | 119K | | | | | | $0.75 | $3 |
|
|
160
161
|
| `nano-gpt/ernie-5.1:thinking` | 119K | | | | | | $0.75 | $3 |
|
|
161
|
-
| `nano-gpt/ernie-x1.1-preview` | 64K | | | | | | $0.15 | $0.60 |
|
|
162
162
|
| `nano-gpt/EVA-UNIT-01/EVA-LLaMA-3.33-70B-v0.0` | 33K | | | | | | $2 | $2 |
|
|
163
163
|
| `nano-gpt/EVA-UNIT-01/EVA-LLaMA-3.33-70B-v0.1` | 33K | | | | | | $2 | $2 |
|
|
164
164
|
| `nano-gpt/EVA-UNIT-01/EVA-Qwen2.5-32B-v0.2` | 16K | | | | | | $0.80 | $0.80 |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Ollama Cloud
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 25 Ollama Cloud models through Mastra's model router. Authentication is handled automatically using the `OLLAMA_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Ollama Cloud documentation](https://docs.ollama.com/cloud).
|
|
10
10
|
|
|
@@ -58,6 +58,7 @@ for await (const chunk of stream) {
|
|
|
58
58
|
| `ollama-cloud/minimax-m2.7` | 197K | | | | | | $0.30 | $1 |
|
|
59
59
|
| `ollama-cloud/minimax-m3` | 512K | | | | | | $0.60 | $2 |
|
|
60
60
|
| `ollama-cloud/mistral-large-3:675b` | 262K | | | | | | $0.50 | $2 |
|
|
61
|
+
| `ollama-cloud/mistral-large-4` | 1.0M | | | | | | $1 | $4 |
|
|
61
62
|
| `ollama-cloud/nemotron-3-nano:30b` | 1.0M | | | | | | $0.06 | $0.24 |
|
|
62
63
|
| `ollama-cloud/nemotron-3-super` | 262K | | | | | | $0.01 | $0.60 |
|
|
63
64
|
| `ollama-cloud/nemotron-3-ultra` | 262K | | | | | | $0.10 | $3 |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# OpenCode Go
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 35 OpenCode Go models through Mastra's model router. Authentication is handled automatically using the `OPENCODE_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [OpenCode Go documentation](https://opencode.ai/docs/go).
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ const agent = new Agent({
|
|
|
19
19
|
id: "my-agent",
|
|
20
20
|
name: "My Agent",
|
|
21
21
|
instructions: "You are a helpful assistant",
|
|
22
|
-
model: "opencode-go/
|
|
22
|
+
model: "opencode-go/claude-haiku-5-5"
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
// Generate a response
|
|
@@ -38,6 +38,7 @@ for await (const chunk of stream) {
|
|
|
38
38
|
|
|
39
39
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
40
|
| ------------------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
|
+
| `opencode-go/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
|
|
41
42
|
| `opencode-go/deepseek-v4-flash` | 1.0M | | | | | | $0.15 | $0.60 |
|
|
42
43
|
| `opencode-go/deepseek-v4-flash-vision-exp` | 1.0M | | | | | | $0.15 | $0.60 |
|
|
43
44
|
| `opencode-go/deepseek-v4-pro` | 1.0M | | | | | | $0.66 | $2 |
|
|
@@ -80,7 +81,7 @@ const agent = new Agent({
|
|
|
80
81
|
name: "custom-agent",
|
|
81
82
|
model: {
|
|
82
83
|
url: "https://opencode.ai/zen/go/v1",
|
|
83
|
-
id: "opencode-go/
|
|
84
|
+
id: "opencode-go/claude-haiku-5-5",
|
|
84
85
|
apiKey: process.env.OPENCODE_API_KEY,
|
|
85
86
|
headers: {
|
|
86
87
|
"X-Custom-Header": "value"
|
|
@@ -99,7 +100,7 @@ const agent = new Agent({
|
|
|
99
100
|
const useAdvanced = requestContext.task === "complex";
|
|
100
101
|
return useAdvanced
|
|
101
102
|
? "opencode-go/space-bunny-free"
|
|
102
|
-
: "opencode-go/
|
|
103
|
+
: "opencode-go/claude-haiku-5-5";
|
|
103
104
|
}
|
|
104
105
|
});
|
|
105
106
|
```
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# OpenCode Zen
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 119 OpenCode Zen models through Mastra's model router. Authentication is handled automatically using the `OPENCODE_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [OpenCode Zen documentation](https://opencode.ai/docs/zen).
|
|
10
10
|
|
|
@@ -42,6 +42,7 @@ for await (const chunk of stream) {
|
|
|
42
42
|
| `opencode/claude-fable-5` | 1.0M | | | | | | $10 | $50 |
|
|
43
43
|
| `opencode/claude-fable-5-1` | 1.0M | | | | | | $10 | $50 |
|
|
44
44
|
| `opencode/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
|
|
45
|
+
| `opencode/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
|
|
45
46
|
| `opencode/claude-opus-4-5` | 200K | | | | | | $5 | $25 |
|
|
46
47
|
| `opencode/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 |
|
|
47
48
|
| `opencode/claude-opus-4-7` | 1.0M | | | | | | $5 | $25 |
|
|
@@ -167,8 +167,8 @@ for await (const chunk of stream) {
|
|
|
167
167
|
| `requesty/minimax-m2.7-highspeed` | 200K | | | | | | $0.60 | $2 |
|
|
168
168
|
| `requesty/minimax-m3` | 1.0M | | | | | | $0.30 | $1 |
|
|
169
169
|
| `requesty/minimax-m3@eu` | 1.0M | | | | | | $0.40 | $2 |
|
|
170
|
-
| `requesty/mistral-large-4` |
|
|
171
|
-
| `requesty/mistral-large-4@eu` |
|
|
170
|
+
| `requesty/mistral-large-4` | 524K | | | | | | $0.68 | $2 |
|
|
171
|
+
| `requesty/mistral-large-4@eu` | 524K | | | | | | $0.68 | $2 |
|
|
172
172
|
| `requesty/mistral-medium-3-5` | 262K | | | | | | $2 | $8 |
|
|
173
173
|
| `requesty/mistral-medium-3-5@eu` | 262K | | | | | | $2 | $8 |
|
|
174
174
|
| `requesty/mistral-medium-latest` | 131K | | | | | | $0.44 | $2 |
|
|
@@ -64,7 +64,7 @@ const result = await agent.generate('message for agent')
|
|
|
64
64
|
|
|
65
65
|
**options.delegation.onDelegationComplete** (`(context: DelegationCompleteContext) => { feedback?: string } | void | Promise<{ feedback?: string } | void>`): Called after a subagent delegation completes. The context includes a bail() method to stop further execution, and you can return { feedback } to guide the supervisor's next action. Feedback is saved to supervisor memory as an assistant message.
|
|
66
66
|
|
|
67
|
-
**options.delegation.messageFilter** (`(context: MessageFilterContext) =>
|
|
67
|
+
**options.delegation.messageFilter** (`(context: MessageFilterContext) => ModelMessage[] | Promise<ModelMessage[]>`): Callback function called before delegating to a subagent. Use this to filter the messages that are passed to the subagent.
|
|
68
68
|
|
|
69
69
|
**options.scorers** (`MastraScorers | Record<string, { scorer: MastraScorer['name']; sampling?: ScoringSamplingConfig }>`): Evaluation scorers to run on the execution results.
|
|
70
70
|
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
# Classifier
|
|
6
6
|
|
|
7
|
-
`Classifier` asks
|
|
7
|
+
`Classifier` asks a decision model one or more fixed-domain questions about shared state. Use it when your application needs a typed choice, numeric score, or boolean probability without parsing generated text.
|
|
8
8
|
|
|
9
9
|
A classifier only returns evaluation results. Your application decides how to use them, for example by selecting a route or comparing a probability with a safety threshold.
|
|
10
10
|
|
|
11
|
-
`Classifier` requires
|
|
11
|
+
`Classifier` requires a decision model (`DecisionModelV4`, or the deprecated `EvaluationModelV4`, optionally wrapped in `MastraDecisionModel`). It doesn't accept a `'provider/model'` string, a bare model ID, or a language model.
|
|
12
12
|
|
|
13
13
|
## Basic usage
|
|
14
14
|
|
|
15
|
-
This example uses the [TypeSafe AI provider](https://ai-sdk.dev/providers/ai-sdk-providers/typesafe-ai). Make sure to set the `TYPESAFE_AI_API_KEY` environment variable. To use another provider, see [
|
|
15
|
+
This example uses the [TypeSafe AI provider](https://ai-sdk.dev/providers/ai-sdk-providers/typesafe-ai). Make sure to set the `TYPESAFE_AI_API_KEY` environment variable. To use another provider, see [Decision models](#decision-models).
|
|
16
16
|
|
|
17
17
|
Install the provider package:
|
|
18
18
|
|
|
@@ -48,7 +48,7 @@ import { typeSafeAi } from '@ai-sdk/typesafe-ai'
|
|
|
48
48
|
|
|
49
49
|
const classifier = new Classifier({
|
|
50
50
|
id: 'request-classifier',
|
|
51
|
-
model: typeSafeAi.
|
|
51
|
+
model: typeSafeAi.decisionModel('jev-latest'),
|
|
52
52
|
questions: {
|
|
53
53
|
route: {
|
|
54
54
|
type: 'choice',
|
|
@@ -65,7 +65,7 @@ const classifier = new Classifier({
|
|
|
65
65
|
},
|
|
66
66
|
})
|
|
67
67
|
|
|
68
|
-
const result = await classifier.
|
|
68
|
+
const result = await classifier.decide({
|
|
69
69
|
state: {
|
|
70
70
|
subject: 'Duplicate charge',
|
|
71
71
|
message: 'I was charged twice for the same subscription.',
|
|
@@ -76,11 +76,11 @@ result.answers.route.choice // 'billing' | 'support'
|
|
|
76
76
|
result.answers.urgent.probability // P(true), from 0 to 1
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
The
|
|
79
|
+
The decision model receives every question with the same `state`. When a question omits `instructions`, its question name is used instead.
|
|
80
80
|
|
|
81
|
-
##
|
|
81
|
+
## Decision models
|
|
82
82
|
|
|
83
|
-
The examples on this page follow the [TypeSafe AI provider setup](https://ai-sdk.dev/providers/ai-sdk-providers/typesafe-ai#setup) in the AI SDK documentation. Other AI SDK providers, including OpenAI, Anthropic, and Google, also expose
|
|
83
|
+
The examples on this page follow the [TypeSafe AI provider setup](https://ai-sdk.dev/providers/ai-sdk-providers/typesafe-ai#setup) in the AI SDK documentation. Other AI SDK providers, including OpenAI, Anthropic, and Google, also expose a `decisionModel()` factory (previously `evaluationModel()`, still available as a deprecated alias). Mastra calls `doDecide()` and falls back to `doEvaluate()` for older providers. See [provider models](https://ai-sdk.dev/docs/ai-sdk-core/decisions#provider-models) for the full list, supported model IDs, and how each provider answers questions.
|
|
84
84
|
|
|
85
85
|
Each provider exports a ready-made instance, which is what the examples on this page use. See [AI SDK providers](https://ai-sdk.dev/providers/ai-sdk-providers) for the others.
|
|
86
86
|
|
|
@@ -89,7 +89,7 @@ Pass a key explicitly by calling the factory instead:
|
|
|
89
89
|
```typescript
|
|
90
90
|
import { createTypeSafeAi } from '@ai-sdk/typesafe-ai'
|
|
91
91
|
|
|
92
|
-
const model = createTypeSafeAi({ apiKey: process.env.TYPESAFE_AI_API_KEY }).
|
|
92
|
+
const model = createTypeSafeAi({ apiKey: process.env.TYPESAFE_AI_API_KEY }).decisionModel(
|
|
93
93
|
'jev-latest',
|
|
94
94
|
)
|
|
95
95
|
```
|
|
@@ -102,11 +102,11 @@ new Classifier(options)
|
|
|
102
102
|
|
|
103
103
|
**id** (`string`): A non-empty identifier used in tracing and error context.
|
|
104
104
|
|
|
105
|
-
**model** (`EvaluationModelV4 |
|
|
105
|
+
**model** (`DecisionModelV4 | EvaluationModelV4 | MastraDecisionModel`): An AI SDK decision model or a Mastra decision model wrapper. The model declares which question types it supports.
|
|
106
106
|
|
|
107
|
-
**questions** (`ClassifierQuestions`): A non-empty record of named questions. Omit this field to supply the questions to each
|
|
107
|
+
**questions** (`ClassifierQuestions`): A non-empty record of named questions. Omit this field to supply the questions to each decide() call instead.
|
|
108
108
|
|
|
109
|
-
Constructor questions and per-call questions are mutually exclusive. If the constructor includes `questions`, `
|
|
109
|
+
Constructor questions and per-call questions are mutually exclusive. If the constructor includes `questions`, `decide()` rejects a `questions` option at compile time. If the constructor omits them, every `decide()` call must provide them. A processor, workflow step, or scorer classifies through a configured classifier, which requires constructor questions.
|
|
110
110
|
|
|
111
111
|
## Question types
|
|
112
112
|
|
|
@@ -210,9 +210,11 @@ These rules keep a question answerable from the state:
|
|
|
210
210
|
|
|
211
211
|
To check a question, change one field of the state and confirm one answer moves.
|
|
212
212
|
|
|
213
|
-
## `
|
|
213
|
+
## `decide(options)`
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
Answers all questions against the supplied state.
|
|
216
|
+
|
|
217
|
+
`evaluate(options)` is a deprecated alias for `decide(options)` and will be removed in a future release.
|
|
216
218
|
|
|
217
219
|
**state** (`ClassifierState`): The JSON-compatible state evaluated by every question.
|
|
218
220
|
|
|
@@ -220,7 +222,7 @@ Evaluates all questions against the supplied state.
|
|
|
220
222
|
|
|
221
223
|
**abortSignal** (`AbortSignal`): Cancels the active provider request and any wait between retry attempts.
|
|
222
224
|
|
|
223
|
-
**providerOptions** (`SharedV4ProviderOptions`): Provider-specific options forwarded unchanged to the
|
|
225
|
+
**providerOptions** (`SharedV4ProviderOptions`): Provider-specific options forwarded unchanged to the decision model.
|
|
224
226
|
|
|
225
227
|
**maxRetries** (`number`): The number of retries allowed after retryable provider API errors. Must be a non-negative integer. (Default: `2`)
|
|
226
228
|
|
|
@@ -234,10 +236,10 @@ import { typeSafeAi } from '@ai-sdk/typesafe-ai'
|
|
|
234
236
|
|
|
235
237
|
const classifier = new Classifier({
|
|
236
238
|
id: 'dynamic-classifier',
|
|
237
|
-
model: typeSafeAi.
|
|
239
|
+
model: typeSafeAi.decisionModel('jev-latest'),
|
|
238
240
|
})
|
|
239
241
|
|
|
240
|
-
const result = await classifier.
|
|
242
|
+
const result = await classifier.decide({
|
|
241
243
|
state: { response: 'Your refund has been processed.' },
|
|
242
244
|
questions: {
|
|
243
245
|
tone: {
|
|
@@ -255,17 +257,17 @@ result.answers.tone.choice // 'empathetic' | 'neutral'
|
|
|
255
257
|
|
|
256
258
|
## Return value
|
|
257
259
|
|
|
258
|
-
`
|
|
260
|
+
`decide()` returns `Promise<ClassifierResult<QUESTIONS>>`.
|
|
259
261
|
|
|
260
262
|
**answers** (`ClassifierAnswers<QUESTIONS>`): One typed answer for each configured question.
|
|
261
263
|
|
|
262
264
|
**usage** (`ClassifierUsage`): Token usage reported by the provider. totalTokens is the sum of inputTokens and outputTokens, with missing values counted as zero.
|
|
263
265
|
|
|
264
|
-
**warnings** (`SharedV4Warning[]`): Warnings returned by the
|
|
266
|
+
**warnings** (`SharedV4Warning[]`): Warnings returned by the decision model.
|
|
265
267
|
|
|
266
268
|
**rounding** (`{ probabilityDecimals?: number; scoreDecimals?: number }`): The precision the provider used for probabilities and scores.
|
|
267
269
|
|
|
268
|
-
**providerMetadata** (`SharedV4ProviderMetadata`): Provider-specific metadata returned by the
|
|
270
|
+
**providerMetadata** (`SharedV4ProviderMetadata`): Provider-specific metadata returned by the decision model.
|
|
269
271
|
|
|
270
272
|
**response** (`ClassifierResult["response"]`): Provider response metadata. Mastra supplies the current time and configured model ID when the provider omits them.
|
|
271
273
|
|
|
@@ -295,33 +297,29 @@ Input validation includes:
|
|
|
295
297
|
- `state`, instructions, and criteria must be JSON-compatible.
|
|
296
298
|
- The question record and choice criteria must not be empty.
|
|
297
299
|
- Score criteria must contain at least two defined levels.
|
|
298
|
-
- Every question type must be supported by the
|
|
300
|
+
- Every question type must be supported by the decision model.
|
|
299
301
|
- `maxRetries` must be a non-negative integer.
|
|
300
302
|
|
|
301
303
|
Provider responses must contain exactly one matching answer for each question. The classifier also rejects invalid choices, out-of-range scores or probabilities, incomplete probability distributions, non-finite token counts, malformed warnings, and invalid response timestamps.
|
|
302
304
|
|
|
303
|
-
Only retryable AI SDK `APICallError` failures are retried. Other errors reject immediately. When all retries fail, `
|
|
305
|
+
Only retryable AI SDK `APICallError` failures are retried. Other errors reject immediately. When all retries fail, `decide()` rethrows the last provider error. Aborting the supplied signal rejects with the signal's abort reason, including when cancellation occurs during retry backoff.
|
|
304
306
|
|
|
305
307
|
## Observability
|
|
306
308
|
|
|
307
|
-
When an active Mastra span exists, `
|
|
309
|
+
When an active Mastra span exists, `decide()` creates a `CLASSIFIER_EVALUATION` child span. It records the classifier and model identifiers, provider, question count and types, attempts, duration, and token usage.
|
|
308
310
|
|
|
309
311
|
The span doesn't include the evaluated state, question instructions, criteria, answers, probabilities, provider response body, or generated text.
|
|
310
312
|
|
|
311
313
|
## Customize provider responses
|
|
312
314
|
|
|
313
|
-
`Classifier` automatically wraps a raw AI SDK
|
|
315
|
+
`Classifier` automatically wraps a raw AI SDK decision model in `MastraDecisionModel`. Pass your own wrapper when provider output needs normalization before validation.
|
|
314
316
|
|
|
315
317
|
```typescript
|
|
316
|
-
import {
|
|
317
|
-
Classifier,
|
|
318
|
-
MastraEvaluationModel,
|
|
319
|
-
type EvaluationModelResult,
|
|
320
|
-
} from '@mastra/core/classifier'
|
|
318
|
+
import { Classifier, MastraDecisionModel, type DecisionModelResult } from '@mastra/core/classifier'
|
|
321
319
|
import { typeSafeAi } from '@ai-sdk/typesafe-ai'
|
|
322
320
|
|
|
323
|
-
class
|
|
324
|
-
protected override transformResult(result:
|
|
321
|
+
class NormalizedDecisionModel extends MastraDecisionModel {
|
|
322
|
+
protected override transformResult(result: DecisionModelResult): DecisionModelResult {
|
|
325
323
|
return {
|
|
326
324
|
...result,
|
|
327
325
|
answers: normalizeAnswers(result.answers),
|
|
@@ -331,14 +329,16 @@ class NormalizedEvaluationModel extends MastraEvaluationModel {
|
|
|
331
329
|
|
|
332
330
|
const classifier = new Classifier({
|
|
333
331
|
id: 'normalized-classifier',
|
|
334
|
-
model: new
|
|
335
|
-
typeSafeAi.
|
|
332
|
+
model: new NormalizedDecisionModel(
|
|
333
|
+
typeSafeAi.decisionModel('jev-latest'),
|
|
336
334
|
),
|
|
337
335
|
})
|
|
338
336
|
```
|
|
339
337
|
|
|
340
338
|
`transformResult()` runs after the provider call and before `Classifier` validates the response.
|
|
341
339
|
|
|
340
|
+
`MastraEvaluationModel` and `EvaluationModelResult` are deprecated aliases for `MastraDecisionModel` and `DecisionModelResult` and will be removed in a future release.
|
|
341
|
+
|
|
342
342
|
## Registering classifiers
|
|
343
343
|
|
|
344
344
|
Register classifiers on the `Mastra` instance to share them across your application and retrieve them by key or ID. When a registered classifier is evaluated without an active trace, it starts a root `CLASSIFIER_EVALUATION` span through the `Mastra` instance's configured observability provider.
|
|
@@ -350,7 +350,7 @@ import { typeSafeAi } from '@ai-sdk/typesafe-ai'
|
|
|
350
350
|
|
|
351
351
|
export const safety = new Classifier({
|
|
352
352
|
id: 'safety',
|
|
353
|
-
model: typeSafeAi.
|
|
353
|
+
model: typeSafeAi.decisionModel('jev-latest'),
|
|
354
354
|
questions: {
|
|
355
355
|
unsafe: { type: 'boolean' },
|
|
356
356
|
},
|
|
@@ -384,7 +384,7 @@ const workflow = createWorkflow({
|
|
|
384
384
|
|
|
385
385
|
A string reference resolves through the `Mastra` instance at execution time. The ID doesn't carry the question types, so supply them with a type argument to keep the answers typed. In Studio, the workflow graph shows the step as a classifier node.
|
|
386
386
|
|
|
387
|
-
The workflow adapter doesn't include warnings, raw provider responses, headers, or provider metadata in step output. Use direct `
|
|
387
|
+
The workflow adapter doesn't include warnings, raw provider responses, headers, or provider metadata in step output. Use direct `decide()` calls or classifier observability when you need that provider-level detail.
|
|
388
388
|
|
|
389
389
|
## Related
|
|
390
390
|
|
|
@@ -230,6 +230,18 @@ await mastraClient.updateWorkingMemory({
|
|
|
230
230
|
|
|
231
231
|
For resource-scoped working memory, you must provide the `resourceId` parameter. It allows the memory to persist across all conversation threads for that user.
|
|
232
232
|
|
|
233
|
+
By default the call replaces the whole record. For schema-based, resource-scoped working memory, pass `mode: 'merge'` with a JSON object string to deep-merge only the provided fields atomically. The server returns `400` if the storage adapter doesn't support atomic merges (currently only `@mastra/pg` does).
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
await mastraClient.updateWorkingMemory({
|
|
237
|
+
agentId: 'agent-1',
|
|
238
|
+
threadId: 'thread-1',
|
|
239
|
+
resourceId: 'user-123',
|
|
240
|
+
workingMemory: JSON.stringify({ city: 'Berlin' }),
|
|
241
|
+
mode: 'merge',
|
|
242
|
+
})
|
|
243
|
+
```
|
|
244
|
+
|
|
233
245
|
### Get Memory Status
|
|
234
246
|
|
|
235
247
|
Check the status of the memory system:
|
|
@@ -366,7 +366,7 @@ export const mastra = new Mastra({
|
|
|
366
366
|
|
|
367
367
|
**Type:** `Record<string, Classifier>`
|
|
368
368
|
|
|
369
|
-
Classifiers ask
|
|
369
|
+
Classifiers ask decision models fixed-option questions about application state and return typed answers. Register reusable classifiers here to retrieve them with `getClassifier()` or `getClassifierById()`. When a registered classifier is evaluated without an active trace, it starts a root `CLASSIFIER_EVALUATION` span through the `Mastra` instance's configured observability provider.
|
|
370
370
|
|
|
371
371
|
Visit the [Classifier reference](https://mastra.ai/reference/classifier/classifier) to learn more.
|
|
372
372
|
|
|
@@ -377,7 +377,7 @@ import { typeSafeAi } from '@ai-sdk/typesafe-ai'
|
|
|
377
377
|
|
|
378
378
|
const safety = new Classifier({
|
|
379
379
|
id: 'safety',
|
|
380
|
-
model: typeSafeAi.
|
|
380
|
+
model: typeSafeAi.decisionModel('jev-latest'),
|
|
381
381
|
questions: {
|
|
382
382
|
unsafe: {
|
|
383
383
|
type: 'boolean',
|