@mastra/mcp-docs-server 1.2.15-alpha.1 → 1.2.15-alpha.10
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/a2a.md +75 -2
- package/.docs/docs/agents/processors.md +2 -0
- package/.docs/docs/agents/skills.md +15 -1
- package/.docs/docs/capabilities/channels/overview.md +19 -0
- package/.docs/docs/capabilities/subagents.md +23 -5
- package/.docs/docs/connections/overview.md +94 -0
- package/.docs/docs/datasets/running-experiments.md +18 -0
- package/.docs/docs/evals/overview.md +16 -4
- package/.docs/docs/harness/agent-controller.md +6 -0
- package/.docs/docs/harness/overview.md +26 -0
- package/.docs/docs/index.md +1 -1
- package/.docs/docs/mcp/overview.md +10 -0
- package/.docs/docs/memory/multi-user-threads.md +1 -1
- package/.docs/docs/memory/observational-memory.md +1 -1
- package/.docs/docs/memory/semantic-recall.md +2 -1
- package/.docs/docs/memory/working-memory.md +1 -0
- package/.docs/docs/observability/feedback.md +16 -0
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +1 -0
- package/.docs/docs/server/auth.md +2 -0
- package/.docs/docs/server/mastra-client.md +11 -11
- package/.docs/docs/storage/overview.md +1 -0
- package/.docs/docs/workflows/agents-and-tools.md +2 -2
- package/.docs/docs/workflows/{stored-workflows.md → dynamic-workflows.md} +23 -23
- package/.docs/docs/workflows/snapshots.md +3 -1
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +25 -14
- package/.docs/guides/getting-started/quickstart.md +1 -1
- package/.docs/guides/rag/overview.md +1 -1
- package/.docs/guides/rag/retrieval.md +17 -0
- package/.docs/guides/rag/vector-databases.md +41 -0
- package/.docs/guides/voice/realtime-voice.md +28 -2
- package/.docs/models/gateways/neon.md +15 -9
- package/.docs/models/gateways/netlify.md +1 -2
- package/.docs/models/gateways/openrouter.md +3 -2
- package/.docs/models/gateways/vercel.md +10 -3
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/cortecs.md +2 -1
- package/.docs/models/providers/deepinfra.md +6 -3
- package/.docs/models/providers/digitalocean.md +6 -5
- package/.docs/models/providers/empiriolabs.md +6 -4
- package/.docs/models/providers/friendli.md +8 -9
- package/.docs/models/providers/huggingface.md +4 -1
- package/.docs/models/providers/hyper.md +5 -6
- package/.docs/models/providers/kilo.md +11 -9
- package/.docs/models/providers/llmgateway.md +3 -3
- package/.docs/models/providers/meta.md +7 -5
- package/.docs/models/providers/nano-gpt.md +7 -4
- package/.docs/models/providers/neuralwatt.md +2 -1
- package/.docs/models/providers/ofox.md +74 -16
- package/.docs/models/providers/opencode-go.md +1 -1
- package/.docs/models/providers/opencode.md +2 -3
- package/.docs/models/providers/regolo-ai.md +25 -20
- package/.docs/models/providers/upstage.md +3 -2
- package/.docs/models/providers/vivgrid.md +4 -2
- package/.docs/models/providers/wandb.md +1 -1
- package/.docs/reference/agents/channels.md +22 -1
- package/.docs/reference/agents/generate.md +1 -1
- package/.docs/reference/ai-sdk/chat-route.md +2 -0
- package/.docs/reference/browser/agent-browser.md +1 -1
- package/.docs/reference/browser/mastra-browser.md +1 -1
- package/.docs/reference/browser/stagehand-browser.md +1 -1
- package/.docs/reference/channels/slack-provider.md +2 -0
- package/.docs/reference/client-js/observability.md +22 -0
- package/.docs/reference/client-js/workflows.md +32 -19
- package/.docs/reference/configuration.md +26 -1
- package/.docs/reference/core/{addStoredWorkflow.md → addDynamicWorkflow.md} +10 -10
- package/.docs/reference/core/{addStoredWorkflows.md → addDynamicWorkflows.md} +9 -9
- package/.docs/reference/editor/tool-provider.md +26 -1
- package/.docs/reference/file-based-agents/config.md +22 -21
- package/.docs/reference/file-based-agents/instructions.md +42 -17
- package/.docs/reference/index.md +6 -3
- package/.docs/reference/observability/metrics/automatic-metrics.md +10 -8
- package/.docs/reference/rag/metadata-filters.md +13 -4
- package/.docs/reference/server/register-api-route.md +2 -0
- package/.docs/reference/server/routes.md +38 -24
- package/.docs/reference/storage/composite.md +58 -0
- package/.docs/reference/storage/oracledb.md +239 -0
- package/.docs/reference/storage/overview.md +9 -9
- package/.docs/reference/storage/retention.md +1 -1
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/tools/bedrock-kb-tool.md +117 -0
- package/.docs/reference/tools/mcp-client.md +54 -0
- package/.docs/reference/vectors/oracledb.md +347 -0
- package/.docs/reference/voice/google.md +19 -3
- package/.docs/reference/workflows/{stored-workflow-definition.md → dynamic-workflow-definition.md} +7 -7
- package/.docs/reference/workflows/step.md +40 -0
- package/.docs/reference/workflows/workflow-methods/agent.md +3 -3
- package/.docs/reference/workflows/workflow-methods/tool.md +3 -3
- package/.docs/reference/workspace/daytona-sandbox.md +21 -0
- package/.docs/reference/workspace/workspace-class.md +2 -0
- package/CHANGELOG.md +44 -0
- package/package.json +6 -6
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Upstage
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 4 Upstage models through Mastra's model router. Authentication is handled automatically using the `UPSTAGE_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Upstage documentation](https://developers.upstage.ai).
|
|
8
8
|
|
|
@@ -39,6 +39,7 @@ for await (const chunk of stream) {
|
|
|
39
39
|
| `upstage/solar-mini` | 33K | | | | | | $0.15 | $0.15 |
|
|
40
40
|
| `upstage/solar-pro2` | 66K | | | | | | $0.25 | $0.25 |
|
|
41
41
|
| `upstage/solar-pro3` | 131K | | | | | | $0.25 | $0.25 |
|
|
42
|
+
| `upstage/solar-pro4` | 524K | | | | | | $0.30 | $1 |
|
|
42
43
|
|
|
43
44
|
## Advanced configuration
|
|
44
45
|
|
|
@@ -68,7 +69,7 @@ const agent = new Agent({
|
|
|
68
69
|
model: ({ requestContext }) => {
|
|
69
70
|
const useAdvanced = requestContext.task === "complex";
|
|
70
71
|
return useAdvanced
|
|
71
|
-
? "upstage/solar-
|
|
72
|
+
? "upstage/solar-pro4"
|
|
72
73
|
: "upstage/solar-mini";
|
|
73
74
|
}
|
|
74
75
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Vivgrid
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 19 Vivgrid models through Mastra's model router. Authentication is handled automatically using the `VIVGRID_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Vivgrid documentation](https://docs.vivgrid.com/models).
|
|
8
8
|
|
|
@@ -37,6 +37,7 @@ for await (const chunk of stream) {
|
|
|
37
37
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
38
|
| --------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
39
|
| `vivgrid/deepseek-v3.2` | 128K | | | | | | $0.28 | $0.42 |
|
|
40
|
+
| `vivgrid/deepseek-v4-flash` | 1.0M | | | | | | $0.15 | $0.30 |
|
|
40
41
|
| `vivgrid/deepseek-v4-pro` | 1.0M | | | | | | $0.43 | $0.87 |
|
|
41
42
|
| `vivgrid/gemini-3.1-flash-lite-preview` | 1.0M | | | | | | $0.25 | $2 |
|
|
42
43
|
| `vivgrid/gemini-3.1-pro-preview` | 1.0M | | | | | | $2 | $12 |
|
|
@@ -53,6 +54,7 @@ for await (const chunk of stream) {
|
|
|
53
54
|
| `vivgrid/gpt-5.6-luna` | 1.1M | | | | | | $1 | $6 |
|
|
54
55
|
| `vivgrid/gpt-5.6-sol` | 1.1M | | | | | | $5 | $30 |
|
|
55
56
|
| `vivgrid/gpt-5.6-terra` | 1.1M | | | | | | $3 | $15 |
|
|
57
|
+
| `vivgrid/kimi-k3` | 1.0M | | | | | | $3 | $15 |
|
|
56
58
|
|
|
57
59
|
## Advanced configuration
|
|
58
60
|
|
|
@@ -82,7 +84,7 @@ const agent = new Agent({
|
|
|
82
84
|
model: ({ requestContext }) => {
|
|
83
85
|
const useAdvanced = requestContext.task === "complex";
|
|
84
86
|
return useAdvanced
|
|
85
|
-
? "vivgrid/
|
|
87
|
+
? "vivgrid/kimi-k3"
|
|
86
88
|
: "vivgrid/deepseek-v3.2";
|
|
87
89
|
}
|
|
88
90
|
});
|
|
@@ -39,7 +39,7 @@ for await (const chunk of stream) {
|
|
|
39
39
|
| `wandb/deepseek-ai/DeepSeek-V3.1` | 161K | | | | | | $0.55 | $2 |
|
|
40
40
|
| `wandb/deepseek-ai/DeepSeek-V4-Flash` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
41
41
|
| `wandb/deepseek-ai/DeepSeek-V4-Flash-0731` | 262K | | | | | | $0.13 | $0.28 |
|
|
42
|
-
| `wandb/deepseek-ai/DeepSeek-V4-Pro` | 1.0M | | | | | | $
|
|
42
|
+
| `wandb/deepseek-ai/DeepSeek-V4-Pro` | 1.0M | | | | | | $1 | $3 |
|
|
43
43
|
| `wandb/google/gemma-4-31B-it` | 262K | | | | | | $0.10 | $0.34 |
|
|
44
44
|
| `wandb/ibm-granite/granite-4.1-8b` | 131K | | | | | | $0.05 | $0.10 |
|
|
45
45
|
| `wandb/JetBrains/Mellum2-12B-A2.5B-Instruct` | 131K | | | | | | $0.05 | $0.10 |
|
|
@@ -102,7 +102,9 @@ const agent = new Agent({
|
|
|
102
102
|
|
|
103
103
|
**streaming** (`boolean | { updateIntervalMs?: number }`): Stream agent text deltas to the channel as the agent generates them instead of buffering and posting once per step. Requires the underlying adapter to support post-and-edit streaming. Slack defaults to true; other adapters default to false. (Default: `false (true for Slack)`)
|
|
104
104
|
|
|
105
|
-
**
|
|
105
|
+
**textFormat** (`'markdown' | 'plain'`): Dialect for the agent's final reply text. 'markdown' (the default) posts replies as markdown: adapters with native markdown rendering (Slack) render it directly, others convert it to their platform format. 'plain' posts replies as literal plain text, restoring the pre-markdown behavior for agents prompted to emit a platform dialect such as Slack mrkdwn. Applies to final reply text only; tool cards, error messages, and tripwire notices are unaffected. Native streaming is always markdown regardless of this setting. (Default: `'markdown'`)
|
|
106
|
+
|
|
107
|
+
**toolDisplay** (`'cards' | 'text' | 'timeline' | 'grouped' | 'hidden' | ToolDisplayFn`): How tool calls are rendered in the channel. "cards" posts per-tool running/result cards as rich Block Kit. "text" posts the same lifecycle as plain text (no Block Kit). "timeline" and "grouped" stream tool state as inline task\_update chunks (requires streaming: true; Slack only today — other adapters may render a placeholder). "hidden" executes tools silently. Pass a function to render tool events yourself; return { kind: "post", message } for a discrete post/edit, { kind: "stream", chunk } to push into the streaming widget, or undefined to skip rendering that event. Add openIfEmpty: false to a stream result when its chunk should only apply to an active streaming session. Approve/deny prompts always render as a separate card regardless of mode. (Default: `'cards' ('grouped' for Slack)`)
|
|
106
108
|
|
|
107
109
|
**typingStatus** (`boolean | ((chunk: AgentChunkType, ctx: TypingStatusContext) => string | false | null | undefined | void)`): Control the platform typing indicator. true uses built-in defaults (is typing… on text, is calling {tool}… on tool-call, is waiting for approval… on tool-call-approval). false suppresses typing entirely — useful when a live streaming widget (e.g. toolDisplay: "grouped" in Slack) already conveys progress. Pass a function to set custom status copy per chunk; return a string to set the status, or false/null/undefined to leave it unchanged. Compose with defaultTypingStatus (exported from @mastra/core/channels) to fall back to defaults for chunks you don't handle. (Default: `true`)
|
|
108
110
|
|
|
@@ -116,6 +118,25 @@ const agent = new Agent({
|
|
|
116
118
|
|
|
117
119
|
Pass a function to `toolDisplay` for fully custom rendering. The function receives a `ToolDisplayEvent` (`running` / `result` / `error` / `approval`) and a `ToolDisplayContext` (`{ mode, platform }`); return `{ kind: 'post', message }` for a discrete post/edit, `{ kind: 'stream', chunk }` to push into the active streaming widget, or `undefined` to skip rendering that event.
|
|
118
120
|
|
|
121
|
+
By default, a stream result opens a streaming session when none is active. Set `openIfEmpty: false` when the chunk only applies to an existing session. Mastra skips the chunk when no session is active. Static channels ignore this option and keep their existing plain-text fallback behavior.
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
toolDisplay: event => {
|
|
125
|
+
if (event.kind !== 'running') return undefined
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
kind: 'stream',
|
|
129
|
+
chunk: {
|
|
130
|
+
type: 'task_update',
|
|
131
|
+
id: event.toolCallId,
|
|
132
|
+
title: event.displayName,
|
|
133
|
+
status: 'in_progress',
|
|
134
|
+
},
|
|
135
|
+
openIfEmpty: false,
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
119
140
|
Approve/deny prompts (`requireApproval`) always render as a separate card regardless of mode, because inline task entries can't carry interactive buttons.
|
|
120
141
|
|
|
121
142
|
```typescript
|
|
@@ -56,7 +56,7 @@ const result = await agent.generate('message for agent')
|
|
|
56
56
|
|
|
57
57
|
**options.delegation** (`DelegationConfig`): Configuration for subagent delegation. Use this to control and monitor when the agent delegates tasks to other agents, including the ability to modify, reject delegations, and provide feedback to guide the supervisor.
|
|
58
58
|
|
|
59
|
-
**options.delegation.onDelegationStart** (`(context: DelegationStartContext) => DelegationStartResult | void | Promise<DelegationStartResult | void>`): Called before delegating to a subagent. Use this to modify the delegation parameters
|
|
59
|
+
**options.delegation.onDelegationStart** (`(context: DelegationStartContext) => DelegationStartResult | void | Promise<DelegationStartResult | void>`): Called before delegating to a subagent. Use this to modify the delegation parameters, reject the delegation entirely, or mutate context.requestContext to add entries to the subagent run's request context.
|
|
60
60
|
|
|
61
61
|
**options.delegation.onDelegationComplete** (`(context: DelegationCompleteContext) => { feedback?: string } | void | Promise<{ feedback?: string } | void>`): Called after a subagent delegation completes. The context includes a bail() method to stop further execution, and you can return { feedback } to guide the supervisor's next action. Feedback is saved to supervisor memory as an assistant message.
|
|
62
62
|
|
|
@@ -69,6 +69,8 @@ export const mastra = new Mastra({
|
|
|
69
69
|
|
|
70
70
|
**sendSources** (`boolean`): Whether to include source citations in the stream. (Default: `false`)
|
|
71
71
|
|
|
72
|
+
**heartbeatMs** (`number`): Interval in milliseconds for SSE heartbeats that keep connections active through infrastructure with idle timeouts.
|
|
73
|
+
|
|
72
74
|
## Additional configuration
|
|
73
75
|
|
|
74
76
|
You can use [`prepareSendMessagesRequest`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-chat#transport.default-chat-transport.prepare-send-messages-request) to customize the request sent to the chat route, for example to pass additional configuration to the agent:
|
|
@@ -32,7 +32,7 @@ then interact with elements using their refs (e.g., @e5).`,
|
|
|
32
32
|
|
|
33
33
|
**headless** (`boolean`): Whether to run the browser in headless mode (no visible UI). (Default: `true`)
|
|
34
34
|
|
|
35
|
-
**viewport** (`{ width: number; height: number }`): Browser viewport dimensions. (Default: `{ width: 1280, height: 720 }`)
|
|
35
|
+
**viewport** (`{ width: number; height: number } | 'window'`): Browser viewport dimensions, or 'window' to match the real browser window instead of a fixed size. (Default: `{ width: 1280, height: 720 }`)
|
|
36
36
|
|
|
37
37
|
**timeout** (`number`): Default timeout in milliseconds for browser operations. (Default: `30000`)
|
|
38
38
|
|
|
@@ -35,7 +35,7 @@ export const browserAgent = new Agent({
|
|
|
35
35
|
|
|
36
36
|
**headless** (`boolean`): Whether to run the browser in headless mode (no visible UI). (Default: `true`)
|
|
37
37
|
|
|
38
|
-
**viewport** (`{ width: number; height: number }`): Browser viewport dimensions. Controls the size of the browser window. (Default: `{ width: 1280, height: 720 }`)
|
|
38
|
+
**viewport** (`{ width: number; height: number } | 'window'`): Browser viewport dimensions. Controls the size of the browser window. Set to 'window' to match the real browser window instead of a fixed size, supported by the agent-browser provider and by Stagehand when connecting over CDP. (Default: `{ width: 1280, height: 720 }`)
|
|
39
39
|
|
|
40
40
|
**timeout** (`number`): Default timeout in milliseconds. Each provider defines its own semantics and default. See the provider reference for details.
|
|
41
41
|
|
|
@@ -33,7 +33,7 @@ Use stagehand_extract to get data from pages.`,
|
|
|
33
33
|
|
|
34
34
|
**headless** (`boolean`): Whether to run the browser in headless mode. (Default: `true`)
|
|
35
35
|
|
|
36
|
-
**viewport** (`{ width: number; height: number }`): Browser viewport dimensions. (Default: `{ width: 1280, height: 720 }`)
|
|
36
|
+
**viewport** (`{ width: number; height: number } | 'window'`): Browser viewport dimensions. 'window' matches the real browser window and only applies when connecting over CDP; a locally launched browser falls back to the default size. (Default: `{ width: 1280, height: 720 }`)
|
|
37
37
|
|
|
38
38
|
**env** (`'LOCAL' | 'BROWSERBASE'`): Environment to run the browser in. Use 'BROWSERBASE' for cloud execution. (Default: `'LOCAL'`)
|
|
39
39
|
|
|
@@ -53,6 +53,8 @@ await slack.configure({
|
|
|
53
53
|
|
|
54
54
|
**streaming** (`StreamingConfig | false`): Stream agent text deltas to Slack as they're generated. Pass { updateIntervalMs } to customize the post-and-edit interval, or false to buffer text until step-finish. Disabling streaming restricts toolDisplay to static modes. (Default: `true`)
|
|
55
55
|
|
|
56
|
+
**textFormat** (`'markdown' | 'plain'`): Dialect for the agent's final reply text, forwarded to the Slack adapter. 'markdown' (the default) posts replies as markdown so Slack renders bold text, links, and tables natively. 'plain' posts literal plain text, the escape hatch for agents prompted to emit Slack mrkdwn. Applies to buffered replies (streaming: false) and the streaming fallback; native streaming is always markdown. (Default: `'markdown'`)
|
|
57
|
+
|
|
56
58
|
**toolDisplay** (`ToolDisplay`): How tool calls are rendered in Slack: 'cards', 'text', 'timeline', 'grouped', 'hidden', or a function. 'hidden' suppresses tool call/result rendering entirely. 'timeline' and 'grouped' require streaming. With streaming: false, only static modes are available and the default is 'cards'. (Default: `'grouped'`)
|
|
57
59
|
|
|
58
60
|
**typingStatus** (`boolean | TypingStatusFn`): Show a typing indicator while the agent works. Set false to disable, or pass a function to return custom status text per stream chunk (return undefined to fall back to the default for that chunk). (Default: `true`)
|
|
@@ -41,6 +41,28 @@ console.log(`Total pages: ${traces.pagination.totalPages}`)
|
|
|
41
41
|
const completeTrace = await mastraClient.getTrace(traces.spans[0].traceId)
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
## Listing traces for a list view
|
|
45
|
+
|
|
46
|
+
`listTracesLight()` returns the same rows as a trace list, without the `input`, `output` and `attributes` payloads. Each row carries a short `inputPreview` string instead, so a list can render a preview column without transferring the whole prompt.
|
|
47
|
+
|
|
48
|
+
Prefer it whenever you are rendering many traces at once, and fetch the full record only when a row is opened:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
const list = await mastraClient.listTracesLight({
|
|
52
|
+
pagination: { page: 0, perPage: 25 },
|
|
53
|
+
filters: { entityType: 'agent' },
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
for (const span of list.spans) {
|
|
57
|
+
console.log(span.name, span.inputPreview)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Fetch the full payload only for the trace the user selects
|
|
61
|
+
const selected = await mastraClient.getTrace(list.spans[0].traceId)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
It accepts the same filtering, ordering and delta-polling arguments as `listTraces()`. Use `listTraces()` when you actually need the full span payloads.
|
|
65
|
+
|
|
44
66
|
## Scoring traces
|
|
45
67
|
|
|
46
68
|
Score specific traces using registered scorers for evaluation:
|
|
@@ -12,6 +12,19 @@ Retrieve a list of all available workflows:
|
|
|
12
12
|
const workflows = await mastraClient.listWorkflows()
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## Getting workflow run counts
|
|
16
|
+
|
|
17
|
+
Retrieve per-workflow counts of `running` and [`suspended`](https://mastra.ai/docs/workflows/suspend-and-resume) runs in a single request. The counts are computed on the server and keyed by the workflow's registry key — the key used when registering the workflow in the Mastra config, which can differ from the workflow's own `id`:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
const runCounts = await mastraClient.listWorkflowRunCounts()
|
|
21
|
+
// { "cityWorkflow": { running: 2, suspended: 1 }, ... }
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Returns: `Record<string, { running: number; suspended: number }>`
|
|
25
|
+
|
|
26
|
+
The server may cache the counts for a few seconds between requests. Servers that predate this endpoint respond with `404 Not Found` — handle the error when the client can talk to older deployments.
|
|
27
|
+
|
|
15
28
|
## Working with a specific workflow
|
|
16
29
|
|
|
17
30
|
Get an instance of a specific workflow by its ID:
|
|
@@ -212,28 +225,28 @@ A workflow run result yields the following:
|
|
|
212
225
|
|
|
213
226
|
**payload** (`object`): Contains currentStep (id, status, output, payload) and workflowState (status, steps record)
|
|
214
227
|
|
|
215
|
-
##
|
|
228
|
+
## Dynamic workflows
|
|
216
229
|
|
|
217
|
-
> **Beta:**
|
|
230
|
+
> **Beta:** Dynamic workflows are in beta. Breaking changes may occur without a major version bump until the API is stable.
|
|
218
231
|
|
|
219
|
-
|
|
232
|
+
Dynamic workflows are workflow definitions expressed as JSON. The server persists each definition and registers it as a runnable workflow. See [Dynamic workflows](https://mastra.ai/docs/workflows/dynamic-workflows) for the definition format.
|
|
220
233
|
|
|
221
|
-
### `
|
|
234
|
+
### `listDynamicWorkflows()`
|
|
222
235
|
|
|
223
|
-
List
|
|
236
|
+
List dynamic workflow definitions, optionally filtered by `status` (`'active' | 'archived'`) and `authorId`:
|
|
224
237
|
|
|
225
238
|
```typescript
|
|
226
|
-
const { definitions, total } = await mastraClient.
|
|
239
|
+
const { definitions, total } = await mastraClient.listDynamicWorkflows({
|
|
227
240
|
status: 'active',
|
|
228
241
|
})
|
|
229
242
|
```
|
|
230
243
|
|
|
231
|
-
### `
|
|
244
|
+
### `upsertDynamicWorkflow()`
|
|
232
245
|
|
|
233
|
-
Create or replace a
|
|
246
|
+
Create or replace a dynamic workflow definition. The server validates the definition, persists it, and live-registers it for execution:
|
|
234
247
|
|
|
235
248
|
```typescript
|
|
236
|
-
const stored = await mastraClient.
|
|
249
|
+
const stored = await mastraClient.upsertDynamicWorkflow({
|
|
237
250
|
id: 'greeting-workflow',
|
|
238
251
|
description: 'Returns a greeting for the supplied name',
|
|
239
252
|
inputSchema: {
|
|
@@ -261,7 +274,7 @@ const stored = await mastraClient.upsertStoredWorkflow({
|
|
|
261
274
|
When the root definition nests helper workflows that don't exist yet, pass them in the same request through `dependencies`. The server validates and registers the bundle as a unit and echoes the helper ids back as `dependencyIds`:
|
|
262
275
|
|
|
263
276
|
```typescript
|
|
264
|
-
const stored = await mastraClient.
|
|
277
|
+
const stored = await mastraClient.upsertDynamicWorkflow({
|
|
265
278
|
id: 'root-workflow',
|
|
266
279
|
// ...schemas and graph referencing 'helper-workflow'...
|
|
267
280
|
dependencies: [helperDefinition],
|
|
@@ -270,33 +283,33 @@ const stored = await mastraClient.upsertStoredWorkflow({
|
|
|
270
283
|
console.log(stored.dependencyIds) // ['helper-workflow']
|
|
271
284
|
```
|
|
272
285
|
|
|
273
|
-
### `
|
|
286
|
+
### `getDynamicWorkflow()`
|
|
274
287
|
|
|
275
|
-
Get a
|
|
288
|
+
Get a dynamic workflow instance for definition management. To execute a dynamic workflow, use `getWorkflow(id).createRun()` like any other workflow:
|
|
276
289
|
|
|
277
290
|
```typescript
|
|
278
|
-
const
|
|
291
|
+
const dynamicWorkflow = mastraClient.getDynamicWorkflow('greeting-workflow')
|
|
279
292
|
```
|
|
280
293
|
|
|
281
|
-
### `
|
|
294
|
+
### `dynamicWorkflow.details()`
|
|
282
295
|
|
|
283
296
|
Retrieve the persisted definition, including schemas, graph, status, and timestamps:
|
|
284
297
|
|
|
285
298
|
```typescript
|
|
286
|
-
const definition = await
|
|
299
|
+
const definition = await dynamicWorkflow.details()
|
|
287
300
|
```
|
|
288
301
|
|
|
289
|
-
### `
|
|
302
|
+
### `dynamicWorkflow.delete()`
|
|
290
303
|
|
|
291
304
|
Delete the stored definition and unregister the live workflow:
|
|
292
305
|
|
|
293
306
|
```typescript
|
|
294
|
-
await
|
|
307
|
+
await dynamicWorkflow.delete()
|
|
295
308
|
```
|
|
296
309
|
|
|
297
|
-
### Executing a
|
|
310
|
+
### Executing a dynamic workflow
|
|
298
311
|
|
|
299
|
-
Once registered, a
|
|
312
|
+
Once registered, a dynamic workflow runs through the ordinary workflow API:
|
|
300
313
|
|
|
301
314
|
```typescript
|
|
302
315
|
const workflow = mastraClient.getWorkflow('greeting-workflow')
|
|
@@ -438,7 +438,7 @@ export const mastra = new Mastra({
|
|
|
438
438
|
|
|
439
439
|
**Type:** `Record<string, MastraVector>`
|
|
440
440
|
|
|
441
|
-
Vector stores for semantic search and embeddings. Used in RAG pipelines, similarity search, and other embedding-based features. Mastra supports multiple vector databases including Pinecone, PostgreSQL with pgvector, MongoDB, and more.
|
|
441
|
+
Vector stores for semantic search and embeddings. Used in RAG pipelines, similarity search, and other embedding-based features. Mastra supports multiple vector databases including Pinecone, PostgreSQL with pgvector, OracleDB, MongoDB, and more.
|
|
442
442
|
|
|
443
443
|
Visit the [RAG documentation](https://mastra.ai/guides/rag/overview) to learn more.
|
|
444
444
|
|
|
@@ -500,6 +500,31 @@ const mastra = new Mastra({
|
|
|
500
500
|
|
|
501
501
|
## Bundler options
|
|
502
502
|
|
|
503
|
+
### bundler.entries
|
|
504
|
+
|
|
505
|
+
**Type:** `Record<string, string>`\
|
|
506
|
+
**Default:** `{}`
|
|
507
|
+
|
|
508
|
+
Additional process entries to emit alongside the server bundle, as a map of output name to source path relative to your Mastra directory. Each entry becomes its own `<name>.mjs` in `.mastra/output`.
|
|
509
|
+
|
|
510
|
+
Use this for long-running processes that run beside your Mastra server rather than inside it, such as a [LiveKit voice worker](https://mastra.ai/guides/voice/realtime-voice). The entry shares the output directory, `package.json`, and installed dependencies with the server, so one `mastra build` produces one deployable artifact you can start with different commands.
|
|
511
|
+
|
|
512
|
+
```typescript
|
|
513
|
+
import { Mastra } from '@mastra/core'
|
|
514
|
+
|
|
515
|
+
export const mastra = new Mastra({
|
|
516
|
+
bundler: {
|
|
517
|
+
entries: { 'voice-worker': './voice-worker.ts' },
|
|
518
|
+
},
|
|
519
|
+
})
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
This emits `.mastra/output/voice-worker.mjs` next to `.mastra/output/index.mjs`. Dependencies imported only by the extra entry are analyzed too, so they're installed into the output.
|
|
523
|
+
|
|
524
|
+
Entry names can contain `/` to nest the output. They can't be `index`, which is the server bundle, `tools`, which is the tool aggregator, or start with `tools/`, which is reserved for tool bundles.
|
|
525
|
+
|
|
526
|
+
> **Note:** `mastra build` applies the [`bundler.externals`](#bundlerexternals) default of `true` only when you set no bundler options at all. Once you set `entries`, set `externals` explicitly as well if your extra entry depends on packages that can't be bundled, such as native modules.
|
|
527
|
+
|
|
503
528
|
### bundler.externals
|
|
504
529
|
|
|
505
530
|
**Type:** `boolean | string[]`\
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
2
|
|
|
3
|
-
# Mastra.
|
|
3
|
+
# Mastra.addDynamicWorkflow()
|
|
4
4
|
|
|
5
|
-
> **Beta:**
|
|
5
|
+
> **Beta:** Dynamic workflows are in beta. Breaking changes may occur without a major version bump until the API is stable.
|
|
6
6
|
|
|
7
|
-
The `.
|
|
7
|
+
The `.addDynamicWorkflow()` method validates a dynamic workflow definition and registers it as a live workflow on the instance, persisting it through the `workflowDefinitions` storage domain. Once registered, the workflow runs like any other workflow via [`getWorkflow()`](https://mastra.ai/reference/core/getWorkflow).
|
|
8
8
|
|
|
9
|
-
See [
|
|
9
|
+
See [Dynamic workflows](https://mastra.ai/docs/workflows/dynamic-workflows) for a complete setup example and the [dynamic workflow definition reference](https://mastra.ai/reference/workflows/dynamic-workflow-definition) for the accepted fields and graph entries.
|
|
10
10
|
|
|
11
11
|
## Usage example
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
await mastra.
|
|
14
|
+
await mastra.addDynamicWorkflow({
|
|
15
15
|
id: 'greeting-workflow',
|
|
16
16
|
description: 'Returns a greeting for the supplied name',
|
|
17
17
|
inputSchema: {
|
|
@@ -41,7 +41,7 @@ const result = await run.start({ inputData: { name: 'Ada' } })
|
|
|
41
41
|
|
|
42
42
|
## Parameters
|
|
43
43
|
|
|
44
|
-
**def** (`
|
|
44
|
+
**def** (`DynamicWorkflowGraph`): The workflow definition: id, optional description and metadata, JSON Schema input/output schemas, optional state and request-context schemas, and the step graph.
|
|
45
45
|
|
|
46
46
|
## Returns
|
|
47
47
|
|
|
@@ -52,11 +52,11 @@ A promise that resolves once the definition is validated, registered, and persis
|
|
|
52
52
|
- The definition is fully validated (structure, references, schema flow) before anything is mutated. Agents, tools, and workflows referenced by the graph must already be registered on the instance.
|
|
53
53
|
- Adding a definition with an existing ID replaces both the stored definition and the live registration. In-flight runs keep the graph they started with.
|
|
54
54
|
- Without a storage adapter that supports the `workflowDefinitions` domain, the workflow is still validated and registered in memory, but the definition is lost on restart.
|
|
55
|
-
- To add a root workflow together with helper workflows it nests, use [`
|
|
55
|
+
- To add a root workflow together with helper workflows it nests, use [`addDynamicWorkflows()`](https://mastra.ai/reference/core/addDynamicWorkflows).
|
|
56
56
|
|
|
57
57
|
## Related
|
|
58
58
|
|
|
59
|
-
- [Mastra.
|
|
59
|
+
- [Mastra.addDynamicWorkflows()](https://mastra.ai/reference/core/addDynamicWorkflows): Add a dependency-ordered bundle of definitions
|
|
60
60
|
- [Mastra.getWorkflow()](https://mastra.ai/reference/core/getWorkflow): Retrieve a registered workflow
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
61
|
+
- [Dynamic workflows](https://mastra.ai/docs/workflows/dynamic-workflows): Set up and use dynamic workflows
|
|
62
|
+
- [Dynamic workflow definition](https://mastra.ai/reference/workflows/dynamic-workflow-definition): Definition fields and graph entries
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
2
|
|
|
3
|
-
# Mastra.
|
|
3
|
+
# Mastra.addDynamicWorkflows()
|
|
4
4
|
|
|
5
|
-
> **Beta:**
|
|
5
|
+
> **Beta:** Dynamic workflows are in beta. Breaking changes may occur without a major version bump until the API is stable.
|
|
6
6
|
|
|
7
|
-
The `.
|
|
7
|
+
The `.addDynamicWorkflows()` method adds a bundle of dynamic workflow definitions that may reference each other. The typical case is a root workflow plus helper workflows it nests, where none of the definitions exist yet.
|
|
8
8
|
|
|
9
9
|
The whole bundle is validated up front. Members are then registered in dependency order, so a helper is always in place before the workflow that nests it.
|
|
10
10
|
|
|
11
|
-
[`
|
|
11
|
+
[`addDynamicWorkflow()`](https://mastra.ai/reference/core/addDynamicWorkflow) is the single-member case.
|
|
12
12
|
|
|
13
13
|
## Usage example
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
await mastra.
|
|
16
|
+
await mastra.addDynamicWorkflows([
|
|
17
17
|
helperDefinition, // nested by the root — order in the array doesn't matter
|
|
18
18
|
rootDefinition, // graph contains { type: 'workflow', workflowId: helperDefinition.id }
|
|
19
19
|
])
|
|
@@ -21,7 +21,7 @@ await mastra.addStoredWorkflows([
|
|
|
21
21
|
|
|
22
22
|
## Parameters
|
|
23
23
|
|
|
24
|
-
**defs** (`readonly
|
|
24
|
+
**defs** (`readonly DynamicWorkflowGraph[]`): The workflow definitions to add. Nested-workflow references may resolve against the live registries or against other members of the same bundle.
|
|
25
25
|
|
|
26
26
|
## Returns
|
|
27
27
|
|
|
@@ -35,6 +35,6 @@ A promise that resolves once every member is validated, registered, and persiste
|
|
|
35
35
|
|
|
36
36
|
## Related
|
|
37
37
|
|
|
38
|
-
- [Mastra.
|
|
39
|
-
- [
|
|
40
|
-
- [
|
|
38
|
+
- [Mastra.addDynamicWorkflow()](https://mastra.ai/reference/core/addDynamicWorkflow): Add a single definition
|
|
39
|
+
- [Dynamic workflows](https://mastra.ai/docs/workflows/dynamic-workflows): Set up and use dynamic workflows
|
|
40
|
+
- [Dynamic workflow definition](https://mastra.ai/reference/workflows/dynamic-workflow-definition): Definition fields and graph entries
|
|
@@ -83,7 +83,32 @@ Composio tools use uppercase slug format: `GITHUB_CREATE_ISSUE`, `SLACK_SEND_MES
|
|
|
83
83
|
|
|
84
84
|
### Authentication
|
|
85
85
|
|
|
86
|
-
Connections use per-author scope by default. Set `defaultScope: 'caller-supplied'` to bucket authorization by the caller identity resolved from request context.
|
|
86
|
+
Connections use per-author scope by default. Set `defaultScope: 'caller-supplied'` to bucket authorization by the caller identity resolved from `MASTRA_RESOURCE_ID_KEY` in request context. Ensure each authenticated request provides a stable, unique resource ID. When using `MastraAuthWorkos`, configure `mapUserToResourceId` to set this value from the authenticated user.
|
|
87
|
+
|
|
88
|
+
### Connection management tools
|
|
89
|
+
|
|
90
|
+
Composio provides tools for starting and monitoring authorization from an agent chat. When `allowedToolkits` is set, include `composio` to make these tools available:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
const editor = new MastraEditor({
|
|
94
|
+
toolProviders: {
|
|
95
|
+
composio: new ComposioToolProvider({
|
|
96
|
+
apiKey: process.env.COMPOSIO_API_KEY!,
|
|
97
|
+
allowedToolkits: ['composio', 'gmail'],
|
|
98
|
+
defaultScope: 'caller-supplied',
|
|
99
|
+
}),
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Add only the connection management tools that the agent needs:
|
|
105
|
+
|
|
106
|
+
| Tool | Behavior |
|
|
107
|
+
| ------------------------------- | ---------------------------------------------------------------------------- |
|
|
108
|
+
| `COMPOSIO_MANAGE_CONNECTIONS` | Creates an authorization link in chat through a session owned by the caller. |
|
|
109
|
+
| `COMPOSIO_WAIT_FOR_CONNECTIONS` | Waits for the caller to finish authorization before the agent continues. |
|
|
110
|
+
|
|
111
|
+
`COMPOSIO_WAIT_FOR_CONNECTIONS` is optional. Without it, complete authorization and return to the chat. Then ask the agent to continue. The connected account remains associated with the caller resource ID for later requests.
|
|
87
112
|
|
|
88
113
|
***
|
|
89
114
|
|
|
@@ -69,32 +69,33 @@ Please note:
|
|
|
69
69
|
|
|
70
70
|
Keep `config.ts` focused on runtime options. Use sibling files for concerns that benefit from their own location.
|
|
71
71
|
|
|
72
|
-
| Setting | File or folder
|
|
73
|
-
| ------------ |
|
|
74
|
-
| Instructions | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | Keeps the always-on prompt readable as markdown
|
|
75
|
-
| Tools | [`tools/`](https://mastra.ai/reference/file-based-agents/tools)
|
|
76
|
-
| Skills | [`skills/`](https://mastra.ai/reference/file-based-agents/skills)
|
|
77
|
-
| Memory | [`memory.ts`](https://mastra.ai/reference/file-based-agents/memory)
|
|
78
|
-
| Workspace | [`workspace.ts`](https://mastra.ai/reference/file-based-agents/workspace)
|
|
79
|
-
| Processors | [`processors/`](https://mastra.ai/reference/file-based-agents/processors)
|
|
80
|
-
| Subagents | [`subagents/`](https://mastra.ai/reference/file-based-agents/subagents)
|
|
72
|
+
| Setting | File or folder | Why it lives there |
|
|
73
|
+
| ------------ | ---------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
74
|
+
| Instructions | [`instructions.md` or `instructions.ts`](https://mastra.ai/reference/file-based-agents/instructions) | Keeps the always-on prompt readable as markdown, or computed in TypeScript |
|
|
75
|
+
| Tools | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | Gives each callable action its own typed module |
|
|
76
|
+
| Skills | [`skills/`](https://mastra.ai/reference/file-based-agents/skills) | Keeps load-on-demand procedures separate from always-on instructions |
|
|
77
|
+
| Memory | [`memory.ts`](https://mastra.ai/reference/file-based-agents/memory) | Configures persistent memory without crowding runtime options |
|
|
78
|
+
| Workspace | [`workspace.ts`](https://mastra.ai/reference/file-based-agents/workspace) | Configures files and sandbox behavior separately from model settings |
|
|
79
|
+
| Processors | [`processors/`](https://mastra.ai/reference/file-based-agents/processors) | Separates input and output processing pipelines |
|
|
80
|
+
| Subagents | [`subagents/`](https://mastra.ai/reference/file-based-agents/subagents) | Gives each specialist child agent its own directory |
|
|
81
81
|
|
|
82
82
|
## Precedence
|
|
83
83
|
|
|
84
84
|
`config.ts` merges with the agent's other files according to these rules:
|
|
85
85
|
|
|
86
|
-
| Domain | Source A
|
|
87
|
-
| ------------ |
|
|
88
|
-
| Instructions | Dynamic `config.instructions`
|
|
89
|
-
| Instructions | Static `config.instructions`
|
|
90
|
-
|
|
|
91
|
-
| Tools |
|
|
92
|
-
|
|
|
93
|
-
| Skills |
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
| Domain | Source A | Source B | Winner |
|
|
87
|
+
| ------------ | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
|
88
|
+
| Instructions | Dynamic `config.instructions` | [`instructions.ts` or `instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | Dynamic `config.instructions` |
|
|
89
|
+
| Instructions | Static `config.instructions` | [`instructions.ts` or `instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | The instructions file |
|
|
90
|
+
| Instructions | [`instructions.ts`](https://mastra.ai/reference/file-based-agents/instructions) | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | `instructions.ts` |
|
|
91
|
+
| Tools | `config.tools` | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | Both merge; `config.tools` wins on key collisions |
|
|
92
|
+
| Tools | Function `config.tools` | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | Function `config.tools`; discovered tools are ignored |
|
|
93
|
+
| Skills | `config.skills` | [`skills/`](https://mastra.ai/reference/file-based-agents/skills) | Both merge; `config.skills` wins on name collisions |
|
|
94
|
+
| Skills | Function `config.skills` | [`skills/`](https://mastra.ai/reference/file-based-agents/skills) | Function `config.skills`; discovered skills are ignored |
|
|
95
|
+
| Memory | `config.memory` | [`memory.ts`](https://mastra.ai/reference/file-based-agents/memory) | `config.memory` |
|
|
96
|
+
| Workspace | `config.workspace` | [`workspace.ts`](https://mastra.ai/reference/file-based-agents/workspace) | `config.workspace` |
|
|
97
|
+
|
|
98
|
+
Missing `instructions.md`, `instructions.ts`, and `config.instructions` fails the build. Missing both `config.memory` and `memory.ts` leaves the agent without memory.
|
|
98
99
|
|
|
99
100
|
## Discovery lifecycle
|
|
100
101
|
|