@mastra/mcp-docs-server 1.2.7-alpha.8 → 1.2.7
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-builder/integrations.md +44 -2
- package/.docs/docs/agent-builder/skill-registries.md +1 -3
- package/.docs/docs/agent-controller/overview.md +1 -1
- package/.docs/docs/agent-controller/session.md +1 -3
- package/.docs/docs/agents/code-mode.md +17 -1
- package/.docs/docs/agents/guardrails.md +8 -8
- package/.docs/docs/agents/overview.md +2 -2
- package/.docs/docs/agents/processors.md +9 -3
- package/.docs/docs/agents/skills.md +2 -4
- package/.docs/docs/agents/structured-output.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +1 -3
- package/.docs/docs/agents/using-tools.md +4 -4
- package/.docs/docs/browser/agent-browser.md +1 -3
- package/.docs/docs/browser/browser-viewer.md +1 -3
- package/.docs/docs/browser/stagehand.md +1 -1
- package/.docs/docs/capabilities/channels/overview.md +1 -3
- package/.docs/docs/deployment/mastra-server.md +2 -4
- package/.docs/docs/editor/overview.md +2 -6
- package/.docs/docs/editor/prompts.md +1 -1
- package/.docs/docs/editor/tools.md +3 -5
- package/.docs/docs/evals/custom-scorers.md +1 -3
- package/.docs/docs/evals/datasets/overview.md +4 -4
- package/.docs/docs/evals/datasets/running-experiments.md +4 -2
- package/.docs/docs/evals/evals-with-memory.md +1 -3
- package/.docs/docs/evals/gates-and-verdicts.md +17 -2
- package/.docs/docs/evals/quick-checks.md +1 -3
- package/.docs/docs/getting-started/file-based-agents.md +9 -4
- package/.docs/docs/long-running-agents/background-tasks.md +1 -1
- package/.docs/docs/long-running-agents/durable-agents.md +3 -5
- package/.docs/docs/long-running-agents/goals.md +1 -3
- package/.docs/docs/long-running-agents/signal-providers.md +1 -3
- package/.docs/docs/long-running-agents/signals.md +7 -21
- package/.docs/docs/mastra-platform/configuration.md +15 -22
- package/.docs/docs/mastra-platform/database.md +50 -6
- package/.docs/docs/mastra-platform/deploy.md +142 -0
- package/.docs/docs/mastra-platform/environments.md +103 -0
- package/.docs/docs/mastra-platform/github.md +2 -2
- package/.docs/docs/mastra-platform/overview.md +5 -5
- package/.docs/docs/mastra-platform/server.md +2 -0
- package/.docs/docs/mastra-platform/studio.md +5 -3
- package/.docs/docs/mcp/mcp-apps.md +3 -3
- package/.docs/docs/mcp/overview.md +6 -10
- package/.docs/docs/memory/overview.md +4 -4
- package/.docs/docs/observability/integrations/exporters/mastra-platform.md +1 -3
- package/.docs/docs/observability/logging.md +3 -1
- package/.docs/docs/observability/metrics/querying.md +2 -0
- package/.docs/docs/observability/tracing/overview.md +3 -1
- package/.docs/docs/server/auth/auth0.md +1 -1
- package/.docs/docs/server/auth/better-auth.md +2 -2
- package/.docs/docs/server/auth/clerk.md +1 -1
- package/.docs/docs/server/auth/firebase.md +1 -1
- package/.docs/docs/server/auth/google.md +2 -2
- package/.docs/docs/server/auth/jwt.md +2 -2
- package/.docs/docs/server/auth/okta.md +2 -2
- package/.docs/docs/server/auth/workos.md +1 -1
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/mastra-server.md +1 -1
- package/.docs/docs/server/pubsub.md +1 -1
- package/.docs/docs/server/request-context.md +4 -4
- package/.docs/docs/server/server-adapters.md +8 -8
- package/.docs/docs/studio/auth.md +1 -3
- package/.docs/docs/workflows/agents-and-tools.md +3 -5
- package/.docs/docs/workflows/control-flow.md +1 -1
- package/.docs/docs/workflows/overview.md +5 -5
- package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
- package/.docs/guides/build-your-ui/copilotkit/overview.md +1 -1
- package/.docs/guides/concepts/streaming.md +3 -3
- package/.docs/guides/guide/chef-michel.md +1 -1
- package/.docs/guides/guide/coding-agent.md +392 -0
- package/.docs/guides/migrations/mastra-cloud.md +5 -12
- package/.docs/models/environment-variables.md +14 -2
- package/.docs/models/gateways/azure-openai.md +15 -15
- package/.docs/models/gateways/mastra.md +2 -2
- package/.docs/models/gateways/openrouter.md +4 -7
- package/.docs/models/gateways/vercel.md +5 -10
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/abacus.md +44 -14
- package/.docs/models/providers/ai-router.md +77 -0
- package/.docs/models/providers/ambient.md +10 -6
- package/.docs/models/providers/baseten.md +1 -1
- package/.docs/models/providers/blueclaw.md +74 -0
- package/.docs/models/providers/crossmodel.md +8 -2
- package/.docs/models/providers/daoxe.md +81 -0
- package/.docs/models/providers/databricks.md +7 -2
- package/.docs/models/providers/deepinfra.md +2 -2
- package/.docs/models/providers/deepseek.md +2 -2
- package/.docs/models/providers/ebcloud.md +76 -0
- package/.docs/models/providers/empiriolabs.md +108 -0
- package/.docs/models/providers/google.md +4 -0
- package/.docs/models/providers/hpc-ai.md +16 -10
- package/.docs/models/providers/inferx.md +78 -0
- package/.docs/models/providers/llmgateway.md +2 -8
- package/.docs/models/providers/lynkr.md +73 -0
- package/.docs/models/providers/model-oracle-ai.md +87 -0
- package/.docs/models/providers/neon.md +1 -1
- package/.docs/models/providers/nvidia.md +1 -3
- package/.docs/models/providers/openai.md +12 -3
- package/.docs/models/providers/opencode.md +5 -2
- package/.docs/models/providers/pioneer.md +148 -0
- package/.docs/models/providers/routing-run.md +4 -1
- package/.docs/models/providers/snowflake-cortex.md +4 -1
- package/.docs/models/providers/stepfun-ai-step-plan.md +75 -0
- package/.docs/models/providers/stepfun-ai.md +6 -6
- package/.docs/models/providers/stepfun-step-plan.md +76 -0
- package/.docs/models/providers/stepfun.md +5 -5
- package/.docs/models/providers/unorouter.md +95 -0
- package/.docs/models/providers/vivgrid.md +5 -2
- package/.docs/models/providers/wafer.ai.md +9 -12
- package/.docs/models/providers/xai.md +1 -1
- package/.docs/models/providers/zenmux.md +5 -1
- package/.docs/models/providers.md +14 -2
- package/.docs/reference/agents/generateLegacy.md +8 -2
- package/.docs/reference/cli/mastra.md +131 -10
- package/.docs/reference/code-sdk/mount-agent-controller.md +2 -0
- package/.docs/reference/coding-agent/create-coding-agent.md +5 -4
- package/.docs/reference/evals/create-scorer.md +63 -0
- package/.docs/reference/evals/run-evals.md +2 -2
- package/.docs/reference/file-based-agents/logger.md +26 -0
- package/.docs/reference/file-based-agents/scorers.md +54 -0
- package/.docs/reference/index.md +2 -0
- package/.docs/reference/mastra-platform/api.md +1 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +8 -8
- package/.docs/reference/observability/tracing/exporters/braintrust.md +1 -0
- package/.docs/reference/observability/tracing/exporters/datadog.md +10 -9
- package/.docs/reference/observability/tracing/exporters/langsmith.md +8 -7
- package/.docs/reference/observability/tracing/exporters/posthog.md +13 -12
- package/.docs/reference/observability/tracing/exporters/sentry.md +1 -0
- package/.docs/reference/observability/tracing/interfaces.md +9 -0
- package/.docs/reference/processors/stream-error-retry-processor.md +39 -2
- package/.docs/reference/pubsub/base.md +10 -0
- package/.docs/reference/pubsub/caching-pubsub.md +8 -0
- package/.docs/reference/pubsub/redis-streams.md +12 -0
- package/.docs/reference/server/express-adapter.md +1 -3
- package/.docs/reference/server/fastify-adapter.md +1 -3
- package/.docs/reference/server/hono-adapter.md +1 -3
- package/.docs/reference/server/koa-adapter.md +1 -3
- package/.docs/reference/server/nestjs-adapter.md +1 -3
- package/.docs/reference/server/register-api-route.md +5 -4
- package/.docs/reference/templates/overview.md +1 -1
- package/.docs/reference/tools/mcp-client.md +22 -0
- package/.docs/reference/tools/mcp-server.md +161 -4
- package/.docs/reference/voice/google.md +48 -8
- package/.docs/reference/voice/speechify.md +10 -6
- package/.docs/reference/workspace/agentcore-runtime-sandbox.md +1 -3
- package/.docs/reference/workspace/agentfs-filesystem.md +1 -3
- package/.docs/reference/workspace/apple-container-sandbox.md +1 -3
- package/.docs/reference/workspace/archil-filesystem.md +1 -3
- package/.docs/reference/workspace/azure-blob-filesystem.md +1 -3
- package/.docs/reference/workspace/blaxel-sandbox.md +1 -3
- package/.docs/reference/workspace/daytona-sandbox.md +1 -3
- package/.docs/reference/workspace/docker-sandbox.md +1 -3
- package/.docs/reference/workspace/e2b-sandbox.md +20 -3
- package/.docs/reference/workspace/files-sdk-filesystem.md +1 -3
- package/.docs/reference/workspace/gcs-filesystem.md +1 -3
- package/.docs/reference/workspace/google-drive-filesystem.md +1 -3
- package/.docs/reference/workspace/local-filesystem.md +1 -3
- package/.docs/reference/workspace/local-sandbox.md +1 -3
- package/.docs/reference/workspace/modal-sandbox.md +1 -3
- package/.docs/reference/workspace/railway-sandbox.md +1 -3
- package/.docs/reference/workspace/s3-filesystem.md +1 -3
- package/.docs/reference/workspace/vercel-sandbox.md +5 -7
- package/.docs/reference/workspace/vercel-serverless.md +1 -3
- package/CHANGELOG.md +79 -0
- package/package.json +10 -10
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Wafer
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 5 Wafer models through Mastra's model router. Authentication is handled automatically using the `WAFER_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Wafer documentation](https://docs.wafer.ai/wafer-pass).
|
|
8
8
|
|
|
@@ -34,16 +34,13 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
## Models
|
|
36
36
|
|
|
37
|
-
| Model
|
|
38
|
-
|
|
|
39
|
-
| `wafer.ai/
|
|
40
|
-
| `wafer.ai/
|
|
41
|
-
| `wafer.ai/
|
|
42
|
-
| `wafer.ai/
|
|
43
|
-
| `wafer.ai/
|
|
44
|
-
| `wafer.ai/Qwen3.5-397B-A17B` | 262K | | | | | | $0.43 | $3 |
|
|
45
|
-
| `wafer.ai/Qwen3.6-35B-A3B` | 256K | | | | | | $0.15 | $1 |
|
|
46
|
-
| `wafer.ai/qwen3.7-max` | 256K | | | | | | $5 | $15 |
|
|
37
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
+
| ---------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `wafer.ai/GLM-5.1` | 203K | | | | | | $1 | $3 |
|
|
40
|
+
| `wafer.ai/GLM-5.2` | 1.0M | | | | | | $1 | $4 |
|
|
41
|
+
| `wafer.ai/glm5.2-fast` | 1.0M | | | | | | $3 | $10 |
|
|
42
|
+
| `wafer.ai/Kimi-K2.6` | 262K | | | | | | $1 | $5 |
|
|
43
|
+
| `wafer.ai/MiniMax-M3` | 1.0M | | | | | | $0.33 | $1 |
|
|
47
44
|
|
|
48
45
|
## Advanced configuration
|
|
49
46
|
|
|
@@ -73,7 +70,7 @@ const agent = new Agent({
|
|
|
73
70
|
model: ({ requestContext }) => {
|
|
74
71
|
const useAdvanced = requestContext.task === "complex";
|
|
75
72
|
return useAdvanced
|
|
76
|
-
? "wafer.ai/
|
|
73
|
+
? "wafer.ai/glm5.2-fast"
|
|
77
74
|
: "wafer.ai/GLM-5.1";
|
|
78
75
|
}
|
|
79
76
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# ZenMux
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 118 ZenMux models through Mastra's model router. Authentication is handled automatically using the `ZENMUX_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [ZenMux documentation](https://docs.zenmux.ai).
|
|
8
8
|
|
|
@@ -101,6 +101,9 @@ for await (const chunk of stream) {
|
|
|
101
101
|
| `zenmux/openai/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
|
|
102
102
|
| `zenmux/openai/gpt-5.5-instant` | 400K | | | | | | $5 | $30 |
|
|
103
103
|
| `zenmux/openai/gpt-5.5-pro` | 1.1M | | | | | | $30 | $180 |
|
|
104
|
+
| `zenmux/openai/gpt-5.6-luna` | 1.1M | | | | | | $1 | $6 |
|
|
105
|
+
| `zenmux/openai/gpt-5.6-sol` | 1.1M | | | | | | $5 | $30 |
|
|
106
|
+
| `zenmux/openai/gpt-5.6-terra` | 1.1M | | | | | | $3 | $15 |
|
|
104
107
|
| `zenmux/qwen/qwen3-coder-plus` | 1.0M | | | | | | $1 | $5 |
|
|
105
108
|
| `zenmux/qwen/qwen3-max` | 256K | | | | | | $1 | $6 |
|
|
106
109
|
| `zenmux/qwen/qwen3.5-flash` | 1.0M | | | | | | $0.10 | $0.40 |
|
|
@@ -128,6 +131,7 @@ for await (const chunk of stream) {
|
|
|
128
131
|
| `zenmux/x-ai/grok-4.2-fast` | 2.0M | | | | | | $3 | $9 |
|
|
129
132
|
| `zenmux/x-ai/grok-4.2-fast-non-reasoning` | 2.0M | | | | | | $3 | $9 |
|
|
130
133
|
| `zenmux/x-ai/grok-4.3` | 1.0M | | | | | | $1 | $3 |
|
|
134
|
+
| `zenmux/x-ai/grok-4.5` | 500K | | | | | | $2 | $6 |
|
|
131
135
|
| `zenmux/x-ai/grok-build-0.1` | 256K | | | | | | $1 | $2 |
|
|
132
136
|
| `zenmux/x-ai/grok-code-fast-1` | 256K | | | | | | $0.20 | $2 |
|
|
133
137
|
| `zenmux/xiaomi/mimo-v2-flash` | 262K | | | | | | $0.10 | $0.30 |
|
|
@@ -14,6 +14,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
14
14
|
- [302.AI](https://mastra.ai/models/providers/302ai)
|
|
15
15
|
- [Abacus](https://mastra.ai/models/providers/abacus)
|
|
16
16
|
- [abliteration.ai](https://mastra.ai/models/providers/abliteration-ai)
|
|
17
|
+
- [AI-ROUTER](https://mastra.ai/models/providers/ai-router)
|
|
17
18
|
- [Alibaba](https://mastra.ai/models/providers/alibaba)
|
|
18
19
|
- [Alibaba (China)](https://mastra.ai/models/providers/alibaba-cn)
|
|
19
20
|
- [Alibaba Coding Plan](https://mastra.ai/models/providers/alibaba-coding-plan)
|
|
@@ -27,6 +28,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
27
28
|
- [Bailing](https://mastra.ai/models/providers/bailing)
|
|
28
29
|
- [Baseten](https://mastra.ai/models/providers/baseten)
|
|
29
30
|
- [Berget.AI](https://mastra.ai/models/providers/berget)
|
|
31
|
+
- [Blue Claw](https://mastra.ai/models/providers/blueclaw)
|
|
30
32
|
- [Cerebras](https://mastra.ai/models/providers/cerebras)
|
|
31
33
|
- [Chutes](https://mastra.ai/models/providers/chutes)
|
|
32
34
|
- [Clarifai](https://mastra.ai/models/providers/clarifai)
|
|
@@ -37,10 +39,13 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
37
39
|
- [CrofAI](https://mastra.ai/models/providers/crof)
|
|
38
40
|
- [CrossModel](https://mastra.ai/models/providers/crossmodel)
|
|
39
41
|
- [D.Run (China)](https://mastra.ai/models/providers/drun)
|
|
42
|
+
- [DaoXE](https://mastra.ai/models/providers/daoxe)
|
|
40
43
|
- [Databricks](https://mastra.ai/models/providers/databricks)
|
|
41
44
|
- [Deep Infra](https://mastra.ai/models/providers/deepinfra)
|
|
42
45
|
- [DigitalOcean](https://mastra.ai/models/providers/digitalocean)
|
|
43
46
|
- [DInference](https://mastra.ai/models/providers/dinference)
|
|
47
|
+
- [EBCloud](https://mastra.ai/models/providers/ebcloud)
|
|
48
|
+
- [EmpirioLabs AI](https://mastra.ai/models/providers/empiriolabs)
|
|
44
49
|
- [evroc](https://mastra.ai/models/providers/evroc)
|
|
45
50
|
- [FastRouter](https://mastra.ai/models/providers/fastrouter)
|
|
46
51
|
- [Fireworks AI](https://mastra.ai/models/providers/fireworks-ai)
|
|
@@ -56,6 +61,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
56
61
|
- [Inception](https://mastra.ai/models/providers/inception)
|
|
57
62
|
- [Inceptron](https://mastra.ai/models/providers/inceptron)
|
|
58
63
|
- [Inference](https://mastra.ai/models/providers/inference)
|
|
64
|
+
- [InferX](https://mastra.ai/models/providers/inferx)
|
|
59
65
|
- [IO.NET](https://mastra.ai/models/providers/io-net)
|
|
60
66
|
- [Jiekou.AI](https://mastra.ai/models/providers/jiekou)
|
|
61
67
|
- [Kenari](https://mastra.ai/models/providers/kenari)
|
|
@@ -69,6 +75,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
69
75
|
- [LMStudio](https://mastra.ai/models/providers/lmstudio)
|
|
70
76
|
- [LongCat](https://mastra.ai/models/providers/longcat)
|
|
71
77
|
- [LucidQuery](https://mastra.ai/models/providers/lucidquery)
|
|
78
|
+
- [Lynkr](https://mastra.ai/models/providers/lynkr)
|
|
72
79
|
- [Meganova](https://mastra.ai/models/providers/meganova)
|
|
73
80
|
- [Meta](https://mastra.ai/models/providers/meta)
|
|
74
81
|
- [MiniMax (minimax.io)](https://mastra.ai/models/providers/minimax)
|
|
@@ -77,6 +84,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
77
84
|
- [MiniMax Token Plan (minimaxi.com)](https://mastra.ai/models/providers/minimax-cn-coding-plan)
|
|
78
85
|
- [Mixlayer](https://mastra.ai/models/providers/mixlayer)
|
|
79
86
|
- [Moark](https://mastra.ai/models/providers/moark)
|
|
87
|
+
- [Model Oracle AI](https://mastra.ai/models/providers/model-oracle-ai)
|
|
80
88
|
- [ModelScope](https://mastra.ai/models/providers/modelscope)
|
|
81
89
|
- [Moonshot AI](https://mastra.ai/models/providers/moonshotai)
|
|
82
90
|
- [Moonshot AI (China)](https://mastra.ai/models/providers/moonshotai-cn)
|
|
@@ -96,6 +104,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
96
104
|
- [OVHcloud AI Endpoints](https://mastra.ai/models/providers/ovhcloud)
|
|
97
105
|
- [Perplexity](https://mastra.ai/models/providers/perplexity)
|
|
98
106
|
- [Perplexity Agent](https://mastra.ai/models/providers/perplexity-agent)
|
|
107
|
+
- [Pioneer](https://mastra.ai/models/providers/pioneer)
|
|
99
108
|
- [Poe](https://mastra.ai/models/providers/poe)
|
|
100
109
|
- [Poolside](https://mastra.ai/models/providers/poolside)
|
|
101
110
|
- [Privatemode AI](https://mastra.ai/models/providers/privatemode-ai)
|
|
@@ -111,8 +120,10 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
111
120
|
- [SiliconFlow (China)](https://mastra.ai/models/providers/siliconflow-cn)
|
|
112
121
|
- [Snowflake Cortex](https://mastra.ai/models/providers/snowflake-cortex)
|
|
113
122
|
- [STACKIT](https://mastra.ai/models/providers/stackit)
|
|
114
|
-
- [StepFun](https://mastra.ai/models/providers/stepfun)
|
|
115
|
-
- [StepFun
|
|
123
|
+
- [StepFun (China)](https://mastra.ai/models/providers/stepfun)
|
|
124
|
+
- [StepFun (Global)](https://mastra.ai/models/providers/stepfun-ai)
|
|
125
|
+
- [StepFun Step Plan (China)](https://mastra.ai/models/providers/stepfun-step-plan)
|
|
126
|
+
- [StepFun Step Plan (Global)](https://mastra.ai/models/providers/stepfun-ai-step-plan)
|
|
116
127
|
- [Subconscious](https://mastra.ai/models/providers/subconscious)
|
|
117
128
|
- [submodel](https://mastra.ai/models/providers/submodel)
|
|
118
129
|
- [Synthetic](https://mastra.ai/models/providers/synthetic)
|
|
@@ -125,6 +136,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
125
136
|
- [TrustedRouter](https://mastra.ai/models/providers/trustedrouter)
|
|
126
137
|
- [Umans AI](https://mastra.ai/models/providers/umans-ai)
|
|
127
138
|
- [Umans AI Coding Plan](https://mastra.ai/models/providers/umans-ai-coding-plan)
|
|
139
|
+
- [UnoRouter](https://mastra.ai/models/providers/unorouter)
|
|
128
140
|
- [Upstage](https://mastra.ai/models/providers/upstage)
|
|
129
141
|
- [Vivgrid](https://mastra.ai/models/providers/vivgrid)
|
|
130
142
|
- [Vultr](https://mastra.ai/models/providers/vultr)
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# Agent.generateLegacy() (Legacy)
|
|
4
4
|
|
|
5
|
-
> **Warning:** **Deprecated**: This method is deprecated and only works with
|
|
5
|
+
> **Warning:** **Deprecated**: This method is deprecated and only works with legacy model adapters. For current model adapters, use [`.generate()`](https://mastra.ai/reference/agents/generate) instead.
|
|
6
6
|
|
|
7
|
-
The `.generateLegacy()` method is the legacy version of the agent generation API, used
|
|
7
|
+
The `.generateLegacy()` method is the legacy version of the agent generation API, used with legacy model adapters to produce text or structured responses. This method accepts messages and optional generation options.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
@@ -12,6 +12,12 @@ The `.generateLegacy()` method is the legacy version of the agent generation API
|
|
|
12
12
|
await agent.generateLegacy('message for agent')
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## Processor retry support
|
|
16
|
+
|
|
17
|
+
`generateLegacy()` doesn't run error processors or `maxProcessorRetries`. It uses the legacy AI SDK generation path instead.
|
|
18
|
+
|
|
19
|
+
Scorer judges with legacy model adapters call `generateLegacy()`. They don't receive the coordinated `StreamErrorRetryProcessor` budget available to scorer judges that use Mastra’s current generation API. Use a current model adapter when you need error-processor retries. The legacy `maxRetries` option remains separate and defaults to `2`.
|
|
20
|
+
|
|
15
21
|
## Parameters
|
|
16
22
|
|
|
17
23
|
**messages** (`string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[]`): The messages to send to the agent. Can be a single string, array of strings, or structured message objects with multimodal content (text, images, etc.).
|
|
@@ -282,32 +282,30 @@ mastra deploy --env staging --yes
|
|
|
282
282
|
|
|
283
283
|
## `mastra env`
|
|
284
284
|
|
|
285
|
-
Manages environments on Mastra platform. Environments are named deploy targets (for example `production`, `staging`, `preview-42`) that belong to a project.
|
|
285
|
+
Manages environments on Mastra platform. Environments are named deploy targets (for example `production`, `staging`, `preview-42`) that belong to a project. The current organization is resolved from stored credentials.
|
|
286
|
+
|
|
287
|
+
Every subcommand resolves its project from, in order: the `MASTRA_PROJECT_ID` environment variable, the `--project <name|slug|id>` flag, or the `.mastra-project.json` file written by [`mastra deploy`](#mastra-deploy) in the current directory. Run from your project directory and you never need to name the project.
|
|
286
288
|
|
|
287
289
|
### `mastra env list`
|
|
288
290
|
|
|
289
|
-
Lists environments for a project.
|
|
291
|
+
Lists environments for a project. Each environment shows its latest deploy (with an `(active)` marker when it's serving traffic) and the env var names injected by managed resources such as attached databases.
|
|
290
292
|
|
|
291
293
|
```bash
|
|
292
|
-
mastra env list
|
|
294
|
+
mastra env list
|
|
293
295
|
```
|
|
294
296
|
|
|
295
297
|
#### `--json`
|
|
296
298
|
|
|
297
|
-
Emit machine-readable JSON. Only non-sensitive metadata (id, name, slug, type, region, branch, and
|
|
299
|
+
Emit machine-readable JSON. Only non-sensitive metadata (id, name, slug, type, region, branch, URLs, managed env var names, and latest deploy status) is included so the output is safe to log in CI.
|
|
298
300
|
|
|
299
301
|
### `mastra env create`
|
|
300
302
|
|
|
301
303
|
Creates a new environment for a project.
|
|
302
304
|
|
|
303
305
|
```bash
|
|
304
|
-
mastra env create
|
|
306
|
+
mastra env create staging --type staging --region eu
|
|
305
307
|
```
|
|
306
308
|
|
|
307
|
-
#### `-n, --name`
|
|
308
|
-
|
|
309
|
-
Environment name (required).
|
|
310
|
-
|
|
311
309
|
#### `-t, --type`
|
|
312
310
|
|
|
313
311
|
Environment type. One of `production`, `staging`, or `preview`. Defaults to `staging`.
|
|
@@ -325,7 +323,7 @@ Emit machine-readable JSON. Sensitive fields are omitted, as with [`mastra env l
|
|
|
325
323
|
Deletes an environment.
|
|
326
324
|
|
|
327
325
|
```bash
|
|
328
|
-
mastra env delete <
|
|
326
|
+
mastra env delete <env>
|
|
329
327
|
```
|
|
330
328
|
|
|
331
329
|
`<env>` can be an environment name, slug, or ID. The CLI prompts for confirmation unless `--yes` is passed.
|
|
@@ -334,6 +332,127 @@ mastra env delete <project> <env>
|
|
|
334
332
|
|
|
335
333
|
Skip the confirmation prompt.
|
|
336
334
|
|
|
335
|
+
### `mastra env restart`
|
|
336
|
+
|
|
337
|
+
Restarts an environment's running service so saved env vars (including managed vars from attached databases) take effect immediately, without a new deploy.
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
mastra env restart <env>
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
`<env>` can be an environment name, slug, or ID. Fails with a conflict error if the environment has never been deployed.
|
|
344
|
+
|
|
345
|
+
### `mastra env vars pull`
|
|
346
|
+
|
|
347
|
+
Pulls an environment's env vars into a local env file (default: `.env`). The file contains the merged set a deploy actually runs with: vars stored on the environment (for example, added in the dashboard's environment editor) plus project-level vars, with project values winning on conflict. Managed vars injected by attached databases are listed as comments (names only) since their values are platform-managed secrets.
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
mastra env vars pull
|
|
351
|
+
mastra env vars pull <env> --output .env.staging
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
`<env>` can be an environment name, slug, or ID, and can be omitted when the project has exactly one environment. The file is written with `0600` permissions.
|
|
355
|
+
|
|
356
|
+
#### `-o, --output`
|
|
357
|
+
|
|
358
|
+
File to write. Defaults to `.env`.
|
|
359
|
+
|
|
360
|
+
### `mastra env db`
|
|
361
|
+
|
|
362
|
+
Manages databases attached to a project on Mastra platform. Databases are provisioned from a managed provider (for example Turso or Neon) and inject their connection env vars into deploys automatically.
|
|
363
|
+
|
|
364
|
+
A database is either **environment-scoped** (its env vars only go to one environment) or **shared** (project-scoped: its env vars go to all environments). Pass the environment argument to work with environment-scoped databases; omit it for shared databases.
|
|
365
|
+
|
|
366
|
+
Creating and deleting databases requires the `admin` role in the organization.
|
|
367
|
+
|
|
368
|
+
### `mastra env db list`
|
|
369
|
+
|
|
370
|
+
Lists databases attached to a project, including provider, provisioning status, scope (which environment each database feeds), and the env var names each database injects. Pass an environment to only show databases feeding that environment (environment-scoped plus shared).
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
mastra env db list
|
|
374
|
+
mastra env db list <env>
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
#### `--json`
|
|
378
|
+
|
|
379
|
+
Emit machine-readable JSON.
|
|
380
|
+
|
|
381
|
+
### `mastra env db create`
|
|
382
|
+
|
|
383
|
+
Provisions a managed database, attaches it, and polls until it's ready. Provisioning errors are printed with the provider's error detail.
|
|
384
|
+
|
|
385
|
+
With an environment argument, the database is scoped to that environment: only it receives the database's connection env vars, and the provider region is derived from the environment's region. Without one, the database is shared by all environments.
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
mastra env db create <env> --kind turso
|
|
389
|
+
mastra env db create --kind neon --name my-app-db --region aws-us-east-1
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
#### `--kind`
|
|
393
|
+
|
|
394
|
+
Database provider (required). One of `turso` or `neon`.
|
|
395
|
+
|
|
396
|
+
#### `--name`
|
|
397
|
+
|
|
398
|
+
Database name. Defaults to a name derived from the project slug (for example `my-app-db`).
|
|
399
|
+
|
|
400
|
+
#### `--region`
|
|
401
|
+
|
|
402
|
+
Provider region ID for shared databases. Ignored for environment-scoped databases.
|
|
403
|
+
|
|
404
|
+
#### `--no-wait`
|
|
405
|
+
|
|
406
|
+
Return immediately after the attach is queued instead of polling until the database is ready. Check progress later with `mastra env db show`.
|
|
407
|
+
|
|
408
|
+
#### `--json`
|
|
409
|
+
|
|
410
|
+
Emit machine-readable JSON.
|
|
411
|
+
|
|
412
|
+
### `mastra env db show`
|
|
413
|
+
|
|
414
|
+
Shows database details and, once the database is ready, its connection env vars. Secret values are masked by default.
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
mastra env db show <database>
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
`<database>` can be a database ID or name.
|
|
421
|
+
|
|
422
|
+
#### `--show-secrets`
|
|
423
|
+
|
|
424
|
+
Print secret connection values instead of masking them.
|
|
425
|
+
|
|
426
|
+
#### `--json`
|
|
427
|
+
|
|
428
|
+
Emit machine-readable JSON. Secret values are masked unless `--show-secrets` is passed.
|
|
429
|
+
|
|
430
|
+
### `mastra env db delete`
|
|
431
|
+
|
|
432
|
+
Permanently deletes a database with the provider, including all of its data. This cannot be undone. The CLI prompts for confirmation unless `--yes` is passed. After deletion, deploys no longer receive the database's env vars.
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
mastra env db delete <database>
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
#### `-y, --yes`
|
|
439
|
+
|
|
440
|
+
Skip the confirmation prompt.
|
|
441
|
+
|
|
442
|
+
### `mastra env deploys`
|
|
443
|
+
|
|
444
|
+
Lists deploys for a project, newest first. Deploys that are serving traffic are marked `(active)`.
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
mastra env deploys [environment]
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Omit `[environment]` to show deploys across all environments; pass an environment name, slug, or ID to filter to one.
|
|
451
|
+
|
|
452
|
+
#### `--json`
|
|
453
|
+
|
|
454
|
+
Emit machine-readable JSON.
|
|
455
|
+
|
|
337
456
|
## `mastra studio deploy`
|
|
338
457
|
|
|
339
458
|
> **Info:** `mastra studio deploy` continues to work but is superseded by [`mastra deploy`](#mastra-deploy), which supports named environments (`--env staging`, `--env production`) on a single project. New setups should use `mastra deploy`.
|
|
@@ -1380,6 +1499,8 @@ By default, Mastra collects anonymous information about your project like your O
|
|
|
1380
1499
|
|
|
1381
1500
|
When a server started with `mastra dev` or `mastra start` has observability metrics enabled, Mastra also sends anonymous, aggregated model usage at startup: input and output token counts per provider and model, plus the command (`dev` or `start`) and `NODE_ENV`. No prompts, responses, or other message content is ever sent. You can read the [source code](https://github.com/mastra-ai/mastra/blob/main/packages/core/src/telemetry/usage-telemetry.ts) to check what's collected.
|
|
1382
1501
|
|
|
1502
|
+
At server startup, Mastra also sends an anonymous project-surface snapshot: counts of registered agents, agent controllers, workflows, tools, processors, vector stores, scorers, workspaces, MCP servers, gateways, and channels, plus booleans for memory, voice, editor, and observability usage and the coarse storage backend category. It doesn't send names or identifiers. You can read the [source code](https://github.com/mastra-ai/mastra/blob/main/packages/core/src/telemetry/feature-telemetry.ts) to check what's collected.
|
|
1503
|
+
|
|
1383
1504
|
You can opt out of all CLI and usage analytics by setting an environment variable:
|
|
1384
1505
|
|
|
1385
1506
|
```bash
|
|
@@ -48,6 +48,8 @@ const { controller } = await mountAgentControllerOnMastra({ mastra })
|
|
|
48
48
|
|
|
49
49
|
**extraTools** (`Record<string, ToolAction> | (ctx) => Record<string, ToolAction>`): Extra tools merged into the dynamic tool set.
|
|
50
50
|
|
|
51
|
+
**postToolObserver** (`(context: ToolAfterHookContext) => void | Promise<void>`): Observes completed tool calls without replacing the tool or changing hook-manager behavior. Observer errors are logged and do not fail successful tool calls.
|
|
52
|
+
|
|
51
53
|
**disabledTools** (`string[]`): Tools removed from the dynamic tool set before exposure to the model.
|
|
52
54
|
|
|
53
55
|
**storage** (`StorageConfig`): Custom storage config instead of the auto-detected default.
|
|
@@ -38,7 +38,7 @@ const agent = createCodingAgent({
|
|
|
38
38
|
|
|
39
39
|
**signals** (`SignalProvider[]`): Signal providers for the agent. When omitted, defaults to a single TaskSignalProvider.
|
|
40
40
|
|
|
41
|
-
**errorProcessors** (`Processor[]`): Error processors for the agent. When omitted, defaults to
|
|
41
|
+
**errorProcessors** (`Processor[]`): Error processors for the agent. When omitted, defaults to unknown stream-error retries with specialized ECONNRESET and bad-request policies, plus PrefillErrorHandler and ProviderHistoryCompat.
|
|
42
42
|
|
|
43
43
|
**goal** (`AgentGoalConfig`): Goal configuration. When provided without a prompt, the prompt defaults to DEFAULT\_GOAL\_JUDGE\_PROMPT.
|
|
44
44
|
|
|
@@ -54,7 +54,7 @@ The factory only fills a default when you don't provide the corresponding field.
|
|
|
54
54
|
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
55
55
|
| `workspace` | A [`Workspace`](https://mastra.ai/reference/workspace/workspace-class) backed by `LocalFilesystem` and `LocalSandbox` rooted at the base path. |
|
|
56
56
|
| `signals` | A single [`TaskSignalProvider`](https://mastra.ai/reference/signals/task-signal-provider). |
|
|
57
|
-
| `errorProcessors` | ECONNRESET and bad-request
|
|
57
|
+
| `errorProcessors` | Unknown stream-error retries with specialized ECONNRESET and bad-request policies, plus `PrefillErrorHandler` and `ProviderHistoryCompat`. |
|
|
58
58
|
| `goal.prompt` | `DEFAULT_GOAL_JUDGE_PROMPT` (only when a `goal` is configured). |
|
|
59
59
|
|
|
60
60
|
### Workspace
|
|
@@ -85,12 +85,13 @@ const agent = createCodingAgent({
|
|
|
85
85
|
|
|
86
86
|
### Error processors
|
|
87
87
|
|
|
88
|
-
The default error
|
|
88
|
+
The default [`StreamErrorRetryProcessor`](https://mastra.ai/reference/processors/stream-error-retry-processor) applies these retry policies:
|
|
89
89
|
|
|
90
|
+
- Unknown errors left unmatched by provider metadata or a specific matcher retry up to twice with a `3000ms` delay. Known authorization failures surface immediately.
|
|
90
91
|
- Network resets (`ECONNRESET` / `socket hang up`) retry up to twice with exponential backoff (`1000ms * 2^retryCount`, capped at `30000ms`).
|
|
91
92
|
- Bad-request errors retry once after `2000ms`.
|
|
92
93
|
|
|
93
|
-
`PrefillErrorHandler` and `ProviderHistoryCompat` are also included for provider compatibility.
|
|
94
|
+
Specific network-reset and bad-request policies take precedence over the unknown-error policy. Passing `errorProcessors` replaces the default processor stack. `PrefillErrorHandler` and `ProviderHistoryCompat` are also included for provider compatibility.
|
|
94
95
|
|
|
95
96
|
## Related
|
|
96
97
|
|
|
@@ -53,6 +53,14 @@ const scorer = createScorer({
|
|
|
53
53
|
|
|
54
54
|
**judge.jsonPromptInjection** (`boolean`): When true, inject the JSON schema into the prompt instead of using the provider's native response\_format API. Set this for models that don't support native structured output (e.g. some Groq Llama models) to avoid a wasted 400 call.
|
|
55
55
|
|
|
56
|
+
**judge.inputProcessors** (`Processor[]`): Input processors applied to the internal judge agent before its messages reach the model (e.g. redaction, validation).
|
|
57
|
+
|
|
58
|
+
**judge.outputProcessors** (`Processor[]`): Output processors applied to the internal judge agent's output before it is returned (e.g. moderation, transformation).
|
|
59
|
+
|
|
60
|
+
**judge.errorProcessors** (`Processor[]`): Error processors for judge models that use Mastra’s current generation API. These implement processAPIError and can inspect LLM API rejections and signal a retry, e.g. StreamErrorRetryProcessor. Legacy model adapters use generateLegacy() and do not run error processors.
|
|
61
|
+
|
|
62
|
+
**judge.maxProcessorRetries** (`number`): Maximum number of times error processors can retry one judge generation. The runtime defaults to 10 when errorProcessors are configured without this value. Set it explicitly to bound the retry budget.
|
|
63
|
+
|
|
56
64
|
**type** (`string`): Type specification for input/output. Use 'agent' for automatic agent types. For custom types, use the generic approach instead.
|
|
57
65
|
|
|
58
66
|
**prepareRun** (`(run: ScorerRun) => ScorerRun | Promise<ScorerRun>`): Transform the scorer run data before the pipeline executes. Use this to filter messages, limit context size, or drop fields the scorer doesn't need. The \`filterRun()\` utility creates this function from declarative options. Can be async.
|
|
@@ -63,6 +71,61 @@ The judge only runs for steps defined as **prompt objects** (`preprocess`, `anal
|
|
|
63
71
|
|
|
64
72
|
When a prompt-object step runs, its structured LLM output is stored in the corresponding result field (`preprocessStepResult`, `analyzeStepResult`, or the value consumed by `calculateScore` in `generateScore`).
|
|
65
73
|
|
|
74
|
+
## Retry judge requests
|
|
75
|
+
|
|
76
|
+
Use the existing judge `errorProcessors` configuration to retry transient failures inside a failed judge request. This doesn't retry the scorer workflow, trace target, batch item, score write, or a completed scorer step.
|
|
77
|
+
|
|
78
|
+
`@mastra/core` `1.49.0` doesn't include scorer error-processor configuration. Upgrade to a version with scorer processor support, or backport that focused change, before using this configuration.
|
|
79
|
+
|
|
80
|
+
The following example uses one bounded retry budget. Set the processor `maxRetries` and `judge.maxProcessorRetries` to the same value. Keep the internal judge agent's model retries at the default of `0` so model retries don't multiply processor attempts.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { createScorer } from '@mastra/core/evals'
|
|
84
|
+
import { StreamErrorRetryProcessor } from '@mastra/core/processors'
|
|
85
|
+
|
|
86
|
+
const isTransientNetworkError = (error: unknown) =>
|
|
87
|
+
error instanceof Error && /ECONNRESET|ETIMEDOUT|socket hang up/i.test(error.message)
|
|
88
|
+
|
|
89
|
+
const retryProcessor = new StreamErrorRetryProcessor({
|
|
90
|
+
maxRetries: 2,
|
|
91
|
+
maxRetryAfterMs: 30_000,
|
|
92
|
+
delayMs: ({ retryCount }) => Math.min(1_000 * 2 ** retryCount, 30_000),
|
|
93
|
+
matchers: [isTransientNetworkError],
|
|
94
|
+
retryUnknownErrors: false,
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
export const responseQuality = createScorer({
|
|
98
|
+
id: 'response-quality',
|
|
99
|
+
description: 'Scores response quality',
|
|
100
|
+
judge: {
|
|
101
|
+
model: myModel,
|
|
102
|
+
instructions: 'Return a score and concise reason.',
|
|
103
|
+
errorProcessors: [retryProcessor],
|
|
104
|
+
maxProcessorRetries: 2,
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
.generateScore({
|
|
108
|
+
description: 'Score the response quality.',
|
|
109
|
+
createPrompt: ({ run }) => `Score: ${run.output}`,
|
|
110
|
+
})
|
|
111
|
+
.generateReason({
|
|
112
|
+
description: 'Explain the score.',
|
|
113
|
+
createPrompt: () => 'Explain the score.',
|
|
114
|
+
})
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
With this configuration, a failed request has at most three provider attempts: the initial request plus two processor retries. If `generateScore` completes and `generateReason` receives a retryable failure, only `generateReason` retries.
|
|
118
|
+
|
|
119
|
+
`StreamErrorRetryProcessor` honors retryable provider metadata and narrow custom matchers. It keeps `retryUnknownErrors` disabled by default, so authentication, invalid-request, and context-length errors fail immediately unless you explicitly match them. It bounds `Retry-After` values to `30_000` milliseconds by default; use `maxRetryAfterMs` to change that cap.
|
|
120
|
+
|
|
121
|
+
Avoid adding outer scorer or workflow retries. Avoid combining a nonzero model retry setting with this processor unless you intentionally accept additional attempts.
|
|
122
|
+
|
|
123
|
+
### Override retries for one step
|
|
124
|
+
|
|
125
|
+
A step's `judge` configuration overrides scorer-level judge fields. Processor arrays replace the scorer-level arrays. Omit `maxProcessorRetries` in the step configuration to inherit the scorer-level numeric cap.
|
|
126
|
+
|
|
127
|
+
Coordinated processor retries require a judge model that uses Mastra’s current generation API. Legacy model adapters call [`generateLegacy()`](https://mastra.ai/reference/agents/generateLegacy), bypass error processors, and use that API's separate AI SDK `maxRetries` default of `2`.
|
|
128
|
+
|
|
66
129
|
## Type safety
|
|
67
130
|
|
|
68
131
|
You can specify input/output types when creating scorers for better type inference and IntelliSense support:
|
|
@@ -56,9 +56,9 @@ result.thresholdResults // [{ id, passed, averageScore, threshold }]
|
|
|
56
56
|
|
|
57
57
|
**data** (`RunEvalsDataItem[]`): Array of test cases with input data and optional ground truth.
|
|
58
58
|
|
|
59
|
-
**scorers** (`ScorerEntry[] | AgentScorerConfig | WorkflowScorerConfig`): Scorers to use. Each entry is either a bare MastraScorer or { scorer, threshold } for threshold tracking. An AgentScorerConfig object separates agent-level and trajectory scorers. A WorkflowScorerConfig object specifies scorers for the workflow, individual steps, and trajectory.
|
|
59
|
+
**scorers** (`ScorerEntry[] | AgentScorerConfig | WorkflowScorerConfig`): Scorers to use. Each entry is either a bare MastraScorer or { scorer, threshold } for threshold tracking. An AgentScorerConfig object separates agent-level and trajectory scorers. A WorkflowScorerConfig object specifies scorers for the workflow, individual steps, and trajectory. Optional when at least one gate is provided (gate-only runs).
|
|
60
60
|
|
|
61
|
-
**gates** (`MastraScorer[]`): Scorers that must score 1.0 for the run to pass. If any gate averages below 1.0 across data items, the verdict is failed. Gates run before regular scorers on each data item.
|
|
61
|
+
**gates** (`MastraScorer[]`): Scorers that must score 1.0 for the run to pass. If any gate averages below 1.0 across data items, the verdict is failed. Gates run before regular scorers on each data item. When provided, scorers may be omitted.
|
|
62
62
|
|
|
63
63
|
**targetOptions** (`AgentExecutionOptions | WorkflowRunOptions`): Options forwarded to the target during execution. For agents: options passed to agent.generate() (e.g. maxSteps, modelSettings, instructions). For workflows: options passed to run.start() (e.g. perStep, outputOptions, initialState).
|
|
64
64
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Logger
|
|
4
|
+
|
|
5
|
+
Mastra sets the project's [logger](https://mastra.ai/docs/observability/logging) from a `logger.ts` file directly under `src/mastra/`. The file default-exports a logger, which replaces the built-in `ConsoleLogger` used across agents, workflows, and other components.
|
|
6
|
+
|
|
7
|
+
Use this page for the file-based convention. For log levels, transports, and provider details, see [logging](https://mastra.ai/docs/observability/logging).
|
|
8
|
+
|
|
9
|
+
## Quickstart
|
|
10
|
+
|
|
11
|
+
Create `src/mastra/logger.ts` and default-export a logger, such as [`PinoLogger`](https://mastra.ai/reference/logging/pino-logger):
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { PinoLogger } from '@mastra/loggers'
|
|
15
|
+
|
|
16
|
+
export default new PinoLogger({
|
|
17
|
+
name: 'Mastra',
|
|
18
|
+
level: 'info',
|
|
19
|
+
})
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Mastra registers the logger before storage, observability, and file-based agents, so those primitives log through this logger as they are wired up.
|
|
23
|
+
|
|
24
|
+
## Precedence with code
|
|
25
|
+
|
|
26
|
+
Code-registered logging wins over `logger.ts`. If you pass `logger` to `new Mastra({ logger })` in `src/mastra/index.ts` (or set `logger: false` to disable logging), `logger.ts` is ignored with a warning. Use `logger.ts` when one project-wide logger is enough; use code registration when setup depends on runtime wiring.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Scorers
|
|
4
|
+
|
|
5
|
+
A file-based agent discovers [scorers](https://mastra.ai/docs/evals/overview) from its `scorers/` directory. Use this page for the file-based convention; use the scorers guide for built-in scorers, custom scorers, and sampling.
|
|
6
|
+
|
|
7
|
+
Each file under `scorers/` default-exports one scorer, and the filename becomes its key. The default export is either a [`MastraScorer`](https://mastra.ai/reference/evals/create-scorer) or a `{ scorer, sampling }` entry.
|
|
8
|
+
|
|
9
|
+
## Quickstart
|
|
10
|
+
|
|
11
|
+
Add a scorer by placing a file under the agent's `scorers/` directory. This example uses a [custom scorer](https://mastra.ai/docs/evals/custom-scorers):
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { createScorer } from '@mastra/core/evals'
|
|
15
|
+
|
|
16
|
+
export default createScorer({
|
|
17
|
+
id: 'relevance',
|
|
18
|
+
description: 'Scores how relevant the response is',
|
|
19
|
+
}).generateScore(() => 1)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The scorer is registered on the `weather` agent under the key `relevance`, the same as adding it to `config.scorers`.
|
|
23
|
+
|
|
24
|
+
## Sampling
|
|
25
|
+
|
|
26
|
+
To control how often a scorer runs, default-export a `{ scorer, sampling }` entry instead of a bare scorer:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { createScorer } from '@mastra/core/evals'
|
|
30
|
+
|
|
31
|
+
const relevance = createScorer({
|
|
32
|
+
id: 'relevance',
|
|
33
|
+
description: 'Scores how relevant the response is',
|
|
34
|
+
}).generateScore(() => 1)
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
scorer: relevance,
|
|
38
|
+
sampling: { type: 'ratio', rate: 0.5 },
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Precedence with config
|
|
43
|
+
|
|
44
|
+
Discovered scorers are merged with the scorers defined in [`config.ts`](https://mastra.ai/reference/file-based-agents/config). On a key collision, `config.scorers` wins with a warning. If `config.scorers` is a function, discovered scorers are ignored with a warning because function-valued scorers can't be statically merged.
|
|
45
|
+
|
|
46
|
+
When keys collide, precedence is:
|
|
47
|
+
|
|
48
|
+
1. Function-valued `config.scorers`
|
|
49
|
+
2. Record-valued `config.scorers`
|
|
50
|
+
3. Discovered files under `scorers/`
|
|
51
|
+
|
|
52
|
+
Non-colliding discovered scorers are preserved.
|
|
53
|
+
|
|
54
|
+
Visit [`createScorer()`](https://mastra.ai/reference/evals/create-scorer) for the full scorer interface.
|
package/.docs/reference/index.md
CHANGED
|
@@ -177,9 +177,11 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
177
177
|
- [.updateItem()](https://mastra.ai/reference/datasets/updateItem)
|
|
178
178
|
- [config.ts](https://mastra.ai/reference/file-based-agents/config)
|
|
179
179
|
- [Instructions](https://mastra.ai/reference/file-based-agents/instructions)
|
|
180
|
+
- [Logger](https://mastra.ai/reference/file-based-agents/logger)
|
|
180
181
|
- [Memory](https://mastra.ai/reference/file-based-agents/memory)
|
|
181
182
|
- [Observability](https://mastra.ai/reference/file-based-agents/observability)
|
|
182
183
|
- [Processors](https://mastra.ai/reference/file-based-agents/processors)
|
|
184
|
+
- [Scorers](https://mastra.ai/reference/file-based-agents/scorers)
|
|
183
185
|
- [Server](https://mastra.ai/reference/file-based-agents/server)
|
|
184
186
|
- [Skills](https://mastra.ai/reference/file-based-agents/skills)
|
|
185
187
|
- [Storage](https://mastra.ai/reference/file-based-agents/storage)
|
|
@@ -107,4 +107,4 @@ The root URL for the endpoints below is: `/v1/gateway`
|
|
|
107
107
|
|
|
108
108
|
## Gateway proxy endpoints
|
|
109
109
|
|
|
110
|
-
Visit the [
|
|
110
|
+
Visit the [Gateway documentation](https://gateway.mastra.ai/docs) for more details.
|