@mastra/mcp-docs-server 0.13.11 → 0.13.12-alpha.0
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%2Fclient-js.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +28 -28
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +37 -37
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +37 -37
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +20 -20
- 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 +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +20 -20
- 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 +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +34 -34
- 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 +29 -29
- package/.docs/organized/changelogs/create-mastra.md +19 -19
- package/.docs/organized/changelogs/mastra.md +43 -43
- package/.docs/raw/reference/agents/agent.mdx +1 -1
- 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/cli/scorers.mdx +160 -0
- package/.docs/raw/reference/templates.mdx +3 -3
- package/.docs/raw/reference/tools/create-tool.mdx +2 -2
- 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} +7 -8
- 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/workflows/overview.mdx +3 -3
- package/.docs/raw/workflows-legacy/overview.mdx +8 -8
- package/package.json +4 -4
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# mastra
|
|
2
2
|
|
|
3
|
+
## 0.10.22-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 97c1d5e: Add new `scorers` subcommand for managing scorers.
|
|
8
|
+
Refactor cli to be more modular.
|
|
9
|
+
- Updated dependencies [c30bca8]
|
|
10
|
+
- @mastra/core@0.13.3-alpha.0
|
|
11
|
+
- @mastra/deployer@0.13.3-alpha.0
|
|
12
|
+
|
|
13
|
+
## 0.10.21
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 63449d0: Change the globbing of tools to exclude test files. Files inside `__tests__` directory and files with `.test.` or `.spec.` in their file name are now excluded from bundling.
|
|
18
|
+
- 77b6cfe: Use just modelId for gpt-5 check
|
|
19
|
+
- 96169cc: Create handler that returns providers user has keys for in their env
|
|
20
|
+
- 33da97c: Set temperature to 1 for gpt-5 model in playground
|
|
21
|
+
- c6d2603: Properly set baseUrl in playground when user sets the host or port in Mastra instance.
|
|
22
|
+
- 7aad750: Fix tool ui showing after message when chat is refreshed
|
|
23
|
+
- ce04175: Add update agent model handler
|
|
24
|
+
- Updated dependencies [d5330bf]
|
|
25
|
+
- Updated dependencies [aaf0224]
|
|
26
|
+
- Updated dependencies [2e74797]
|
|
27
|
+
- Updated dependencies [42cb4e9]
|
|
28
|
+
- Updated dependencies [8388649]
|
|
29
|
+
- Updated dependencies [a239d41]
|
|
30
|
+
- Updated dependencies [dd94a26]
|
|
31
|
+
- Updated dependencies [3ba6772]
|
|
32
|
+
- Updated dependencies [96169cc]
|
|
33
|
+
- Updated dependencies [b5cf2a3]
|
|
34
|
+
- Updated dependencies [2fff911]
|
|
35
|
+
- Updated dependencies [b32c50d]
|
|
36
|
+
- Updated dependencies [c6d2603]
|
|
37
|
+
- Updated dependencies [63449d0]
|
|
38
|
+
- Updated dependencies [121a3f8]
|
|
39
|
+
- Updated dependencies [ce04175]
|
|
40
|
+
- Updated dependencies [ec510e7]
|
|
41
|
+
- @mastra/core@0.13.2
|
|
42
|
+
- @mastra/deployer@0.13.2
|
|
43
|
+
- @mastra/mcp@0.10.11
|
|
44
|
+
|
|
3
45
|
## 0.10.21-alpha.2
|
|
4
46
|
|
|
5
47
|
### Patch Changes
|
|
@@ -256,47 +298,5 @@
|
|
|
256
298
|
- @mastra/mcp@0.10.8-alpha.0
|
|
257
299
|
- @mastra/core@0.12.0-alpha.5
|
|
258
300
|
|
|
259
|
-
## 0.10.16-alpha.2
|
|
260
|
-
|
|
261
|
-
### Patch Changes
|
|
262
|
-
|
|
263
|
-
- d5cc460: This change implements a fix to sourcemap mappings being off due to `removeDeployer` Babel plugin missing source map config.
|
|
264
|
-
- a5681f2: fix: pagination breaks trace grouping
|
|
265
|
-
- Updated dependencies [27cc97a]
|
|
266
|
-
- Updated dependencies [27cc97a]
|
|
267
|
-
- Updated dependencies [41daa63]
|
|
268
|
-
- Updated dependencies [254a36b]
|
|
269
|
-
- Updated dependencies [0b89602]
|
|
270
|
-
- Updated dependencies [4d37822]
|
|
271
|
-
- Updated dependencies [ff9c125]
|
|
272
|
-
- Updated dependencies [d5cc460]
|
|
273
|
-
- Updated dependencies [b8efbb9]
|
|
274
|
-
- Updated dependencies [71466e7]
|
|
275
|
-
- Updated dependencies [0c99fbe]
|
|
276
|
-
- @mastra/core@0.12.0-alpha.2
|
|
277
|
-
- @mastra/deployer@0.12.0-alpha.2
|
|
278
|
-
|
|
279
|
-
## 0.10.16-alpha.1
|
|
280
|
-
|
|
281
|
-
### Patch Changes
|
|
282
|
-
|
|
283
|
-
- 6336993: Fix workflow input form overflow
|
|
284
|
-
- Updated dependencies [e0f73c6]
|
|
285
|
-
- Updated dependencies [cda801d]
|
|
286
|
-
- Updated dependencies [a77c823]
|
|
287
|
-
- @mastra/core@0.12.0-alpha.1
|
|
288
|
-
- @mastra/deployer@0.12.0-alpha.1
|
|
289
|
-
|
|
290
|
-
## 0.10.16-alpha.0
|
|
291
|
-
|
|
292
|
-
### Patch Changes
|
|
293
|
-
|
|
294
|
-
- bc6b44a: Extract tools import from `createHonoServer`; the function now receives tools via a prop on the `options` parameter.
|
|
295
|
-
- f442224: speech to text using voice config
|
|
296
|
-
- 7a7754f: Fast follow scorers fixing input types, improve llm scorer reliability, fix ui to display scores that are 0
|
|
297
|
-
- d8dec5e: add a cta to invite to deploy to cloud
|
|
298
|
-
- 89d2f4e: add TTS to the playground
|
|
299
|
-
- Updated dependencies [510e2c8]
|
|
300
|
-
- Updated dependencies [2f72fb2]
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 4892 more lines hidden. See full changelog in package directory.
|
|
@@ -13,7 +13,7 @@ The `Agent` class is the foundation for creating AI agents in Mastra. It provide
|
|
|
13
13
|
import { openai } from "@ai-sdk/openai";
|
|
14
14
|
import { Agent } from "@mastra/core/agent";
|
|
15
15
|
|
|
16
|
-
const agent = new Agent({
|
|
16
|
+
export const agent = new Agent({
|
|
17
17
|
name: "test-agent",
|
|
18
18
|
instructions: 'message for agent',
|
|
19
19
|
model: openai("gpt-4o")
|
|
@@ -5,7 +5,7 @@ description: "Documentation for the `Agent.getDefaultGenerateOptions()` method i
|
|
|
5
5
|
|
|
6
6
|
# Agent.getDefaultGenerateOptions()
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Agents can be configured with default generation options for controlling model behavior, output formatting and tool and workflow calls. The `.getDefaultGenerateOptions()` method retrieves these defaults, resolving them if they are functions. These options apply to all `generate()`calls unless overridden and are useful for inspecting an agent’s unknown defaults.
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ description: "Documentation for the `Agent.getDefaultStreamOptions()` method in
|
|
|
5
5
|
|
|
6
6
|
# Agent.getDefaultStreamOptions()
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Agents can be configured with default streaming options for memory usage, output format, and iteration steps. The `.getDefaultStreamOptions()` method returns these defaults, resolving them if they are functions. These options apply to all `stream()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ description: "Documentation for the `Agent.getDefaultVNextStreamOptions()` metho
|
|
|
5
5
|
|
|
6
6
|
# Agent.getDefaultVNextStreamOptions()
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Agents can be configured with default streaming options for memory usage, output format, and iteration steps. The `.getDefaultVNextStreamOptions()` method returns these defaults, resolving them if they are functions. These options apply to all `streamVNext()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "mastra scorers | Evaluation Management | Mastra CLI"
|
|
3
|
+
description: "Manage scorers for evaluating AI outputs with the Mastra CLI"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# mastra scorers
|
|
7
|
+
|
|
8
|
+
The `mastra scorers` command provides management capabilities for evaluation scorers that measure the quality, accuracy, and performance of AI-generated outputs.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
mastra scorers <command> [options]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Commands
|
|
17
|
+
|
|
18
|
+
### mastra scorers add
|
|
19
|
+
|
|
20
|
+
Add a new scorer template to your project.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
mastra scorers add [scorer-name] [options]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### Options
|
|
27
|
+
|
|
28
|
+
<PropertiesTable
|
|
29
|
+
content={[
|
|
30
|
+
{
|
|
31
|
+
name: "--dir",
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Path to your Mastra directory (default: auto-detect)",
|
|
34
|
+
isOptional: true,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "--help",
|
|
38
|
+
type: "boolean",
|
|
39
|
+
description: "Display help for command",
|
|
40
|
+
isOptional: true,
|
|
41
|
+
},
|
|
42
|
+
]}
|
|
43
|
+
/>
|
|
44
|
+
|
|
45
|
+
#### Examples
|
|
46
|
+
|
|
47
|
+
Add a specific scorer by name:
|
|
48
|
+
|
|
49
|
+
```bash copy
|
|
50
|
+
mastra scorers add answer-relevancy
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Interactive scorer selection (when no name provided):
|
|
54
|
+
|
|
55
|
+
```bash copy
|
|
56
|
+
mastra scorers add
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Add scorer to custom directory:
|
|
60
|
+
|
|
61
|
+
```bash copy
|
|
62
|
+
mastra scorers add toxicity-detection --dir ./custom/scorers
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### mastra scorers list
|
|
66
|
+
|
|
67
|
+
List all available scorer templates.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
mastra scorers list
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This command displays built-in scorer templates organized by category:
|
|
74
|
+
|
|
75
|
+
- **Accuracy and Reliability**: answer-relevancy, bias-detection, faithfulness, hallucination, toxicity-detection
|
|
76
|
+
- **Output Quality**: completeness, content-similarity, keyword-coverage, textual-difference, tone-consistency
|
|
77
|
+
|
|
78
|
+
## Available Scorers
|
|
79
|
+
|
|
80
|
+
When running `mastra scorers add` without specifying a scorer name, you can select from these built-in templates:
|
|
81
|
+
|
|
82
|
+
### Accuracy and Reliability
|
|
83
|
+
|
|
84
|
+
- **answer-relevancy**: Evaluates how relevant an AI response is to the input question
|
|
85
|
+
- **bias-detection**: Identifies potential biases in AI-generated content
|
|
86
|
+
- **faithfulness**: Measures how faithful the response is to provided context
|
|
87
|
+
- **hallucination**: Detects when AI generates information not grounded in the input
|
|
88
|
+
- **toxicity-detection**: Identifies harmful or inappropriate content
|
|
89
|
+
|
|
90
|
+
### Output Quality
|
|
91
|
+
|
|
92
|
+
- **completeness**: Assesses whether the response fully addresses the input
|
|
93
|
+
- **content-similarity**: Measures semantic similarity between expected and actual outputs
|
|
94
|
+
- **keyword-coverage**: Evaluates coverage of expected keywords or topics
|
|
95
|
+
- **textual-difference**: Measures textual differences between responses
|
|
96
|
+
- **tone-consistency**: Evaluates consistency of tone and style
|
|
97
|
+
|
|
98
|
+
## What It Does
|
|
99
|
+
|
|
100
|
+
1. **Dependency Management**: Automatically installs `@mastra/evals` package if needed
|
|
101
|
+
2. **Template Selection**: Provides interactive selection when no scorer specified
|
|
102
|
+
3. **File Generation**: Creates scorer files from built-in templates
|
|
103
|
+
4. **Directory Structure**: Places scorers in `src/mastra/scorers/` or custom directory
|
|
104
|
+
5. **Duplicate Detection**: Prevents overwriting existing scorer files
|
|
105
|
+
|
|
106
|
+
## Integration
|
|
107
|
+
|
|
108
|
+
After adding scorers, integrate them with your agents or workflows:
|
|
109
|
+
|
|
110
|
+
### With Agents
|
|
111
|
+
|
|
112
|
+
```typescript filename="src/mastra/agents/evaluated-agent.ts"
|
|
113
|
+
import { Agent } from "@mastra/core/agent";
|
|
114
|
+
import { openai } from "@ai-sdk/openai";
|
|
115
|
+
import { createAnswerRelevancyScorer } from "../scorers/answer-relevancy-scorer";
|
|
116
|
+
|
|
117
|
+
export const evaluatedAgent = new Agent({
|
|
118
|
+
// ... other config
|
|
119
|
+
scorers: {
|
|
120
|
+
relevancy: {
|
|
121
|
+
scorer: createAnswerRelevancyScorer({ model: openai("gpt-4o-mini") }),
|
|
122
|
+
sampling: { type: "ratio", rate: 0.5 }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### With Workflow Steps
|
|
129
|
+
|
|
130
|
+
```typescript filename="src/mastra/workflows/content-generation.ts"
|
|
131
|
+
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
132
|
+
import { customStepScorer } from "../scorers/custom-step-scorer";
|
|
133
|
+
|
|
134
|
+
const contentStep = createStep({
|
|
135
|
+
// ... other config
|
|
136
|
+
scorers: {
|
|
137
|
+
customStepScorer: {
|
|
138
|
+
scorer: customStepScorer(),
|
|
139
|
+
sampling: { type: "ratio", rate: 1 }
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Testing Scorers
|
|
146
|
+
|
|
147
|
+
Use the [Local Dev Playground](/docs/server-db/local-dev-playground) to test your scorers:
|
|
148
|
+
|
|
149
|
+
```bash copy
|
|
150
|
+
mastra dev
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Navigate to [http://localhost:4111/](http://localhost:4111/) and access the scorers section to run individual scorers against test inputs and view detailed results.
|
|
154
|
+
|
|
155
|
+
## Next Steps
|
|
156
|
+
|
|
157
|
+
- Learn about scorer implementation in [Creating Custom Scorers](/docs/scorers/custom-scorers)
|
|
158
|
+
- Explore built-in options in [Off-the-shelf Scorers](/docs/scorers/off-the-shelf-scorers)
|
|
159
|
+
- See [Scorers Overview](/docs/scorers/overview) for evaluation pipeline details
|
|
160
|
+
- Test scorers with the [Local Dev Playground](/docs/server-db/local-dev-playground)
|
|
@@ -5,10 +5,10 @@ description: "Complete guide to creating, using, and contributing Mastra templat
|
|
|
5
5
|
|
|
6
6
|
import { FileTree, Tabs, Callout } from 'nextra/components'
|
|
7
7
|
|
|
8
|
-
This reference provides comprehensive information about Mastra templates, including how to use existing templates, create your own, and contribute to the community ecosystem.
|
|
9
|
-
|
|
10
8
|
## Overview
|
|
11
9
|
|
|
10
|
+
This reference provides comprehensive information about Mastra templates, including how to use existing templates, create your own, and contribute to the community ecosystem.
|
|
11
|
+
|
|
12
12
|
Mastra templates are pre-built project structures that demonstrate specific use cases and patterns. They provide:
|
|
13
13
|
|
|
14
14
|
- **Working examples** - Complete, functional Mastra applications
|
|
@@ -184,7 +184,7 @@ Detailed explanation of the template's functionality and use case.
|
|
|
184
184
|
## Setup
|
|
185
185
|
|
|
186
186
|
1. Copy `.env.example` to `.env` and fill in your API keys
|
|
187
|
-
2. Install dependencies: `npm install`
|
|
187
|
+
2. Install dependencies: `npm install`
|
|
188
188
|
3. Run the project: `npm run dev`
|
|
189
189
|
|
|
190
190
|
## Environment Variables
|
|
@@ -13,8 +13,8 @@ The `createTool()` function is used to define custom tools that your Mastra agen
|
|
|
13
13
|
import { createTool } from "@mastra/core/tools";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
|
|
16
|
-
export const
|
|
17
|
-
id: "
|
|
16
|
+
export const tool = createTool({
|
|
17
|
+
id: "test-tool",
|
|
18
18
|
description: "Reverse the input string",
|
|
19
19
|
inputSchema: z.object({
|
|
20
20
|
input: z.string()
|
|
@@ -44,5 +44,5 @@ workflow.branch([
|
|
|
44
44
|
|
|
45
45
|
## Related
|
|
46
46
|
|
|
47
|
-
- [Conditional branching](../../docs/workflows/flow
|
|
47
|
+
- [Conditional branching](../../docs/workflows/control-flow.mdx)
|
|
48
48
|
- [Conditional branching example](../../examples/workflows/conditional-branching.mdx)
|
|
@@ -24,10 +24,9 @@ await workflow.createRunAsync();
|
|
|
24
24
|
<PropertiesTable
|
|
25
25
|
content={[
|
|
26
26
|
{
|
|
27
|
-
name: "
|
|
28
|
-
type: "
|
|
29
|
-
description:
|
|
30
|
-
"Optional configuration for the run, including a custom run ID",
|
|
27
|
+
name: "runId",
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Optional custom identifier for the workflow run",
|
|
31
30
|
isOptional: true,
|
|
32
31
|
},
|
|
33
32
|
]}
|
|
@@ -62,4 +61,5 @@ const result = await run.start({
|
|
|
62
61
|
|
|
63
62
|
## Related
|
|
64
63
|
|
|
64
|
+
- [Run Class](./run.mdx)
|
|
65
65
|
- [Running workflows](../../examples/workflows/running-workflows.mdx)
|
|
@@ -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,9 +1,9 @@
|
|
|
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
|
+
# Run.streamVNext()
|
|
7
7
|
|
|
8
8
|
The `.streamVNext()` method enables real-time streaming of responses from a workflow.
|
|
9
9
|
|
|
@@ -49,7 +49,7 @@ const stream = run.streamVNext({
|
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
name: "stream.status",
|
|
52
|
-
type: "Promise<
|
|
52
|
+
type: "Promise<RunStatus>",
|
|
53
53
|
description: "A promise that resolves to the current workflow run status",
|
|
54
54
|
},
|
|
55
55
|
{
|
|
@@ -89,8 +89,7 @@ The stream emits various event types during workflow execution. Each event has a
|
|
|
89
89
|
- **`step-result`**: A step completes with results
|
|
90
90
|
- **`finish`**: Workflow execution completes with usage statistics
|
|
91
91
|
|
|
92
|
+
## Related
|
|
92
93
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
- [Workflows overview](../../../docs/workflows/overview.mdx#run-workflow)
|
|
95
|
+
- [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)
|