@mastra/mcp-docs-server 1.2.13-alpha.8 → 1.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agents/overview.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +2 -2
- package/.docs/docs/agents/using-tools.md +29 -0
- package/.docs/docs/capabilities/channels/imessage.md +181 -0
- package/.docs/docs/capabilities/channels/overview.md +1 -0
- package/.docs/docs/{evals/datasets → datasets}/overview.md +3 -3
- package/.docs/docs/{evals/datasets → datasets}/running-experiments.md +59 -2
- package/.docs/docs/editor/overview.md +201 -206
- package/.docs/docs/evals/evals-with-memory.md +1 -1
- package/.docs/docs/getting-started/develop.md +196 -0
- package/.docs/docs/index.md +78 -1
- package/.docs/docs/mastra-platform/workspaces.md +13 -13
- package/.docs/docs/memory/observational-memory.md +23 -0
- package/.docs/docs/studio/observability.md +4 -0
- package/.docs/docs/studio/overview.md +2 -2
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/guides/getting-started/quickstart.md +3 -3
- package/.docs/{docs → guides}/rag/chunking-and-embedding.md +1 -1
- package/.docs/{docs → guides}/rag/graph-rag.md +1 -1
- package/.docs/{docs → guides}/rag/overview.md +2 -2
- package/.docs/{docs → guides}/rag/retrieval.md +1 -1
- package/.docs/{docs → guides}/voice/overview.md +4 -4
- package/.docs/{docs → guides}/voice/realtime-voice.md +2 -2
- package/.docs/{docs → guides}/voice/speech-to-speech.md +1 -1
- package/.docs/{docs → guides}/voice/speech-to-text.md +1 -1
- package/.docs/{docs → guides}/voice/text-to-speech.md +2 -2
- package/.docs/models/embeddings.md +63 -65
- package/.docs/models/environment-variables.md +5 -1
- package/.docs/models/gateways/netlify.md +1 -2
- package/.docs/models/gateways/openrouter.md +5 -3
- package/.docs/models/gateways/vercel.md +8 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +3 -1
- package/.docs/models/providers/alibaba-token-plan-cn.md +27 -25
- package/.docs/models/providers/alibaba-token-plan.md +27 -25
- package/.docs/models/providers/alibaba.md +2 -1
- package/.docs/models/providers/ambient.md +13 -12
- package/.docs/models/providers/baseten.md +3 -1
- package/.docs/models/providers/chutes.md +6 -8
- package/.docs/models/providers/crof.md +2 -1
- package/.docs/models/providers/crossmodel.md +7 -3
- package/.docs/models/providers/deepinfra.md +9 -2
- package/.docs/models/providers/digitalocean.md +34 -27
- package/.docs/models/providers/empiriolabs.md +4 -1
- package/.docs/models/providers/fireworks-ai.md +20 -19
- package/.docs/models/providers/greenpt.md +17 -8
- package/.docs/models/providers/groq.md +20 -20
- package/.docs/models/providers/huggingface.md +3 -1
- package/.docs/models/providers/hyper.md +9 -7
- package/.docs/models/providers/impossibl.md +148 -0
- package/.docs/models/providers/infomaniak.md +83 -0
- package/.docs/models/providers/kilo.md +349 -350
- package/.docs/models/providers/llmgateway.md +6 -3
- package/.docs/models/providers/mistral.md +5 -2
- package/.docs/models/providers/modal.md +5 -4
- package/.docs/models/providers/modelis.md +81 -0
- package/.docs/models/providers/nano-gpt.md +146 -148
- package/.docs/models/providers/neuralwatt.md +2 -1
- package/.docs/models/providers/ofox.md +2 -2
- package/.docs/models/providers/ollama-cloud.md +23 -22
- package/.docs/models/providers/opencode-go.md +3 -2
- package/.docs/models/providers/requesty.md +54 -45
- package/.docs/models/providers/scx.md +74 -0
- package/.docs/models/providers/tensorx.md +97 -0
- package/.docs/models/providers/togetherai.md +2 -1
- package/.docs/models/providers/umans-ai-coding-plan.md +11 -9
- package/.docs/models/providers/umans-ai.md +11 -9
- package/.docs/models/providers/wandb.md +2 -2
- package/.docs/models/providers/zai-coding-plan.md +11 -13
- package/.docs/models/providers/zhipuai-coding-plan.md +12 -12
- package/.docs/models/providers.md +5 -1
- package/.docs/reference/agents/agent.md +1 -1
- package/.docs/reference/agents/generate.md +1 -1
- package/.docs/reference/agents/getVoice.md +1 -1
- package/.docs/{docs/getting-started → reference}/build-with-ai.md +5 -110
- package/.docs/reference/cli/create-mastra.md +2 -0
- package/.docs/reference/cli/mastra.md +66 -1
- package/.docs/reference/client-js/agents.md +1 -1
- package/.docs/reference/configuration.md +2 -2
- package/.docs/reference/core/getEditor.md +1 -1
- package/.docs/reference/core/getVector.md +2 -2
- package/.docs/reference/core/listVectors.md +2 -2
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/datasets/startExperiment.md +6 -0
- package/.docs/reference/datasets/startExperimentAsync.md +4 -0
- package/.docs/reference/editor/browser-provider.md +2 -2
- package/.docs/reference/editor/filesystem-provider.md +1 -1
- package/.docs/reference/editor/mastra-editor.md +31 -18
- package/.docs/reference/editor/prompt-blocks.md +137 -0
- package/.docs/reference/editor/sandbox-provider.md +1 -1
- package/.docs/reference/editor/storage-browser-ref.md +3 -3
- package/.docs/reference/editor/storage-workspace-ref.md +3 -3
- package/.docs/reference/editor/tool-provider.md +44 -10
- package/.docs/reference/editor/tools.md +100 -0
- package/.docs/reference/editor/versioning.md +130 -0
- package/.docs/reference/evals/mastra-scorer.md +68 -8
- package/.docs/reference/file-based-agents/config.md +39 -1
- package/.docs/reference/index.md +3 -4
- package/.docs/reference/memory/observational-memory.md +3 -1
- package/.docs/reference/memory/serialized-memory-config.md +3 -3
- package/.docs/reference/observability/tracing/interfaces.md +3 -1
- package/.docs/reference/processors/token-limiter-processor.md +15 -1
- package/.docs/reference/project-structure.md +1 -1
- package/.docs/reference/rag/database-config.md +1 -1
- package/.docs/reference/storage/composite.md +2 -0
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/voice/livekit.md +3 -3
- package/.docs/reference/workspace/platform-filesystem.md +3 -3
- package/.docs/reference/workspace/platform-sandbox.md +5 -5
- package/CHANGELOG.md +30 -0
- package/README.md +1 -1
- package/package.json +6 -6
- package/.docs/docs/agent-builder/access-control.md +0 -99
- package/.docs/docs/agent-builder/browser.md +0 -63
- package/.docs/docs/agent-builder/channels.md +0 -78
- package/.docs/docs/agent-builder/configuration.md +0 -132
- package/.docs/docs/agent-builder/deploying.md +0 -124
- package/.docs/docs/agent-builder/integrations.md +0 -115
- package/.docs/docs/agent-builder/memory.md +0 -69
- package/.docs/docs/agent-builder/model-policy.md +0 -50
- package/.docs/docs/agent-builder/overview.md +0 -114
- package/.docs/docs/agent-builder/skill-registries.md +0 -31
- package/.docs/docs/agent-builder/workspace.md +0 -62
- package/.docs/docs/editor/prompts.md +0 -140
- package/.docs/docs/editor/tools.md +0 -148
- package/.docs/docs/getting-started/file-based-agents.md +0 -121
- package/.docs/docs/what-is-mastra.md +0 -161
- package/.docs/reference/client-js/agent-builder.md +0 -163
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +0 -76
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +0 -79
- package/.docs/reference/editor/agent-builder/builder-models.md +0 -66
- /package/.docs/{docs → guides}/getting-started/manual-install.md +0 -0
- /package/.docs/{docs → guides}/rag/vector-databases.md +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Develop
|
|
4
|
+
|
|
5
|
+
Once you have a Mastra project, you're ready to develop, run, and test your agent.
|
|
6
|
+
|
|
7
|
+
## Run Mastra locally
|
|
8
|
+
|
|
9
|
+
The fastest way to see your agent working is in [Mastra Studio](https://mastra.ai/docs/studio/overview). From your project root, start Studio and the local development server with [`mastra dev`](https://mastra.ai/reference/cli/mastra):
|
|
10
|
+
|
|
11
|
+
**npm**:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx mastra dev
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**pnpm**:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm dlx mastra dev
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Yarn**:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn dlx mastra dev
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Bun**:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bun x mastra dev
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Open Studio at [`http://localhost:4111`](http://localhost:4111) to test your agent and inspect its runs.
|
|
36
|
+
|
|
37
|
+
The development server also exposes APIs for your agents, tools, and workflows. Open [`http://localhost:4111/api`](http://localhost:4111/api) to browse what's available, then connect your frontend using the [Mastra Client](https://mastra.ai/docs/server/mastra-client).
|
|
38
|
+
|
|
39
|
+
Changes in your `src/mastra/` directory automatically restart the development server, so you don't need to restart it manually as you build.
|
|
40
|
+
|
|
41
|
+
## Build with AI
|
|
42
|
+
|
|
43
|
+
Mastra provides a skill and a CLI to help your coding agent write high-quality Mastra code.
|
|
44
|
+
|
|
45
|
+
### Mastra skill
|
|
46
|
+
|
|
47
|
+
AI models may not have up-to-date knowledge of Mastra's APIs. Use the [Mastra skill](https://github.com/mastra-ai/skills) to give your coding agent implementation guidance, best practices, and instructions for fetching the latest Mastra documentation.
|
|
48
|
+
|
|
49
|
+
Install the skill manually with:
|
|
50
|
+
|
|
51
|
+
**npm**:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx skills add mastra-ai/skills
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**pnpm**:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pnpm dlx skills add mastra-ai/skills
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Yarn**:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
yarn dlx skills add mastra-ai/skills
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Bun**:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
bun x skills add mastra-ai/skills
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Periodically update the skill to get the latest guidance:
|
|
76
|
+
|
|
77
|
+
**npm**:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npx skills update mastra
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**pnpm**:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pnpm dlx skills update mastra
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Yarn**:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
yarn dlx skills update mastra
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Bun**:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
bun x skills update mastra
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
> **Note:** When you create a project with [create mastra](https://mastra.ai/docs), the command automatically installs the Mastra skill so your coding agent can discover and use it.
|
|
102
|
+
|
|
103
|
+
### Mastra CLI
|
|
104
|
+
|
|
105
|
+
Use the [`mastra` CLI](https://mastra.ai/reference/cli/mastra) to give your coding agent a feedback loop for testing updates and inspecting results. The CLI gives it access to agents, workflows, tools, memory, evals, traces, and logs.
|
|
106
|
+
|
|
107
|
+
For example, your coding agent can run an agent, then pull traces to inspect the results:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx mastra api --url http://localhost:4111 agent run agent '{"messages":"Hello"}'
|
|
111
|
+
npx mastra api --url http://localhost:4111 trace list
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Remember to install the [Mastra skill](#mastra-skill) to teach your coding agent how to use the CLI.
|
|
115
|
+
|
|
116
|
+
## Project structure
|
|
117
|
+
|
|
118
|
+
One of the first decisions when adopting a framework is how to structure the project. We recommend keeping framework code under `src/mastra/`, with related primitives grouped into their own files or folders. Use `src/mastra/index.ts` as the central place to configure and register them.
|
|
119
|
+
|
|
120
|
+
A minimal project can look like this:
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
src/
|
|
124
|
+
mastra/
|
|
125
|
+
agents/
|
|
126
|
+
agent.ts
|
|
127
|
+
tools/
|
|
128
|
+
tool.ts
|
|
129
|
+
workflows/
|
|
130
|
+
workflow.ts
|
|
131
|
+
scorers/
|
|
132
|
+
scorer.ts
|
|
133
|
+
skills.ts
|
|
134
|
+
index.ts
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
See the [project structure reference](https://mastra.ai/reference/project-structure) for the default layout and recommended conventions.
|
|
138
|
+
|
|
139
|
+
## File-based agents
|
|
140
|
+
|
|
141
|
+
> **Beta:** File-based agents are in beta and may change before they're stable.
|
|
142
|
+
|
|
143
|
+
> **📹 Watch:** [How to create your first file-based agent](https://www.youtube.com/watch?v=5Kfn-oYkJNg\&t=18s)
|
|
144
|
+
|
|
145
|
+
With file-based agents, Mastra automatically [discovers](https://mastra.ai/reference/file-based-agents/config) agents and related primitives from supported files under `src/mastra/`. You organize those files by convention instead of importing and registering each primitive on your [`Mastra`](https://mastra.ai/reference/core/mastra-class) instance.
|
|
146
|
+
|
|
147
|
+
The file system becomes a direct representation of your project structure, so you and your coding agent can understand how the project fits together without tracing how everything is wired together in code.
|
|
148
|
+
|
|
149
|
+
You can use file-based agents throughout your project or adopt them incrementally alongside primitives defined in code. Not every Mastra feature or use case is supported yet.
|
|
150
|
+
|
|
151
|
+
### Create your first agent
|
|
152
|
+
|
|
153
|
+
A file-based agent lives in its own directory under `src/mastra/agents/`. To create a working agent, add a `config.ts` file for its model and runtime options and an `instructions.md` file for its always-on prompt:
|
|
154
|
+
|
|
155
|
+
```text
|
|
156
|
+
src/mastra/agents/
|
|
157
|
+
writing-assistant/
|
|
158
|
+
config.ts
|
|
159
|
+
instructions.md
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The directory name becomes the agent's default `id` and `name`. In this example, Mastra registers the agent as `writing-assistant`.
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
import { agentConfig } from '@mastra/core/agent'
|
|
166
|
+
|
|
167
|
+
export default agentConfig({
|
|
168
|
+
model: 'openai/gpt-5.6-sol',
|
|
169
|
+
})
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```markdown
|
|
173
|
+
Rewrite text clearly and concisely.
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Run `npx mastra dev`, open Studio, and select `writing-assistant` to test it.
|
|
177
|
+
|
|
178
|
+
### How discovery works
|
|
179
|
+
|
|
180
|
+
Mastra uses paths to discover and name file-based capabilities. An agent directory supplies the default agent `id` and `name`. For example, `tools/search_docs.ts` registers a tool as `search_docs`, while `skills/style-guide.md` registers a skill as `style-guide`. See the extension paths below.
|
|
181
|
+
|
|
182
|
+
### Extend your agent
|
|
183
|
+
|
|
184
|
+
Add files or directories when your agent needs more functionality:
|
|
185
|
+
|
|
186
|
+
| Path | What it adds |
|
|
187
|
+
| ------------------------------------------------------------------------------------------ | ------------------------------------------------- |
|
|
188
|
+
| [`tools/<tool-name>.ts`](https://mastra.ai/reference/file-based-agents/tools) | Functions the model can call |
|
|
189
|
+
| [`skills/<skill-name>.md`](https://mastra.ai/reference/file-based-agents/skills) | Detailed guidance the agent loads when relevant |
|
|
190
|
+
| [`memory.ts`](https://mastra.ai/reference/file-based-agents/memory) | Conversation history and working context |
|
|
191
|
+
| [`workspace.ts` and `workspace/`](https://mastra.ai/reference/file-based-agents/workspace) | Filesystem and shell access |
|
|
192
|
+
| [`subagents/<agent-id>/`](https://mastra.ai/reference/file-based-agents/subagents) | Specialist agents that the parent can delegate to |
|
|
193
|
+
|
|
194
|
+
Keep each capability next to the agent that uses it. Mastra discovers and registers these files when the development server starts or restarts.
|
|
195
|
+
|
|
196
|
+
Browse the [file-based agents reference](https://mastra.ai/reference/file-based-agents/config) for all supported file conventions and configuration options.
|
package/.docs/docs/index.md
CHANGED
|
@@ -166,4 +166,81 @@ For other frameworks, see the [framework integration guides](https://mastra.ai/g
|
|
|
166
166
|
|
|
167
167
|
Browse [templates](https://mastra.ai/templates) for complete Mastra projects you can clone and adapt.
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
## Use cases
|
|
170
|
+
|
|
171
|
+
<details>
|
|
172
|
+
**Embed agents in your product**
|
|
173
|
+
|
|
174
|
+
Add AI capabilities to your platform so your users can build or interact with agents.
|
|
175
|
+
|
|
176
|
+
Used by [Replit](https://mastra.ai/blog/replitagent3), [Fireworks](https://mastra.ai/blog/fireworks-xml-prompting), [Medusa](https://mastra.ai/blog/medusa-ecommerce)
|
|
177
|
+
|
|
178
|
+
</details>
|
|
179
|
+
|
|
180
|
+
<details>
|
|
181
|
+
**Customer-facing assistants**
|
|
182
|
+
|
|
183
|
+
Build agents that handle inquiries, schedule appointments, send reminders, and answer questions via chat, WhatsApp, or voice.
|
|
184
|
+
|
|
185
|
+
Used by [Vetnio](https://mastra.ai/blog/vetnio), [Lua](https://mastra.ai/blog/lua-scaling)
|
|
186
|
+
|
|
187
|
+
Templates: [Docs Chatbot](https://mastra.ai/templates/docs-chatbot), [Slack Agent](https://mastra.ai/templates/slack-agent)
|
|
188
|
+
|
|
189
|
+
</details>
|
|
190
|
+
|
|
191
|
+
<details>
|
|
192
|
+
**Internal copilots**
|
|
193
|
+
|
|
194
|
+
Help employees work faster with AI that understands your domain, such as HR queries, clinical documentation, sales prep, or document generation.
|
|
195
|
+
|
|
196
|
+
Used by [Factorial](https://mastra.ai/blog/factorial-case-study), [Counsel Health](https://mastra.ai/blog/counsel-health), [Cedar](https://mastra.ai/blog/cedar-case-study), [SoftBank](https://mastra.ai/blog/softbank-productivity-mastra-2025-08-20)
|
|
197
|
+
|
|
198
|
+
Templates: [Chat with PDF](https://mastra.ai/templates/chat-with-pdf), [Google Sheet Analysis](https://mastra.ai/templates/google-sheets-analysis)
|
|
199
|
+
|
|
200
|
+
</details>
|
|
201
|
+
|
|
202
|
+
<details>
|
|
203
|
+
**Data analysis agents**
|
|
204
|
+
|
|
205
|
+
Let users query databases and dashboards in natural language. Connect to your data sources and return answers, charts, or reports.
|
|
206
|
+
|
|
207
|
+
Used by [Index](https://mastra.ai/blog/index-case-study), [PLAID Japan](https://mastra.ai/blog/plaid-jpn-gcp-agents)
|
|
208
|
+
|
|
209
|
+
Templates: [Chat with Database](https://mastra.ai/templates/text-to-sql), [CSV to Questions](https://mastra.ai/templates/csv-to-questions)
|
|
210
|
+
|
|
211
|
+
</details>
|
|
212
|
+
|
|
213
|
+
<details>
|
|
214
|
+
**Content automation**
|
|
215
|
+
|
|
216
|
+
Generate, transform, and manage structured content at scale for a content management system, knowledge base, or documentation system.
|
|
217
|
+
|
|
218
|
+
Used by [Sanity](https://mastra.ai/blog/sanity)
|
|
219
|
+
|
|
220
|
+
Templates: [Chat with YouTube](https://mastra.ai/templates/chat-with-youtube), [Flash Cards from PDF](https://mastra.ai/templates/flash-cards-from-pdf)
|
|
221
|
+
|
|
222
|
+
</details>
|
|
223
|
+
|
|
224
|
+
<details>
|
|
225
|
+
**DevOps and engineering automation**
|
|
226
|
+
|
|
227
|
+
Automate deployments, debug production issues, manage infrastructure, and handle on-call workflows.
|
|
228
|
+
|
|
229
|
+
Used by [StarSling](https://mastra.ai/blog/starsling)
|
|
230
|
+
|
|
231
|
+
Templates: [GitHub PR Code Review](https://mastra.ai/templates/github-pr-code-review-agent), [Browser Agent](https://mastra.ai/templates/browsing-agent)
|
|
232
|
+
|
|
233
|
+
</details>
|
|
234
|
+
|
|
235
|
+
<details>
|
|
236
|
+
**Sales and go-to-market workflows**
|
|
237
|
+
|
|
238
|
+
Turn customer conversations into structured tasks, generate investment memos, or automate outreach sequences.
|
|
239
|
+
|
|
240
|
+
Used by [Kestral](https://mastra.ai/blog/kestral), [Orange Collective](https://mastra.ai/blog/orange-collective-vc-operating-system), [WorkOS](https://mastra.ai/blog/workos-teaching-mastra)
|
|
241
|
+
|
|
242
|
+
Templates: [Customer Feedback Summarization](https://mastra.ai/templates/customer-feedback-summarization)
|
|
243
|
+
|
|
244
|
+
</details>
|
|
245
|
+
|
|
246
|
+
> **Video:** [A quick tour of the Mastra platform](https://www.youtube.com/watch?v=NosES9aJxCc) shows how the pieces fit together.
|
|
@@ -9,7 +9,7 @@ Every workspace exposes two capabilities:
|
|
|
9
9
|
- One **bucket** for filesystem storage, wrapped by [`PlatformFilesystem`](https://mastra.ai/reference/workspace/platform-filesystem). The bucket is a durable, environment-scoped store agents read from and write to across runs.
|
|
10
10
|
- A pool of **on-demand sandboxes** for command execution, wrapped by [`PlatformSandbox`](https://mastra.ai/reference/workspace/platform-sandbox). Each `PlatformSandbox` instance provisions its own remote sandbox on `start()` and destroys it on `destroy()`. Agents typically spin up many sandboxes per session, use them for a task, and let them go.
|
|
11
11
|
|
|
12
|
-
Workspaces are scoped to a single [environment](https://mastra.ai/docs/mastra-platform/environments), so `production` and `staging` don't share buckets or sandbox pools. The platform manages provisioning,
|
|
12
|
+
Workspaces are scoped to a single [environment](https://mastra.ai/docs/mastra-platform/environments), so `production` and `staging` don't share buckets or sandbox pools. The platform manages provisioning, authentication, and idle cleanup.
|
|
13
13
|
|
|
14
14
|
## When workspaces are provisioned
|
|
15
15
|
|
|
@@ -68,11 +68,11 @@ export const mastra = new Mastra({
|
|
|
68
68
|
})
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
`PlatformFilesystem` and `PlatformSandbox` read their
|
|
71
|
+
`PlatformFilesystem` and `PlatformSandbox` read their configuration from environment variables, so you don't pass any options on the platform. The platform injects them at deploy time. See [Environment variables](#environment-variables).
|
|
72
72
|
|
|
73
73
|
## One bucket, many sandboxes
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
`PlatformFilesystem` and `PlatformSandbox` have different lifecycles, which matters when you design agents.
|
|
76
76
|
|
|
77
77
|
**`PlatformFilesystem` is a long-lived handle to the environment's bucket.** All requests, all agents, and all sandboxes in the environment read and write the same object storage. Anything an agent writes is visible on the next request unless you explicitly delete it.
|
|
78
78
|
|
|
@@ -109,25 +109,25 @@ await perProjectSandbox.start()
|
|
|
109
109
|
|
|
110
110
|
See [`PlatformSandbox` reference](https://mastra.ai/reference/workspace/platform-sandbox) for the full lifecycle, checkpoint recovery, reattachment, and clone options.
|
|
111
111
|
|
|
112
|
-
##
|
|
112
|
+
## Environment variables
|
|
113
113
|
|
|
114
|
-
Every deploy that runs on a platform environment with a workspace receives these variables:
|
|
114
|
+
Every deploy that runs on a platform environment with a workspace receives these variables automatically:
|
|
115
115
|
|
|
116
|
-
| Variable
|
|
117
|
-
|
|
|
118
|
-
| `
|
|
119
|
-
| `MASTRA_PROJECT_ID`
|
|
120
|
-
| `MASTRA_ENVIRONMENT_ID`
|
|
121
|
-
| `MASTRA_PLATFORM_BUCKET_NAME`
|
|
116
|
+
| Variable | Contents |
|
|
117
|
+
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
118
|
+
| `MASTRA_PLATFORM_ACCESS_TOKEN` | Platform-issued JSON Web Token (JWT) the workspace providers use to authenticate. The token is scoped to the deploy's organization and project. |
|
|
119
|
+
| `MASTRA_PROJECT_ID` | Project the deploy belongs to. |
|
|
120
|
+
| `MASTRA_ENVIRONMENT_ID` | Environment the deploy belongs to. Selects which sandbox pool the platform uses. |
|
|
121
|
+
| `MASTRA_PLATFORM_BUCKET_NAME` | Bucket name attached to the environment. Selects which bucket `PlatformFilesystem` reads and writes. |
|
|
122
122
|
|
|
123
123
|
These names are reserved. If your project sets any of them explicitly, the platform-managed values take precedence.
|
|
124
124
|
|
|
125
125
|
## Local development
|
|
126
126
|
|
|
127
|
-
Reuse the same providers locally by putting the four variables in your `.env` file. Get the values from your project's Workspaces tab
|
|
127
|
+
Reuse the same providers locally by putting the four variables in your `.env` file. Get the project, environment, and bucket values from your project's **Workspaces** tab. For `MASTRA_PLATFORM_ACCESS_TOKEN`, create an `sk_` API token on your organization's settings page under **API Tokens**. Platform deploys use an injected JWT instead.
|
|
128
128
|
|
|
129
129
|
```bash
|
|
130
|
-
|
|
130
|
+
MASTRA_PLATFORM_ACCESS_TOKEN=sk_your-api-token
|
|
131
131
|
MASTRA_PROJECT_ID=your-project-id
|
|
132
132
|
MASTRA_ENVIRONMENT_ID=your-environment-id
|
|
133
133
|
MASTRA_PLATFORM_BUCKET_NAME=your-bucket-name
|
|
@@ -476,6 +476,29 @@ const memory = new Memory({
|
|
|
476
476
|
})
|
|
477
477
|
```
|
|
478
478
|
|
|
479
|
+
#### Custom recall guidance
|
|
480
|
+
|
|
481
|
+
Mastra injects scope-aware instructions that teach the agent when to search, list threads, or read a specific thread. Use `instructions` to append application-specific guidance after those built-in instructions. The built-in instructions are never replaced:
|
|
482
|
+
|
|
483
|
+
```typescript
|
|
484
|
+
const memory = new Memory({
|
|
485
|
+
options: {
|
|
486
|
+
observationalMemory: {
|
|
487
|
+
model: 'google/gemini-2.5-flash',
|
|
488
|
+
retrieval: {
|
|
489
|
+
vector: true,
|
|
490
|
+
instructions: `
|
|
491
|
+
Prefer the current conversation when it already contains the answer.
|
|
492
|
+
For an initial scan, use a small limit with detail="low".
|
|
493
|
+
`,
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
})
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
This keeps recall-specific guidance attached to the recall tool instead of the agent's global instructions, so it doesn't affect unrelated tasks.
|
|
501
|
+
|
|
479
502
|
#### What retrieval enables
|
|
480
503
|
|
|
481
504
|
With retrieval mode enabled, OM:
|
|
@@ -96,6 +96,10 @@ Visit the [metrics overview](https://mastra.ai/docs/observability/metrics/overvi
|
|
|
96
96
|
|
|
97
97
|
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.
|
|
98
98
|
|
|
99
|
+
Above the trace list, open **Columns** to show or hide input, entity, duration, input token, output token, estimated cost, and custom metadata columns. To display custom metadata, add the top-level key used in `tracingOptions.metadata`. Studio saves the selection in browser storage for the current Mastra server and API prefix.
|
|
100
|
+
|
|
101
|
+
Token and estimated cost columns require an observability store that supports metrics. These columns stay hidden in the **Branches** view because several branch rows can belong to the same trace.
|
|
102
|
+
|
|
99
103
|
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.
|
|
100
104
|
|
|
101
105
|
To export a trace, select **Download trace JSON** in the trace panel header. This saves the entire trace as a `trace-<id>.json` file, with every span and its full input, output, metadata, and attributes. Use it to share a trace or attach it to a bug report, or alternatively build an evaluation dataset offline.
|
|
@@ -103,13 +103,13 @@ The Scorers tab displays the results of your agent's scorers as they run. When m
|
|
|
103
103
|
|
|
104
104
|
Create and manage collections of test cases to evaluate your agents and workflows. Import items from CSV or JSON and define input and ground-truth schemas, plus 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.
|
|
105
105
|
|
|
106
|
-
See [datasets overview](https://mastra.ai/docs/
|
|
106
|
+
See [datasets overview](https://mastra.ai/docs/datasets/overview) for the full API and versioning details.
|
|
107
107
|
|
|
108
108
|
### Experiments
|
|
109
109
|
|
|
110
110
|
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.
|
|
111
111
|
|
|
112
|
-
See [datasets overview](https://mastra.ai/docs/
|
|
112
|
+
See [datasets overview](https://mastra.ai/docs/datasets/overview) for setup details.
|
|
113
113
|
|
|
114
114
|
## Observability
|
|
115
115
|
|
|
@@ -280,5 +280,5 @@ When you configure search on a workspace, agents receive tools for searching and
|
|
|
280
280
|
## Related
|
|
281
281
|
|
|
282
282
|
- [Workspace overview](https://mastra.ai/docs/workspace/overview)
|
|
283
|
-
- [RAG overview](https://mastra.ai/
|
|
283
|
+
- [RAG overview](https://mastra.ai/guides/rag/overview)
|
|
284
284
|
- [Workspace class reference](https://mastra.ai/reference/workspace/workspace-class)
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
# Mastra Quickstart
|
|
4
4
|
|
|
5
|
-
**For AI agents:** Create a new Mastra project non-interactively with `npm create mastra@latest <project-name> -- --llm <provider>`, replacing `<provider>` with `openai`, `anthropic`, `google`, or `xai`. For a minimal project without an agent or model provider, use `npm create mastra@latest <project-name> -- --empty`. To build a Mastra project from scratch, see the [manual installation guide](https://mastra.ai/
|
|
5
|
+
**For AI agents:** Create a new Mastra project non-interactively with `npm create mastra@latest <project-name> -- --llm <provider>`, replacing `<provider>` with `openai`, `anthropic`, `google`, or `xai`. For a minimal project without an agent or model provider, use `npm create mastra@latest <project-name> -- --empty`. To build a Mastra project from scratch, see the [manual installation guide](https://mastra.ai/guides/getting-started/manual-install).
|
|
6
6
|
|
|
7
7
|
The `create-mastra` CLI is the quickest way to start a Mastra project. It creates an agent harness with workspace tools, memory, task tracking, web access, schedules, storage, and observability.
|
|
8
8
|
|
|
9
|
-
For more control, see the [manual installation guide](https://mastra.ai/
|
|
9
|
+
For more control, see the [manual installation guide](https://mastra.ai/guides/getting-started/manual-install). To add Mastra to an existing project, use [`mastra init`](https://mastra.ai/reference/cli/mastra).
|
|
10
10
|
|
|
11
11
|
> **📹 Watch:** Watch the [Mastra AI agent course](https://www.youtube.com/watch?v=lCmf_qrGfGA) for a guided introduction to building agents with Mastra.
|
|
12
12
|
|
|
@@ -83,6 +83,6 @@ Open [Studio at localhost:4111](http://localhost:4111), select the agent, and se
|
|
|
83
83
|
## Next steps
|
|
84
84
|
|
|
85
85
|
- Integrate Mastra with [Next.js](https://mastra.ai/guides/getting-started/next-js), [React](https://mastra.ai/guides/getting-started/vite-react), or [Astro](https://mastra.ai/guides/getting-started/astro)
|
|
86
|
-
- Learn how to [build Mastra with AI](https://mastra.ai/
|
|
86
|
+
- Learn how to [build Mastra with AI](https://mastra.ai/reference/build-with-ai)
|
|
87
87
|
- Build an agent from scratch with a [guide](https://mastra.ai/guides)
|
|
88
88
|
- Watch the [Mastra YouTube channel](https://www.youtube.com/@mastra-ai)
|
|
@@ -181,5 +181,5 @@ For more examples of different chunking strategies and embedding configurations,
|
|
|
181
181
|
|
|
182
182
|
For more details on vector databases and embeddings, see:
|
|
183
183
|
|
|
184
|
-
- [Vector Databases](https://mastra.ai/
|
|
184
|
+
- [Vector Databases](https://mastra.ai/guides/rag/vector-databases)
|
|
185
185
|
- [Embedding API Reference](https://mastra.ai/reference/rag/embeddings)
|
|
@@ -14,7 +14,7 @@ GraphRAG is particularly effective when:
|
|
|
14
14
|
- Understanding connections between concepts is important
|
|
15
15
|
- Simple vector similarity misses important contextual relationships
|
|
16
16
|
|
|
17
|
-
For straightforward semantic search without relationship traversal, use [standard retrieval methods](https://mastra.ai/
|
|
17
|
+
For straightforward semantic search without relationship traversal, use [standard retrieval methods](https://mastra.ai/guides/rag/retrieval).
|
|
18
18
|
|
|
19
19
|
## How GraphRAG works
|
|
20
20
|
|
|
@@ -63,11 +63,11 @@ This example shows the essentials. Initialize a document and create chunks, then
|
|
|
63
63
|
|
|
64
64
|
## Document processing
|
|
65
65
|
|
|
66
|
-
The basic building block of RAG is document processing. Documents can be chunked using strategies (recursive, sliding window, etc.) and enriched with metadata. See the [chunking and embedding doc](https://mastra.ai/
|
|
66
|
+
The basic building block of RAG is document processing. Documents can be chunked using strategies (recursive, sliding window, etc.) and enriched with metadata. See the [chunking and embedding doc](https://mastra.ai/guides/rag/chunking-and-embedding).
|
|
67
67
|
|
|
68
68
|
## Vector storage
|
|
69
69
|
|
|
70
|
-
Mastra supports multiple vector stores for embedding persistence and similarity search, including pgvector, Pinecone, Qdrant, and MongoDB. See the [vector database doc](https://mastra.ai/
|
|
70
|
+
Mastra supports multiple vector stores for embedding persistence and similarity search, including pgvector, Pinecone, Qdrant, and MongoDB. See the [vector database doc](https://mastra.ai/guides/rag/vector-databases).
|
|
71
71
|
|
|
72
72
|
## More resources
|
|
73
73
|
|
|
@@ -517,4 +517,4 @@ The re-ranked results combine vector similarity with semantic understanding to i
|
|
|
517
517
|
|
|
518
518
|
For more details about re-ranking, see the [rerank()](https://mastra.ai/reference/rag/rerankWithScorer) method.
|
|
519
519
|
|
|
520
|
-
For graph-based retrieval that follows connections between chunks, see the [GraphRAG](https://mastra.ai/
|
|
520
|
+
For graph-based retrieval that follows connections between chunks, see the [GraphRAG](https://mastra.ai/guides/rag/graph-rag) documentation.
|
|
@@ -29,7 +29,7 @@ You can then use the following voice capabilities:
|
|
|
29
29
|
|
|
30
30
|
Turn your agent's responses into natural-sounding speech using Mastra's TTS capabilities. Choose from multiple providers like OpenAI, ElevenLabs, and more.
|
|
31
31
|
|
|
32
|
-
For detailed configuration options and advanced features, check out our [Text-to-Speech guide](https://mastra.ai/
|
|
32
|
+
For detailed configuration options and advanced features, check out our [Text-to-Speech guide](https://mastra.ai/guides/voice/text-to-speech).
|
|
33
33
|
|
|
34
34
|
**OpenAI**:
|
|
35
35
|
|
|
@@ -331,7 +331,7 @@ Visit the [Murf Voice Reference](https://mastra.ai/reference/voice/murf) for mor
|
|
|
331
331
|
|
|
332
332
|
### Speech to Text (STT)
|
|
333
333
|
|
|
334
|
-
Transcribe spoken content using providers like OpenAI, ElevenLabs, and more. For detailed configuration options and more, check out [Speech to Text](https://mastra.ai/
|
|
334
|
+
Transcribe spoken content using providers like OpenAI, ElevenLabs, and more. For detailed configuration options and more, check out [Speech to Text](https://mastra.ai/guides/voice/speech-to-text).
|
|
335
335
|
|
|
336
336
|
You can download a sample audio file from [here](https://github.com/mastra-ai/realtime-voice-demo/raw/refs/heads/main/how_can_i_help_you.mp3).
|
|
337
337
|
|
|
@@ -564,7 +564,7 @@ Visit the [Sarvam Voice Reference](https://mastra.ai/reference/voice/sarvam) for
|
|
|
564
564
|
|
|
565
565
|
### Speech to Speech (STS)
|
|
566
566
|
|
|
567
|
-
Create conversational experiences with speech-to-speech capabilities. The unified API enables real-time voice interactions between users and AI agents. For detailed configuration options and advanced features, check out [Speech to Speech](https://mastra.ai/
|
|
567
|
+
Create conversational experiences with speech-to-speech capabilities. The unified API enables real-time voice interactions between users and AI agents. For detailed configuration options and advanced features, check out [Speech to Speech](https://mastra.ai/guides/voice/speech-to-speech).
|
|
568
568
|
|
|
569
569
|
**OpenAI**:
|
|
570
570
|
|
|
@@ -775,7 +775,7 @@ Visit the [xAI Realtime Voice Reference](https://mastra.ai/reference/voice/xai-r
|
|
|
775
775
|
|
|
776
776
|
### Realtime voice
|
|
777
777
|
|
|
778
|
-
Run live calls a user can talk over, in the browser or over the phone. Mastra hands the audio loop to LiveKit, which covers voice activity detection, semantic turn detection, and barge-in, while your agent generates each reply with its own model, tools, and memory. For setup and configuration options, check out [Realtime voice](https://mastra.ai/
|
|
778
|
+
Run live calls a user can talk over, in the browser or over the phone. Mastra hands the audio loop to LiveKit, which covers voice activity detection, semantic turn detection, and barge-in, while your agent generates each reply with its own model, tools, and memory. For setup and configuration options, check out [Realtime voice](https://mastra.ai/guides/voice/realtime-voice).
|
|
779
779
|
|
|
780
780
|
## Voice configuration
|
|
781
781
|
|
|
@@ -6,7 +6,7 @@ Realtime voice turns a Mastra agent into a live call a user can talk over, in th
|
|
|
6
6
|
|
|
7
7
|
The [`@mastra/livekit`](https://mastra.ai/reference/voice/livekit) package connects Mastra agents to the [LiveKit Agents framework](https://docs.livekit.io/agents/): LiveKit owns the audio loop like voice activity detection, streaming speech-to-text, semantic turn detection, barge-in, and text-to-speech. Your Mastra agent generates every reply with its own model, tools, and memory.
|
|
8
8
|
|
|
9
|
-
Use realtime voice when you need low-latency, interruptible voice conversations. For provider-based speech-to-speech without LiveKit, see [Speech to Speech](https://mastra.ai/
|
|
9
|
+
Use realtime voice when you need low-latency, interruptible voice conversations. For provider-based speech-to-speech without LiveKit, see [Speech to Speech](https://mastra.ai/guides/voice/speech-to-speech).
|
|
10
10
|
|
|
11
11
|
## Quickstart
|
|
12
12
|
|
|
@@ -399,6 +399,6 @@ Conversation history lives in Mastra Memory, so voice sessions and text chat can
|
|
|
399
399
|
## Related
|
|
400
400
|
|
|
401
401
|
- [`@mastra/livekit` reference](https://mastra.ai/reference/voice/livekit)
|
|
402
|
-
- [Speech to Speech](https://mastra.ai/
|
|
402
|
+
- [Speech to Speech](https://mastra.ai/guides/voice/speech-to-speech)
|
|
403
403
|
- [Agent Memory](https://mastra.ai/docs/memory/overview)
|
|
404
404
|
- [LiveKit Agents docs](https://docs.livekit.io/agents/)
|
|
@@ -54,7 +54,7 @@ const micStream = getMicrophoneStream()
|
|
|
54
54
|
await agent.voice.send(micStream)
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
For a broader overview of voice providers on agents, see [Voice in Mastra](https://mastra.ai/
|
|
57
|
+
For a broader overview of voice providers on agents, see [Voice in Mastra](https://mastra.ai/guides/voice/overview).
|
|
58
58
|
|
|
59
59
|
## Use tools in realtime sessions
|
|
60
60
|
|
|
@@ -96,4 +96,4 @@ const transcription = await agent.voice.listen(audioStream, {
|
|
|
96
96
|
console.log(`Transcription: ${transcription}`)
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
For a broader overview of voice providers on agents, see [Voice in Mastra](https://mastra.ai/
|
|
99
|
+
For a broader overview of voice providers on agents, see [Voice in Mastra](https://mastra.ai/guides/voice/overview).
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Text-to-Speech (TTS) in Mastra offers a unified API for synthesizing spoken audio from text using providers. By incorporating TTS into your applications, you can enhance user experience with natural voice interactions and improve accessibility for users with visual impairments, plus create more engaging multimodal interfaces.
|
|
6
6
|
|
|
7
|
-
TTS is a core component of any voice application. Combined with STT (Speech-to-Text), it forms the foundation of voice interaction systems. Newer models support STS ([Speech-to-Speech](https://mastra.ai/
|
|
7
|
+
TTS is a core component of any voice application. Combined with STT (Speech-to-Text), it forms the foundation of voice interaction systems. Newer models support STS ([Speech-to-Speech](https://mastra.ai/guides/voice/speech-to-speech)) which can be used for real-time interactions but come at high cost ($).
|
|
8
8
|
|
|
9
9
|
## Configuration
|
|
10
10
|
|
|
@@ -102,4 +102,4 @@ await new Promise<void>((resolve, reject) => {
|
|
|
102
102
|
})
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
For a broader overview of voice providers on agents, see [Voice in Mastra](https://mastra.ai/
|
|
105
|
+
For a broader overview of voice providers on agents, see [Voice in Mastra](https://mastra.ai/guides/voice/overview).
|