@mastra/mcp-docs-server 1.2.1-alpha.2 → 1.2.1-alpha.4

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.
Files changed (30) hide show
  1. package/.docs/docs/agents/background-tasks.md +89 -14
  2. package/.docs/docs/agents/durable-agents.md +231 -0
  3. package/.docs/docs/agents/using-tools.md +52 -0
  4. package/.docs/docs/getting-started/build-with-ai.md +273 -8
  5. package/.docs/docs/server/pubsub.md +2 -2
  6. package/.docs/docs/workflows/overview.md +71 -0
  7. package/.docs/guides/build-your-ui/ai-sdk-ui.md +3 -3
  8. package/.docs/guides/concepts/streaming.md +317 -0
  9. package/.docs/guides/getting-started/quickstart.md +1 -1
  10. package/.docs/models/index.md +1 -1
  11. package/.docs/models/providers/opencode.md +2 -1
  12. package/.docs/reference/agents/durable-agent.md +30 -1
  13. package/.docs/reference/agents/getDefaultOptions.md +1 -1
  14. package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
  15. package/.docs/reference/agents/inngest-agent.md +339 -0
  16. package/.docs/reference/ai-sdk/handle-workflow-stream.md +1 -1
  17. package/.docs/reference/ai-sdk/workflow-route.md +1 -1
  18. package/.docs/reference/index.md +1 -0
  19. package/.docs/reference/streaming/workflows/timeTravelStream.md +1 -1
  20. package/.docs/reference/tools/create-tool.md +1 -1
  21. package/.docs/reference/workflows/run.md +1 -1
  22. package/CHANGELOG.md +7 -0
  23. package/package.json +5 -5
  24. package/.docs/docs/build-with-ai/mcp-docs-server.md +0 -238
  25. package/.docs/docs/build-with-ai/skills.md +0 -63
  26. package/.docs/docs/streaming/background-task-streaming.md +0 -80
  27. package/.docs/docs/streaming/events.md +0 -148
  28. package/.docs/docs/streaming/overview.md +0 -136
  29. package/.docs/docs/streaming/tool-streaming.md +0 -189
  30. package/.docs/docs/streaming/workflow-streaming.md +0 -109
@@ -1,109 +0,0 @@
1
- # Workflow streaming
2
-
3
- Workflow streaming in Mastra enables workflows to send incremental results while they execute, rather than waiting until completion. This allows you to surface partial progress, intermediate states, or progressive data directly to users or upstream agents and workflows.
4
-
5
- Streams can be written to in two main ways:
6
-
7
- - **From within a workflow step**: every workflow step receives a `writer` argument, which is a writable stream you can use to push updates as execution progresses.
8
- - **From an agent stream**: you can also pipe an agent's `stream` output directly into a workflow step's writer, making it convenient to chain agent responses into workflow results without extra glue code.
9
-
10
- By combining writable workflow streams with agent streaming, you gain fine-grained control over how intermediate results flow through your system and into the user experience.
11
-
12
- ## Using the `writer` argument
13
-
14
- The `writer` argument is passed to a workflow step's `execute` function and can be used to emit custom events, data, or values into the active stream. This enables workflow steps to provide intermediate results or status updates while execution is still in progress.
15
-
16
- > **Warning:** You must `await` the call to `writer.write(...)` or else you will lock the stream and get a `WritableStream is locked` error.
17
-
18
- ```typescript
19
- import { createStep } from "@mastra/core/workflows";
20
-
21
- export const testStep = createStep({
22
- execute: async ({ inputData, writer }) => {
23
- const { value } = inputData;
24
-
25
- await writer?.write({
26
- type: "custom-event",
27
- status: "pending"
28
- });
29
-
30
- const response = await fetch(...);
31
-
32
- await writer?.write({
33
- type: "custom-event",
34
- status: "success"
35
- });
36
-
37
- return {
38
- value: ""
39
- };
40
- },
41
- });
42
- ```
43
-
44
- ## Inspecting workflow stream payloads
45
-
46
- Events written to the stream are included in the emitted chunks. These chunks can be inspected to access any custom fields, such as event types, intermediate values, or step-specific data.
47
-
48
- ```typescript
49
- const testWorkflow = mastra.getWorkflow('testWorkflow')
50
-
51
- const run = await testWorkflow.createRun()
52
-
53
- const stream = await run.stream({
54
- inputData: {
55
- value: 'initial data',
56
- },
57
- })
58
-
59
- for await (const chunk of stream) {
60
- console.log(chunk)
61
- }
62
-
63
- if (result!.status === 'suspended') {
64
- // if the workflow is suspended, we can resume it with the resumeStream method
65
- const resumedStream = await run.resumeStream({
66
- resumeData: { value: 'resume data' },
67
- })
68
-
69
- for await (const chunk of resumedStream) {
70
- console.log(chunk)
71
- }
72
- }
73
- ```
74
-
75
- ## Resuming an interrupted workflow stream
76
-
77
- If a workflow stream is closed or interrupted for any reason, you can resume it with the `resumeStream` method. This will return a new `ReadableStream` that you can use to observe the workflow events.
78
-
79
- ```typescript
80
- const newStream = await run.resumeStream()
81
-
82
- for await (const chunk of newStream) {
83
- console.log(chunk)
84
- }
85
- ```
86
-
87
- ## Workflow using an agent
88
-
89
- Pipe an agent's `textStream` to the workflow step's `writer`. This streams partial output, and Mastra automatically aggregates the agent's usage into the workflow run.
90
-
91
- ```typescript
92
- import { createStep } from '@mastra/core/workflows'
93
- import { z } from 'zod'
94
-
95
- export const testStep = createStep({
96
- execute: async ({ inputData, mastra, writer }) => {
97
- const { city } = inputData
98
-
99
- const testAgent = mastra?.getAgent('testAgent')
100
- const stream = await testAgent?.stream(`What is the weather in ${city}$?`)
101
-
102
- await stream!.textStream.pipeTo(writer!)
103
-
104
- return {
105
- value: await stream!.text,
106
- }
107
- },
108
- })
109
- ```