@mastra/mcp-docs-server 1.1.35 → 1.1.36-alpha.1
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/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/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/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 +1 -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 +7 -0
- package/package.json +4 -4
|
@@ -4,7 +4,7 @@ Mastra applications can be deployed to cloud providers and serverless platforms.
|
|
|
4
4
|
|
|
5
5
|
## Mastra platform
|
|
6
6
|
|
|
7
|
-
Mastra provides a platform to deploy your server to the cloud. Read the [Mastra platform deployment guide](https://mastra.ai/
|
|
7
|
+
Mastra provides a platform to deploy your server to the cloud. Read the [Mastra platform deployment guide](https://mastra.ai/docs/mastra-platform/overview) to learn more.
|
|
8
8
|
|
|
9
9
|
## Cloud providers
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Deployment overview
|
|
2
2
|
|
|
3
|
-
Mastra applications can be deployed to any Node.js-compatible environment. You can deploy a Mastra server, integrate with an existing web framework, deploy to cloud providers, or use [Mastra platform](https://mastra.ai/docs/mastra-platform/overview) for Studio and server deployment.
|
|
3
|
+
Mastra applications can be deployed to any Node.js-compatible environment. You can deploy a Mastra server, integrate with an existing web framework, deploy to cloud providers, or use [Mastra platform](https://mastra.ai/docs/mastra-platform/overview) for observability, Studio, and server deployment.
|
|
4
4
|
|
|
5
5
|
## Runtime support
|
|
6
6
|
|
|
@@ -27,12 +27,13 @@ Read about [monorepo deployment](https://mastra.ai/docs/deployment/monorepo).
|
|
|
27
27
|
|
|
28
28
|
### Mastra platform
|
|
29
29
|
|
|
30
|
-
The [Mastra platform](https://mastra.ai/docs/mastra-platform/overview) provides
|
|
30
|
+
The [Mastra platform](https://mastra.ai/docs/mastra-platform/overview) provides three products for deploying, monitoring, and managing AI applications built with the Mastra framework:
|
|
31
31
|
|
|
32
|
-
- **
|
|
33
|
-
- **
|
|
32
|
+
- [**Observability**](https://mastra.ai/docs/mastra-platform/observability): A standalone hosted product for searchable traces, logs, and metrics across Mastra projects and deploys
|
|
33
|
+
- [**Studio**](https://mastra.ai/docs/mastra-platform/studio): A hosted visual environment for testing agents, running workflows, and inspecting traces
|
|
34
|
+
- [**Server**](https://mastra.ai/docs/mastra-platform/server): A production deployment target that runs your Mastra application as an API server
|
|
34
35
|
|
|
35
|
-
Learn more in the [
|
|
36
|
+
Learn more in the [Mastra platform overview](https://mastra.ai/docs/mastra-platform/overview).
|
|
36
37
|
|
|
37
38
|
### Cloud Providers
|
|
38
39
|
|
|
@@ -41,18 +41,34 @@ To pin the deploy to a specific env file (instead of relying on the default sele
|
|
|
41
41
|
mastra studio deploy --env-file .env.production --yes
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
### Observability
|
|
45
|
+
|
|
46
|
+
The following environment variables configure the Observability product on the Mastra platform.
|
|
47
|
+
|
|
48
|
+
| Variable | Description |
|
|
49
|
+
| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `MASTRA_PLATFORM_ACCESS_TOKEN` | Org-scoped access token. The CLI writes this during observability provisioning and uses it for platform authentication. |
|
|
51
|
+
| `MASTRA_PROJECT_ID` | UUID of the platform project. `MastraPlatformExporter` uses it to link observability data to the platform project. Studio and Server deploys read the project ID from `.mastra-project.json`. |
|
|
52
|
+
| `MASTRA_PLATFORM_OBSERVABILITY_ENDPOINT` | Optional observability endpoint override. This is only set automatically for local platform development. Defaults to `https://observability.mastra.ai`. |
|
|
53
|
+
| `MASTRA_ORG_ID` | Overrides the active organization for CLI commands. You can also set it with the `--org` flag on supported commands. |
|
|
54
|
+
|
|
55
|
+
`MastraPlatformExporter` reads `MASTRA_PLATFORM_ACCESS_TOKEN` to authenticate platform export.
|
|
56
|
+
|
|
44
57
|
## Multiple environments
|
|
45
58
|
|
|
46
|
-
A platform project maps to a single deployed instance with one set of env vars.
|
|
59
|
+
A platform project maps to a single deployed instance with one set of env vars. Platform projects don't have built-in `staging` vs `production` slots. To run the same codebase across multiple environments, create one project per environment and use the matching `.mastra-project.json` file for each deploy.
|
|
47
60
|
|
|
48
61
|
```bash
|
|
49
|
-
# Create
|
|
62
|
+
# Create and deploy each environment for the first time.
|
|
50
63
|
mastra studio deploy --project "my-app-staging" --env-file .env.staging --yes
|
|
51
64
|
mastra studio deploy --project "my-app-production" --env-file .env.production --yes
|
|
52
65
|
|
|
53
|
-
#
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
# For subsequent deploys, restore the matching .mastra-project.json file before deploying.
|
|
67
|
+
cp .mastra-project.staging.json .mastra-project.json
|
|
68
|
+
mastra studio deploy --env-file .env.staging --yes
|
|
69
|
+
|
|
70
|
+
cp .mastra-project.production.json .mastra-project.json
|
|
71
|
+
mastra studio deploy --env-file .env.production --yes
|
|
56
72
|
```
|
|
57
73
|
|
|
58
|
-
Each project has its own Studio URL and
|
|
74
|
+
Each project has its own Studio URL and can send observability data to the Mastra platform. When using [`MastraPlatformExporter`](https://mastra.ai/docs/observability/tracing/exporters/mastra-platform), set `MASTRA_PROJECT_ID` and `MASTRA_PLATFORM_ACCESS_TOKEN` per environment so traces route to the matching platform project.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Observability on Mastra platform
|
|
2
|
+
|
|
3
|
+
Observability on Mastra platform is a standalone hosted product for searchable traces, logs, and metrics across Mastra projects and deploys. Use it when you want observability without deploying Studio first or setting up local storage.
|
|
4
|
+
|
|
5
|
+
Mastra can configure platform observability during project setup. The CLI provisions a platform project, writes the required environment variables, and registers observability exporters in your Mastra config.
|
|
6
|
+
|
|
7
|
+
## Quickstart
|
|
8
|
+
|
|
9
|
+
Choose the setup path that matches your project. New and existing projects can use the CLI to provision Observability automatically, while manual setup is available when you already manage platform projects and environment variables yourself.
|
|
10
|
+
|
|
11
|
+
### New project
|
|
12
|
+
|
|
13
|
+
Create a new Mastra project:
|
|
14
|
+
|
|
15
|
+
**npm**:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm create mastra@latest
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**pnpm**:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm create mastra
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Yarn**:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
yarn create mastra
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Bun**:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
bunx create-mastra
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
When prompted, enable Mastra Observability:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
Enable Mastra Observability? (will open auth flow)
|
|
43
|
+
|
|
44
|
+
> Yes
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The CLI authenticates with Mastra platform, creates a platform project, writes the required environment variables, and configures the observability exporters.
|
|
48
|
+
|
|
49
|
+
### Existing non-Mastra projects
|
|
50
|
+
|
|
51
|
+
If you already have an application, such as a Next.js app, but have not added Mastra yet, run `mastra init` and enable Mastra Observability when prompted:
|
|
52
|
+
|
|
53
|
+
**npm**:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx mastra init
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**pnpm**:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pnpm dlx mastra init
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Yarn**:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
yarn dlx mastra init
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Bun**:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
bun x mastra init
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The CLI can select an existing platform project or create a new one.
|
|
78
|
+
|
|
79
|
+
### Manual setup
|
|
80
|
+
|
|
81
|
+
Create a project in [Mastra Platform](https://projects.mastra.ai), add `MASTRA_PLATFORM_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` to `.env`, then register `MastraPlatformExporter` in your Mastra config. Add `MastraStorageExporter` if you also want to persist observability events to your configured Mastra Storage:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { Mastra } from '@mastra/core/mastra'
|
|
85
|
+
import { Observability, MastraPlatformExporter } from '@mastra/observability'
|
|
86
|
+
|
|
87
|
+
export const mastra = new Mastra({
|
|
88
|
+
observability: new Observability({
|
|
89
|
+
configs: {
|
|
90
|
+
default: {
|
|
91
|
+
serviceName: 'mastra',
|
|
92
|
+
exporters: [new MastraPlatformExporter()],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
}),
|
|
96
|
+
})
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
See [Mastra platform configuration](https://mastra.ai/docs/mastra-platform/configuration) for the environment variables used by platform observability.
|
|
@@ -1,65 +1,22 @@
|
|
|
1
1
|
# Mastra platform
|
|
2
2
|
|
|
3
|
-
The [Mastra platform](https://projects.mastra.ai) provides
|
|
3
|
+
The [Mastra platform](https://projects.mastra.ai) provides three products for deploying, monitoring, and managing AI applications built with the Mastra framework:
|
|
4
4
|
|
|
5
|
-
- **
|
|
6
|
-
- **
|
|
5
|
+
- [**Observability**](https://mastra.ai/docs/mastra-platform/observability): The baseline product for every platform project, with searchable traces, logs, and metrics across Mastra projects and deploys
|
|
6
|
+
- [**Studio**](https://mastra.ai/docs/mastra-platform/studio): A hosted visual environment for testing agents, running workflows, and inspecting traces. Starting with Studio also gives you Observability.
|
|
7
|
+
- [**Server**](https://mastra.ai/docs/mastra-platform/server): A production deployment target that runs your Mastra application as an API server. Starting with Server also gives you Observability.
|
|
7
8
|
|
|
8
|
-
##
|
|
9
|
+
## Get started
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
Choose the path that matches what you want to do:
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
**npm**:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install -g mastra
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
**pnpm**:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
pnpm add -g mastra
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
**Yarn**:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
yarn global add mastra
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
**Bun**:
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
bun add --global mastra
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
3. Deploy Studio with a single command:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
mastra studio deploy
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
On a successful deploy, the CLI will output the URL of your deployed Studio instance.
|
|
47
|
-
|
|
48
|
-
4. Deploy Server with a single command:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
mastra server deploy
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
On a successful deploy, the CLI will output the URL of your deployed Server instance.
|
|
55
|
-
|
|
56
|
-
You have now successfully deployed both Studio and Server instances of your Mastra application. The CLI created a `.mastra-project.json` file in your project directory.
|
|
57
|
-
|
|
58
|
-
This file links your local project to a platform project. It's auto-generated on your first deploy and contains the `projectId`, `projectName`, and `organizationId`. Commit this file to your repository so CI/CD knows which project to deploy to.
|
|
13
|
+
- **Add hosted observability**: Use [Observability](https://mastra.ai/docs/mastra-platform/observability) to collect searchable traces, logs, and metrics across projects and deploys. Start here if you want monitoring without deploying Studio or Server first.
|
|
14
|
+
- **Deploy Studio**: Use [Studio](https://mastra.ai/docs/mastra-platform/studio) to host the visual development environment for your team. Start here if you want a shared UI for testing agents, running workflows, and inspecting traces.
|
|
15
|
+
- **Deploy Server**: Use [Server](https://mastra.ai/docs/mastra-platform/server) to run your Mastra application as a production API server. Start here when you’re ready to serve agents, tools, and workflows from the cloud.
|
|
59
16
|
|
|
60
17
|
## Key Concepts
|
|
61
18
|
|
|
62
|
-
**Projects** are the shared parent entity across all products. A single project can have a Studio deployment and a Server deployment. Projects belong to an **Organization**, which is the multi-tenant container for your team.
|
|
19
|
+
**Projects** are the shared parent entity across all products. A single project can have Observability, a Studio deployment, and a Server deployment. Projects belong to an **Organization**, which is the multi-tenant container for your team.
|
|
63
20
|
|
|
64
21
|
Your Mastra application is built from three building blocks:
|
|
65
22
|
|
|
@@ -73,6 +30,6 @@ Develop your project locally with [`mastra dev`](https://mastra.ai/reference/cli
|
|
|
73
30
|
|
|
74
31
|
Once you're ready to deploy your application to production, use [`mastra studio deploy`](https://mastra.ai/reference/cli/mastra) and [`mastra server deploy`](https://mastra.ai/reference/cli/mastra) to push your application to the cloud.
|
|
75
32
|
|
|
76
|
-
Follow the [Studio
|
|
33
|
+
Follow the [Studio on Mastra platform](https://mastra.ai/docs/mastra-platform/studio) and [Server on Mastra platform](https://mastra.ai/docs/mastra-platform/server) docs for step-by-step instructions.
|
|
77
34
|
|
|
78
|
-
If you host your Mastra application on your own infrastructure, you can still send observability data to
|
|
35
|
+
If you host your Mastra application on your own infrastructure, you can still send observability data to Mastra platform using the [MastraPlatformExporter](https://mastra.ai/docs/observability/tracing/exporters/mastra-platform).
|
|
@@ -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
|
|