@mastra/mcp-docs-server 1.1.18-alpha.1 → 1.1.18

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.
Files changed (88) hide show
  1. package/.docs/docs/agents/overview.md +4 -4
  2. package/.docs/docs/agents/processors.md +1 -1
  3. package/.docs/docs/community/licensing.md +7 -9
  4. package/.docs/docs/deployment/monorepo.md +0 -6
  5. package/.docs/docs/evals/built-in-scorers.md +1 -1
  6. package/.docs/docs/{observability → evals}/datasets/overview.md +12 -12
  7. package/.docs/docs/{observability → evals}/datasets/running-experiments.md +9 -9
  8. package/.docs/docs/evals/overview.md +8 -9
  9. package/.docs/docs/getting-started/manual-install.md +1 -2
  10. package/.docs/docs/index.md +1 -1
  11. package/.docs/docs/mastra-cloud/deployment.md +2 -2
  12. package/.docs/docs/mastra-cloud/observability.md +2 -2
  13. package/.docs/docs/mastra-cloud/overview.md +1 -1
  14. package/.docs/docs/mastra-cloud/setup.md +3 -3
  15. package/.docs/docs/mcp/publishing-mcp-server.md +20 -0
  16. package/.docs/docs/memory/message-history.md +6 -4
  17. package/.docs/docs/memory/observational-memory.md +20 -11
  18. package/.docs/docs/memory/overview.md +4 -4
  19. package/.docs/docs/memory/semantic-recall.md +28 -19
  20. package/.docs/docs/memory/storage.md +4 -4
  21. package/.docs/docs/observability/metrics/overview.md +114 -0
  22. package/.docs/docs/observability/overview.md +13 -5
  23. package/.docs/docs/observability/tracing/exporters/default.md +2 -4
  24. package/.docs/docs/observability/tracing/exporters/laminar.md +4 -4
  25. package/.docs/docs/observability/tracing/exporters/sentry.md +4 -4
  26. package/.docs/docs/observability/tracing/overview.md +2 -2
  27. package/.docs/docs/rag/chunking-and-embedding.md +2 -2
  28. package/.docs/docs/server/auth/composite-auth.md +1 -7
  29. package/.docs/docs/server/auth/custom-auth-provider.md +2 -4
  30. package/.docs/docs/server/auth/jwt.md +1 -1
  31. package/.docs/docs/server/auth/simple-auth.md +1 -7
  32. package/.docs/docs/server/auth.md +3 -3
  33. package/.docs/docs/server/custom-adapters.md +3 -1
  34. package/.docs/docs/server/custom-api-routes.md +1 -1
  35. package/.docs/docs/server/mastra-client.md +1 -3
  36. package/.docs/docs/server/mastra-server.md +8 -0
  37. package/.docs/docs/server/request-context.md +17 -17
  38. package/.docs/docs/server/server-adapters.md +8 -8
  39. package/.docs/docs/streaming/events.md +1 -90
  40. package/.docs/docs/streaming/overview.md +0 -42
  41. package/.docs/docs/studio/auth.md +142 -0
  42. package/.docs/docs/{deployment/studio.md → studio/deployment.md} +42 -16
  43. package/.docs/docs/studio/observability.md +98 -0
  44. package/.docs/docs/studio/overview.md +127 -0
  45. package/.docs/docs/workflows/agents-and-tools.md +7 -10
  46. package/.docs/docs/workflows/control-flow.md +1 -1
  47. package/.docs/docs/workflows/overview.md +12 -7
  48. package/.docs/docs/workflows/suspend-and-resume.md +1 -1
  49. package/.docs/guides/concepts/multi-agent-systems.md +4 -4
  50. package/.docs/guides/deployment/vercel.md +1 -1
  51. package/.docs/guides/getting-started/next-js.md +1 -1
  52. package/.docs/guides/getting-started/quickstart.md +1 -1
  53. package/.docs/guides/guide/ai-recruiter.md +1 -1
  54. package/.docs/guides/guide/chef-michel.md +1 -1
  55. package/.docs/guides/guide/code-review-bot.md +1 -1
  56. package/.docs/guides/guide/dev-assistant.md +1 -1
  57. package/.docs/guides/guide/docs-manager.md +1 -1
  58. package/.docs/guides/guide/github-actions-pr-description.md +1 -1
  59. package/.docs/guides/guide/notes-mcp-server.md +1 -1
  60. package/.docs/guides/guide/stock-agent.md +1 -1
  61. package/.docs/guides/guide/web-search.md +2 -2
  62. package/.docs/guides/index.md +1 -1
  63. package/.docs/guides/migrations/upgrade-to-v1/client.md +1 -1
  64. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +1 -1
  65. package/.docs/models/index.md +2 -2
  66. package/.docs/models/providers/aihubmix.md +17 -102
  67. package/.docs/models/providers/synthetic.md +2 -1
  68. package/.docs/models/providers.md +0 -1
  69. package/.docs/reference/agents/agent.md +1 -1
  70. package/.docs/reference/cli/mastra.md +3 -3
  71. package/.docs/reference/client-js/workflows.md +2 -2
  72. package/.docs/reference/configuration.md +4 -4
  73. package/.docs/reference/deployer/cloudflare.md +1 -1
  74. package/.docs/reference/deployer/vercel.md +1 -1
  75. package/.docs/reference/index.md +16 -14
  76. package/.docs/reference/memory/observational-memory.md +1 -1
  77. package/.docs/reference/observability/metrics/automatic-metrics.md +132 -0
  78. package/.docs/reference/storage/cloudflare-d1.md +1 -1
  79. package/.docs/reference/storage/cloudflare.md +3 -3
  80. package/.docs/reference/storage/convex.md +1 -1
  81. package/.docs/reference/storage/dynamodb.md +1 -1
  82. package/.docs/reference/storage/lance.md +1 -1
  83. package/.docs/reference/storage/upstash.md +1 -1
  84. package/.docs/reference/workspace/vercel.md +118 -0
  85. package/CHANGELOG.md +23 -0
  86. package/package.json +6 -6
  87. package/.docs/docs/getting-started/studio.md +0 -113
  88. package/.docs/docs/mastra-cloud/studio.md +0 -24
