@mastra/mcp-docs-server 1.2.7-alpha.12 → 1.2.7-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.
Files changed (166) hide show
  1. package/.docs/docs/agent-builder/integrations.md +2 -44
  2. package/.docs/docs/agent-builder/overview.md +3 -4
  3. package/.docs/docs/agent-builder/skill-registries.md +3 -1
  4. package/.docs/docs/agent-controller/overview.md +2 -3
  5. package/.docs/docs/agent-controller/session.md +3 -1
  6. package/.docs/docs/agents/a2a.md +1 -2
  7. package/.docs/docs/agents/channels.md +225 -0
  8. package/.docs/docs/agents/code-mode.md +1 -1
  9. package/.docs/docs/agents/file-based-agents.md +297 -0
  10. package/.docs/docs/agents/guardrails.md +9 -10
  11. package/.docs/docs/agents/overview.md +4 -4
  12. package/.docs/docs/agents/skills.md +5 -3
  13. package/.docs/docs/agents/structured-output.md +1 -1
  14. package/.docs/docs/agents/supervisor-agents.md +4 -3
  15. package/.docs/docs/agents/using-tools.md +4 -2
  16. package/.docs/docs/browser/agent-browser.md +3 -1
  17. package/.docs/docs/browser/browser-viewer.md +3 -1
  18. package/.docs/docs/browser/overview.md +1 -2
  19. package/.docs/docs/browser/stagehand.md +1 -1
  20. package/.docs/docs/deployment/mastra-server.md +4 -2
  21. package/.docs/docs/editor/overview.md +6 -2
  22. package/.docs/docs/editor/prompts.md +1 -1
  23. package/.docs/docs/editor/tools.md +5 -3
  24. package/.docs/docs/evals/custom-scorers.md +3 -1
  25. package/.docs/docs/evals/datasets/overview.md +5 -4
  26. package/.docs/docs/evals/datasets/running-experiments.md +2 -4
  27. package/.docs/docs/evals/evals-with-memory.md +3 -1
  28. package/.docs/docs/evals/gates-and-verdicts.md +3 -1
  29. package/.docs/docs/evals/overview.md +1 -4
  30. package/.docs/docs/evals/quick-checks.md +3 -1
  31. package/.docs/docs/long-running-agents/background-tasks.md +1 -1
  32. package/.docs/docs/long-running-agents/durable-agents.md +5 -3
  33. package/.docs/docs/long-running-agents/goals.md +3 -1
  34. package/.docs/docs/long-running-agents/signal-providers.md +3 -1
  35. package/.docs/docs/long-running-agents/signals.md +22 -11
  36. package/.docs/docs/mastra-platform/observability.md +1 -5
  37. package/.docs/docs/mcp/mcp-apps.md +3 -3
  38. package/.docs/docs/mcp/overview.md +10 -6
  39. package/.docs/docs/memory/observational-memory.md +1 -2
  40. package/.docs/docs/memory/overview.md +4 -6
  41. package/.docs/docs/memory/semantic-recall.md +1 -1
  42. package/.docs/docs/memory/working-memory.md +3 -3
  43. package/.docs/docs/observability/integrations/exporters/mastra-platform.md +3 -1
  44. package/.docs/docs/observability/logging.md +1 -1
  45. package/.docs/docs/observability/tracing/overview.md +1 -1
  46. package/.docs/docs/server/auth/auth0.md +1 -1
  47. package/.docs/docs/server/auth/better-auth.md +2 -2
  48. package/.docs/docs/server/auth/clerk.md +1 -1
  49. package/.docs/docs/server/auth/firebase.md +1 -1
  50. package/.docs/docs/server/auth/google.md +2 -2
  51. package/.docs/docs/server/auth/jwt.md +2 -2
  52. package/.docs/docs/server/auth/okta.md +2 -2
  53. package/.docs/docs/server/auth/workos.md +1 -1
  54. package/.docs/docs/server/mastra-client.md +1 -1
  55. package/.docs/docs/server/mastra-server.md +1 -1
  56. package/.docs/docs/server/pubsub.md +1 -1
  57. package/.docs/docs/server/request-context.md +4 -4
  58. package/.docs/docs/server/server-adapters.md +8 -8
  59. package/.docs/docs/studio/auth.md +3 -1
  60. package/.docs/docs/studio/overview.md +1 -1
  61. package/.docs/docs/voice/livekit.md +3 -100
  62. package/.docs/docs/workflows/agents-and-tools.md +5 -3
  63. package/.docs/docs/workflows/control-flow.md +3 -1
  64. package/.docs/docs/workflows/overview.md +7 -6
  65. package/.docs/docs/workspace/overview.md +1 -2
  66. package/.docs/docs/workspace/sandbox.md +0 -2
  67. package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
  68. package/.docs/guides/build-your-ui/copilotkit/overview.md +1 -1
  69. package/.docs/guides/concepts/streaming.md +3 -3
  70. package/.docs/guides/getting-started/quickstart.md +1 -3
  71. package/.docs/guides/guide/chef-michel.md +2 -0
  72. package/.docs/guides/guide/slack-assistant.md +2 -2
  73. package/.docs/guides/guide/stock-agent.md +2 -0
  74. package/.docs/models/environment-variables.md +0 -7
  75. package/.docs/models/gateways/netlify.md +1 -4
  76. package/.docs/models/gateways/openrouter.md +7 -10
  77. package/.docs/models/gateways/vercel.md +1 -8
  78. package/.docs/models/index.md +1 -1
  79. package/.docs/models/providers/abacus.md +14 -44
  80. package/.docs/models/providers/google.md +1 -2
  81. package/.docs/models/providers/llmgateway.md +181 -185
  82. package/.docs/models/providers/nano-gpt.md +2 -2
  83. package/.docs/models/providers/neon.md +29 -40
  84. package/.docs/models/providers/nvidia.md +3 -1
  85. package/.docs/models/providers/openai.md +1 -6
  86. package/.docs/models/providers/opencode.md +2 -6
  87. package/.docs/models/providers/poolside.md +5 -6
  88. package/.docs/models/providers/routing-run.md +34 -23
  89. package/.docs/models/providers/the-grid-ai.md +3 -3
  90. package/.docs/models/providers/wandb.md +14 -21
  91. package/.docs/models/providers/xai.md +1 -2
  92. package/.docs/models/providers.md +0 -7
  93. package/.docs/reference/agents/channels.md +2 -2
  94. package/.docs/reference/channels/channel-provider.md +1 -1
  95. package/.docs/reference/channels/slack-provider.md +2 -2
  96. package/.docs/reference/cli/mastra.md +10 -117
  97. package/.docs/reference/evals/create-scorer.md +0 -8
  98. package/.docs/reference/index.md +0 -17
  99. package/.docs/reference/memory/memory-class.md +1 -1
  100. package/.docs/reference/memory/serialized-memory-config.md +1 -1
  101. package/.docs/reference/project-structure.md +1 -1
  102. package/.docs/reference/pubsub/lease-provider.md +1 -1
  103. package/.docs/reference/server/express-adapter.md +3 -1
  104. package/.docs/reference/server/fastify-adapter.md +3 -1
  105. package/.docs/reference/server/hono-adapter.md +3 -1
  106. package/.docs/reference/server/koa-adapter.md +3 -1
  107. package/.docs/reference/server/nestjs-adapter.md +3 -1
  108. package/.docs/reference/storage/clickhouse.md +0 -32
  109. package/.docs/reference/storage/composite.md +1 -27
  110. package/.docs/reference/storage/retention.md +0 -11
  111. package/.docs/reference/tools/mcp-client.md +0 -22
  112. package/.docs/reference/tools/mcp-server.md +4 -161
  113. package/.docs/reference/voice/livekit.md +8 -272
  114. package/.docs/reference/workspace/agentcore-runtime-sandbox.md +3 -1
  115. package/.docs/reference/workspace/agentfs-filesystem.md +3 -1
  116. package/.docs/reference/workspace/apple-container-sandbox.md +3 -1
  117. package/.docs/reference/workspace/archil-filesystem.md +3 -1
  118. package/.docs/reference/workspace/azure-blob-filesystem.md +3 -1
  119. package/.docs/reference/workspace/blaxel-sandbox.md +3 -1
  120. package/.docs/reference/workspace/daytona-sandbox.md +3 -1
  121. package/.docs/reference/workspace/docker-sandbox.md +3 -1
  122. package/.docs/reference/workspace/e2b-sandbox.md +3 -1
  123. package/.docs/reference/workspace/files-sdk-filesystem.md +3 -1
  124. package/.docs/reference/workspace/gcs-filesystem.md +3 -1
  125. package/.docs/reference/workspace/google-drive-filesystem.md +3 -1
  126. package/.docs/reference/workspace/local-filesystem.md +3 -1
  127. package/.docs/reference/workspace/local-sandbox.md +3 -1
  128. package/.docs/reference/workspace/modal-sandbox.md +3 -1
  129. package/.docs/reference/workspace/railway-sandbox.md +3 -1
  130. package/.docs/reference/workspace/s3-filesystem.md +3 -1
  131. package/.docs/reference/workspace/vercel-sandbox.md +7 -5
  132. package/.docs/reference/workspace/vercel-serverless.md +3 -1
  133. package/CHANGELOG.md +0 -29
  134. package/package.json +5 -5
  135. package/.docs/docs/capabilities/channels/discord.md +0 -98
  136. package/.docs/docs/capabilities/channels/other-adapters.md +0 -68
  137. package/.docs/docs/capabilities/channels/overview.md +0 -255
  138. package/.docs/docs/capabilities/channels/slack.md +0 -225
  139. package/.docs/docs/capabilities/channels/teams.md +0 -100
  140. package/.docs/docs/capabilities/channels/telegram.md +0 -98
  141. package/.docs/docs/capabilities/channels/whatsapp.md +0 -99
  142. package/.docs/docs/getting-started/file-based-agents.md +0 -116
  143. package/.docs/models/providers/crossmodel.md +0 -109
  144. package/.docs/models/providers/empiriolabs.md +0 -106
  145. package/.docs/models/providers/meta.md +0 -101
  146. package/.docs/models/providers/model-oracle-ai.md +0 -87
  147. package/.docs/models/providers/pioneer.md +0 -148
  148. package/.docs/models/providers/unorouter.md +0 -95
  149. package/.docs/models/providers/zenifra.md +0 -73
  150. package/.docs/reference/file-based-agents/config.md +0 -97
  151. package/.docs/reference/file-based-agents/instructions.md +0 -54
  152. package/.docs/reference/file-based-agents/logger.md +0 -26
  153. package/.docs/reference/file-based-agents/memory.md +0 -58
  154. package/.docs/reference/file-based-agents/observability.md +0 -32
  155. package/.docs/reference/file-based-agents/processors.md +0 -56
  156. package/.docs/reference/file-based-agents/scorers.md +0 -54
  157. package/.docs/reference/file-based-agents/server.md +0 -37
  158. package/.docs/reference/file-based-agents/skills.md +0 -56
  159. package/.docs/reference/file-based-agents/storage.md +0 -30
  160. package/.docs/reference/file-based-agents/studio.md +0 -56
  161. package/.docs/reference/file-based-agents/subagents.md +0 -123
  162. package/.docs/reference/file-based-agents/tools.md +0 -63
  163. package/.docs/reference/file-based-agents/workflows.md +0 -52
  164. package/.docs/reference/file-based-agents/workspace.md +0 -74
  165. package/.docs/reference/memory/summarizeConversation.md +0 -99
  166. package/.docs/reference/memory/summarizeThread.md +0 -93
