@mastra/mcp-docs-server 1.1.35 → 1.1.36-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/a2a.md +235 -0
- package/.docs/docs/agents/response-caching.md +11 -11
- package/.docs/docs/agents/signals.md +1 -1
- package/.docs/docs/deployment/cloud-providers.md +1 -1
- package/.docs/docs/deployment/overview.md +6 -5
- package/.docs/docs/mastra-platform/configuration.md +22 -6
- package/.docs/docs/mastra-platform/observability.md +99 -0
- package/.docs/docs/mastra-platform/overview.md +12 -55
- package/.docs/{guides/deployment/mastra-platform.md → docs/mastra-platform/server.md} +30 -37
- package/.docs/docs/mastra-platform/studio.md +81 -0
- package/.docs/docs/observability/overview.md +10 -5
- package/.docs/docs/observability/tracing/exporters/mastra-platform.md +13 -13
- package/.docs/docs/observability/tracing/exporters/mastra-storage.md +1 -1
- package/.docs/docs/observability/tracing/overview.md +4 -4
- package/.docs/docs/server/mastra-client.md +1 -0
- package/.docs/docs/server/mastra-server.md +2 -1
- package/.docs/docs/studio/deployment.md +1 -37
- package/.docs/docs/studio/observability.md +28 -23
- package/.docs/docs/studio/overview.md +3 -3
- package/.docs/guides/getting-started/quickstart.md +4 -4
- package/.docs/guides/migrations/mastra-cloud.md +8 -8
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +2 -2
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +1 -1
- package/.docs/models/providers/alibaba.md +1 -1
- package/.docs/models/providers/auriko.md +85 -0
- package/.docs/models/providers/claudinio.md +71 -0
- package/.docs/models/providers/deepinfra.md +3 -1
- package/.docs/models/providers/google.md +1 -1
- package/.docs/models/providers/kilo.md +1 -1
- package/.docs/models/providers/llmgateway.md +1 -1
- package/.docs/models/providers/wafer.ai.md +4 -6
- package/.docs/models/providers.md +2 -0
- package/.docs/reference/cli/create-mastra.md +6 -0
- package/.docs/reference/cli/mastra.md +30 -14
- package/.docs/reference/harness/harness-class.md +1 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +1 -1
- package/.docs/reference/observability/tracing/configuration.md +1 -1
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +2 -2
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +3 -3
- package/.docs/reference/observability/tracing/interfaces.md +1 -1
- package/CHANGELOG.md +14 -0
- package/package.json +4 -4
|
@@ -1,46 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Server on Mastra platform
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Server on Mastra platform is a production deployment target that runs your Mastra application as an API server. Use it when you want the platform to build, deploy, host, and manage your Mastra server.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
You get a stable API endpoint, environment variable management, custom domain support, and deploy history out of the box.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> **Note:** Server deploy provisions hosted storage automatically. If you override storage with [LibSQLStore](https://mastra.ai/reference/storage/libsql) and a file URL, switch to a remotely hosted database because Mastra platform uses an ephemeral filesystem.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Quickstart
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
1. Follow the [get started guide](https://mastra.ai/docs) to create your first Mastra project.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
2. Install the `mastra` CLI globally:
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
**npm**:
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
npm install -g mastra
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**pnpm**:
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g mastra
|
|
19
|
+
```
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
pnpm add -g mastra
|
|
27
|
-
```
|
|
21
|
+
**pnpm**:
|
|
28
22
|
|
|
29
|
-
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add -g mastra
|
|
25
|
+
```
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
yarn global add mastra
|
|
33
|
-
```
|
|
27
|
+
**Yarn**:
|
|
34
28
|
|
|
35
|
-
|
|
29
|
+
```bash
|
|
30
|
+
yarn global add mastra
|
|
31
|
+
```
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
bun add --global mastra
|
|
39
|
-
```
|
|
33
|
+
**Bun**:
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
```bash
|
|
36
|
+
bun add --global mastra
|
|
37
|
+
```
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
3. Deploy your project:
|
|
44
40
|
|
|
45
41
|
```bash
|
|
46
42
|
mastra server deploy
|
|
@@ -54,7 +50,7 @@ bun add --global mastra
|
|
|
54
50
|
|
|
55
51
|
See the [CLI reference](https://mastra.ai/reference/cli/mastra) for the full list of flags.
|
|
56
52
|
|
|
57
|
-
|
|
53
|
+
4. Verify your deployment at the URL printed by the CLI. Append `/api/agents` to confirm it returns a JSON list of your agents.
|
|
58
54
|
|
|
59
55
|
> **Warning:** Set up [authentication](https://mastra.ai/docs/server/auth) before exposing your endpoints publicly.
|
|
60
56
|
|
|
@@ -181,11 +177,8 @@ The CLI reads `organizationId` and `projectId` from `.mastra-project.json` by de
|
|
|
181
177
|
|
|
182
178
|
## Related
|
|
183
179
|
|
|
184
|
-
- [
|
|
185
|
-
- [
|
|
186
|
-
- [
|
|
187
|
-
- [
|
|
188
|
-
- [
|
|
189
|
-
- [Mastra platform overview](https://mastra.ai/docs/mastra-platform/overview)
|
|
190
|
-
- [Studio deployment](https://mastra.ai/docs/studio/deployment)
|
|
191
|
-
- [Deployment overview](https://mastra.ai/docs/deployment/overview)
|
|
180
|
+
- [`mastra server deploy`](https://mastra.ai/reference/cli/mastra)
|
|
181
|
+
- [`mastra server pause`](https://mastra.ai/reference/cli/mastra)
|
|
182
|
+
- [`mastra server restart`](https://mastra.ai/reference/cli/mastra)
|
|
183
|
+
- [`mastra studio deploy`](https://mastra.ai/reference/cli/mastra)
|
|
184
|
+
- [`mastra auth tokens`](https://mastra.ai/reference/cli/mastra)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Studio on Mastra platform
|
|
2
|
+
|
|
3
|
+
Studio on Mastra platform is a hosted visual environment for testing agents, running workflows, and inspecting traces. Use it when you want to share Studio with your team without hosting the Studio UI yourself.
|
|
4
|
+
|
|
5
|
+
## Quickstart
|
|
6
|
+
|
|
7
|
+
1. Follow the [get started guide](https://mastra.ai/docs) to create your first Mastra project.
|
|
8
|
+
|
|
9
|
+
2. Install the `mastra` CLI globally:
|
|
10
|
+
|
|
11
|
+
**npm**:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g mastra
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**pnpm**:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm add -g mastra
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Yarn**:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn global add mastra
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Bun**:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bun add --global mastra
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
3. Deploy Studio with a single command:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
mastra studio deploy
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
On a successful deploy, the CLI outputs the URL of your deployed Studio instance.
|
|
42
|
+
|
|
43
|
+
On your first deploy, the CLI prompts you to create a new project or select an existing one. It then creates a `.mastra-project.json` file in your project directory. This file links your local project to a platform project. It contains the `projectId`, `projectName`, and `organizationId`. Commit this file to your repository so CI/CD knows which project to deploy to.
|
|
44
|
+
|
|
45
|
+
## How deploy works
|
|
46
|
+
|
|
47
|
+
The `mastra studio deploy` command builds your project, compiles `src/mastra/` into `.mastra/output`, packages the output as an artifact ZIP, uploads it, and deploys it to a cloud sandbox.
|
|
48
|
+
|
|
49
|
+
A deploy transitions through **queued → uploading → starting → running** or **failed** if something goes wrong. If a sandbox is already running for your project, the platform updates it in place with no downtime. Otherwise, it creates a fresh sandbox. Your instance URL is assigned per project slug and remains stable across deploys.
|
|
50
|
+
|
|
51
|
+
See the [`mastra studio deploy` CLI reference](https://mastra.ai/reference/cli/mastra) for the full list of flags and CI/CD usage.
|
|
52
|
+
|
|
53
|
+
## Environment files
|
|
54
|
+
|
|
55
|
+
The deploy bundles environment variables from a `.env` or `.env.*` file in the project directory. If no env file is present, the deploy errors with `No env file found for deploy.` after the build step. Add at least an empty `.env` file before running the command.
|
|
56
|
+
|
|
57
|
+
When multiple env files are present, the CLI prompts you to pick one. To select non-interactively, pass `--env-file`:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
mastra studio deploy --env-file .env.production --yes
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This is also how you target multiple environments from a single codebase: maintain one env file per environment, such as `.env.staging` and `.env.production`, and pass the right one to each deploy. Each environment still requires its own Mastra platform project. See [Configuration](https://mastra.ai/docs/mastra-platform/configuration) for the multi-environment pattern.
|
|
64
|
+
|
|
65
|
+
## Create a new project non-interactively
|
|
66
|
+
|
|
67
|
+
`mastra studio deploy` can create a project on first run. If `--project <name>` doesn't match an existing project, the CLI uses the value as the new project name and creates it after confirmation. Combined with `--yes`, this is fully scriptable:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
mastra studio deploy --project "my-new-project" --yes
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Use this from CI or AI coding agents instead of `mastra studio projects create`, which is interactive only.
|
|
74
|
+
|
|
75
|
+
## Self-host Studio
|
|
76
|
+
|
|
77
|
+
To deploy Studio on your own infrastructure, see [Studio deployment](https://mastra.ai/docs/studio/deployment).
|
|
78
|
+
|
|
79
|
+
## Related
|
|
80
|
+
|
|
81
|
+
- [`mastra studio deploy`](https://mastra.ai/reference/cli/mastra)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Observability overview
|
|
2
2
|
|
|
3
|
-
Mastra's observability system gives you visibility into every agent run, workflow step, tool call, and model interaction. It captures three complementary signals that work together to help you understand what your application is doing and why.
|
|
3
|
+
Mastra's observability system gives you visibility into every agent run, workflow step, tool call, and model interaction. Agent behavior depends on model responses, prompts, tools, memory, and workflow state, so observability helps you inspect runtime decisions from day one. It captures three complementary signals that work together to help you understand what your application is doing and why.
|
|
4
4
|
|
|
5
5
|
- [**Tracing**](https://mastra.ai/docs/observability/tracing/overview): Records every operation as a hierarchical timeline of spans, capturing inputs, outputs, token usage, and timing.
|
|
6
6
|
- [**Logging**](https://mastra.ai/docs/observability/logging): Forwards structured log entries from your application and Mastra internals to observability storage, correlated to traces automatically.
|
|
@@ -24,9 +24,9 @@ Logs are correlated to traces automatically. Every `logger.info()`, `logger.warn
|
|
|
24
24
|
|
|
25
25
|
All three signals share correlation IDs (trace ID, span ID, entity type, entity name), so you can jump between a metric spike, the traces behind it, and the logs within those traces.
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Quickstart
|
|
28
28
|
|
|
29
|
-
Install `@mastra/observability` and
|
|
29
|
+
Install `@mastra/observability` and storage backends that support traces and metrics:
|
|
30
30
|
|
|
31
31
|
**npm**:
|
|
32
32
|
|
|
@@ -83,7 +83,7 @@ export const mastra = new Mastra({
|
|
|
83
83
|
serviceName: 'mastra',
|
|
84
84
|
exporters: [
|
|
85
85
|
new MastraStorageExporter(), // Persists observability events to Mastra Storage
|
|
86
|
-
new MastraPlatformExporter(), // Sends observability events to Mastra
|
|
86
|
+
new MastraPlatformExporter(), // Sends observability events to Mastra platform (if MASTRA_PLATFORM_ACCESS_TOKEN is set)
|
|
87
87
|
],
|
|
88
88
|
spanOutputProcessors: [
|
|
89
89
|
new SensitiveDataFilter(), // Redacts sensitive data like passwords, tokens, keys
|
|
@@ -96,6 +96,10 @@ export const mastra = new Mastra({
|
|
|
96
96
|
|
|
97
97
|
This enables tracing, log forwarding, and metrics. Mastra also supports external tracing providers like Langfuse, Datadog, and any OpenTelemetry-compatible platform. See [Tracing](https://mastra.ai/docs/observability/tracing/overview) for configuration details.
|
|
98
98
|
|
|
99
|
+
## Mastra platform
|
|
100
|
+
|
|
101
|
+
For hosted traces, logs, and metrics across projects and deploys, see [Observability on Mastra platform](https://mastra.ai/docs/mastra-platform/observability).
|
|
102
|
+
|
|
99
103
|
## Storage
|
|
100
104
|
|
|
101
105
|
Not all storage backends support every signal. Traces and logs work with most backends, but metrics require an OLAP-capable store like DuckDB (development) or ClickHouse (production). For the full compatibility list, see [storage provider support](https://mastra.ai/docs/observability/tracing/exporters/mastra-storage).
|
|
@@ -108,4 +112,5 @@ For production environments with high traffic, use composite storage to route th
|
|
|
108
112
|
- [Logging](https://mastra.ai/docs/observability/logging)
|
|
109
113
|
- [Metrics](https://mastra.ai/docs/observability/metrics/overview)
|
|
110
114
|
- [Mastra Studio](https://mastra.ai/docs/studio/observability)
|
|
111
|
-
- [Automatic metrics reference](https://mastra.ai/reference/observability/metrics/automatic-metrics)
|
|
115
|
+
- [Automatic metrics reference](https://mastra.ai/reference/observability/metrics/automatic-metrics)
|
|
116
|
+
- [Mastra platform observability](https://mastra.ai/docs/mastra-platform/observability)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Mastra
|
|
1
|
+
# Mastra platform exporter
|
|
2
2
|
|
|
3
3
|
The `MastraPlatformExporter` sends traces, logs, metrics, scores, and feedback to the Mastra platform. Use it to route observability data from any Mastra app to a hosted project in the Mastra platform.
|
|
4
4
|
|
|
5
5
|
> **Note:** `MastraPlatformExporter` was previously called `CloudExporter`. The original `CloudExporter` class is still exported from `@mastra/observability` for backward compatibility, but it is deprecated. New code should use `MastraPlatformExporter`.
|
|
6
6
|
|
|
7
|
-
> **Self-hosted or standalone apps:** If you host your Mastra application on your own infrastructure (not on Mastra
|
|
7
|
+
> **Self-hosted or standalone apps:** If you host your Mastra application on your own infrastructure (not on Mastra platform), you still need a deployed Studio project to view traces, logs, and metrics. `MastraPlatformExporter` sends data to a Studio project, so one must exist before you can use it.
|
|
8
8
|
>
|
|
9
9
|
> 1. [Create a Mastra project](https://mastra.ai/guides/getting-started/quickstart) if you don't have one yet.
|
|
10
10
|
> 2. [Deploy Studio](https://mastra.ai/docs/studio/deployment) to the Mastra platform with `mastra studio deploy`.
|
|
@@ -13,8 +13,8 @@ The `MastraPlatformExporter` sends traces, logs, metrics, scores, and feedback t
|
|
|
13
13
|
## Version compatibility
|
|
14
14
|
|
|
15
15
|
- `MastraPlatformExporter` is available starting in `@mastra/observability@1.12.0`. In `1.8.0` through `1.11.x` the same exporter ships only as `CloudExporter`; the constructor signature and environment variables are identical.
|
|
16
|
-
- In `@mastra/observability@1.8.0` through `1.9.1`, set `
|
|
17
|
-
- Starting in `@mastra/observability@1.9.2`, the exporter defaults to `https://observability.mastra.ai`, so `
|
|
16
|
+
- In `@mastra/observability@1.8.0` through `1.9.1`, set `MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT=https://observability.mastra.ai` in addition to `MASTRA_PLATFORM_ACCESS_TOKEN` and `MASTRA_PROJECT_ID`.
|
|
17
|
+
- Starting in `@mastra/observability@1.9.2`, the exporter defaults to `https://observability.mastra.ai`, so `MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT` is only required when you want to send telemetry to a different collector.
|
|
18
18
|
|
|
19
19
|
## Quickstart
|
|
20
20
|
|
|
@@ -28,7 +28,7 @@ Run the following command:
|
|
|
28
28
|
mastra auth tokens create exporter-token
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
This command prints a token secret that you can use as `
|
|
31
|
+
This command prints a token secret that you can use as `MASTRA_PLATFORM_ACCESS_TOKEN`.
|
|
32
32
|
|
|
33
33
|
If you already have an access token, copy the **Observability** value from the Mastra platform instead. You can find it in either of these places:
|
|
34
34
|
|
|
@@ -38,7 +38,7 @@ If you already have an access token, copy the **Observability** value from the M
|
|
|
38
38
|
Set the token as an environment variable:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
|
|
41
|
+
MASTRA_PLATFORM_ACCESS_TOKEN=<your-platform-access-token>
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
### 2. Find your `projectId`
|
|
@@ -74,20 +74,20 @@ MASTRA_PROJECT_ID=<your-project-id>
|
|
|
74
74
|
Set both values in your environment so `MastraPlatformExporter` can authenticate and route telemetry to the correct project:
|
|
75
75
|
|
|
76
76
|
```bash
|
|
77
|
-
|
|
77
|
+
MASTRA_PLATFORM_ACCESS_TOKEN=<your-platform-access-token>
|
|
78
78
|
MASTRA_PROJECT_ID=<your-project-id>
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
If you use `@mastra/observability@1.8.0` through `1.9.1`, also set the Mastra platform collector explicitly:
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
|
-
|
|
84
|
+
MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT=https://observability.mastra.ai
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
If you want to send telemetry somewhere other than Mastra platform, set `
|
|
87
|
+
If you want to send telemetry somewhere other than Mastra platform, set `MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT` as well. Pass either a base origin or a full traces publish URL ending in `/spans/publish`.
|
|
88
88
|
|
|
89
89
|
```bash
|
|
90
|
-
|
|
90
|
+
MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT=https://collector.example.com
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
When you pass a base origin, `MastraPlatformExporter` derives the matching publish URLs for traces, logs, metrics, scores, and feedback automatically.
|
|
@@ -124,7 +124,7 @@ If you prefer, rely entirely on environment variables:
|
|
|
124
124
|
new MastraPlatformExporter()
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
With `
|
|
127
|
+
With `MASTRA_PLATFORM_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` set, `MastraPlatformExporter` sends data to the Mastra platform project you configured. If you also set `MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT`, it sends data to that collector instead.
|
|
128
128
|
|
|
129
129
|
> **Note:** Visit [MastraPlatformExporter reference](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for the full list of configuration options.
|
|
130
130
|
|
|
@@ -156,10 +156,10 @@ export const mastra = new Mastra({
|
|
|
156
156
|
|
|
157
157
|
## Complete configuration
|
|
158
158
|
|
|
159
|
-
`MastraPlatformExporter` defaults to Mastra platform. If you want to send telemetry to a different collector, set `
|
|
159
|
+
`MastraPlatformExporter` defaults to Mastra platform. If you want to send telemetry to a different collector, set `MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT` in your environment or pass `endpoint` in code.
|
|
160
160
|
|
|
161
161
|
```bash
|
|
162
|
-
|
|
162
|
+
MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT=https://collector.example.com
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
The following example demonstrates how to override the collector endpoint and batching behavior in code:
|
|
@@ -61,7 +61,7 @@ export const mastra = new Mastra({
|
|
|
61
61
|
serviceName: 'mastra',
|
|
62
62
|
exporters: [
|
|
63
63
|
new MastraStorageExporter(), // Persists observability events to Mastra Storage
|
|
64
|
-
new MastraPlatformExporter(), // Sends observability events to Mastra
|
|
64
|
+
new MastraPlatformExporter(), // Sends observability events to Mastra platform (requires MASTRA_PLATFORM_ACCESS_TOKEN)
|
|
65
65
|
],
|
|
66
66
|
spanOutputProcessors: [new SensitiveDataFilter()],
|
|
67
67
|
},
|
|
@@ -33,7 +33,7 @@ export const mastra = new Mastra({
|
|
|
33
33
|
serviceName: 'mastra',
|
|
34
34
|
exporters: [
|
|
35
35
|
new MastraStorageExporter(), // Persists observability events to Mastra Storage
|
|
36
|
-
new MastraPlatformExporter(), // Sends observability events to Mastra
|
|
36
|
+
new MastraPlatformExporter(), // Sends observability events to Mastra platform (if MASTRA_PLATFORM_ACCESS_TOKEN is set)
|
|
37
37
|
],
|
|
38
38
|
spanOutputProcessors: [
|
|
39
39
|
new SensitiveDataFilter(), // Redacts sensitive data like passwords, tokens, keys
|
|
@@ -57,7 +57,7 @@ This configuration includes:
|
|
|
57
57
|
- **Exporters**:
|
|
58
58
|
|
|
59
59
|
- `MastraStorageExporter` - Persists observability events to Mastra Storage
|
|
60
|
-
- `MastraPlatformExporter` - Sends observability events to Mastra
|
|
60
|
+
- `MastraPlatformExporter` - Sends observability events to Mastra platform (requires `MASTRA_PLATFORM_ACCESS_TOKEN`)
|
|
61
61
|
|
|
62
62
|
- **Span Output Processors**: `SensitiveDataFilter` - Redacts sensitive fields
|
|
63
63
|
|
|
@@ -69,8 +69,8 @@ Exporters determine where your trace data is sent and how it's stored. They inte
|
|
|
69
69
|
|
|
70
70
|
Mastra provides two built-in exporters:
|
|
71
71
|
|
|
72
|
-
- **[Mastra Storage](https://mastra.ai/docs/observability/tracing/exporters/mastra-storage)
|
|
73
|
-
- **[Mastra
|
|
72
|
+
- **[Mastra Storage](https://mastra.ai/docs/observability/tracing/exporters/mastra-storage)**: Persists observability events to Mastra Storage for viewing in Studio
|
|
73
|
+
- **[Mastra platform](https://mastra.ai/docs/observability/tracing/exporters/mastra-platform)**: Sends observability events to Mastra platform for production monitoring and collaboration
|
|
74
74
|
|
|
75
75
|
### External Exporters
|
|
76
76
|
|
|
@@ -57,6 +57,7 @@ export const mastraClient = new MastraClient({
|
|
|
57
57
|
The Mastra Client SDK exposes all resources served by the Mastra Server.
|
|
58
58
|
|
|
59
59
|
- **[Agents](https://mastra.ai/reference/client-js/agents)**: Generate responses and stream conversations.
|
|
60
|
+
- **[A2A](https://mastra.ai/docs/agents/a2a)**: Discover agents through agent cards and work with task-based A2A streams.
|
|
60
61
|
- **[Memory](https://mastra.ai/reference/client-js/memory)**: Manage conversation threads and message history.
|
|
61
62
|
- **[Tools](https://mastra.ai/reference/client-js/tools)**: Executed and managed tools.
|
|
62
63
|
- **[Workflows](https://mastra.ai/reference/client-js/workflows)**: Trigger workflows and track their execution.
|
|
@@ -12,6 +12,7 @@ Mastra runs as an HTTP server that exposes your agents, workflows, and other fun
|
|
|
12
12
|
- **[Server Adapters](https://mastra.ai/docs/server/server-adapters)**: Run Mastra with Express, Hono, or your own HTTP server instead of the generated server.
|
|
13
13
|
- **[Custom Adapters](https://mastra.ai/docs/server/custom-adapters)**: Build adapters for frameworks not officially supported.
|
|
14
14
|
- **[Mastra Client SDK](https://mastra.ai/docs/server/mastra-client)**: Type-safe client for calling agents, workflows, and tools from browser or server environments.
|
|
15
|
+
- **[A2A](https://mastra.ai/docs/agents/a2a)**: Expose agents through A2A agent cards, task streams, and push notifications.
|
|
15
16
|
- **[Authentication](https://mastra.ai/docs/server/auth)**: Secure endpoints with JWT, Clerk, Supabase, Firebase, Auth0, or WorkOS.
|
|
16
17
|
|
|
17
18
|
## Configuration
|
|
@@ -33,7 +34,7 @@ export const mastra = new Mastra({
|
|
|
33
34
|
|
|
34
35
|
## Deploy your server
|
|
35
36
|
|
|
36
|
-
Mastra servers can be deployed to any Node.js-compatible environment. Deploy it to production using the [Mastra platform](https://mastra.ai/docs/mastra-platform/overview) or your own
|
|
37
|
+
Mastra servers can be deployed to any Node.js-compatible environment. Deploy it to production using the [Mastra platform](https://mastra.ai/docs/mastra-platform/overview) or your own infrastructure. Visit the [deployment docs](https://mastra.ai/docs/deployment/overview) to learn how.
|
|
37
38
|
|
|
38
39
|
## Server architecture
|
|
39
40
|
|
|
@@ -61,43 +61,7 @@ The command uses Node's built-in `http` module and [`serve-handler`](https://www
|
|
|
61
61
|
|
|
62
62
|
## Mastra platform
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Run the following command:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
mastra studio deploy
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
> **Note:** See the [CLI reference](https://mastra.ai/reference/cli/mastra) for the full list of flags and CI/CD usage.
|
|
73
|
-
|
|
74
|
-
This builds your project (compiling `src/mastra/` into `.mastra/output`), packages it as an artifact ZIP, uploads it, and deploys it to a cloud sandbox.
|
|
75
|
-
|
|
76
|
-
If this is your first deploy, the CLI will prompt you to create a new project or select an existing one. The `.mastra-project.json` file is written automatically.
|
|
77
|
-
|
|
78
|
-
A deploy transitions through **queued → uploading → starting → running** (or **failed** if something goes wrong). If a sandbox is already running for your project, the platform hot-updates it in place with no downtime. Otherwise it creates a fresh sandbox. Your instance URL is assigned per project slug and remains stable across deploys.
|
|
79
|
-
|
|
80
|
-
### Env file requirement
|
|
81
|
-
|
|
82
|
-
The deploy bundles environment variables from a `.env` or `.env.*` file in the project directory. If no env file is present, the deploy errors with `No env file found for deploy.` after the build step. Add at least an empty `.env` file before running the command.
|
|
83
|
-
|
|
84
|
-
When multiple env files are present, the CLI prompts you to pick one. To select non-interactively, pass `--env-file`:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
mastra studio deploy --env-file .env.production --yes
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
This is also how you target multiple environments from a single codebase: maintain one env file per environment (for example `.env.staging`, `.env.production`) and pass the right one to each deploy. Each environment still requires its own Mastra platform project — see [Configuration](https://mastra.ai/docs/mastra-platform/configuration) for the multi-environment pattern.
|
|
91
|
-
|
|
92
|
-
### Create a new project non-interactively
|
|
93
|
-
|
|
94
|
-
`mastra studio deploy` can create a project on first run. If `--project <name>` does not match an existing project, the CLI uses the value as the new project name and creates it after confirmation. Combined with `--yes`, this is fully scriptable:
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
mastra studio deploy --project "my-new-project" --yes
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Use this from CI or AI coding agents instead of `mastra studio projects create`, which is interactive only.
|
|
64
|
+
For hosted Studio on Mastra platform, see [Studio on Mastra platform](https://mastra.ai/docs/mastra-platform/studio).
|
|
101
65
|
|
|
102
66
|
## Running a server
|
|
103
67
|
|
|
@@ -6,27 +6,7 @@ Studio includes these observability views:
|
|
|
6
6
|
- **Traces** for individual request inspection
|
|
7
7
|
- **Logs** for browsing internal and application logs
|
|
8
8
|
|
|
9
|
-
All require an
|
|
10
|
-
|
|
11
|
-
## Metrics
|
|
12
|
-
|
|
13
|
-
A dashboard that summarizes agent, workflow, and tool performance over a configurable time range (last 24 hours to 30 days). The top row shows total agent runs, model cost, token consumption, and average scorer performance. Below that, detailed cards break down model usage and cost per model, token usage per agent, trace volume with completed and error counts, latency percentiles (p50 and p95), and scorer trends over time.
|
|
14
|
-
|
|
15
|
-
Visit the [metrics overview](https://mastra.ai/docs/observability/metrics/overview) for more details.
|
|
16
|
-
|
|
17
|
-
> **Note:** Metrics require a separate OLAP store for observability. Relational databases like PostgreSQL, LibSQL, etc. are not supported for metrics. In-memory storage resets on restart.
|
|
18
|
-
|
|
19
|
-
## Traces
|
|
20
|
-
|
|
21
|
-
When you run an agent or workflow, the Observability tab displays traces that highlight the key AI operations such as model calls, tool executions, and workflow steps. Follow these traces to see how data moves, where time is spent, and what's happening under the hood.
|
|
22
|
-
|
|
23
|
-
Tracing filters out low-level framework details so your traces stay focused and readable. Visit the [tracing overview](https://mastra.ai/docs/observability/tracing/overview) for more details.
|
|
24
|
-
|
|
25
|
-
## Logs
|
|
26
|
-
|
|
27
|
-
Browse internal Mastra logs forwarded to your observability storage. Logs provide full-text search (across message content, entity names, and trace IDs), date presets (last 24 hours to 30 days), and multi-select filters for level, entity type, and entity name. Selecting a log opens a detail panel showing the full message, structured data, and metadata. If the log is correlated with a trace, you can navigate directly to the trace and span timeline.
|
|
28
|
-
|
|
29
|
-
Log forwarding is enabled by default when you configure observability. See [logging](https://mastra.ai/docs/observability/logging) for level configuration, query examples, and customization details.
|
|
9
|
+
All require an observability storage backend to be configured.
|
|
30
10
|
|
|
31
11
|
## Quickstart
|
|
32
12
|
|
|
@@ -87,7 +67,7 @@ export const mastra = new Mastra({
|
|
|
87
67
|
serviceName: 'mastra',
|
|
88
68
|
exporters: [
|
|
89
69
|
new MastraStorageExporter(), // Persists observability events to Mastra Storage
|
|
90
|
-
new MastraPlatformExporter(), // Sends observability events to Mastra
|
|
70
|
+
new MastraPlatformExporter(), // Sends observability events to Mastra platform (if MASTRA_PLATFORM_ACCESS_TOKEN is set)
|
|
91
71
|
],
|
|
92
72
|
spanOutputProcessors: [
|
|
93
73
|
new SensitiveDataFilter(), // Redacts sensitive data like passwords, tokens, keys
|
|
@@ -98,9 +78,34 @@ export const mastra = new Mastra({
|
|
|
98
78
|
})
|
|
99
79
|
```
|
|
100
80
|
|
|
81
|
+
## Mastra platform
|
|
82
|
+
|
|
83
|
+
For hosted traces, logs, and metrics across projects and deploys, see [Observability on Mastra platform](https://mastra.ai/docs/mastra-platform/observability).
|
|
84
|
+
|
|
85
|
+
## Metrics
|
|
86
|
+
|
|
87
|
+
A dashboard that summarizes agent, workflow, and tool performance over a configurable time range (last 24 hours to 30 days). The top row shows total agent runs, model cost, token consumption, and average scorer performance. Below that, detailed cards break down model usage and cost per model, token usage per agent, trace volume with completed and error counts, latency percentiles (p50 and p95), and scorer trends over time.
|
|
88
|
+
|
|
89
|
+
Visit the [metrics overview](https://mastra.ai/docs/observability/metrics/overview) for more details.
|
|
90
|
+
|
|
91
|
+
> **Note:** Metrics require a separate OLAP store for observability. Relational databases like PostgreSQL, LibSQL, etc. aren't supported for metrics. In-memory storage resets on restart.
|
|
92
|
+
|
|
93
|
+
## Traces
|
|
94
|
+
|
|
95
|
+
When you run an agent or workflow, the Observability tab displays traces that highlight the key AI operations such as model calls, tool executions, and workflow steps. Follow these traces to see how data moves, where time is spent, and what's happening under the hood.
|
|
96
|
+
|
|
97
|
+
Tracing filters out low-level framework details so your traces stay focused and readable. Visit the [tracing overview](https://mastra.ai/docs/observability/tracing/overview) for more details.
|
|
98
|
+
|
|
99
|
+
## Logs
|
|
100
|
+
|
|
101
|
+
Browse internal Mastra logs forwarded to your observability storage. Logs provide full-text search (across message content, entity names, and trace IDs), date presets (last 24 hours to 30 days), and multi-select filters for level, entity type, and entity name. Selecting a log opens a detail panel showing the full message, structured data, and metadata. If the log is correlated with a trace, you can navigate directly to the trace and span timeline.
|
|
102
|
+
|
|
103
|
+
Log forwarding is enabled by default when you configure observability. See [logging](https://mastra.ai/docs/observability/logging) for level configuration, query examples, and customization details.
|
|
104
|
+
|
|
101
105
|
## Related
|
|
102
106
|
|
|
103
107
|
- [Observability overview](https://mastra.ai/docs/observability/overview)
|
|
104
108
|
- [Metrics overview](https://mastra.ai/docs/observability/metrics/overview)
|
|
105
109
|
- [Tracing overview](https://mastra.ai/docs/observability/tracing/overview)
|
|
106
|
-
- [Logging](https://mastra.ai/docs/observability/logging)
|
|
110
|
+
- [Logging](https://mastra.ai/docs/observability/logging)
|
|
111
|
+
- [Mastra platform observability](https://mastra.ai/docs/mastra-platform/observability)
|
|
@@ -34,14 +34,14 @@ bun run dev
|
|
|
34
34
|
|
|
35
35
|
Once the server is running, you can:
|
|
36
36
|
|
|
37
|
-
- Open the Studio UI at [
|
|
38
|
-
- Visit
|
|
37
|
+
- Open the Studio UI at [`localhost:4111`](http://localhost:4111/) to interact with your agents, workflows, and tools.
|
|
38
|
+
- Visit [`localhost:4111/swagger-ui`](http://localhost:4111/swagger-ui) to discover and interact with the underlying REST API.
|
|
39
39
|
|
|
40
40
|
While Studio is running, you can edit your [agents](https://mastra.ai/docs/agents/overview), [workflows](https://mastra.ai/docs/workflows/overview), and other parts of your Mastra application in real time.
|
|
41
41
|
|
|
42
42
|
## Deploy Studio
|
|
43
43
|
|
|
44
|
-
When you're ready to share Studio with your team, you can deploy it to production using
|
|
44
|
+
When you're ready to share Studio with your team, you can deploy it to production using [Studio on Mastra platform](https://mastra.ai/docs/mastra-platform/studio) or your own infrastructure. Visit the [deployment docs](https://mastra.ai/docs/studio/deployment) to learn how.
|
|
45
45
|
|
|
46
46
|
## Primitives
|
|
47
47
|
|
|
@@ -10,9 +10,7 @@ If you need more control over the setup, see the [manual installation guide](htt
|
|
|
10
10
|
|
|
11
11
|
## Initialize Mastra
|
|
12
12
|
|
|
13
|
-
You can run `create mastra` anywhere on your machine.
|
|
14
|
-
|
|
15
|
-
When prompted, choose a provider (e.g. OpenAI) and enter your key:
|
|
13
|
+
You can run `create mastra` anywhere on your machine. Start the setup wizard:
|
|
16
14
|
|
|
17
15
|
**npm**:
|
|
18
16
|
|
|
@@ -38,7 +36,9 @@ yarn create mastra
|
|
|
38
36
|
bunx create-mastra
|
|
39
37
|
```
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
You'll be prompted for various configuration options, including your LLM provider and whether to enable [Observability](https://mastra.ai/docs/mastra-platform/observability) on the Mastra platform.
|
|
40
|
+
|
|
41
|
+
The wizard creates a new directory for your project with a `src/mastra` folder containing an example weather agent and the following files:
|
|
42
42
|
|
|
43
43
|
- `index.ts`: Entry point for all Mastra-related code and configuration
|
|
44
44
|
- `agents/weather-agent.ts`: A weather agent with a prompt that uses the tool
|
|
@@ -254,7 +254,7 @@ export const mastra = new Mastra({
|
|
|
254
254
|
```
|
|
255
255
|
|
|
256
256
|
- `MastraStorageExporter` persists observability events to Mastra Storage for [Studio](https://mastra.ai/docs/studio/observability).
|
|
257
|
-
- `MastraPlatformExporter` sends observability events to Mastra
|
|
257
|
+
- `MastraPlatformExporter` sends observability events to Mastra platform when `MASTRA_PLATFORM_ACCESS_TOKEN` is set.
|
|
258
258
|
- `SensitiveDataFilter` redacts passwords, tokens, and keys from span data before export.
|
|
259
259
|
|
|
260
260
|
See the [observability overview](https://mastra.ai/docs/observability/overview) for the full configuration, including composite storage with DuckDB for metrics.
|
|
@@ -295,7 +295,7 @@ MASTRA_PROJECT_ID="<staging-id>" mastra studio deploy --env-file .env.staging --
|
|
|
295
295
|
MASTRA_PROJECT_ID="<production-id>" mastra studio deploy --env-file .env.production --yes
|
|
296
296
|
```
|
|
297
297
|
|
|
298
|
-
Each environment ends up with its own Studio URL and its own observability data. Send `
|
|
298
|
+
Each environment ends up with its own Studio URL and its own observability data. Send `MASTRA_PLATFORM_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` per environment so `MastraPlatformExporter` routes traces to the correct project.
|
|
299
299
|
|
|
300
300
|
## Deploy Server (optional)
|
|
301
301
|
|
|
@@ -305,7 +305,7 @@ If you need a production API endpoint, deploy a Server:
|
|
|
305
305
|
mastra server deploy
|
|
306
306
|
```
|
|
307
307
|
|
|
308
|
-
This creates a separate deployment with a stable API URL, environment variable management, and custom domain support. See the [Server deployment guide](https://mastra.ai/
|
|
308
|
+
This creates a separate deployment with a stable API URL, environment variable management, and custom domain support. See the [Server deployment guide](https://mastra.ai/docs/mastra-platform/server) for the full walkthrough.
|
|
309
309
|
|
|
310
310
|
> **Note:** Environment variables from `.env`, `.env.local`, and `.env.production` are included automatically on first deploy. After that, manage env vars through the [web dashboard](https://projects.mastra.ai). Review and sanitize these files before first deploy to avoid uploading development-only or personal secrets.
|
|
311
311
|
|
|
@@ -387,8 +387,8 @@ Update any clients pointing to your old Mastra Cloud URL to the new Server or St
|
|
|
387
387
|
|
|
388
388
|
## Related
|
|
389
389
|
|
|
390
|
-
- [
|
|
391
|
-
- [
|
|
392
|
-
- [
|
|
393
|
-
- [
|
|
394
|
-
- [
|
|
390
|
+
- [Mastra platform overview](https://mastra.ai/docs/mastra-platform/overview)
|
|
391
|
+
- [Observability overview](https://mastra.ai/docs/mastra-platform/observability)
|
|
392
|
+
- [Studio deployment](https://mastra.ai/docs/mastra-platform/studio)
|
|
393
|
+
- [Server deployment](https://mastra.ai/docs/mastra-platform/server)
|
|
394
|
+
- [CLI reference](https://mastra.ai/reference/cli/mastra)
|
|
@@ -6,7 +6,7 @@ The observability system has been restructured in v1 with a dedicated `@mastra/o
|
|
|
6
6
|
>
|
|
7
7
|
> Complete this migration in the same change that bumps your Mastra packages, and verify traces appear in [Mastra Studio](https://mastra.ai/docs/studio/observability) before considering the upgrade complete. If you previously hosted on Mastra Cloud, also follow the [Mastra Cloud migration guide](https://mastra.ai/guides/migrations/mastra-cloud) — the new platform requires a new access token and a Studio project before `MastraPlatformExporter` can route data to it.
|
|
8
8
|
|
|
9
|
-
> **Exporter rename:** `MastraPlatformExporter` (sends data to Mastra
|
|
9
|
+
> **Exporter rename:** `MastraPlatformExporter` (sends data to Mastra platform) replaces the previous `CloudExporter`, and `MastraStorageExporter` (persists data to Mastra Storage) replaces the previous `DefaultExporter`. The original classes still ship from `@mastra/observability` and behave identically, but they are deprecated. New code should use `MastraPlatformExporter` and `MastraStorageExporter`; existing imports of `CloudExporter`/`DefaultExporter` continue to work until they are removed in a future major version.
|
|
10
10
|
|
|
11
11
|
## Migration paths
|
|
12
12
|
|
|
@@ -52,7 +52,7 @@ export const mastra = new Mastra({
|
|
|
52
52
|
serviceName: 'mastra',
|
|
53
53
|
exporters: [
|
|
54
54
|
new MastraStorageExporter(), // Persists observability events to Mastra Storage
|
|
55
|
-
new MastraPlatformExporter(), // Sends observability events to Mastra
|
|
55
|
+
new MastraPlatformExporter(), // Sends observability events to Mastra platform (if MASTRA_PLATFORM_ACCESS_TOKEN is set)
|
|
56
56
|
],
|
|
57
57
|
spanOutputProcessors: [
|
|
58
58
|
new SensitiveDataFilter(), // Redacts sensitive data like passwords, tokens, keys
|
package/.docs/models/index.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Model Providers
|
|
2
2
|
|
|
3
|
-
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to
|
|
3
|
+
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 3911 models from 112 providers through a single API.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -106,7 +106,7 @@ for await (const chunk of stream) {
|
|
|
106
106
|
| `alibaba-cn/qwen3.5-flash` | 1.0M | | | | | | $0.17 | $2 |
|
|
107
107
|
| `alibaba-cn/qwen3.5-plus` | 1.0M | | | | | | $0.57 | $3 |
|
|
108
108
|
| `alibaba-cn/qwen3.6-max-preview` | 246K | | | | | | $1 | $8 |
|
|
109
|
-
| `alibaba-cn/qwen3.6-plus` | 1.0M | | | | | | $0.
|
|
109
|
+
| `alibaba-cn/qwen3.6-plus` | 1.0M | | | | | | $0.50 | $3 |
|
|
110
110
|
| `alibaba-cn/qwq-32b` | 131K | | | | | | $0.29 | $0.86 |
|
|
111
111
|
| `alibaba-cn/qwq-plus` | 131K | | | | | | $0.23 | $0.57 |
|
|
112
112
|
| `alibaba-cn/siliconflow/deepseek-r1-0528` | 164K | | | | | | $0.50 | $2 |
|