@mastra/mcp-docs-server 0.13.11 → 0.13.12-alpha.1
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/organized/changelogs/%40internal%2Fstorage-test-utils.md +19 -19
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +42 -42
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +53 -53
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +49 -49
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +49 -49
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +54 -54
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Flance.md +22 -22
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +37 -37
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +49 -49
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Frag.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +8 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +44 -44
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +14 -0
- package/.docs/organized/changelogs/create-mastra.md +26 -26
- package/.docs/organized/changelogs/mastra.md +63 -63
- package/.docs/organized/code-examples/agent.md +292 -275
- package/.docs/raw/agents/input-processors.mdx +25 -19
- package/.docs/raw/agents/output-processors.mdx +376 -0
- package/.docs/raw/agents/overview.mdx +165 -188
- package/.docs/raw/agents/streaming.mdx +11 -5
- package/.docs/raw/community/contributing-templates.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +9 -9
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +27 -33
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +12 -12
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +17 -17
- package/.docs/raw/getting-started/templates.mdx +1 -1
- package/.docs/raw/rag/vector-databases.mdx +9 -1
- package/.docs/raw/reference/agents/agent.mdx +9 -3
- package/.docs/raw/reference/agents/generate.mdx +80 -3
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +1 -1
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +1 -1
- package/.docs/raw/reference/agents/getDefaultVNextStreamOptions.mdx +1 -1
- package/.docs/raw/reference/agents/getLLM.mdx +1 -1
- package/.docs/raw/reference/agents/streamVNext.mdx +88 -5
- package/.docs/raw/reference/cli/scorers.mdx +160 -0
- package/.docs/raw/reference/rag/chroma.mdx +158 -17
- package/.docs/raw/reference/templates.mdx +3 -3
- package/.docs/raw/reference/tools/create-tool.mdx +2 -2
- package/.docs/raw/reference/tools/mcp-client.mdx +9 -9
- package/.docs/raw/reference/tools/mcp-server.mdx +5 -5
- package/.docs/raw/reference/workflows/branch.mdx +1 -1
- package/.docs/raw/reference/workflows/create-run.mdx +4 -4
- package/.docs/raw/reference/workflows/execute.mdx +2 -2
- package/.docs/raw/reference/workflows/foreach.mdx +1 -1
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +58 -0
- package/.docs/raw/reference/workflows/{resume.mdx → run-methods/resume.mdx} +7 -5
- package/.docs/raw/reference/workflows/{start.mdx → run-methods/start.mdx} +5 -5
- package/.docs/raw/reference/workflows/{stream.mdx → run-methods/stream.mdx} +6 -3
- package/.docs/raw/reference/workflows/{streamVNext.mdx → run-methods/streamVNext.mdx} +14 -9
- package/.docs/raw/reference/workflows/{watch.mdx → run-methods/watch.mdx} +12 -12
- package/.docs/raw/reference/workflows/run.mdx +104 -0
- package/.docs/raw/reference/workflows/step.mdx +0 -1
- package/.docs/raw/reference/workflows/workflow.mdx +3 -2
- package/.docs/raw/{reference/workflows → server-db}/snapshots.mdx +2 -2
- package/.docs/raw/voice/overview.mdx +81 -2
- package/.docs/raw/voice/speech-to-speech.mdx +45 -0
- package/.docs/raw/workflows/overview.mdx +11 -4
- package/.docs/raw/workflows-legacy/overview.mdx +8 -8
- package/package.json +4 -4
|
@@ -127,5 +127,5 @@ await workflow.execute({
|
|
|
127
127
|
## Related
|
|
128
128
|
|
|
129
129
|
- [Workflow.createRunAsync()](./create-run.mdx) - Alternative method for creating workflow runs
|
|
130
|
-
- [WorkflowRun.start()](./start.mdx) - Starting workflow execution
|
|
131
|
-
- [
|
|
130
|
+
- [WorkflowRun.start()](./run-methods/start.mdx) - Starting workflow execution
|
|
131
|
+
- [Workflows overview](../../docs/workflows/overview.mdx#run-workflow)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: Run.cancel() | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the `Run.cancel()` method in workflows, which cancels a workflow run.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Run.cancel()
|
|
7
|
+
|
|
8
|
+
The `.cancel()` method cancels a workflow run, stopping execution and cleaning up resources.
|
|
9
|
+
|
|
10
|
+
## Usage example
|
|
11
|
+
|
|
12
|
+
```typescript showLineNumbers copy
|
|
13
|
+
const run = await workflow.createRunAsync();
|
|
14
|
+
|
|
15
|
+
await run.cancel();
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
<PropertiesTable
|
|
21
|
+
content={[
|
|
22
|
+
{
|
|
23
|
+
name: "No parameters",
|
|
24
|
+
type: "void",
|
|
25
|
+
description: "This method takes no parameters",
|
|
26
|
+
isOptional: false,
|
|
27
|
+
},
|
|
28
|
+
]}
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
## Returns
|
|
32
|
+
|
|
33
|
+
<PropertiesTable
|
|
34
|
+
content={[
|
|
35
|
+
{
|
|
36
|
+
name: "result",
|
|
37
|
+
type: "Promise<void>",
|
|
38
|
+
description: "A promise that resolves when the workflow run has been cancelled",
|
|
39
|
+
},
|
|
40
|
+
]}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
## Extended usage example
|
|
44
|
+
|
|
45
|
+
```typescript showLineNumbers copy
|
|
46
|
+
const run = await workflow.createRunAsync();
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const result = await run.start({ inputData: { value: "initial data" } });
|
|
50
|
+
} catch (error) {
|
|
51
|
+
await run.cancel();
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Related
|
|
56
|
+
|
|
57
|
+
- [Workflows overview](../../../docs/workflows/overview.mdx#run-workflow)
|
|
58
|
+
- [Workflow.createRunAsync()](../create-run.mdx)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference:
|
|
3
|
-
description: Documentation for the `
|
|
2
|
+
title: "Reference: Run.resume() | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the `Run.resume()` method in workflows, which resumes a suspended workflow run with new data.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Run.resume()
|
|
7
7
|
|
|
8
8
|
The `.resume()` method resumes a suspended workflow run with new data, allowing you to continue execution from a specific step.
|
|
9
9
|
|
|
@@ -77,5 +77,7 @@ if (result.status === "suspended") {
|
|
|
77
77
|
|
|
78
78
|
## Related
|
|
79
79
|
|
|
80
|
-
- [
|
|
81
|
-
- [
|
|
80
|
+
- [Workflows overview](../../../docs/workflows/overview.mdx#run-workflow)
|
|
81
|
+
- [Workflow.createRunAsync()](../create-run.mdx)
|
|
82
|
+
- [Suspend and resume](../../../docs/workflows/suspend-and-resume.mdx)
|
|
83
|
+
- [Human in the loop example](../../../examples/workflows/human-in-the-loop.mdx)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference:
|
|
3
|
-
description: Documentation for the `
|
|
2
|
+
title: "Reference: Run.start() | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the `Run.start()` method in workflows, which starts a workflow run with input data.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Run.start()
|
|
7
7
|
|
|
8
8
|
The `.start()` method starts a workflow run with input data, allowing you to execute the workflow from the beginning.
|
|
9
9
|
|
|
@@ -76,5 +76,5 @@ const result = await run.start({
|
|
|
76
76
|
|
|
77
77
|
## Related
|
|
78
78
|
|
|
79
|
-
- [
|
|
80
|
-
- [
|
|
79
|
+
- [Workflows overview](../../../docs/workflows/overview.mdx#run-workflow)
|
|
80
|
+
- [Workflow.createRunAsync()](../create-run.mdx)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference:
|
|
3
|
-
description: Documentation for the `
|
|
2
|
+
title: "Reference: Run.stream() | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the `Run.stream()` method in workflows, which allows you to monitor the execution of a workflow run as a stream.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Run.stream()
|
|
7
7
|
|
|
8
8
|
The `.stream()` method allows you to monitor the execution of a workflow run, providing real-time updates on the status of steps.
|
|
9
9
|
|
|
@@ -81,4 +81,7 @@ The stream emits various event types during workflow execution. Each event has a
|
|
|
81
81
|
- **`finish`**: Workflow execution completes
|
|
82
82
|
|
|
83
83
|
|
|
84
|
+
## Related
|
|
84
85
|
|
|
86
|
+
- [Workflows overview](../../../docs/workflows/overview.mdx#run-workflow)
|
|
87
|
+
- [Workflow.createRunAsync()](../create-run.mdx)
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference:
|
|
3
|
-
description: Documentation for the `
|
|
2
|
+
title: "Reference: Run.streamVNext() | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the `Run.streamVNext()` method in workflows, which enables real-time streaming of responses.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { Callout } from "nextra/components";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
# Run.streamVNext()
|
|
9
|
+
|
|
10
|
+
<Callout type="warning">
|
|
11
|
+
**Experimental Feature**: This is a new streaming implementation that will replace the existing `stream()` method once battle-tested. The API may change as we refine the feature based on feedback.
|
|
12
|
+
</Callout>
|
|
13
|
+
|
|
14
|
+
The `.streamVNext()` method enables real-time streaming of responses from a workflow. This enhanced streaming capability will eventually replace the current `stream()` method.
|
|
9
15
|
|
|
10
16
|
## Usage example
|
|
11
17
|
|
|
@@ -49,7 +55,7 @@ const stream = run.streamVNext({
|
|
|
49
55
|
},
|
|
50
56
|
{
|
|
51
57
|
name: "stream.status",
|
|
52
|
-
type: "Promise<
|
|
58
|
+
type: "Promise<RunStatus>",
|
|
53
59
|
description: "A promise that resolves to the current workflow run status",
|
|
54
60
|
},
|
|
55
61
|
{
|
|
@@ -89,8 +95,7 @@ The stream emits various event types during workflow execution. Each event has a
|
|
|
89
95
|
- **`step-result`**: A step completes with results
|
|
90
96
|
- **`finish`**: Workflow execution completes with usage statistics
|
|
91
97
|
|
|
98
|
+
## Related
|
|
92
99
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
- [Workflows overview](../../../docs/workflows/overview.mdx#run-workflow)
|
|
101
|
+
- [Workflow.createRunAsync()](../create-run.mdx)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference:
|
|
3
|
-
description: Documentation for the `
|
|
2
|
+
title: "Reference: Run.watch() | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the `Run.watch()` method in workflows, which allows you to monitor the execution of a workflow run.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Run.watch()
|
|
7
7
|
|
|
8
8
|
The `.watch()` method allows you to monitor the execution of a workflow run, providing real-time updates on the status of steps.
|
|
9
9
|
|
|
@@ -12,8 +12,8 @@ The `.watch()` method allows you to monitor the execution of a workflow run, pro
|
|
|
12
12
|
```typescript showLineNumbers copy
|
|
13
13
|
const run = await workflow.createRunAsync();
|
|
14
14
|
|
|
15
|
-
run.watch(event => {
|
|
16
|
-
console.log(
|
|
15
|
+
run.watch((event) => {
|
|
16
|
+
console.log(event?.payload?.currentStep?.id);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
const result = await run.start({ inputData: { value: "initial data" } });
|
|
@@ -59,16 +59,16 @@ const result = await run.start({ inputData: { value: "initial data" } });
|
|
|
59
59
|
const run = await workflow.createRunAsync();
|
|
60
60
|
|
|
61
61
|
run.watch((event) => {
|
|
62
|
-
console.log(
|
|
63
|
-
},
|
|
64
|
-
|
|
62
|
+
console.log(event?.payload?.currentStep?.id);
|
|
63
|
+
}, "watch");
|
|
65
64
|
|
|
66
65
|
const result = await run.start({ inputData: { value: "initial data" } });
|
|
67
66
|
```
|
|
68
67
|
|
|
69
68
|
## Related
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
- [
|
|
74
|
-
- [Workflow
|
|
70
|
+
## Related
|
|
71
|
+
|
|
72
|
+
- [Workflows overview](../../../docs/workflows/overview.mdx#run-workflow)
|
|
73
|
+
- [Workflow.createRunAsync()](../create-run.mdx)
|
|
74
|
+
- [Watch Workflow](../../../docs/workflows/overview.mdx#watch-workflow)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: Run Class | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the Run class in Mastra, which represents a workflow execution instance.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Run Class
|
|
7
|
+
|
|
8
|
+
The `Run` class represents a workflow execution instance, providing methods to start, resume, stream, and monitor workflow execution.
|
|
9
|
+
|
|
10
|
+
## Usage example
|
|
11
|
+
|
|
12
|
+
```typescript showLineNumbers copy
|
|
13
|
+
const run = await workflow.createRunAsync();
|
|
14
|
+
|
|
15
|
+
const result = await run.start({
|
|
16
|
+
inputData: { value: "initial data" }
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (result.status === "suspended") {
|
|
20
|
+
const resumedResult = await run.resume({
|
|
21
|
+
resumeData: { value: "resume data" }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Run Methods
|
|
27
|
+
|
|
28
|
+
<PropertiesTable
|
|
29
|
+
content={[
|
|
30
|
+
{
|
|
31
|
+
name: "start",
|
|
32
|
+
type: "(options?: StartOptions) => Promise<WorkflowResult>",
|
|
33
|
+
description: "Starts workflow execution with input data",
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "resume",
|
|
38
|
+
type: "(options?: ResumeOptions) => Promise<WorkflowResult>",
|
|
39
|
+
description: "Resumes a suspended workflow from a specific step",
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "stream",
|
|
44
|
+
type: "(options?: StreamOptions) => Promise<StreamResult>",
|
|
45
|
+
description: "Monitors workflow execution as a stream of events",
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "streamVNext",
|
|
50
|
+
type: "(options?: StreamOptions) => MastraWorkflowStream",
|
|
51
|
+
description: "Enables real-time streaming with enhanced features",
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "watch",
|
|
56
|
+
type: "(callback: WatchCallback, type?: WatchType) => UnwatchFunction",
|
|
57
|
+
description: "Monitors workflow execution with callback-based events",
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "cancel",
|
|
62
|
+
type: "() => Promise<void>",
|
|
63
|
+
description: "Cancels the workflow execution",
|
|
64
|
+
required: true,
|
|
65
|
+
}
|
|
66
|
+
]}
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
## Run Status
|
|
70
|
+
|
|
71
|
+
A workflow run's `status` indicates its current execution state. The possible values are:
|
|
72
|
+
|
|
73
|
+
<PropertiesTable
|
|
74
|
+
content={[
|
|
75
|
+
{
|
|
76
|
+
name: "success",
|
|
77
|
+
type: "string",
|
|
78
|
+
description:
|
|
79
|
+
"All steps finished executing successfully, with a valid result output",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "failed",
|
|
83
|
+
type: "string",
|
|
84
|
+
description:
|
|
85
|
+
"Workflow execution encountered an error during execution, with error details available",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "suspended",
|
|
89
|
+
type: "string",
|
|
90
|
+
description:
|
|
91
|
+
"Workflow execution is paused waiting for resume, with suspended step information",
|
|
92
|
+
},
|
|
93
|
+
]}
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
## Related
|
|
97
|
+
|
|
98
|
+
- [Running workflows](../../examples/workflows/running-workflows.mdx)
|
|
99
|
+
- [Run.start()](./run-methods/start.mdx)
|
|
100
|
+
- [Run.resume()](./run-methods/resume.mdx)
|
|
101
|
+
- [Run.stream()](./run-methods/stream.mdx)
|
|
102
|
+
- [Run.streamVNext()](./run-methods/streamVNext.mdx)
|
|
103
|
+
- [Run.watch()](./run-methods/watch.mdx)
|
|
104
|
+
- [Run.cancel()](./run-methods/cancel.mdx)
|
|
@@ -13,7 +13,7 @@ The `Workflow` class enables you to create state machines for complex sequences
|
|
|
13
13
|
import { createWorkflow } from "@mastra/core/workflows";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
|
|
16
|
-
const workflow = createWorkflow({
|
|
16
|
+
export const workflow = createWorkflow({
|
|
17
17
|
id: "test-workflow",
|
|
18
18
|
inputSchema: z.object({
|
|
19
19
|
value: z.string(),
|
|
@@ -89,4 +89,5 @@ if (result.status === "suspended") {
|
|
|
89
89
|
|
|
90
90
|
## Related
|
|
91
91
|
|
|
92
|
-
- [
|
|
92
|
+
- [Step Class](./step.mdx)
|
|
93
|
+
- [Control flow](../../docs/workflows/control-flow.mdx)
|
|
@@ -79,7 +79,7 @@ Mastra persists snapshots to the configured storage system. By default, snapshot
|
|
|
79
79
|
The snapshots are stored in the `workflow_snapshots` table and identified uniquely by the `run_id` for the associated run when using libsql.
|
|
80
80
|
Utilizing a persistence layer allows for the snapshots to be persisted across workflow runs, allowing for advanced human-in-the-loop functionality.
|
|
81
81
|
|
|
82
|
-
Read more about [libsql storage](
|
|
82
|
+
Read more about [libsql storage](../../reference/storage/libsql.mdx) and [upstash storage](../../reference/storage/upstash.mdx) here.
|
|
83
83
|
|
|
84
84
|
### Saving Snapshots
|
|
85
85
|
|
|
@@ -206,4 +206,4 @@ run.watch(async ({ activePaths }) => {
|
|
|
206
206
|
|
|
207
207
|
- [Suspend and resume](../../docs/workflows/suspend-and-resume.mdx)
|
|
208
208
|
- [Human in the loop example](../../examples/workflows/human-in-the-loop.mdx)
|
|
209
|
-
- [
|
|
209
|
+
- [WorkflowRun.watch()](../../reference/workflows/run-methods/watch.mdx)
|
|
@@ -548,7 +548,7 @@ For detailed configuration options and advanced features, check out [Speech to S
|
|
|
548
548
|
The tab shows how to set up real-time voice communication with event handling for audio responses.
|
|
549
549
|
This enables conversational AI experiences with continuous audio streaming.
|
|
550
550
|
*/}
|
|
551
|
-
<Tabs items={["OpenAI"]}>
|
|
551
|
+
<Tabs items={["OpenAI", "Google Gemini Live"]}>
|
|
552
552
|
<Tabs.Tab>
|
|
553
553
|
```typescript
|
|
554
554
|
import { Agent } from '@mastra/core/agent';
|
|
@@ -578,6 +578,53 @@ await voiceAgent.voice.send(micStream);
|
|
|
578
578
|
|
|
579
579
|
Visit the [OpenAI Voice Reference](/reference/voice/openai-realtime) for more information on the OpenAI voice provider.
|
|
580
580
|
|
|
581
|
+
</Tabs.Tab>
|
|
582
|
+
<Tabs.Tab>
|
|
583
|
+
```typescript
|
|
584
|
+
import { Agent } from '@mastra/core/agent';
|
|
585
|
+
import { openai } from '@ai-sdk/openai';
|
|
586
|
+
import { playAudio, getMicrophoneStream } from '@mastra/node-audio';
|
|
587
|
+
import { GeminiLiveVoice } from "@mastra/voice-google-gemini-live";
|
|
588
|
+
|
|
589
|
+
const voiceAgent = new Agent({
|
|
590
|
+
name: "Voice Agent",
|
|
591
|
+
instructions: "You are a voice assistant that can help users with their tasks.",
|
|
592
|
+
model: openai("gpt-4o"),
|
|
593
|
+
voice: new GeminiLiveVoice({
|
|
594
|
+
// Live API mode
|
|
595
|
+
apiKey: process.env.GOOGLE_API_KEY,
|
|
596
|
+
model: 'gemini-2.0-flash-exp',
|
|
597
|
+
speaker: 'Puck',
|
|
598
|
+
debug: true,
|
|
599
|
+
// Vertex AI alternative:
|
|
600
|
+
// vertexAI: true,
|
|
601
|
+
// project: 'your-gcp-project',
|
|
602
|
+
// location: 'us-central1',
|
|
603
|
+
// serviceAccountKeyFile: '/path/to/service-account.json',
|
|
604
|
+
}),
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
// Connect before using speak/send
|
|
608
|
+
await voiceAgent.voice.connect();
|
|
609
|
+
|
|
610
|
+
// Listen for agent audio responses
|
|
611
|
+
voiceAgent.voice.on('speaker', ({ audio }) => {
|
|
612
|
+
playAudio(audio);
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
// Listen for text responses and transcriptions
|
|
616
|
+
voiceAgent.voice.on('writing', ({ text, role }) => {
|
|
617
|
+
console.log(`${role}: ${text}`);
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
// Initiate the conversation
|
|
621
|
+
await voiceAgent.voice.speak('How can I help you today?');
|
|
622
|
+
|
|
623
|
+
// Send continuous audio from the microphone
|
|
624
|
+
const micStream = getMicrophoneStream();
|
|
625
|
+
await voiceAgent.voice.send(micStream);
|
|
626
|
+
```
|
|
627
|
+
|
|
581
628
|
</Tabs.Tab>
|
|
582
629
|
</Tabs>
|
|
583
630
|
|
|
@@ -592,7 +639,7 @@ The tabs help users understand the full configuration capabilities of each provi
|
|
|
592
639
|
Each tab shows both speech and listening model configurations where applicable.
|
|
593
640
|
*/}
|
|
594
641
|
|
|
595
|
-
<Tabs items={["OpenAI", "Azure", "ElevenLabs", "PlayAI", "Google", "Cloudflare", "Deepgram", "Speechify", "Sarvam", "Murf", "OpenAI Realtime"]}>
|
|
642
|
+
<Tabs items={["OpenAI", "Azure", "ElevenLabs", "PlayAI", "Google", "Cloudflare", "Deepgram", "Speechify", "Sarvam", "Murf", "OpenAI Realtime", "Google Gemini Live"]}>
|
|
596
643
|
<Tabs.Tab>
|
|
597
644
|
```typescript
|
|
598
645
|
// OpenAI Voice Configuration
|
|
@@ -618,6 +665,38 @@ Visit the [OpenAI Voice Reference](/reference/voice/openai) for more information
|
|
|
618
665
|
</Tabs.Tab>
|
|
619
666
|
<Tabs.Tab>
|
|
620
667
|
```typescript
|
|
668
|
+
// Google Gemini Live Voice Configuration
|
|
669
|
+
import { GeminiLiveVoice } from '@mastra/voice-google-gemini-live';
|
|
670
|
+
|
|
671
|
+
const voice = new GeminiLiveVoice({
|
|
672
|
+
// Live API
|
|
673
|
+
apiKey: process.env.GOOGLE_API_KEY,
|
|
674
|
+
model: 'gemini-2.0-flash-exp',
|
|
675
|
+
speaker: 'Puck',
|
|
676
|
+
debug: true,
|
|
677
|
+
// Vertex AI alternative:
|
|
678
|
+
// vertexAI: true,
|
|
679
|
+
// project: 'your-gcp-project',
|
|
680
|
+
// location: 'us-central1',
|
|
681
|
+
// serviceAccountKeyFile: '/path/to/service-account.json',
|
|
682
|
+
// sessionConfig: {
|
|
683
|
+
// vad: { enabled: true, sensitivity: 0.5, silenceDurationMs: 1000 },
|
|
684
|
+
// interrupts: { enabled: true, allowUserInterruption: true },
|
|
685
|
+
// contextCompression: false,
|
|
686
|
+
// }
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
// Per-turn overrides
|
|
690
|
+
await voice.speak('Hello', {
|
|
691
|
+
languageCode: 'en-US',
|
|
692
|
+
responseModalities: ['AUDIO'] as any,
|
|
693
|
+
speaker: 'Puck',
|
|
694
|
+
});
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
</Tabs.Tab>
|
|
698
|
+
<Tabs.Tab>
|
|
699
|
+
```typescript
|
|
621
700
|
// Azure Voice Configuration
|
|
622
701
|
const voice = new AzureVoice({
|
|
623
702
|
speechModel: {
|
|
@@ -58,3 +58,48 @@ await agent.voice.send(micStream);
|
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
For integrating Speech-to-Speech capabilities with agents, refer to the [Adding Voice to Agents](../agents/adding-voice.mdx) documentation.
|
|
61
|
+
|
|
62
|
+
## Google Gemini Live (Realtime)
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { Agent } from "@mastra/core/agent";
|
|
66
|
+
import { GeminiLiveVoice } from "@mastra/voice-google-gemini-live";
|
|
67
|
+
import { playAudio, getMicrophoneStream } from "@mastra/node-audio";
|
|
68
|
+
|
|
69
|
+
const agent = new Agent({
|
|
70
|
+
name: 'Agent',
|
|
71
|
+
instructions: 'You are a helpful assistant with real-time voice capabilities.',
|
|
72
|
+
// Model used for text generation; voice provider handles realtime audio
|
|
73
|
+
model: openai("gpt-4o"),
|
|
74
|
+
voice: new GeminiLiveVoice({
|
|
75
|
+
apiKey: process.env.GOOGLE_API_KEY,
|
|
76
|
+
model: 'gemini-2.0-flash-exp',
|
|
77
|
+
speaker: 'Puck',
|
|
78
|
+
debug: true,
|
|
79
|
+
// Vertex AI option:
|
|
80
|
+
// vertexAI: true,
|
|
81
|
+
// project: 'your-gcp-project',
|
|
82
|
+
// location: 'us-central1',
|
|
83
|
+
// serviceAccountKeyFile: '/path/to/service-account.json',
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
await agent.voice.connect();
|
|
88
|
+
|
|
89
|
+
agent.voice.on('speaker', ({ audio }) => {
|
|
90
|
+
playAudio(audio);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
agent.voice.on('writing', ({ role, text }) => {
|
|
94
|
+
console.log(`${role}: ${text}`);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
await agent.voice.speak('How can I help you today?');
|
|
98
|
+
|
|
99
|
+
const micStream = getMicrophoneStream();
|
|
100
|
+
await agent.voice.send(micStream);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Note:
|
|
104
|
+
- Live API requires `GOOGLE_API_KEY`. Vertex AI requires project/location and service account credentials.
|
|
105
|
+
- Events: `speaker` (audio stream), `writing` (text), `turnComplete`, `usage`, and `error`.
|
|
@@ -21,10 +21,17 @@ You create workflows by:
|
|
|
21
21
|
|
|
22
22
|
This structure provides full type safety and runtime validation, ensuring data integrity across the entire workflow.
|
|
23
23
|
|
|
24
|
+
> **📹 Watch**: → An introduction to workflows, and how they compare to agents [YouTube (7 minutes)](https://youtu.be/0jg2g3sNvgw)
|
|
24
25
|
|
|
25
26
|
## Getting started
|
|
26
27
|
|
|
27
|
-
To use workflows,
|
|
28
|
+
To use workflows, install the required dependencies:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install @mastra/core
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Import the necessary functions from the `workflows` subpath:
|
|
28
35
|
|
|
29
36
|
```typescript filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
30
37
|
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
@@ -179,7 +186,7 @@ if (result.status === 'success') {
|
|
|
179
186
|
console.log(`output value: ${result.result.output}`);
|
|
180
187
|
}
|
|
181
188
|
```
|
|
182
|
-
> see [createRunAsync](/reference/workflows/create-run) and [start](/reference/workflows/start) for more information.
|
|
189
|
+
> see [createRunAsync](/reference/workflows/create-run) and [start](/reference/workflows/run-methods/start) for more information.
|
|
183
190
|
|
|
184
191
|
To trigger this workflow, run the following:
|
|
185
192
|
|
|
@@ -277,7 +284,7 @@ for await (const chunk of result.stream) {
|
|
|
277
284
|
}
|
|
278
285
|
```
|
|
279
286
|
|
|
280
|
-
> See [stream](/reference/workflows/stream) and [messages](/reference/workflows/stream#messages) for more information.
|
|
287
|
+
> See [stream](/reference/workflows/run-methods/stream) and [messages](/reference/workflows/run-methods/stream#messages) for more information.
|
|
281
288
|
|
|
282
289
|
### Watch Workflow
|
|
283
290
|
|
|
@@ -299,7 +306,7 @@ const result = await run.start({
|
|
|
299
306
|
});
|
|
300
307
|
```
|
|
301
308
|
|
|
302
|
-
> See [watch](/reference/workflows/watch) for more information.
|
|
309
|
+
> See [watch](/reference/workflows/run-methods/watch) for more information.
|
|
303
310
|
|
|
304
311
|
## More resources
|
|
305
312
|
|
|
@@ -7,14 +7,14 @@ description: "Workflows in Mastra help you orchestrate complex sequences of oper
|
|
|
7
7
|
|
|
8
8
|
All the legacy workflow documentation is available on the links below.
|
|
9
9
|
|
|
10
|
-
- [Steps](/docs/workflows-legacy/steps
|
|
11
|
-
- [Control Flow](/docs/workflows-legacy/control-flow
|
|
12
|
-
- [Variables](/docs/workflows-legacy/variables
|
|
13
|
-
- [Suspend & Resume](/docs/workflows-legacy/suspend-and-resume
|
|
14
|
-
- [Dynamic Workflows](/docs/workflows-legacy/dynamic-workflows
|
|
15
|
-
- [Error Handling](/docs/workflows-legacy/error-handling
|
|
16
|
-
- [Nested Workflows](/docs/workflows-legacy/nested-workflows
|
|
17
|
-
- [Runtime/Dynamic Variables](/docs/workflows-legacy/runtime-variables
|
|
10
|
+
- [Steps](/docs/workflows-legacy/steps.mdx)
|
|
11
|
+
- [Control Flow](/docs/workflows-legacy/control-flow.mdx)
|
|
12
|
+
- [Variables](/docs/workflows-legacy/variables.mdx)
|
|
13
|
+
- [Suspend & Resume](/docs/workflows-legacy/suspend-and-resume.mdx)
|
|
14
|
+
- [Dynamic Workflows](/docs/workflows-legacy/dynamic-workflows.mdx)
|
|
15
|
+
- [Error Handling](/docs/workflows-legacy/error-handling.mdx)
|
|
16
|
+
- [Nested Workflows](/docs/workflows-legacy/nested-workflows.mdx)
|
|
17
|
+
- [Runtime/Dynamic Variables](/docs/workflows-legacy/runtime-variables.mdx)
|
|
18
18
|
|
|
19
19
|
Workflows in Mastra help you orchestrate complex sequences of operations with features like branching, parallel execution, resource suspension, and more.
|
|
20
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.12-alpha.1",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"uuid": "^11.1.0",
|
|
33
33
|
"zod": "^3.25.67",
|
|
34
34
|
"zod-to-json-schema": "^3.24.5",
|
|
35
|
-
"@mastra/
|
|
36
|
-
"@mastra/
|
|
35
|
+
"@mastra/core": "0.14.0-alpha.1",
|
|
36
|
+
"@mastra/mcp": "^0.10.12-alpha.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@hono/node-server": "^1.17.1",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"tsx": "^4.19.4",
|
|
49
49
|
"typescript": "^5.8.3",
|
|
50
50
|
"vitest": "^3.2.4",
|
|
51
|
-
"@mastra/core": "0.
|
|
51
|
+
"@mastra/core": "0.14.0-alpha.1",
|
|
52
52
|
"@internal/lint": "0.0.29"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|