@@ -0,0 +1,297 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # File-based agents
4
+
5
+ **Added in:** `@mastra/core@1.48.0`
6
+
7
+ > **Beta:** This feature is in beta. Breaking changes may occur without a major version bump until the API is stable.
8
+
9
+ You can define an agent by file convention instead of constructing it in code. Mastra discovers a directory under `src/mastra/agents/<name>/`, assembles an [`Agent`](https://mastra.ai/reference/agents/agent), and registers it on your [`Mastra`](https://mastra.ai/reference/core/mastra-class) instance.
10
+
11
+ ## When to use file-based agents
12
+
13
+ Use file-based agents when you want one directory per agent, with configuration, instructions, tools, skills, workspace files, and subagents grouped together.
14
+
15
+ Keep using [`new Agent()`](https://mastra.ai/reference/agents/agent) in code when you need dynamic configuration, programmatic registration, or a shared agent instance across modules. Both approaches can coexist: code-registered agents are always present, and the bundler adds file-based agents when you run through the Mastra CLI.
16
+
17
+ ## Quickstart
18
+
19
+ Create a directory for the agent and add a `config.ts`. Use `agentConfig` so the partial config is typed while sibling files supply the rest.
20
+
21
+ ```typescript
22
+ import { agentConfig } from '@mastra/core/agent'
23
+
24
+ export default agentConfig({
25
+ model: 'openai/gpt-5.5',
26
+ // instructions omitted -> taken from instructions.md
27
+ // tools omitted -> taken from tools/*.ts
28
+ })
29
+ ```
30
+
31
+ Add the agent instructions:
32
+
33
+ ```markdown
34
+ You are a helpful weather assistant. Answer questions about current conditions and forecasts.
35
+ ```
36
+
37
+ Add a tool. The filename becomes the tool key, so this file is exposed as `get_weather`.
38
+
39
+ ```typescript
40
+ import { createTool } from '@mastra/core/tools'
41
+ import { z } from 'zod'
42
+
43
+ export default createTool({
44
+ id: 'get_weather',
45
+ description: 'Get the current weather for a city',
46
+ inputSchema: z.object({ city: z.string() }),
47
+ execute: async ({ context }) => ({ city: context.city, tempC: 21 }),
48
+ })
49
+ ```
50
+
51
+ Your `src/mastra/index.ts` stays the same. The discovered agent is registered automatically when you run the app through `mastra dev` or `mastra build`.
52
+
53
+ ```typescript
54
+ import { Mastra } from '@mastra/core'
55
+ import { Agent } from '@mastra/core/agent'
56
+
57
+ const supportAgent = new Agent({
58
+ id: 'support',
59
+ name: 'support',
60
+ instructions: 'You are a support agent.',
61
+ model: 'openai/gpt-5.5',
62
+ })
63
+
64
+ // `support` is registered in code; `weather` is discovered from the filesystem.
65
+ export const mastra = new Mastra({
66
+ agents: { support: supportAgent },
67
+ })
68
+ ```
69
+
70
+ Start the app through the Mastra CLI:
71
+
72
+ **npm**:
73
+
74
+ ```bash
75
+ npx mastra dev
76
+ ```
77
+
78
+ **pnpm**:
79
+
80
+ ```bash
81
+ pnpm dlx mastra dev
82
+ ```
83
+
84
+ **Yarn**:
85
+
86
+ ```bash
87
+ yarn dlx mastra dev
88
+ ```
89
+
90
+ **Bun**:
91
+
92
+ ```bash
93
+ bun x mastra dev
94
+ ```
95
+
96
+ ## Folder structure
97
+
98
+ The following table shows the supported file-based agent surface:
99
+
100
+ | File / directory | Maps to |
101
+ | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
102
+ | `agents/<name>/config.ts` | Default export merged into the agent config. `id` and `name` default to `<name>`. |
103
+ | `agents/<name>/instructions.md` | The agent `instructions`. The file contents are inlined into generated code. |
104
+ | `agents/<name>/tools/*.ts` | Each default-exported [`createTool()`](https://mastra.ai/reference/tools/create-tool). The tool key defaults to the filename. |
105
+ | `agents/<name>/skills/*.ts` | Each default-exported [`createSkill()`](https://mastra.ai/reference/agents/createSkill), added to the agent `skills`. |
106
+ | `agents/<name>/skills/<skill>/SKILL.md` | A packaged skill. Frontmatter supplies `name` and `description`, the body is the instructions, and files under `references/` are inlined. |
107
+ | `agents/<name>/skills/<skill>.md` | A flat skill. The filename is the skill name and the body is the instructions. |
108
+ | `agents/<name>/memory.ts` | Default export: a [`Memory`](https://mastra.ai/reference/memory/memory-class) instance used as the agent `memory`. |
109
+ | `agents/<name>/workspace.ts` | Default export: a [`Workspace`](https://mastra.ai/reference/workspace/workspace-class) for the agent. |
110
+ | `agents/<name>/workspace/` | Seed files mirrored into the agent's default workspace at build time. |
111
+ | `agents/<name>/subagents/<childId>/` | A declared subagent with the same layout as an agent directory. Wired into the parent as a delegation tool named `<childId>`. |
112
+
113
+ Test files named `*.test.ts`, `*.spec.ts`, `*.test.js`, and `*.spec.js` are ignored during tool and skill discovery.
114
+
115
+ ## Add skills
116
+
117
+ Add skills to a file-based agent by placing them under `agents/<name>/skills/`. Three layouts are supported, and they're inlined into the bundle at build time so the deployed agent doesn't read them from disk at runtime.
118
+
119
+ - A `.ts` file can default-export `createSkill()`:
120
+
121
+ ```typescript
122
+ import { createSkill } from '@mastra/core/skills'
123
+
124
+ export default createSkill({
125
+ name: 'forecasting',
126
+ description: 'Use when the user asks about multi-day forecasts.',
127
+ instructions: 'Summarize the forecast day by day and call out precipitation.',
128
+ })
129
+ ```
130
+
131
+ > **Note:** Visit [`createSkill()` reference](https://mastra.ai/reference/agents/createSkill) for the full API.
132
+
133
+ - A packaged `SKILL.md` directory uses frontmatter for the name and description. Files under `references/` are inlined with the skill.
134
+
135
+ ```markdown
136
+ ---
137
+ name: severe-weather
138
+ description: Use when conditions include storms, flooding, or other hazards.
139
+ ---
140
+
141
+ Lead with the active alert, then give safety guidance.
142
+ ```
143
+
144
+ - A flat `<skill>.md` file uses the filename as the skill name:
145
+
146
+ ```markdown
147
+ Always report temperatures in both Celsius and Fahrenheit.
148
+ ```
149
+
150
+ Discovered skills merge with any `skills` in `config.ts`. On a name collision, `config.skills` wins and a warning is logged. If `config.skills` is a function, discovered skills are ignored with a warning because they can't be statically merged.
151
+
152
+ ## Add memory
153
+
154
+ Give a file-based agent [memory](https://mastra.ai/docs/memory/overview) by adding a `memory.ts` that default-exports a [`Memory`](https://mastra.ai/reference/memory/memory-class) instance:
155
+
156
+ ```typescript
157
+ import { Memory } from '@mastra/memory'
158
+
159
+ export default new Memory()
160
+ ```
161
+
162
+ The exported instance becomes the agent's `memory`. You can also set `memory` directly in `config.ts`. `config.memory` wins over `memory.ts`, and a warning is logged when both are present. If neither is present, the agent has no memory, which is the default.
163
+
164
+ ## Add a workspace
165
+
166
+ When a file-based agent is discovered through `mastra dev` or `mastra build`, it gets a default workspace unless `config.workspace` or `workspace.ts` supplies one. The default workspace uses a contained filesystem and shell sandbox rooted at a per-agent `workspace/` directory in the bundle.
167
+
168
+ To customize it, add a `workspace.ts` that default-exports a [`Workspace`](https://mastra.ai/reference/workspace/workspace-class):
169
+
170
+ ```typescript
171
+ import { Workspace, LocalFilesystem, LocalSandbox } from '@mastra/core/workspace'
172
+
173
+ export default new Workspace({
174
+ name: 'weather-workspace',
175
+ filesystem: new LocalFilesystem({ basePath: './data/weather' }),
176
+ sandbox: new LocalSandbox({ workingDirectory: './data/weather' }),
177
+ })
178
+ ```
179
+
180
+ You can also set `workspace` directly in `config.ts`. `config.workspace` wins over `workspace.ts`, and `workspace.ts` wins over the default workspace.
181
+
182
+ ### Seed files
183
+
184
+ Add a `workspace/` directory to ship files with the agent. Mastra mirrors every file under it into the agent's default workspace at build time, so the agent starts with those files on disk:
185
+
186
+ ```text
187
+ src/mastra/agents/weather/
188
+ config.ts
189
+ workspace/
190
+ README.md
191
+ data/cities.json
192
+ ```
193
+
194
+ Seed files are copied into the bundle next to the running server. Commit the starting files alongside the agent that uses them.
195
+
196
+ ## Add subagents
197
+
198
+ A file-based agent can declare **subagents**, specialist child agents it can delegate to. Add a `subagents/` directory under the agent, with one directory per subagent. Each subagent directory has the same layout as a top-level agent: `config.ts`, `instructions.md`, `tools/`, `skills/`, `memory.ts`, `workspace.ts`, and `workspace/`.
199
+
200
+ ```text
201
+ src/mastra/agents/
202
+ supervisor/
203
+ config.ts
204
+ instructions.md
205
+ subagents/
206
+ researcher/
207
+ config.ts
208
+ instructions.md
209
+ tools/
210
+ search.ts
211
+ ```
212
+
213
+ Each subagent is assembled as its own agent and wired into the parent's `agents` map. The agent loop lowers it into a model-visible delegation tool. The tool name is the bare directory name, so the example above exposes `researcher` to the supervisor.
214
+
215
+ A subagent's `config.ts` must set a non-empty `description`. The description is what the model sees when deciding whether to delegate, so the build fails if it's missing.
216
+
217
+ ```typescript
218
+ import { agentConfig } from '@mastra/core/agent'
219
+
220
+ export default agentConfig({
221
+ model: 'openai/gpt-5.5',
222
+ description: 'Researches a topic and returns cited findings.',
223
+ })
224
+ ```
225
+
226
+ Subagents are isolated. A subagent inherits nothing from its parent. Its tools, skills, and workspace come only from its own directory, and any absent slot falls back to the same framework defaults as a top-level agent.
227
+
228
+ Subagents can declare their own `subagents/` directories, nesting up to three levels below the top-level agent. A `subagents/` directory deeper than that's ignored with a warning.
229
+
230
+ ```text
231
+ src/mastra/agents/
232
+ supervisor/ # depth 0
233
+ subagents/
234
+ researcher/ # depth 1
235
+ subagents/
236
+ summarizer/ # depth 2
237
+ ```
238
+
239
+ Naming rules:
240
+
241
+ - A subagent id that collides with one of the parent's tool keys is a build error.
242
+ - A duplicate subagent id under the same parent is a build error.
243
+ - If a subagent id also exists in the parent's `config.agents`, the `config.agents` entry wins and logs a warning.
244
+ - If `config.agents` is a function, discovered subagents are ignored with a warning because they can't be statically merged.
245
+
246
+ ## Precedence rules
247
+
248
+ File-based and code-based agents coexist with deterministic rules:
249
+
250
+ - **Code wins on name collisions:** If an agent name exists in both code and the filesystem, the code-registered agent is kept and a warning is logged.
251
+ - **A folder can hold a code agent:** If `config.ts` exports a configured `new Agent({ id: 'file-based-agent', ... })`, that instance is used as-is. Sibling `instructions.md`, `tools/`, `skills/`, `memory.ts`, `workspace.ts`, and `subagents/` entries are ignored with warnings.
252
+ - **Instructions:** Dynamic function instructions in `config.ts` win over `instructions.md`. Otherwise, `instructions.md` wins over a static `instructions` string. If neither is present, the build fails for that agent.
253
+ - **Model:** A missing `model` fails the build and names the agent directory.
254
+ - **Tools:** Tools from `tools/*.ts` merge with `config.tools`. On a key collision, `config.tools` wins and a warning is logged. If `config.tools` is a function, discovered tools are ignored with a warning.
255
+ - **Skills:** Skills from `skills/` merge with `config.skills`. On a name collision, `config.skills` wins and a warning is logged. If `config.skills` is a function, discovered skills are ignored with a warning.
256
+ - **Memory:** `config.memory` wins over `memory.ts`, and a warning is logged when both are present. If neither is set, the agent has no memory.
257
+ - **Workspace:** `config.workspace` wins over `workspace.ts`, which wins over the default workspace.
258
+ - **Subagents:** Subagents from `subagents/` merge with `config.agents`. On an id collision, `config.agents` wins and a warning is logged. A subagent id that collides with a tool key, or a duplicate subagent id, is a build error.
259
+
260
+ ## What happens at build time
261
+
262
+ File-based agents are discovered by the Mastra **bundler**, the step that runs under `mastra dev` and `mastra build`.
263
+
264
+ File-based agents are registered only when your app runs through the Mastra CLI. If you import your `mastra` instance directly, `agents/<name>/` directories aren't discovered.
265
+
266
+ When you consume Mastra as a library, register those agents in code instead of relying on file discovery:
267
+
268
+ ```typescript
269
+ import { Mastra } from '@mastra/core'
270
+ import { Agent } from '@mastra/core/agent'
271
+
272
+ const weather = new Agent({
273
+ id: 'weather',
274
+ name: 'weather',
275
+ instructions: 'You are a helpful weather assistant.',
276
+ model: 'openai/gpt-5.5',
277
+ })
278
+
279
+ export const mastra = new Mastra({
280
+ agents: { weather },
281
+ })
282
+ ```
283
+
284
+ ## Related
285
+
286
+ - [Agents overview](https://mastra.ai/docs/agents/overview)
287
+ - [Tools](https://mastra.ai/docs/agents/using-tools)
288
+ - [Skills](https://mastra.ai/docs/agents/skills)
289
+ - [Memory](https://mastra.ai/docs/memory/overview)
290
+ - [Supervisor agents](https://mastra.ai/docs/agents/supervisor-agents)
291
+ - [Workspace](https://mastra.ai/docs/workspace/overview)
292
+ - [Studio overview](https://mastra.ai/docs/studio/overview)
293
+ - [`Agent` reference](https://mastra.ai/reference/agents/agent)
294
+ - [`createTool()` reference](https://mastra.ai/reference/tools/create-tool)
295
+ - [`createSkill()` reference](https://mastra.ai/reference/agents/createSkill)
296
+ - [`Memory` reference](https://mastra.ai/reference/memory/memory-class)
297
+ - [`Workspace` reference](https://mastra.ai/reference/workspace/workspace-class)
@@ -29,7 +29,7 @@ export const normalizedAgent = new Agent({
29
29
  })
30
30
  ```
31
31
 
32
- Visit [`UnicodeNormalizer()`](https://mastra.ai/reference/processors/unicode-normalizer) reference for a full list of configuration options.
32
+ > **Note:** Visit [`UnicodeNormalizer()`](https://mastra.ai/reference/processors/unicode-normalizer) reference for a full list of configuration options.
33
33
 
34
34
  ### Prevent prompt injection
35
35
 
@@ -52,7 +52,7 @@ export const secureAgent = new Agent({
52
52
  })
53
53
  ```
54
54
 
55
- Visit [`PromptInjectionDetector()`](https://mastra.ai/reference/processors/prompt-injection-detector) reference for a full list of configuration options.
55
+ > **Note:** Visit [`PromptInjectionDetector()`](https://mastra.ai/reference/processors/prompt-injection-detector) reference for a full list of configuration options.
56
56
 
57
57
  ### Detect and translate language
58
58
 
@@ -75,7 +75,7 @@ export const multilingualAgent = new Agent({
75
75
  })
76
76
  ```
77
77
 
78
- Visit [`LanguageDetector()`](https://mastra.ai/reference/processors/language-detector) reference for a full list of configuration options.
78
+ > **Note:** Visit [`LanguageDetector()`](https://mastra.ai/reference/processors/language-detector) reference for a full list of configuration options.
79
79
 
80
80
  ## Output processors
81
81
 
@@ -101,7 +101,7 @@ export const batchedAgent = new Agent({
101
101
  })
102
102
  ```
103
103
 
104
- Visit [`BatchPartsProcessor()`](https://mastra.ai/reference/processors/batch-parts-processor) reference for a full list of configuration options.
104
+ > **Note:** Visit [`BatchPartsProcessor()`](https://mastra.ai/reference/processors/batch-parts-processor) reference for a full list of configuration options.
105
105
 
106
106
  ### Scrub system prompts
107
107
 
@@ -128,7 +128,7 @@ const scrubbedAgent = new Agent({
128
128
  })
129
129
  ```
130
130
 
131
- Visit [`SystemPromptScrubber()`](https://mastra.ai/reference/processors/system-prompt-scrubber) reference for a full list of configuration options.
131
+ > **Note:** Visit [`SystemPromptScrubber()`](https://mastra.ai/reference/processors/system-prompt-scrubber) reference for a full list of configuration options.
132
132
 
133
133
  > **Note:** When streaming responses over HTTP, Mastra redacts sensitive request data (system prompts, tool definitions, API keys) from stream chunks at the server level by default. See [Stream data redaction](https://mastra.ai/docs/server/mastra-server) for details.
134
134
 
@@ -158,7 +158,7 @@ export const moderatedAgent = new Agent({
158
158
  })
159
159
  ```
160
160
 
161
- Visit [`ModerationProcessor()`](https://mastra.ai/reference/processors/moderation-processor) reference for a full list of configuration options.
161
+ > **Note:** Visit [`ModerationProcessor()`](https://mastra.ai/reference/processors/moderation-processor) reference for a full list of configuration options.
162
162
 
163
163
  ### Detect and redact PII
164
164
 
@@ -184,7 +184,7 @@ export const privateAgent = new Agent({
184
184
  })
185
185
  ```
186
186
 
187
- Visit [`PIIDetector()`](https://mastra.ai/reference/processors/pii-detector) reference for a full list of configuration options.
187
+ > **Note:** Visit [`PIIDetector()`](https://mastra.ai/reference/processors/pii-detector) reference for a full list of configuration options.
188
188
 
189
189
  ### Enforce cost limits
190
190
 
@@ -206,7 +206,7 @@ export const budgetedAgent = new Agent({
206
206
  })
207
207
  ```
208
208
 
209
- Visit [`CostGuardProcessor()`](https://mastra.ai/reference/processors/cost-guard-processor) reference for scoping modes, time windows, metric persistence delays, and the `onViolation` callback. Requires observability storage with `getMetricAggregate` support.
209
+ > **Note:** Visit [`CostGuardProcessor()`](https://mastra.ai/reference/processors/cost-guard-processor) reference for scoping modes, time windows, metric persistence delays, and the `onViolation` callback. Requires observability storage with `getMetricAggregate` support.
210
210
 
211
211
  ## Processor strategies
212
212
 
@@ -386,5 +386,4 @@ outputProcessors: [
386
386
 
387
387
  - [Processors](https://mastra.ai/docs/agents/processors): How processors work, execution order, custom processors, and retry mechanism
388
388
  - [`Processor` Interface](https://mastra.ai/reference/processors/processor-interface): API reference for the `Processor` interface
389
- - [Memory Processors](https://mastra.ai/docs/memory/memory-processors): Processors for message history, semantic recall, and working memory
390
- - 📹 [Mastra processors and guardrails workshop](https://www.youtube.com/watch?v=4Vpp7xQYvl0)
389
+ - [Memory Processors](https://mastra.ai/docs/memory/memory-processors): Processors for message history, semantic recall, and working memory
@@ -119,7 +119,7 @@ console.log(response.text)
119
119
 
120
120
  Use agents when the task is open-ended and the steps aren't known in advance. An agent decides which tools to call, how many times to loop, and when to stop. You provide the goal and constraints instead of defining each step. For predetermined, multi-step processes with explicit control flow, use [workflows](https://mastra.ai/docs/workflows/overview) instead.
121
121
 
122
- > **📹 Watch:** Watch [Mastra agent quickstart](https://www.youtube.com/watch?v=G8tXjcseNjg) for a short walkthrough of creating and testing a Mastra agent.
122
+ > **Tip:** Watch an introduction to agents, and how they compare to workflows on [YouTube (7 minutes)](https://youtu.be/0jg2g3sNvgw).
123
123
 
124
124
  ## Quickstart
125
125
 
@@ -151,10 +151,10 @@ export const mastra = new Mastra({
151
151
 
152
152
  Once registered, it can be called from workflows, tools, or other agents, and has access to shared resources such as memory, logging, and observability features.
153
153
 
154
- Visit the [agent reference](https://mastra.ai/reference/agents/agent) for more information on available properties and configurations.
155
-
156
154
  > **Tip:** Use [Studio](https://mastra.ai/docs/studio/overview) to test your agent with different messages, inspect tool calls and responses, and debug agent behavior.
157
155
 
156
+ > **Note:** Visit the [agent reference](https://mastra.ai/reference/agents/agent) for more information on available properties and configurations.
157
+
158
158
  ## Use your agent
159
159
 
160
160
  After registration, retrieve your agent with [`mastra.getAgentById()`](https://mastra.ai/reference/core/getAgentById). Call `.generate()` for a complete response or `.stream()` to deliver tokens in real time. You can call agents from [workflow steps](https://mastra.ai/docs/workflows/agents-and-tools), [tools](https://mastra.ai/docs/agents/using-tools), the [Mastra Client](https://mastra.ai/reference/client-js/mastra-client), route handlers, [server adapters](https://mastra.ai/docs/server/server-adapters), or the command line. Visit the [guides section](https://mastra.ai/guides) to learn how to use agents in your framework of choice.
@@ -205,7 +205,7 @@ Once your agent is running, use this table to find the right page for what you w
205
205
  | Build agents that correct their work | [Rubric scorer](https://mastra.ai/docs/agents/supervisor-agents) |
206
206
  | Swap instructions or models based on request context | [Dynamic configuration](https://mastra.ai/docs/server/request-context) |
207
207
  | Add speech-to-text or text-to-speech | [Voice](https://mastra.ai/docs/voice/overview) |
208
- | Connect to Slack, Discord, or Telegram | [Channels](https://mastra.ai/docs/capabilities/channels/overview) |
208
+ | Connect to Slack, Discord, or Telegram | [Channels](https://mastra.ai/docs/agents/channels) |
209
209
 
210
210
  ## Multi-agent systems
211
211
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  Skills are reusable instructions that teach agents how to perform specific tasks. They follow the [Agent Skills specification](https://agentskills.io).
6
6
 
7
- You can attach skills directly to an agent through its `skills` config, or configure them on a [workspace](https://mastra.ai/docs/workspace/overview). Attach them to the agent when the skills belong to that specific agent and you want to define them in code with no workspace required; use a workspace when you want skills discovered from the filesystem and shared across every agent that uses it. This page covers the agent-level approach — defining skills in code, loading them from files, and resolving them per request.
7
+ You can attach skills directly to an agent without setting up a workspace, filesystem, or sandbox. This is useful when you want portable, code-defined capabilities that travel with your agent definition.
8
8
 
9
9
  ## When to use agent-level skills
10
10
 
@@ -69,7 +69,9 @@ export const releaseChecklist = createSkill({
69
69
  })
70
70
  ```
71
71
 
72
- The `references` field bundles supporting documents that the agent can read with the `skill_read` tool, like `references/` files in a filesystem skill. Visit [`createSkill()` reference](https://mastra.ai/reference/agents/createSkill) for the full API.
72
+ The `references` field bundles supporting documents that the agent can read with the `skill_read` tool, like `references/` files in a filesystem skill.
73
+
74
+ > **Note:** Visit [`createSkill()` reference](https://mastra.ai/reference/agents/createSkill) for the full API.
73
75
 
74
76
  ## Filesystem path skills
75
77
 
@@ -177,7 +179,7 @@ for (const meta of allSkills) {
177
179
  }
178
180
  ```
179
181
 
180
- Visit [`.getSkill()` reference](https://mastra.ai/reference/agents/getSkill) and [`.listSkills()` reference](https://mastra.ai/reference/agents/listSkills) for the full API.
182
+ > **Note:** Visit [`.getSkill()` reference](https://mastra.ai/reference/agents/getSkill) and [`.listSkills()` reference](https://mastra.ai/reference/agents/listSkills) for the full API.
181
183
 
182
184
  ## Related
183
185
 
@@ -103,7 +103,7 @@ const response = await testAgent.generate('Help me plan my day.', {
103
103
  console.log(response.object)
104
104
  ```
105
105
 
106
- Visit [`.generate()`](https://mastra.ai/reference/agents/generate) for a full list of configuration options.
106
+ > **Note:** Visit [`.generate()`](https://mastra.ai/reference/agents/generate) for a full list of configuration options.
107
107
 
108
108
  **Example output:** The `response.object` will contain the structured data as defined by the schema.
109
109
 
@@ -226,7 +226,9 @@ How it works:
226
226
  2. **Scoped memory saves**: Only the delegation prompt and the subagent's response are saved to the subagent's memory
227
227
  3. **Fresh thread per invocation**: Each delegation uses a unique thread ID, ensuring clean separation
228
228
 
229
- This ensures subagents have the context they need without cluttering their memory with the entire supervisor conversation. Visit [memory in multi-agent systems](https://mastra.ai/docs/memory/overview) for more details.
229
+ This ensures subagents have the context they need without cluttering their memory with the entire supervisor conversation.
230
+
231
+ > **Note:** Visit [memory in multi-agent systems](https://mastra.ai/docs/memory/overview) for more details.
230
232
 
231
233
  ## Tool approval propagation
232
234
 
@@ -426,5 +428,4 @@ Version overrides propagate automatically through delegation. See [Subagent vers
426
428
  - [Agent.generate() reference](https://mastra.ai/reference/agents/generate)
427
429
  - [Agent approval](https://mastra.ai/docs/agents/agent-approval)
428
430
  - [Memory in multi-agent systems](https://mastra.ai/docs/memory/overview)
429
- - [Concept: Multi-agent systems](https://mastra.ai/guides/concepts/multi-agent-systems)
430
- - 📹 [Mastra supervisor agents workshop](https://www.youtube.com/watch?v=FNb2fL9WhQg\&t=1872s)
431
+ - [Concept: Multi-agent systems](https://mastra.ai/guides/concepts/multi-agent-systems)
@@ -38,7 +38,9 @@ export const weatherTool = createTool({
38
38
  })
39
39
  ```
40
40
 
41
- When creating tools, keep descriptions concise and focused on what the tool does, emphasizing its primary use case. Descriptive schema names can also help guide the agent on how to use the tool. Visit the [`createTool`](https://mastra.ai/reference/tools/create-tool) reference for more information on available properties, configurations, and examples.
41
+ When creating tools, keep descriptions concise and focused on what the tool does, emphasizing its primary use case. Descriptive schema names can also help guide the agent on how to use the tool.
42
+
43
+ > **Note:** Visit the [`createTool`](https://mastra.ai/reference/tools/create-tool) reference for more information on available properties, configurations, and examples.
42
44
 
43
45
  To make a tool available to an agent, add it to the `tools` property on the `Agent` class. Mentioning available tools and their general purpose in the agent's system prompt helps the agent decide when to call a tool and when not to.
44
46
 
@@ -357,7 +359,7 @@ await agent.generate('Check the forecast', {
357
359
  })
358
360
  ```
359
361
 
360
- See the [`Agent.generate()` reference](https://mastra.ai/reference/agents/generate) for all runtime options including `toolsets`, `clientTools`, and `prepareStep`.
362
+ > **Note:** See the [`Agent.generate()` reference](https://mastra.ai/reference/agents/generate) for all runtime options including `toolsets`, `clientTools`, and `prepareStep`.
361
363
 
362
364
  ## Control `toolName` in stream responses
363
365
 
@@ -99,7 +99,9 @@ const browser = new AgentBrowser({
99
99
  })
100
100
  ```
101
101
 
102
- This adds `browser_record` and `browser_record_caption` to the agent's toolset. See [Browser recording (alpha)](https://mastra.ai/docs/browser/recording) for details. See [AgentBrowser reference](https://mastra.ai/reference/browser/agent-browser) for all configuration options and tool details.
102
+ This adds `browser_record` and `browser_record_caption` to the agent's toolset. See [Browser recording (alpha)](https://mastra.ai/docs/browser/recording) for details.
103
+
104
+ > **Note:** See [AgentBrowser reference](https://mastra.ai/reference/browser/agent-browser) for all configuration options and tool details.
103
105
 
104
106
  ## Related
105
107
 
@@ -140,7 +140,9 @@ npm install -g browse
140
140
  browse skills install
141
141
  ```
142
142
 
143
- CDP flag: `--ws` See [BrowserViewer reference](https://mastra.ai/reference/browser/browser-viewer) for all configuration options, advanced connection modes, and method details.
143
+ CDP flag: `--ws`
144
+
145
+ > **Note:** See [BrowserViewer reference](https://mastra.ai/reference/browser/browser-viewer) for all configuration options, advanced connection modes, and method details.
144
146
 
145
147
  ## Related
146
148
 
@@ -169,5 +169,4 @@ const browser = new AgentBrowser({
169
169
  - [Stagehand](https://mastra.ai/docs/browser/stagehand)
170
170
  - [Browser recording (alpha)](https://mastra.ai/docs/browser/recording)
171
171
  - [BrowserViewer](https://mastra.ai/docs/browser/browser-viewer)
172
- - [MastraBrowser reference](https://mastra.ai/reference/browser/mastra-browser)
173
- - 📹 [Mastra browser capabilities workshop](https://www.youtube.com/watch?v=E9KFsZEnQO8\&t=5s)
172
+ - [MastraBrowser reference](https://mastra.ai/reference/browser/mastra-browser)
@@ -146,7 +146,7 @@ const browser = new StagehandBrowser({
146
146
  })
147
147
  ```
148
148
 
149
- See [StagehandBrowser reference](https://mastra.ai/reference/browser/stagehand-browser) for all configuration options.
149
+ > **Note:** See [StagehandBrowser reference](https://mastra.ai/reference/browser/stagehand-browser) for all configuration options.
150
150
 
151
151
  ## Recording
152
152
 
@@ -14,7 +14,9 @@ Run the build command from your project root:
14
14
  mastra build
15
15
  ```
16
16
 
17
- This creates a `.mastra` directory containing your production-ready server. Read the [`mastra build`](https://mastra.ai/reference/cli/mastra) reference for all available flags.
17
+ This creates a `.mastra` directory containing your production-ready server.
18
+
19
+ > **Info:** Read the [`mastra build`](https://mastra.ai/reference/cli/mastra) reference for all available flags.
18
20
 
19
21
  ## Build output
20
22
 
@@ -57,7 +59,7 @@ The `mastra start` command provides additional features:
57
59
  - Provides helpful error messages for missing modules
58
60
  - Handles process signals for graceful shutdown
59
61
 
60
- Read the [`mastra start`](https://mastra.ai/reference/cli/mastra) reference for all available flags.
62
+ > **Info:** Read the [`mastra start`](https://mastra.ai/reference/cli/mastra) reference for all available flags.
61
63
 
62
64
  ## Build configuration
63
65
 
@@ -64,7 +64,9 @@ export const mastra = new Mastra({
64
64
  })
65
65
  ```
66
66
 
67
- Once registered, you can manage agents through [Studio](https://mastra.ai/docs/studio/overview) or programmatically through the server API and Client SDK. See the [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor) for all configuration options.
67
+ Once registered, you can manage agents through [Studio](https://mastra.ai/docs/studio/overview) or programmatically through the server API and Client SDK.
68
+
69
+ > **Note:** See the [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor) for all configuration options.
68
70
 
69
71
  ## Code and database sources
70
72
 
@@ -171,7 +173,9 @@ Because stored agents are data, you can build automation loops that tune agents
171
173
  - Re-run the experiment against the draft and compare scores to the baseline.
172
174
  - Promote the draft to the published version when the scores improve.
173
175
 
174
- This turns agent tuning into a closed feedback loop. One agent owns the production configuration, another agent iterates on it, and every change is versioned so you can roll back if a round of automated edits makes things worse. Combine this with [version targeting](#version-targeting-and-experimentation) to keep production traffic on the published version while the draft is being tested. See the [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor) for the full namespace API.
176
+ This turns agent tuning into a closed feedback loop. One agent owns the production configuration, another agent iterates on it, and every change is versioned so you can roll back if a round of automated edits makes things worse. Combine this with [version targeting](#version-targeting-and-experimentation) to keep production traffic on the published version while the draft is being tested.
177
+
178
+ > **Note:** See the [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor) for the full namespace API.
175
179
 
176
180
  ## What can be overridden
177
181
 
@@ -122,7 +122,7 @@ await editor.agent.update({
122
122
  })
123
123
  ```
124
124
 
125
- See the [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor) for the full `editor.prompt` API.
125
+ > **Note:** See the [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor) for the full `editor.prompt` API.
126
126
 
127
127
  ## Versioning
128
128
 
@@ -52,7 +52,7 @@ Integration providers connect external tool platforms to the editor. Once regist
52
52
 
53
53
  [Composio](https://composio.dev) gives access to hundreds of integration tools organized into toolkits (GitHub, Slack, Gmail, and others).
54
54
 
55
- 1. Get a **project** API key (the `x-api-key` type) from your [Composio dashboard](https://dashboard.composio.dev).
55
+ 1. Get an API key from your Composio dashboard.
56
56
 
57
57
  2. Register the provider in your Editor configuration:
58
58
 
@@ -75,7 +75,7 @@ Integration providers connect external tool platforms to the editor. Once regist
75
75
  })
76
76
  ```
77
77
 
78
- Composio tool slugs use a format like `GITHUB_CREATE_ISSUE`. By default, tool calls use the connection pinned by the agent's author. To route calls to each end user's own account instead, see [connection scope](https://mastra.ai/docs/agent-builder/integrations) in the Agent Builder docs.
78
+ Composio tool slugs use a format like `GITHUB_CREATE_ISSUE`. Tool calls are scoped to the `resourceId` passed through request context for per-user authentication.
79
79
 
80
80
  ### Arcade
81
81
 
@@ -142,7 +142,9 @@ When an agent runs, tools from all sources are merged in this order:
142
142
  2. Integration tools
143
143
  3. MCP tools
144
144
 
145
- If a tool ID exists in multiple sources, later sources take precedence. Description overrides set at the agent level always take priority over the original tool description. See the [ToolProvider reference](https://mastra.ai/reference/editor/tool-provider) for the full provider API.
145
+ If a tool ID exists in multiple sources, later sources take precedence. Description overrides set at the agent level always take priority over the original tool description.
146
+
147
+ > **Note:** See the [ToolProvider reference](https://mastra.ai/reference/editor/tool-provider) for the full provider API.
146
148
 
147
149
  ## Related
148
150
 
@@ -341,7 +341,9 @@ A custom scorer in Mastra uses `createScorer` with four core components:
341
341
  3. [**Score Generation**](#score-generation)
342
342
  4. [**Reason Generation**](#reason-generation)
343
343
 
344
- Together, these components allow you to define custom evaluation logic using LLMs as judges. Visit [createScorer](https://mastra.ai/reference/evals/create-scorer) for the full API and configuration options.
344
+ Together, these components allow you to define custom evaluation logic using LLMs as judges.
345
+
346
+ > **Info:** Visit [createScorer](https://mastra.ai/reference/evals/create-scorer) for the full API and configuration options.
345
347
 
346
348
  ```typescript
347
349
  import { createScorer } from '@mastra/core/evals'