@mastra/mcp-docs-server 1.2.13-alpha.1 → 1.2.13-alpha.12
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/agent-approval.md +2 -2
- 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 +60 -3
- package/.docs/docs/deployment/workers.md +14 -14
- 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/long-running-agents/durable-agents.md +2 -2
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/mastra-platform/workspaces.md +152 -0
- package/.docs/docs/memory/observational-memory.md +53 -13
- package/.docs/docs/memory/overview.md +14 -0
- package/.docs/docs/server/auth/workers.md +7 -5
- package/.docs/docs/server/mastra-client.md +60 -0
- package/.docs/docs/server/pubsub.md +2 -2
- package/.docs/docs/studio/observability.md +4 -0
- package/.docs/docs/studio/overview.md +2 -2
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/docs/workflows/scheduled-workflows.md +1 -0
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/guides/deployment/kubernetes.md +2 -0
- package/.docs/guides/deployment/mastra-workers.md +350 -6
- package/.docs/guides/deployment/vercel.md +2 -0
- 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 +6 -2
- package/.docs/models/gateways/netlify.md +1 -2
- package/.docs/models/gateways/openrouter.md +5 -6
- package/.docs/models/gateways/vercel.md +9 -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 +3 -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 +5 -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 +5 -1
- package/.docs/models/providers/hyper.md +13 -8
- 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 +7 -4
- package/.docs/models/providers/minimax.md +1 -1
- 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 +4 -1
- package/.docs/models/providers/ofox.md +2 -2
- package/.docs/models/providers/ollama-cloud.md +23 -22
- package/.docs/models/providers/openai.md +2 -2
- package/.docs/models/providers/opencode-go.md +4 -2
- package/.docs/models/providers/opencode.md +1 -1
- package/.docs/models/providers/perplexity-agent.md +3 -1
- package/.docs/models/providers/requesty.md +54 -45
- package/.docs/models/providers/scaleway.md +1 -3
- package/.docs/models/providers/scx.md +74 -0
- package/.docs/models/providers/tensorx.md +97 -0
- package/.docs/models/providers/the-grid-ai.md +3 -3
- 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/durable-agent.md +12 -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 +36 -16
- 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 +2 -2
- 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/evals/summarization.md +203 -0
- package/.docs/reference/file-based-agents/config.md +39 -1
- package/.docs/reference/index.md +4 -4
- package/.docs/reference/memory/observational-memory.md +76 -24
- package/.docs/reference/memory/serialized-memory-config.md +3 -3
- package/.docs/reference/observability/tracing/interfaces.md +6 -1
- package/.docs/reference/processors/processor-interface.md +14 -2
- package/.docs/reference/processors/regex-filter-processor.md +1 -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/tools/isolated-vm-transport.md +1 -1
- package/.docs/reference/vectors/mongodb.md +13 -13
- package/.docs/reference/voice/livekit.md +3 -3
- package/.docs/reference/workers/overview.md +10 -8
- package/.docs/reference/workspace/platform-filesystem.md +8 -5
- package/.docs/reference/workspace/platform-sandbox.md +83 -7
- package/CHANGELOG.md +51 -0
- package/README.md +1 -1
- package/package.json +5 -5
- 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/mastra-platform/workspace.md +0 -111
- 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
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Workspace
|
|
4
|
-
|
|
5
|
-
> **Note:** The Agent Builder is part of the Mastra Enterprise Edition. Production deployments require a valid EE license. [Contact sales](https://mastra.ai/contact) for more information.
|
|
6
|
-
|
|
7
|
-
A [workspace](https://mastra.ai/docs/workspace/overview) gives agents filesystem access, command execution, and skill loading. The Agent Builder pins a default workspace onto every new agent through `builder.configuration.agent.workspace`. End users can still override the workspace per agent through the Builder UI.
|
|
8
|
-
|
|
9
|
-
## Quickstart
|
|
10
|
-
|
|
11
|
-
Pin an inline workspace snapshot as the Builder default:
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { Mastra } from '@mastra/core'
|
|
15
|
-
import { MastraEditor } from '@mastra/editor'
|
|
16
|
-
|
|
17
|
-
export const mastra = new Mastra({
|
|
18
|
-
editor: new MastraEditor({
|
|
19
|
-
builder: {
|
|
20
|
-
enabled: true,
|
|
21
|
-
configuration: {
|
|
22
|
-
agent: {
|
|
23
|
-
workspace: {
|
|
24
|
-
type: 'inline',
|
|
25
|
-
config: {
|
|
26
|
-
name: 'project-workspace',
|
|
27
|
-
filesystem: {
|
|
28
|
-
provider: 'local',
|
|
29
|
-
config: { basePath: './workspace' },
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
})
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
The Builder derives a deterministic id from the inline config and persists the snapshot, so identical inline configs are deduplicated across agents.
|
|
41
|
-
|
|
42
|
-
## Workspace references
|
|
43
|
-
|
|
44
|
-
`configuration.agent.workspace` accepts a `StorageWorkspaceRef`:
|
|
45
|
-
|
|
46
|
-
- **`{ type: 'inline', config }`**: Embeds a serialized workspace snapshot directly on the agent. Useful for per-agent, ad-hoc configurations.
|
|
47
|
-
- **`{ type: 'id', workspaceId }`**: References a workspace already registered on the `Mastra` instance via `new Mastra({ workspace })` or `mastra.addWorkspace(...)`. Use this for shared, named workspaces.
|
|
48
|
-
|
|
49
|
-
See the [StorageWorkspaceRef reference](https://mastra.ai/reference/editor/storage-workspace-ref) for both variants.
|
|
50
|
-
|
|
51
|
-
## Filesystem and sandbox
|
|
52
|
-
|
|
53
|
-
A workspace combines a `filesystem` (file tools) and an optional `sandbox` (command execution). For local development, point both at the same directory so files written through the filesystem are immediately visible to commands in the sandbox.
|
|
54
|
-
|
|
55
|
-
For cloud deployments, swap `LocalFilesystem` / `LocalSandbox` for managed providers (e.g., S3, E2B). See [Deploying](https://mastra.ai/docs/agent-builder/deploying) for the cloud-swap pattern.
|
|
56
|
-
|
|
57
|
-
## Related
|
|
58
|
-
|
|
59
|
-
- [Workspace overview](https://mastra.ai/docs/workspace/overview): The underlying workspace model.
|
|
60
|
-
- [Filesystem](https://mastra.ai/docs/workspace/filesystem) and [Sandbox](https://mastra.ai/docs/workspace/sandbox): The building blocks.
|
|
61
|
-
- [BuilderAgentDefaults reference](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults): The full `workspace` field schema.
|
|
62
|
-
- [Configuration](https://mastra.ai/docs/agent-builder/configuration): Wire `workspace` alongside the rest of the Builder config.
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Prompts
|
|
4
|
-
|
|
5
|
-
Prompt blocks are reusable instruction templates that you compose into an agent's system prompt. Each block can contain plain text, template variables, and display conditions.
|
|
6
|
-
|
|
7
|
-
Non-technical team members can edit and test prompt content before publishing changes. Every edit is versioned, so you can compare prompt variations and roll back. The history also records what changed over time.
|
|
8
|
-
|
|
9
|
-
You can create and manage prompt blocks through the Studio UI or programmatically through the server API, then reference them across multiple agents.
|
|
10
|
-
|
|
11
|
-
## Quickstart
|
|
12
|
-
|
|
13
|
-
1. Go to the **Prompts** tab in Studio.
|
|
14
|
-
2. Select **Create prompt** and enter a name and your instruction text.
|
|
15
|
-
3. Save the prompt block and publish it.
|
|
16
|
-
4. Open an agent's **Instructions** section and select **Add block**.
|
|
17
|
-
5. Pick the saved prompt block from the block picker dialog.
|
|
18
|
-
|
|
19
|
-
The block is added as a reference in the agent's instruction list. Changes to the original prompt block update every agent that references it.
|
|
20
|
-
|
|
21
|
-
## Block types
|
|
22
|
-
|
|
23
|
-
An agent's instructions are made up of an ordered list of blocks. Each block is one of three types:
|
|
24
|
-
|
|
25
|
-
| Type | Description |
|
|
26
|
-
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
-
| Inline text | Free-form text written directly in the agent's instruction list. Lives only on that agent. |
|
|
28
|
-
| Prompt block | A standalone block with its own content, stored in the agent snapshot. You can save an inline block as a prompt block to reuse it. |
|
|
29
|
-
| Prompt block reference | A pointer to a saved prompt block. The content is resolved at runtime from the referenced block. |
|
|
30
|
-
|
|
31
|
-
To turn an inline block into a reusable prompt block, open the block's menu and select **Save as prompt block**. To reference an existing prompt block, select **Add block** and pick one from the dialog.
|
|
32
|
-
|
|
33
|
-
## Template variables
|
|
34
|
-
|
|
35
|
-
Prompt blocks support `{{variable}}` syntax for runtime content. Variables are resolved at runtime from the agent's variables and request context.
|
|
36
|
-
|
|
37
|
-
```text
|
|
38
|
-
You are helping {{userName}} with their {{task || 'request'}}.
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
| Syntax | Behavior |
|
|
42
|
-
| ----------------------------- | ------------------------------------------------------------------------------------------- |
|
|
43
|
-
| `{{variableName}}` | Replaced with the variable value. Left as-is if not found. |
|
|
44
|
-
| `{{nested.path.value}}` | Resolves dot-notation paths in the context object. |
|
|
45
|
-
| `{{variable \|\| 'default'}}` | Uses the fallback value when the variable is missing. Single or double quotes are accepted. |
|
|
46
|
-
|
|
47
|
-
Variables are passed through the agent's `variables` configuration or through [request context](https://mastra.ai/docs/server/request-context).
|
|
48
|
-
|
|
49
|
-
## Display conditions
|
|
50
|
-
|
|
51
|
-
Each block can have a **display condition**. A rule group that controls whether the block is included in the final prompt. Conditions are evaluated at runtime against the agent's variables and request context.
|
|
52
|
-
|
|
53
|
-
A rule group uses `AND` or `OR` logic with one or more conditions. Each condition checks a context field against a value using an operator:
|
|
54
|
-
|
|
55
|
-
| Operator | Description |
|
|
56
|
-
| ---------------------------------------------- | ------------------------------------- |
|
|
57
|
-
| `equals` / `not_equals` | Exact match comparison. |
|
|
58
|
-
| `contains` / `not_contains` | String inclusion or array membership. |
|
|
59
|
-
| `greater_than` / `less_than` | Numeric comparison. |
|
|
60
|
-
| `greater_than_or_equal` / `less_than_or_equal` | Numeric comparison with equality. |
|
|
61
|
-
| `in` / `not_in` | Checks if a value is in an array. |
|
|
62
|
-
| `exists` / `not_exists` | Checks if the field is present. |
|
|
63
|
-
|
|
64
|
-
Rule groups can be nested, so you can combine `AND` and `OR` conditions for complex logic.
|
|
65
|
-
|
|
66
|
-
In the Studio, open a block's **Display conditions** panel to set up rules visually. You can also configure conditions programmatically through the API. Blocks without conditions are always included.
|
|
67
|
-
|
|
68
|
-
## Programmatic control
|
|
69
|
-
|
|
70
|
-
Prompt blocks can be managed from code through [`mastra.getEditor().prompt`](https://mastra.ai/reference/editor/mastra-editor). This is useful for seeding a set of starter prompts or syncing blocks between environments, or alternatively generating prompt variants from a script.
|
|
71
|
-
|
|
72
|
-
Create a new prompt block with `editor.prompt.create()`:
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
import { mastra } from '../mastra'
|
|
76
|
-
|
|
77
|
-
const editor = mastra.getEditor()!
|
|
78
|
-
|
|
79
|
-
await editor.prompt.create({
|
|
80
|
-
id: 'brand-voice',
|
|
81
|
-
name: 'Brand voice',
|
|
82
|
-
description: 'Acme Inc. tone and style guidelines',
|
|
83
|
-
content:
|
|
84
|
-
'You write in a friendly, concise tone. Always address the user as {{userName || "there"}}.',
|
|
85
|
-
})
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Update an existing block with `editor.prompt.update()`. Each update creates a new draft version:
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
import { mastra } from '../mastra'
|
|
92
|
-
|
|
93
|
-
const editor = mastra.getEditor()!
|
|
94
|
-
|
|
95
|
-
await editor.prompt.update({
|
|
96
|
-
id: 'brand-voice',
|
|
97
|
-
content: 'You write in a friendly, concise tone. Always greet the user by name when available.',
|
|
98
|
-
})
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Use `editor.prompt.list()` to paginate through stored blocks or `editor.prompt.getById()` to fetch a specific block. To preview an agent's full instructions with a set of prompt blocks applied, call `editor.prompt.preview()` with the draft content.
|
|
102
|
-
|
|
103
|
-
The same operations are available over HTTP through the Mastra server:
|
|
104
|
-
|
|
105
|
-
| Method | Path | Description |
|
|
106
|
-
| -------- | -------------------------------------------- | -------------------------------- |
|
|
107
|
-
| `GET` | `/stored/prompt-blocks` | List all stored prompt blocks. |
|
|
108
|
-
| `POST` | `/stored/prompt-blocks` | Create a stored prompt block. |
|
|
109
|
-
| `GET` | `/stored/prompt-blocks/:storedPromptBlockId` | Get a stored prompt block by ID. |
|
|
110
|
-
| `PATCH` | `/stored/prompt-blocks/:storedPromptBlockId` | Update a stored prompt block. |
|
|
111
|
-
| `DELETE` | `/stored/prompt-blocks/:storedPromptBlockId` | Delete a stored prompt block. |
|
|
112
|
-
|
|
113
|
-
Once a prompt block is created, reference it from an agent's `instructions` field as a `prompt_block_ref`:
|
|
114
|
-
|
|
115
|
-
```typescript
|
|
116
|
-
import { mastra } from '../mastra'
|
|
117
|
-
|
|
118
|
-
const editor = mastra.getEditor()!
|
|
119
|
-
|
|
120
|
-
await editor.agent.update({
|
|
121
|
-
id: 'support-agent',
|
|
122
|
-
instructions: [
|
|
123
|
-
{ type: 'prompt_block_ref', id: 'brand-voice' },
|
|
124
|
-
{ type: 'text', content: 'Answer only questions about Acme products.' },
|
|
125
|
-
],
|
|
126
|
-
})
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
See the [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor) for the full `editor.prompt` API.
|
|
130
|
-
|
|
131
|
-
## Versioning
|
|
132
|
-
|
|
133
|
-
Prompt blocks follow the same [versioning lifecycle](https://mastra.ai/docs/editor/overview) as agents. Each prompt block has a draft that you can edit and publish as a versioned snapshot. As a result, prompt content can be versioned and rolled back independently from the agent that uses it.
|
|
134
|
-
|
|
135
|
-
When an agent references a prompt block, the resolved content comes from the block's active published version by default. During editing, draft content is used for previews. This separation makes it safe for non-technical team members to experiment with prompt wording. The published version stays stable until they explicitly activate a new one.
|
|
136
|
-
|
|
137
|
-
## Related
|
|
138
|
-
|
|
139
|
-
- [Editor overview](https://mastra.ai/docs/editor/overview): Setup and versioning.
|
|
140
|
-
- [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor): Full configuration options for the editor.
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Tools
|
|
4
|
-
|
|
5
|
-
The editor gives you three ways to add tools to agents:
|
|
6
|
-
|
|
7
|
-
- **Code tools**: Tools already registered in your Mastra instance.
|
|
8
|
-
- **Integration providers**: Third-party tool platforms like Composio and Arcade.
|
|
9
|
-
- **MCP clients**: Tools from MCP servers, configured as reusable client definitions.
|
|
10
|
-
|
|
11
|
-
You can manage all three sources through the Studio UI or programmatically through the server API. Non-technical team members can browse tool catalogs and add tools to agents, plus test different tool combinations without code changes. Tool configurations are versioned alongside the rest of the agent, so you can roll back tool changes and compare versions, plus experiment safely.
|
|
12
|
-
|
|
13
|
-
## Description overrides
|
|
14
|
-
|
|
15
|
-
Every tool, regardless of source, can have its description overridden at the agent level. This changes the description the agent sees during tool selection without modifying the original tool definition.
|
|
16
|
-
|
|
17
|
-
This is useful when you want to:
|
|
18
|
-
|
|
19
|
-
- Tailor a generic tool's purpose for a specific agent's context.
|
|
20
|
-
- Add instructions about when or how to use a tool.
|
|
21
|
-
- Clarify ambiguous tool descriptions.
|
|
22
|
-
|
|
23
|
-
In the Studio, select a tool in the agent's tool list and edit the **Description** field. The override applies only to that agent.
|
|
24
|
-
|
|
25
|
-
## Display conditions
|
|
26
|
-
|
|
27
|
-
Each tool in an agent can have display conditions, rule groups that control whether the tool is available at runtime. This uses the same rule system as [prompt blocks](https://mastra.ai/docs/editor/prompts).
|
|
28
|
-
|
|
29
|
-
When a request comes in, the editor evaluates each tool's rules against the current context (agent variables and request context). Tools whose conditions aren't met are excluded from that run.
|
|
30
|
-
|
|
31
|
-
Use display conditions to:
|
|
32
|
-
|
|
33
|
-
- Restrict expensive tools to specific users or roles.
|
|
34
|
-
- Enable tools based on feature flags or environment variables.
|
|
35
|
-
- Conditionally include tools based on the conversation context.
|
|
36
|
-
|
|
37
|
-
Tools without display conditions are always available.
|
|
38
|
-
|
|
39
|
-
## Studio
|
|
40
|
-
|
|
41
|
-
Go to the **Agents** tab in Studio and select an agent to edit. Select the **Editor** tab. Scroll to the **Tools** section.
|
|
42
|
-
|
|
43
|
-
Here you are able to add tools and configure MCP clients.
|
|
44
|
-
|
|
45
|
-
Once you've made the changes, be sure to save the agent configuration.
|
|
46
|
-
|
|
47
|
-
## Integration providers
|
|
48
|
-
|
|
49
|
-
Integration providers connect external tool platforms to the editor. Once registered, you can browse available tools in the Studio and add them to any agent.
|
|
50
|
-
|
|
51
|
-
### Composio
|
|
52
|
-
|
|
53
|
-
[Composio](https://composio.dev) gives access to hundreds of integration tools organized into toolkits (GitHub, Slack, Gmail, and others).
|
|
54
|
-
|
|
55
|
-
1. Get a **project** API key (the `x-api-key` type) from your [Composio dashboard](https://dashboard.composio.dev).
|
|
56
|
-
|
|
57
|
-
2. Register the provider in your Editor configuration:
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
import { Mastra } from '@mastra/core'
|
|
61
|
-
import { MastraEditor } from '@mastra/editor'
|
|
62
|
-
import { ComposioToolProvider } from '@mastra/editor/composio'
|
|
63
|
-
|
|
64
|
-
export const mastra = new Mastra({
|
|
65
|
-
agents: {/* your agents */},
|
|
66
|
-
editor: new MastraEditor({
|
|
67
|
-
toolProviders: {
|
|
68
|
-
composio: new ComposioToolProvider({
|
|
69
|
-
apiKey: process.env.COMPOSIO_API_KEY!,
|
|
70
|
-
}),
|
|
71
|
-
},
|
|
72
|
-
}),
|
|
73
|
-
})
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
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.
|
|
77
|
-
|
|
78
|
-
### Arcade
|
|
79
|
-
|
|
80
|
-
[Arcade](https://arcade.dev) provides a curated catalog of tools with built-in authentication handling.
|
|
81
|
-
|
|
82
|
-
1. Get an API key from your Arcade dashboard.
|
|
83
|
-
|
|
84
|
-
2. Register the provider in your Editor configuration:
|
|
85
|
-
|
|
86
|
-
```typescript
|
|
87
|
-
import { Mastra } from '@mastra/core'
|
|
88
|
-
import { MastraEditor } from '@mastra/editor'
|
|
89
|
-
import { ArcadeToolProvider } from '@mastra/editor/arcade'
|
|
90
|
-
|
|
91
|
-
export const mastra = new Mastra({
|
|
92
|
-
agents: {/* your agents */},
|
|
93
|
-
editor: new MastraEditor({
|
|
94
|
-
toolProviders: {
|
|
95
|
-
arcade: new ArcadeToolProvider({
|
|
96
|
-
apiKey: process.env.ARCADE_API_KEY!,
|
|
97
|
-
}),
|
|
98
|
-
},
|
|
99
|
-
}),
|
|
100
|
-
})
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Arcade tools use a `Toolkit.ToolName` format (for example, `Github.GetRepository`). The provider pre-seeds common toolkits to reduce API calls during browsing.
|
|
104
|
-
|
|
105
|
-
## MCP clients
|
|
106
|
-
|
|
107
|
-
The editor lets you create stored MCP client configurations that connect to MCP servers. Once created, you can reference these clients in any agent to give it access to the server's tools.
|
|
108
|
-
|
|
109
|
-
### Transport types
|
|
110
|
-
|
|
111
|
-
Stored MCP clients support two transport types:
|
|
112
|
-
|
|
113
|
-
| Transport | Description |
|
|
114
|
-
| --------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
115
|
-
| **stdio** | Launches a local process and communicates over standard I/O. Specify the `command` and optional `args` and `env`. |
|
|
116
|
-
| **HTTP** | Connects to a remote MCP server over HTTP. Specify the server `url` and optional `headers`. |
|
|
117
|
-
|
|
118
|
-
### Tool filtering
|
|
119
|
-
|
|
120
|
-
You can filter MCP tools at two levels:
|
|
121
|
-
|
|
122
|
-
1. **Client level**: On the MCP client itself, specify which tools from the server to include or exclude. This applies to every agent that references the client.
|
|
123
|
-
2. **Agent level**: On the agent's MCP client reference, further limit which tools are available. This lets you use the same MCP client in multiple agents while exposing different tool subsets.
|
|
124
|
-
|
|
125
|
-
### Tool namespacing
|
|
126
|
-
|
|
127
|
-
Tools from MCP servers are namespaced as `serverName_toolName` to avoid conflicts. For example, a `search` tool from the `docs` server becomes `docs_search`.
|
|
128
|
-
|
|
129
|
-
### Conditional activation
|
|
130
|
-
|
|
131
|
-
MCP client references in an agent can have display conditions, like [prompt blocks](https://mastra.ai/docs/editor/prompts). This lets you conditionally include MCP tools based on request context or agent variables.
|
|
132
|
-
|
|
133
|
-
## How tools are merged
|
|
134
|
-
|
|
135
|
-
When an agent runs, tools from all sources are merged in this order:
|
|
136
|
-
|
|
137
|
-
1. Code tools
|
|
138
|
-
2. Integration tools
|
|
139
|
-
3. MCP tools
|
|
140
|
-
|
|
141
|
-
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.
|
|
142
|
-
|
|
143
|
-
## Related
|
|
144
|
-
|
|
145
|
-
- [Editor overview](https://mastra.ai/docs/editor/overview): Setup and versioning.
|
|
146
|
-
- [Prompts](https://mastra.ai/docs/editor/prompts): Display conditions reference for prompt blocks.
|
|
147
|
-
- [ToolProvider reference](https://mastra.ai/reference/editor/tool-provider): Composio and Arcade API details.
|
|
148
|
-
- [MCP overview](https://mastra.ai/docs/mcp/overview): General MCP documentation.
|
|
@@ -1,121 +0,0 @@
|
|
|
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.50.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
|
-
File-based agents are an experimental, convention-based way to define [Mastra agents](https://mastra.ai/docs/agents/overview) and the primitives they use in files under `src/mastra/`, instead of registering them manually on your [`Mastra`](https://mastra.ai/reference/core/mastra-class) instance.
|
|
10
|
-
|
|
11
|
-
This approach reduces glue code and makes the file system itself a direct representation of your [project structure](https://mastra.ai/reference/project-structure), so both you and your coding agent can understand it at a glance.
|
|
12
|
-
|
|
13
|
-
You can build your entire project with file-based agents or combine this approach with agents and other primitives defined directly in code for incremental adoption.
|
|
14
|
-
|
|
15
|
-
File-based agents have some limitations while in beta. They don't support every Mastra feature yet. Runtime configuration and wiring are usually better defined directly in code, along with any related primitives.
|
|
16
|
-
|
|
17
|
-
> **Note:** All Mastra documentation currently shows agents and primitives defined directly in code. File-based agents use the same underlying concepts and APIs, so the guidance elsewhere in the docs still applies. As file-based agents mature, more examples may use this structure where appropriate.
|
|
18
|
-
|
|
19
|
-
## Basic layout
|
|
20
|
-
|
|
21
|
-
A small file-based agent looks like this:
|
|
22
|
-
|
|
23
|
-
```text
|
|
24
|
-
src/mastra/
|
|
25
|
-
agents/
|
|
26
|
-
weather/
|
|
27
|
-
config.ts
|
|
28
|
-
instructions.md
|
|
29
|
-
tools/
|
|
30
|
-
get-weather.ts
|
|
31
|
-
skills/
|
|
32
|
-
forecast-review.md
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
The main files in an agent directory are:
|
|
36
|
-
|
|
37
|
-
- [`config.ts`](https://mastra.ai/reference/file-based-agents/config): Model selection and runtime options
|
|
38
|
-
- [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions): The prompt that applies to every response
|
|
39
|
-
- [`tools/`](https://mastra.ai/reference/file-based-agents/tools): Typed functions the model can call
|
|
40
|
-
- [`skills/`](https://mastra.ai/reference/file-based-agents/skills): Reusable instructions
|
|
41
|
-
|
|
42
|
-
You need to define `config.ts` and `instructions.md` at a minimum. Add optional files as needed. Learn more in the [add capabilities](#add-capabilities) section.
|
|
43
|
-
|
|
44
|
-
## Quickstart
|
|
45
|
-
|
|
46
|
-
Create a folder at `src/mastra/agents/weather`. Inside, add a `config.ts` and an `instructions.md` file with these contents:
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
import { agentConfig } from '@mastra/core/agent'
|
|
50
|
-
|
|
51
|
-
export default agentConfig({
|
|
52
|
-
model: 'openai/gpt-5.6-sol',
|
|
53
|
-
})
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
```markdown
|
|
57
|
-
You are a helpful weather assistant. Answer questions about current conditions and forecasts.
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Start Mastra's development server with `mastra dev`. Inside Studio, you can now call the `weather` agent and ask it about the weather.
|
|
61
|
-
|
|
62
|
-
## Add capabilities
|
|
63
|
-
|
|
64
|
-
Map each primitive or feature to its file convention:
|
|
65
|
-
|
|
66
|
-
| Primitive or feature | File convention |
|
|
67
|
-
| -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
68
|
-
| [Agent config](https://mastra.ai/reference/file-based-agents/config) | `src/mastra/agents/<agent-id>/config.ts` |
|
|
69
|
-
| [Agent instructions](https://mastra.ai/reference/file-based-agents/instructions) | `src/mastra/agents/<agent-id>/instructions.md` |
|
|
70
|
-
| [Tools](https://mastra.ai/reference/file-based-agents/tools) | `src/mastra/agents/<agent-id>/tools/` |
|
|
71
|
-
| [Skills](https://mastra.ai/reference/file-based-agents/skills) | `src/mastra/agents/<agent-id>/skills/` |
|
|
72
|
-
| [Memory](https://mastra.ai/reference/file-based-agents/memory) | `src/mastra/agents/<agent-id>/memory.ts` |
|
|
73
|
-
| [Workspace](https://mastra.ai/reference/file-based-agents/workspace) | `src/mastra/agents/<agent-id>/workspace.ts` and `src/mastra/agents/<agent-id>/workspace/` |
|
|
74
|
-
| [Processors](https://mastra.ai/reference/file-based-agents/processors) | `src/mastra/agents/<agent-id>/processors/` |
|
|
75
|
-
| [Scorers](https://mastra.ai/reference/file-based-agents/scorers) | `src/mastra/agents/<agent-id>/scorers/` |
|
|
76
|
-
| [Subagents](https://mastra.ai/reference/file-based-agents/subagents) | `src/mastra/agents/<agent-id>/subagents/` |
|
|
77
|
-
| [Workflows](https://mastra.ai/reference/file-based-agents/workflows) | `src/mastra/workflows/` |
|
|
78
|
-
| [Storage](https://mastra.ai/reference/file-based-agents/storage) | `src/mastra/storage.ts` |
|
|
79
|
-
| [Observability](https://mastra.ai/reference/file-based-agents/observability) | `src/mastra/observability.ts` |
|
|
80
|
-
| [Logger](https://mastra.ai/reference/file-based-agents/logger) | `src/mastra/logger.ts` |
|
|
81
|
-
| [Server config](https://mastra.ai/reference/file-based-agents/server) | `src/mastra/server.ts` |
|
|
82
|
-
| [Studio config](https://mastra.ai/reference/file-based-agents/studio) | `src/mastra/studio.ts` |
|
|
83
|
-
| [Schedules](https://mastra.ai/docs/long-running-agents/schedules) | Not yet file-based, create at runtime with `mastra.schedules.create()` |
|
|
84
|
-
|
|
85
|
-
## Discovery lifecycle
|
|
86
|
-
|
|
87
|
-
File-based primitives are discovered by the Mastra bundler under `mastra dev` and `mastra build`. During discovery, Mastra reads supported files under `src/mastra/`, imports TypeScript and JavaScript modules, reads markdown instructions and skills, copies workspace seed files, and registers the assembled primitives with your Mastra app.
|
|
88
|
-
|
|
89
|
-
After discovery, a file-based agent runs as a normal [`Agent`](https://mastra.ai/reference/agents/agent). Calling it from the Agent API, Studio, workflows, or your application code uses the same runtime as a code-defined agent.
|
|
90
|
-
|
|
91
|
-
Discovery is source-based and conservative.
|
|
92
|
-
|
|
93
|
-
It skips symlinks, test files, and directories that aren't agent directories. Workflows and singleton project files are file-routed only when they have a default export.
|
|
94
|
-
|
|
95
|
-
Start your app through the Mastra CLI so discovery runs:
|
|
96
|
-
|
|
97
|
-
**npm**:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
npx mastra dev
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
**pnpm**:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
pnpm dlx mastra dev
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
**Yarn**:
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
yarn dlx mastra dev
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
**Bun**:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
bun x mastra dev
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
If you import your `mastra` instance directly, `agents/<name>/` directories and the other conventions aren't discovered. When you consume Mastra as a library, register those primitives in code instead.
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Workspace
|
|
4
|
-
|
|
5
|
-
A workspace gives an environment two things your agents can use at runtime:
|
|
6
|
-
|
|
7
|
-
- A **bucket** for filesystem storage, exposed to your code as [`PlatformFilesystem`](https://mastra.ai/reference/workspace/platform-filesystem).
|
|
8
|
-
- A **sandbox** for executing commands, exposed as [`PlatformSandbox`](https://mastra.ai/reference/workspace/platform-sandbox).
|
|
9
|
-
|
|
10
|
-
Workspaces are provisioned per [environment](https://mastra.ai/docs/mastra-platform/environments), so `production` and `staging` each get their own bucket and sandbox. The platform manages provisioning, credentials, and lifecycle. Your deploy code only needs to construct the providers.
|
|
11
|
-
|
|
12
|
-
## When workspaces are provisioned
|
|
13
|
-
|
|
14
|
-
New projects have workspaces enabled by default. When you create an environment, the platform provisions a bucket for it automatically. The sandbox base image is warmed in the background so the first `PlatformSandbox` call starts quickly.
|
|
15
|
-
|
|
16
|
-
Existing projects that haven't opted in show an **Enable workspaces** action in the Workspaces tab. Enabling provisions a bucket for every environment on the project.
|
|
17
|
-
|
|
18
|
-
If provisioning fails for an environment, for example while Railway is under load, the Workspaces tab shows the failure and offers a retry. The environment itself is still created. Only the workspace is unavailable until you retry.
|
|
19
|
-
|
|
20
|
-
## Use the workspace from your code
|
|
21
|
-
|
|
22
|
-
Install the provider package:
|
|
23
|
-
|
|
24
|
-
**npm**:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm install @mastra/platform-workspace
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
**pnpm**:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
pnpm add @mastra/platform-workspace
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**Yarn**:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
yarn add @mastra/platform-workspace
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Bun**:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
bun add @mastra/platform-workspace
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Compose the providers into a workspace and register it with Mastra:
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
import { Workspace } from '@mastra/core/workspace'
|
|
52
|
-
import { PlatformFilesystem, PlatformSandbox } from '@mastra/platform-workspace'
|
|
53
|
-
|
|
54
|
-
export const workspace = new Workspace({
|
|
55
|
-
filesystem: new PlatformFilesystem(),
|
|
56
|
-
sandbox: new PlatformSandbox(),
|
|
57
|
-
})
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
```typescript
|
|
61
|
-
import { Mastra } from '@mastra/core'
|
|
62
|
-
import { workspace } from './workspace'
|
|
63
|
-
|
|
64
|
-
export const mastra = new Mastra({
|
|
65
|
-
workspace,
|
|
66
|
-
})
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
`PlatformFilesystem` and `PlatformSandbox` read their credentials from environment variables the platform injects at deploy time, so you don't pass any options on the platform.
|
|
70
|
-
|
|
71
|
-
## Injected environment variables
|
|
72
|
-
|
|
73
|
-
Every deploy that runs on a platform environment with a workspace receives these variables:
|
|
74
|
-
|
|
75
|
-
| Variable | Contents |
|
|
76
|
-
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
77
|
-
| `MASTRA_PLATFORM_SECRET_KEY` | Secret key scoped to the deploy. Used by the workspace providers to authenticate. `MASTRA_PLATFORM_ACCESS_TOKEN` is also injected as a deprecated alias. |
|
|
78
|
-
| `MASTRA_PROJECT_ID` | Project the deploy belongs to. |
|
|
79
|
-
| `MASTRA_ENVIRONMENT_ID` | Environment the deploy belongs to. Selects which sandbox pool the platform uses. |
|
|
80
|
-
| `MASTRA_PLATFORM_BUCKET_NAME` | Bucket name attached to the environment. Selects which bucket `PlatformFilesystem` reads and writes. |
|
|
81
|
-
|
|
82
|
-
These names are reserved. If your project sets any of them explicitly, the platform-managed values take precedence.
|
|
83
|
-
|
|
84
|
-
## Local development
|
|
85
|
-
|
|
86
|
-
Reuse the same providers locally by putting the four variables in your `.env` file. Get the values from your project's Workspaces tab:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
MASTRA_PLATFORM_SECRET_KEY=your-secret-key
|
|
90
|
-
MASTRA_PROJECT_ID=your-project-id
|
|
91
|
-
MASTRA_ENVIRONMENT_ID=your-environment-id
|
|
92
|
-
MASTRA_PLATFORM_BUCKET_NAME=your-bucket-name
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
`PlatformFilesystem` and `PlatformSandbox` behave the same locally as on the platform, they connect to the same bucket and sandbox pool for that environment. Use a `staging` or `preview` environment's variables for local runs if you want to keep production data isolated.
|
|
96
|
-
|
|
97
|
-
For a purely offline loop that never touches the platform, swap the providers for [`LocalFilesystem`](https://mastra.ai/reference/workspace/local-filesystem) and [`LocalSandbox`](https://mastra.ai/reference/workspace/local-sandbox) in a local build.
|
|
98
|
-
|
|
99
|
-
## Inspect the workspace
|
|
100
|
-
|
|
101
|
-
The Workspaces tab in your platform project shows, per environment:
|
|
102
|
-
|
|
103
|
-
- Bucket status and its contents, with upload, download, and delete actions.
|
|
104
|
-
- Recent sandbox sessions with their command, exit code, and duration.
|
|
105
|
-
- Provisioning failures with a **Retry** action.
|
|
106
|
-
|
|
107
|
-
## See also
|
|
108
|
-
|
|
109
|
-
- [`PlatformFilesystem`](https://mastra.ai/reference/workspace/platform-filesystem): reference for the filesystem provider.
|
|
110
|
-
- [`PlatformSandbox`](https://mastra.ai/reference/workspace/platform-sandbox): reference for the sandbox provider.
|
|
111
|
-
- [Environments](https://mastra.ai/docs/mastra-platform/environments): how environments scope workspaces, variables, and databases.
|