@@ -0,0 +1,142 @@
1
+ # Studio auth
2
+
3
+ When you configure [authentication](https://mastra.ai/docs/server/auth) on your Mastra server, Studio automatically displays a login screen and enforces access control. One configuration secures both the Studio UI and your API routes.
4
+
5
+ Without authentication, Studio and all API routes are publicly accessible.
6
+
7
+ ## When to use Studio Auth
8
+
9
+ - Multiple team members need to interact with agents, workflows, and tools through a shared Studio deployment.
10
+ - Permissions must restrict who can execute agents, edit workflows, or delete datasets.
11
+ - A login screen (SSO, email/password, or both) should gate access to your Studio deployment.
12
+
13
+ ## Quickstart
14
+
15
+ Add an auth provider to your Mastra server configuration. This example uses [Simple Auth](https://mastra.ai/docs/server/auth/simple-auth) for a minimal setup:
16
+
17
+ ```typescript
18
+ import { Mastra } from '@mastra/core'
19
+ import { SimpleAuth } from '@mastra/core/server'
20
+
21
+ export const mastra = new Mastra({
22
+ server: {
23
+ auth: new SimpleAuth({
24
+ users: {
25
+ 'my-api-key': {
26
+ id: 'user-1',
27
+ name: 'Alice',
28
+ role: 'admin',
29
+ },
30
+ },
31
+ }),
32
+ },
33
+ })
34
+ ```
35
+
36
+ Once configured, Studio shows a login screen and requires authentication for all API requests.
37
+
38
+ > **Note:** Visit the [Auth docs](https://mastra.ai/docs/server/auth) for a full list of supported providers.
39
+
40
+ ## How it works
41
+
42
+ Setting [`server.auth`](https://mastra.ai/reference/configuration) does two things at once:
43
+
44
+ - **Studio UI**: Displays a login screen. Depending on the provider, users sign in through SSO, email/password, or both.
45
+ - **API routes**: Requires authentication for all built-in routes (`/api/agents/*`, `/api/workflows/*`, etc.) and custom routes. This applies whether requests come from Studio or direct API calls.
46
+
47
+ Studio detects available capabilities by calling the `GET /api/auth/capabilities` endpoint. The response tells Studio which login methods to render and, if the user is already authenticated, includes their user info and permissions.
48
+
49
+ ## Role-based access control
50
+
51
+ RBAC lets you control what each user can see and do inside Studio. It's separate from authentication: `server.auth` handles who the user is, while `server.rbac` handles what they can do.
52
+
53
+ ### Default roles
54
+
55
+ Mastra ships four default roles. Import them from `@mastra/core/auth/ee`:
56
+
57
+ | Role | Permissions |
58
+ | -------- | ------------------------ |
59
+ | `owner` | Full access (`*`) |
60
+ | `admin` | Read, write, and execute |
61
+ | `member` | Read and execute |
62
+ | `viewer` | Read-only |
63
+
64
+ ### Enable RBAC
65
+
66
+ Use `StaticRBACProvider` with the default roles or define your own:
67
+
68
+ ```typescript
69
+ import { Mastra } from '@mastra/core'
70
+ import { SimpleAuth } from '@mastra/core/server'
71
+ import { StaticRBACProvider, DEFAULT_ROLES } from '@mastra/core/auth/ee'
72
+
73
+ export const mastra = new Mastra({
74
+ server: {
75
+ auth: new SimpleAuth({
76
+ users: {
77
+ 'admin-key': { id: 'user-1', name: 'Alice', role: 'admin' },
78
+ 'viewer-key': { id: 'user-2', name: 'Bob', role: 'viewer' },
79
+ },
80
+ }),
81
+ rbac: new StaticRBACProvider({
82
+ roles: DEFAULT_ROLES,
83
+ getUserRoles: user => [user.role],
84
+ }),
85
+ },
86
+ })
87
+ ```
88
+
89
+ When RBAC is active, Studio hides actions the user doesn't have permission for. A viewer doesn't see delete buttons; a member can't modify agent configurations.
90
+
91
+ ### Permission format
92
+
93
+ Permissions follow the pattern `{resource}:{action}`, with optional resource-level scoping:
94
+
95
+ | Pattern | Meaning |
96
+ | ------------------- | --------------------------- |
97
+ | `*` | Full access to everything |
98
+ | `*:read` | Read all resources |
99
+ | `agents:*` | All actions on agents |
100
+ | `agents:execute` | Execute agents only |
101
+ | `agents:read:my-id` | Read a specific agent by ID |
102
+
103
+ Resources include `agents`, `workflows`, `tools`, `datasets`, `memory`, `scores`, `observability`, and others. Actions are `read`, `write`, `execute`, and `delete`.
104
+
105
+ ### Map external provider roles
106
+
107
+ If your identity provider already defines roles (for example, Clerk organizations or WorkOS groups), map them to Mastra permissions with `roleMapping`:
108
+
109
+ ```typescript
110
+ import { StaticRBACProvider } from '@mastra/core/auth/ee'
111
+
112
+ const rbac = new StaticRBACProvider({
113
+ roleMapping: {
114
+ 'org:admin': ['*'],
115
+ 'org:member': ['*:read', '*:execute'],
116
+ 'org:viewer': ['*:read'],
117
+ },
118
+ getUserRoles: user => user.providerRoles,
119
+ })
120
+ ```
121
+
122
+ ## Login methods
123
+
124
+ Studio adapts its login screen based on the auth provider:
125
+
126
+ | Provider type | Login UI |
127
+ | ---------------- | --------------------------------------- |
128
+ | SSO only | SSO button (e.g. "Sign in with WorkOS") |
129
+ | Credentials only | Email and password form |
130
+ | Both | SSO button and email/password form |
131
+
132
+ Sign-up can be enabled or disabled per provider. When disabled, Studio hides the sign-up link and forces the sign-in form.
133
+
134
+ ## EE licensing
135
+
136
+ Studio Auth features (SSO login, RBAC, permission-based UI) are part of the Mastra Enterprise Edition. They work without a license during local development and with Simple Auth. For production deployments with third-party providers, a valid EE license is required. [Contact sales](https://mastra.ai/contact) for more information.
137
+
138
+ ## Related
139
+
140
+ - [Auth overview](https://mastra.ai/docs/server/auth): Full list of supported auth providers.
141
+ - [Studio deployment](https://mastra.ai/docs/studio/deployment): Deploy Studio to production.
142
+ - [Custom API routes](https://mastra.ai/docs/server/custom-api-routes): Control authentication on individual endpoints.
@@ -1,15 +1,15 @@
1
- # Deploying Studio
1
+ # Studio deployment
2
2
 
3
- [Studio](https://mastra.ai/docs/getting-started/studio) provides an interactive UI for building and testing your agents. It's a React-based Single Page Application (SPA) that runs in the browser and connects to a running [Mastra server](https://mastra.ai/docs/deployment/mastra-server).
3
+ Studio is a React-based Single Page Application (SPA) that runs in the browser and connects to a running [Mastra server](https://mastra.ai/docs/deployment/mastra-server).
4
4
 
5
5
  You can deploy Studio in two primary ways:
6
6
 
7
- - [Mastra Cloud](https://mastra.ai/docs/mastra-cloud/overview) hosts Studio for you and allows you to share access with your team via link
7
+ - [Cloud](https://mastra.ai/docs/mastra-cloud/overview) hosts Studio for you and allows you to share access with your team via link
8
8
  - You can self-host Studio on your own infrastructure, either alongside your Mastra server or separately as a standalone SPA
9
9
 
10
10
  On this page you'll learn how to deploy Studio on your own infrastructure. As the finer details of deployment can vary widely based on your needs and setup, we'll cover the general principles and options available to you.
11
11
 
12
- ## Fundamentals
12
+ ## Quickstart
13
13
 
14
14
  The easiest way to run Studio is the [`mastra studio`](https://mastra.ai/reference/cli/mastra) command.
15
15
 
@@ -65,7 +65,7 @@ Running `mastra studio` as a long-running process is no different from running a
65
65
 
66
66
  > **Warning:** Once Studio is connected to your Mastra server, it has full access to your agents, workflows, and tools. Be sure to secure it properly in production (e.g. behind authentication, VPN, etc.) to prevent unauthorized access.
67
67
  >
68
- > Visit the [Authentication](https://mastra.ai/docs/server/auth) docs to learn more.
68
+ > Visit the [Authentication](https://mastra.ai/docs/studio/auth) docs to learn more.
69
69
 
70
70
  ### Alongside your API
71
71
 
@@ -85,7 +85,15 @@ MASTRA_STUDIO_PATH=.mastra/output/studio node .mastra/output/index.mjs
85
85
 
86
86
  ## Using a CDN
87
87
 
88
- Currently, you can't directly deploy the built Studio assets to a CDN, as the UI relies on some dynamic configuration. With a bit of extra setup, you can create a standalone SPA out of the built assets and deploy it to any static hosting service like Netlify, Vercel, etc.
88
+ ### Automatic
89
+
90
+ Some of the [Cloud providers](https://mastra.ai/docs/deployment/cloud-providers) offer an option to deploy Studio alongside your serverless function. Currently, the supported providers are:
91
+
92
+ - [`VercelDeployer`](https://mastra.ai/reference/deployer/vercel)
93
+
94
+ ### Manual
95
+
96
+ You can't directly deploy the built Studio assets to a CDN, as the UI relies on some dynamic configuration. With a bit of extra setup, you can create a standalone SPA out of the built assets and deploy it to any static hosting service.
89
97
 
90
98
  Follow the example below to create a SPA using Vite.
91
99
 
@@ -212,23 +220,41 @@ Follow the example below to create a SPA using Vite.
212
220
  MASTRA_SERVER_PORT=4111
213
221
  MASTRA_SERVER_PROTOCOL=http
214
222
  MASTRA_API_PREFIX=/api
215
- MASTRA_STUDIO_BASE_PATH=
216
- MASTRA_TELEMETRY_DISABLED=true
217
223
  MASTRA_HIDE_CLOUD_CTA=false
218
- MASTRA_TEMPLATES=false
219
224
  MASTRA_CLOUD_API_ENDPOINT=
220
225
  MASTRA_EXPERIMENTAL_FEATURES=false
226
+ MASTRA_TEMPLATES=false
227
+ MASTRA_TELEMETRY_DISABLED=true
221
228
  MASTRA_REQUEST_CONTEXT_PRESETS=
229
+ MASTRA_THEME_TOGGLE=false
230
+ MASTRA_EXPERIMENTAL_UI=false
231
+ MASTRA_STUDIO_BASE_PATH=
222
232
  ```
223
233
 
224
- ````text
225
- </StepItem>
234
+ 7. Run the build script to generate the static files in the `dist` folder:
226
235
 
227
- <StepItem>
228
- Run the build script to generate the static files in the `dist` folder:
236
+ **npm**:
229
237
 
230
- ```bash npm2yarn
238
+ ```bash
231
239
  npm run build
232
- ````
240
+ ```
241
+
242
+ **pnpm**:
243
+
244
+ ```bash
245
+ pnpm run build
246
+ ```
247
+
248
+ **Yarn**:
249
+
250
+ ```bash
251
+ yarn build
252
+ ```
253
+
254
+ **Bun**:
255
+
256
+ ```bash
257
+ bun run build
258
+ ```
233
259
 
234
- 7. Point your hosting provider to the `dist` folder and deploy!
260
+ 8. Point your hosting provider to the `dist` folder and deploy!
@@ -0,0 +1,98 @@
1
+ # Studio observability
2
+
3
+ Studio includes these observability views:
4
+
5
+ - **Metrics** for aggregate performance data
6
+ - **Traces** for individual request inspection
7
+
8
+ All require an [observability storage backend](#quickstart) to be configured.
9
+
10
+ ## Metrics
11
+
12
+ 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.
13
+
14
+ Visit the [metrics overview](https://mastra.ai/docs/observability/metrics/overview) for more details.
15
+
16
+ > **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.
17
+
18
+ ## Traces
19
+
20
+ 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.
21
+
22
+ 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.
23
+
24
+ ## Quickstart
25
+
26
+ For detailed instructions, follow the [observability instructions](https://mastra.ai/docs/observability/overview). To get up and running quickly, add the `@mastra/observability` package to your project and configure it with [LibSQL](https://mastra.ai/reference/storage/libsql) and [DuckDB](https://mastra.ai/reference/vectors/duckdb) for a local development setup that supports both traces and metrics.
27
+
28
+ **npm**:
29
+
30
+ ```bash
31
+ npm install @mastra/observability @mastra/libsql @mastra/duckdb
32
+ ```
33
+
34
+ **pnpm**:
35
+
36
+ ```bash
37
+ pnpm add @mastra/observability @mastra/libsql @mastra/duckdb
38
+ ```
39
+
40
+ **Yarn**:
41
+
42
+ ```bash
43
+ yarn add @mastra/observability @mastra/libsql @mastra/duckdb
44
+ ```
45
+
46
+ **Bun**:
47
+
48
+ ```bash
49
+ bun add @mastra/observability @mastra/libsql @mastra/duckdb
50
+ ```
51
+
52
+ Then add the following to your `src/mastra/index.ts`:
53
+
54
+ ```ts
55
+ import { Mastra } from '@mastra/core/mastra'
56
+ import { LibSQLStore } from '@mastra/libsql'
57
+ import { DuckDBStore } from '@mastra/duckdb'
58
+ import { MastraCompositeStore } from '@mastra/core/storage'
59
+ import {
60
+ Observability,
61
+ DefaultExporter,
62
+ CloudExporter,
63
+ SensitiveDataFilter,
64
+ } from '@mastra/observability'
65
+
66
+ export const mastra = new Mastra({
67
+ storage: new MastraCompositeStore({
68
+ id: 'composite-storage',
69
+ default: new LibSQLStore({
70
+ id: 'mastra-storage',
71
+ url: 'file:./mastra.db',
72
+ }),
73
+ domains: {
74
+ observability: await new DuckDBStore().getStore('observability'),
75
+ },
76
+ }),
77
+ observability: new Observability({
78
+ configs: {
79
+ default: {
80
+ serviceName: 'mastra',
81
+ exporters: [
82
+ new DefaultExporter(), // Persists traces to storage for Mastra Studio
83
+ new CloudExporter(), // Sends traces to Mastra Cloud (if MASTRA_CLOUD_ACCESS_TOKEN is set)
84
+ ],
85
+ spanOutputProcessors: [
86
+ new SensitiveDataFilter(), // Redacts sensitive data like passwords, tokens, keys
87
+ ],
88
+ },
89
+ },
90
+ }),
91
+ })
92
+ ```
93
+
94
+ ## Related
95
+
96
+ - [Observability overview](https://mastra.ai/docs/observability/overview)
97
+ - [Metrics overview](https://mastra.ai/docs/observability/metrics/overview)
98
+ - [Tracing overview](https://mastra.ai/docs/observability/tracing/overview)
@@ -0,0 +1,127 @@
1
+ # Studio
2
+
3
+ Studio provides an interactive UI for building, testing, and managing your agents, workflows, and tools. Run it locally during development, or [deploy it](https://mastra.ai/docs/studio/deployment) to production so your team can manage agents, monitor performance, and gain insights through built-in observability.
4
+
5
+ Add [authentication](https://mastra.ai/docs/studio/auth) to protect your deployed Studio with login screens, role-based access control, and permission-based UI rendering so you can control what each team member can see and do. You can also [create a project in Mastra Cloud](https://mastra.ai/docs/mastra-cloud/setup) for a hosted option.
6
+
7
+ [YouTube video player](https://www.youtube-nocookie.com/embed/ojGu6Bi4wYk)
8
+
9
+ ## Start Studio
10
+
11
+ If you created your application with `create mastra`, start the development server using the `dev` script. You can also run it directly with `mastra dev`.
12
+
13
+ **npm**:
14
+
15
+ ```bash
16
+ npm run dev
17
+ ```
18
+
19
+ **pnpm**:
20
+
21
+ ```bash
22
+ pnpm run dev
23
+ ```
24
+
25
+ **Yarn**:
26
+
27
+ ```bash
28
+ yarn dev
29
+ ```
30
+
31
+ **Bun**:
32
+
33
+ ```bash
34
+ bun run dev
35
+ ```
36
+
37
+ Once the server is running, you can:
38
+
39
+ - Open the Studio UI at [http://localhost:4111](http://localhost:4111/) to interact with your agents, workflows, and tools.
40
+ - Visit <http://localhost:4111/swagger-ui> to discover and interact with the underlying REST API.
41
+
42
+ To run Studio in production, see [Studio deployment](https://mastra.ai/docs/studio/deployment). To run Studio independently from your Mastra server, use [`mastra studio`](https://mastra.ai/reference/cli/mastra).
43
+
44
+ ## Primitives
45
+
46
+ ### Agents
47
+
48
+ Chat with your agent directly, dynamically switch [models](https://mastra.ai/models), and tweak settings like temperature and top-p to understand how they affect the output.
49
+
50
+ When you interact with your agent, you can follow each step of its reasoning, view tool call outputs, and [observe](#observability) traces and logs to see how responses are generated. You can also attach [scorers](#scorers) to measure and compare response quality over time.
51
+
52
+ ### Workflows
53
+
54
+ Visualize your workflow as a graph and run it step by step with a custom input. During execution, the interface updates in real time to show the active step and the path taken.
55
+
56
+ When running a workflow, you can also view detailed traces showing tool calls, raw JSON outputs, and any errors that might have occurred along the way.
57
+
58
+ ### Processors
59
+
60
+ View the input and output processors attached to each agent. The agent detail panel lists every processor by name and type, so you can verify your guardrails, token limiters, and custom processors are wired up correctly before testing.
61
+
62
+ See [processors](https://mastra.ai/docs/agents/processors) and [guardrails](https://mastra.ai/docs/agents/guardrails) for configuration details.
63
+
64
+ ### MCP servers
65
+
66
+ List the MCP servers attached to your Mastra instance and explore their available tools.
67
+
68
+ ### Tools
69
+
70
+ Run tools on their own to observe behavior and test them before assigning them to an agent. If something goes wrong, re-run a tool in isolation to debug the issue.
71
+
72
+ ### Workspaces
73
+
74
+ Browse the files in your agent's workspace filesystem using a built-in file browser. Switch between workspace mounts, create directories, and view file contents with syntax highlighting. Writable workspaces allow directory creation and file deletion; read-only workspaces are labeled accordingly. The Skills tab lists all discovered skills with their instructions, references, and metadata. Install community skills from [skills.sh](https://skills.sh) or remove existing ones.
75
+
76
+ See [workspaces](https://mastra.ai/docs/workspace/overview) for configuration details.
77
+
78
+ ### Request context
79
+
80
+ Set runtime variables that flow into your agent's instructions and tools through dependency injection. Edit request context as JSON or use a schema-driven form when your agent defines a `requestContextSchema`. Values persist across test chats and experiments, so you can trigger conditional flows without restarting.
81
+
82
+ See [request context](https://mastra.ai/docs/server/request-context) for configuration details.
83
+
84
+ ## Evaluation
85
+
86
+ ### Scorers
87
+
88
+ The Scorers tab displays the results of your agent's scorers as they run. When messages pass through your agent, the defined scorers evaluate each output asynchronously and render their results here. This allows you to understand how your scorers respond to different interactions, compare performance across test cases, and identify areas for improvement.
89
+
90
+ ### Datasets
91
+
92
+ Create and manage collections of test cases to evaluate your agents and workflows. Import items from CSV or JSON, define input and ground-truth schemas, and pin to specific versions so you can reproduce experiments exactly. Run experiments with [scorers](https://mastra.ai/docs/evals/overview) to compare quality across prompts, models, or code changes.
93
+
94
+ See [datasets overview](https://mastra.ai/docs/evals/datasets/overview) for the full API and versioning details.
95
+
96
+ ### Experiments
97
+
98
+ Run all items in a dataset against an agent, workflow, or scorer and collect the results in one place. Select a target, optionally attach scorers, and trigger the experiment. The results view shows each item's input, output, status, and individual score breakdowns. Compare two experiments side by side to measure the impact of prompt, model, or code changes.
99
+
100
+ See [datasets overview](https://mastra.ai/docs/evals/datasets/overview) for setup details.
101
+
102
+ ## Observability
103
+
104
+ Visit the [Studio observability](https://mastra.ai/docs/studio/observability) docs to learn more.
105
+
106
+ ## Settings
107
+
108
+ Configure the connection between Studio and your Mastra server. The settings page includes:
109
+
110
+ - **Mastra instance URL**: The base URL of your Mastra server (e.g. `http://localhost:4111`).
111
+ - **API prefix**: Optional path prefix for all API requests (defaults to `/api`).
112
+ - **Custom headers**: Add key-value pairs sent with every request, useful for authentication tokens or routing headers.
113
+ - **Theme**: Switch between dark, light, or system theme.
114
+
115
+ ## Code configuration
116
+
117
+ In addition to the [settings](#settings) UI, you can configure the local development server and Studio also through the [`server`](https://mastra.ai/reference/configuration) option in your `src/mastra/index.ts`.
118
+
119
+ By default, Studio runs at <http://localhost:4111>. You can change the [`host`](https://mastra.ai/reference/configuration) and [`port`](https://mastra.ai/reference/configuration).
120
+
121
+ Mastra also supports HTTPS development through the [`--https`](https://mastra.ai/reference/cli/mastra) flag, which automatically creates and manages certificates for your project. When you run `mastra dev --https`, a private key and certificate are generated for localhost (or your configured host). Visit the [HTTPS reference](https://mastra.ai/reference/configuration) to learn more.
122
+
123
+ ## Next steps
124
+
125
+ - Learn how to [deploy Studio](https://mastra.ai/docs/studio/deployment) for production use.
126
+ - Add [authentication](https://mastra.ai/docs/studio/auth) to control access to your deployed Studio.
127
+ - Explore [Studio observability](https://mastra.ai/docs/studio/observability) to monitor agent performance and gain insights through metrics, logs, and traces.
@@ -1,14 +1,14 @@
1
1
  # Agents and tools
2
2
 
3
- Workflow steps can call agents to leverage LLM reasoning or call tools for type-safe logic. You can either invoke them from within a step's `execute` function or compose them directly as steps using `createStep()`.
3
+ Workflow steps can call agents to leverage LLM reasoning or call tools for type-safe logic. You can either invoke them from within a step's `execute()` function or compose them directly as steps using `createStep()`.
4
4
 
5
5
  ## Using agents in workflows
6
6
 
7
- Use agents in workflow steps when you need reasoning, language generation, or other LLM-based tasks. Call from a step's `execute` function for more control over the agent call (e.g., track message history or return structured output). Compose agents as steps when you don't need to modify how the agent is invoked.
7
+ Use agents in workflow steps when you need reasoning, language generation, or other LLM-based tasks. Call from a step's `execute()` function for more control over the agent call (e.g., track message history or return structured output). Compose agents as steps when you don't need to modify how the agent is invoked.
8
8
 
9
9
  ### Calling agents
10
10
 
11
- Call agents inside a step's `execute` function using `.generate()` or `.stream()`. This lets you modify the agent call and handle the response before passing it to the next step.
11
+ Call agents inside a step's `execute()` function using `.generate()` or `.stream()`. This lets you modify the agent call and handle the response before passing it to the next step.
12
12
 
13
13
  ```typescript
14
14
  const step1 = createStep({
@@ -41,7 +41,6 @@ Compose an agent as a step using `createStep()` when you don't need to modify th
41
41
 
42
42
  ```typescript
43
43
  import { testAgent } from '../agents/test-agent'
44
-
45
44
  const step1 = createStep(testAgent)
46
45
 
47
46
  export const testWorkflow = createWorkflow({})
@@ -111,20 +110,20 @@ The `structuredOutput.schema` option accepts any Zod schema. The agent will gene
111
110
 
112
111
  ## Using tools in workflows
113
112
 
114
- Use tools in workflow steps to leverage existing tool logic. Call from a step's `execute` function when you need to prepare context or process responses. Compose tools as steps when you don't need to modify how the tool is used.
113
+ Use tools in workflow steps to leverage existing tool logic. Call from a step's `.execute()` function when you need to prepare context or process responses. Compose tools as steps when you don't need to modify how the tool is used.
115
114
 
116
115
  ### Calling tools
117
116
 
118
- Call tools inside a step's `execute` function using `.execute()`. This gives you more control over the tool's input context, or process its response before passing it to the next step.
117
+ Call tools inside a step's `.execute()` function. This gives you more control over the tool's input context, or process its response before passing it to the next step.
119
118
 
120
119
  ```typescript
121
120
  import { testTool } from '../tools/test-tool'
122
121
 
123
122
  const step2 = createStep({
124
123
  execute: async ({ inputData, requestContext }) => {
125
- const { formatted } = inputData
124
+ const { text } = inputData
126
125
 
127
- const response = await testTool.execute({ text: formatted }, { requestContext })
126
+ const response = await testTool.execute({ text }, { requestContext })
128
127
 
129
128
  return {
130
129
  emphasized: response.emphasized,
@@ -133,8 +132,6 @@ const step2 = createStep({
133
132
  })
134
133
  ```
135
134
 
136
- > **Info:** Visit [Calling Tools](https://mastra.ai/docs/workflows/agents-and-tools) for more examples.
137
-
138
135
  ### Tools as steps
139
136
 
140
137
  Compose a tool as a step using `createStep()` when the previous step's output matches the tool's input context. You can use `.map()` to transform the previous step's output if they don't.
@@ -99,7 +99,7 @@ export const testWorkflow = createWorkflow({
99
99
  .commit()
100
100
  ```
101
101
 
102
- > 📹 Watch: How to run steps in parallel and optimize your Mastra workflow → [YouTube (3 minutes)](https://youtu.be/GQJxve5Hki4)
102
+ > **📹 Watch:** How to run steps in parallel and optimize your Mastra workflow → [YouTube (3 minutes)](https://youtu.be/GQJxve5Hki4)
103
103
 
104
104
  ### Output structure
105
105
 
@@ -45,7 +45,7 @@ const step1 = createStep({
45
45
  })
46
46
  ```
47
47
 
48
- > **Info:** Visit [Step Class](https://mastra.ai/reference/workflows/step) for a full list of configuration options.
48
+ > **Info:** Visit [`Step`](https://mastra.ai/reference/workflows/step) for a full list of configuration options.
49
49
 
50
50
  ### Using agents and tools
51
51
 
@@ -80,6 +80,15 @@ export const testWorkflow = createWorkflow({
80
80
 
81
81
  Workflows can be composed using a number of different methods. The method you choose determines how each step's schema should be structured. Visit the [Control Flow](https://mastra.ai/docs/workflows/control-flow) page for more information.
82
82
 
83
+ ## Studio
84
+
85
+ Open [Studio](https://mastra.ai/docs/studio/overview) and select a workflow from the **Workflows** tab.
86
+
87
+ - **Graph view**: The center panel visualizes the workflow's steps and execution flow.
88
+ - **Input form**: The right sidebar generates a form from the workflow's `inputSchema`. Fill it in and start the run.
89
+ - **Live status**: During execution, the graph updates each step's status in real time. The sidebar shows the workflow's input, output, state, and logs.
90
+ - [**Time travel**](https://mastra.ai/docs/workflows/time-travel): After a run completes, replay individual steps to inspect or retry them.
91
+
83
92
  ## Workflow state
84
93
 
85
94
  Workflow state lets you share values across steps without passing them through every step's inputSchema and outputSchema. Use state for tracking progress, accumulating results, or sharing configuration across the entire workflow.
@@ -188,7 +197,7 @@ const testWorkflow = mastra.getWorkflow('testWorkflow')
188
197
 
189
198
  Workflows can be run in two modes: start waits for all steps to complete before returning, and stream emits events during execution. Choose the approach that fits your use case: start when you only need the final result, and stream when you want to monitor progress or trigger actions as steps complete.
190
199
 
191
- **Start**:
200
+ **.start()**:
192
201
 
193
202
  Create a workflow run instance using `createRun()`, then call `.start()` with `inputData` matching the workflow's `inputSchema`. The workflow executes all steps and returns the final result.
194
203
 
@@ -206,7 +215,7 @@ if (result.status === 'success') {
206
215
  }
207
216
  ```
208
217
 
209
- **Stream**:
218
+ **.stream()**:
210
219
 
211
220
  Create a workflow run instance using `.createRun()`, then call `.stream()` with `inputData` matching the workflow's `inputSchema`. Iterate over `fullStream` to track progress, then await `result` to get the final workflow result.
212
221
 
@@ -356,10 +365,6 @@ const step1 = createStep({
356
365
 
357
366
  > **Tip:** For type-safe request context schema validation, see [Schema Validation](https://mastra.ai/docs/server/request-context).
358
367
 
359
- ## Testing with Studio
360
-
361
- Use [Studio](https://mastra.ai/docs/getting-started/studio) to run workflows with different inputs, visualize the execution lifecycle, see the inputs and outputs for each step, and inspect each part of the workflow in more detail.
362
-
363
368
  ## Related
364
369
 
365
370
  For a closer look at workflows, see our [Workflow Guide](https://mastra.ai/guides/guide/ai-recruiter), which walks through the core concepts with a practical example.
@@ -1,4 +1,4 @@
1
- # Suspend and resume
1
+ # Suspend & resume
2
2
 
3
3
  Workflows can be paused at any step to collect additional data, wait for API callbacks, throttle costly operations, or request [human-in-the-loop](https://mastra.ai/docs/workflows/human-in-the-loop) input. When a workflow is suspended, its current execution state is saved as a snapshot. You can later resume the workflow from a [specific step ID](https://mastra.ai/docs/workflows/snapshots), restoring the exact state captured in that snapshot. [Snapshots](https://mastra.ai/docs/workflows/snapshots) are stored in your configured storage provider and persist across deployments and application restarts.
4
4
 
@@ -22,7 +22,7 @@ Multi-agent patterns are useful when the system needs a clear way to divide cont
22
22
 
23
23
  ## Handoffs
24
24
 
25
- A handoff pattern transfers control from one agent to another. Unlike a supervisor pattern, the first agent does not stay in charge for the full task. Instead, the active specialist takes ownership of the next part of the interaction.
25
+ A handoff pattern transfers control from one agent to another. Unlike a supervisor pattern, the first agent doesn't stay in charge for the full task. Instead, the active specialist takes ownership of the next part of the interaction.
26
26
 
27
27
  Use handoffs when the next specialist should continue the interaction directly instead of reporting back through a central coordinator. The tradeoff is that context management becomes more important, since the system must decide what the next agent inherits and what remains scoped.
28
28
 
@@ -34,13 +34,13 @@ A workflow pattern defines the execution path in code. Instead of asking an agen
34
34
 
35
35
  Use workflows when the task is well understood and the execution path is known in advance. The main advantage is predictability: The system is easier to debug, reason about, and audit because the structure is explicit. The tradeoff is flexibility, since workflows are less adaptive when the task changes as it unfolds.
36
36
 
37
- In Mastra, [workflows](https://mastra.ai/docs/workflows/overview) can implement several coordination patterns, including handoffs and councils. What makes a workflow distinct is not which agents it calls, but that the control logic lives in the workflow itself.
37
+ In Mastra, [workflows](https://mastra.ai/docs/workflows/overview) can implement several coordination patterns, including handoffs and councils. What makes a workflow distinct isn't which agents it calls, but that the control logic lives in the workflow itself.
38
38
 
39
39
  ## Supervisors
40
40
 
41
41
  A supervisor pattern keeps one lead agent in control for the full task. The supervisor decides when to delegate, which specialist to call, what context to pass, and how to combine the result.
42
42
 
43
- Use this pattern when the task is open-ended and the full sequence is not known in advance. For example, a research task may require different lines of inquiry based on what earlier steps uncover. A supervisor can adapt as the task unfolds. The tradeoff is that the supervisor becomes the main coordination point. That makes the pattern flexible, but it also means the result depends heavily on good delegation behavior and clear subagent boundaries.
43
+ Use this pattern when the task is open-ended and the full sequence isn't known in advance. For example, a research task may require different lines of inquiry based on what earlier steps uncover. A supervisor can adapt as the task unfolds. The tradeoff is that the supervisor becomes the main coordination point. That makes the pattern flexible, but it also means the result depends heavily on good delegation behavior and clear subagent boundaries.
44
44
 
45
45
  In Mastra, this pattern maps directly to [supervisor agents](https://mastra.ai/docs/agents/supervisor-agents). A supervisor agent defines subagents on the `agents` property and uses `stream()` or `generate()` to coordinate them. Mastra also provides delegation hooks, message filtering, and memory isolation to help control this pattern.
46
46
 
@@ -52,7 +52,7 @@ A council pattern asks multiple agents to work on the same problem independently
52
52
 
53
53
  Use this pattern when the question is ambiguous, evaluative, or high-stakes and answer quality matters more than speed. The tradeoff is cost, since councils intentionally duplicate effort and usually take longer and use more tokens than other patterns.
54
54
 
55
- Mastra does not provide a dedicated council primitive. In Mastra, implement this pattern with [agents](https://mastra.ai/docs/agents/overview) and [workflows](https://mastra.ai/docs/workflows/overview): Run multiple agents in parallel, collect their outputs, and add a final synthesis or review step. Workflow control flow methods such as `.parallel()` provide the structure for this pattern.
55
+ Mastra doesn't provide a dedicated council primitive. In Mastra, implement this pattern with [agents](https://mastra.ai/docs/agents/overview) and [workflows](https://mastra.ai/docs/workflows/overview): Run multiple agents in parallel, collect their outputs, and add a final synthesis or review step. Workflow control flow methods such as `.parallel()` provide the structure for this pattern.
56
56
 
57
57
  ## Choosing a pattern
58
58
 
@@ -69,7 +69,7 @@ export const mastra = new Mastra({
69
69
 
70
70
  ## Studio
71
71
 
72
- You can deploy [Studio](https://mastra.ai/docs/getting-started/studio) alongside your API by enabling the `studio` option. Studio is deployed as static assets served from Vercel's Edge CDN, so it doesn't consume function invocations.
72
+ You can deploy [Studio](https://mastra.ai/docs/studio/overview) alongside your API by enabling the `studio` option. Studio is deployed as static assets served from Vercel's Edge CDN, so it doesn't consume function invocations.
73
73
 
74
74
  ```typescript
75
75
  import { Mastra } from '@mastra/core'
@@ -87,7 +87,7 @@ This creates a `src/mastra` folder with an example weather agent and the followi
87
87
 
88
88
  You'll call `weather-agent.ts` from your Next.js routes in the next steps.
89
89
 
90
- > **Using Mastra Studio alongside Next.js:** If you want to run `mastra dev` (Mastra Studio) alongside your Next.js app and have both share the same database, update the storage URL in `src/mastra/index.ts` to use an absolute path:
90
+ > **Using Studio alongside Next.js:** If you want to run [Studio](https://mastra.ai/docs/studio/overview) alongside your Next.js app and have both share the same database, update the storage URL in `src/mastra/index.ts` to use an absolute path:
91
91
  >
92
92
  > ```typescript
93
93
  > url: 'file:/absolute/path/to/your/project/mastra.db'