@mastra/mcp-docs-server 1.1.35-alpha.8 → 1.1.36-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/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +48 -4
- package/.docs/docs/agents/background-tasks.md +62 -2
- package/.docs/docs/agents/processors.md +9 -1
- package/.docs/docs/agents/response-caching.md +148 -0
- package/.docs/docs/agents/signals.md +151 -0
- package/.docs/docs/agents/using-tools.md +8 -0
- package/.docs/docs/browser/agent-browser.md +15 -0
- package/.docs/docs/browser/stagehand.md +25 -1
- package/.docs/docs/deployment/cloud-providers.md +1 -1
- package/.docs/docs/deployment/overview.md +6 -5
- package/.docs/docs/editor/tools.md +1 -1
- package/.docs/docs/index.md +2 -2
- package/.docs/docs/mastra-platform/configuration.md +22 -6
- package/.docs/docs/mastra-platform/observability.md +99 -0
- package/.docs/docs/mastra-platform/overview.md +12 -55
- package/.docs/{guides/deployment/mastra-platform.md → docs/mastra-platform/server.md} +30 -37
- package/.docs/docs/mastra-platform/studio.md +81 -0
- package/.docs/docs/memory/observational-memory.md +61 -13
- package/.docs/docs/memory/semantic-recall.md +68 -6
- package/.docs/docs/observability/logging.md +2 -2
- package/.docs/docs/observability/metrics/overview.md +4 -4
- package/.docs/docs/observability/overview.md +15 -10
- package/.docs/docs/observability/tracing/bridges/otel.md +25 -0
- package/.docs/docs/observability/tracing/exporters/arize.md +5 -5
- package/.docs/docs/observability/tracing/exporters/braintrust.md +37 -0
- package/.docs/docs/observability/tracing/exporters/langfuse.md +21 -0
- package/.docs/docs/observability/tracing/exporters/{cloud.md → mastra-platform.md} +35 -33
- package/.docs/docs/observability/tracing/exporters/{default.md → mastra-storage.md} +56 -19
- package/.docs/docs/observability/tracing/exporters/otel.md +79 -2
- package/.docs/docs/observability/tracing/overview.md +30 -29
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +6 -6
- package/.docs/docs/server/mastra-server.md +30 -19
- package/.docs/docs/studio/deployment.md +1 -37
- package/.docs/docs/studio/observability.md +31 -26
- package/.docs/docs/studio/overview.md +8 -2
- package/.docs/docs/voice/overview.md +84 -0
- package/.docs/docs/workflows/suspend-and-resume.md +28 -1
- package/.docs/guides/deployment/inngest.md +23 -0
- package/.docs/guides/getting-started/quickstart.md +4 -4
- package/.docs/guides/migrations/mastra-cloud.md +12 -12
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +19 -17
- package/.docs/models/gateways/netlify.md +2 -1
- package/.docs/models/gateways/openrouter.md +4 -1
- package/.docs/models/gateways/vercel.md +2 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +1 -1
- package/.docs/models/providers/alibaba.md +1 -1
- package/.docs/models/providers/chutes.md +23 -54
- package/.docs/models/providers/claudinio.md +71 -0
- package/.docs/models/providers/databricks.md +96 -0
- package/.docs/models/providers/deepinfra.md +3 -1
- package/.docs/models/providers/deepseek.md +3 -1
- package/.docs/models/providers/digitalocean.md +9 -2
- package/.docs/models/providers/firepass.md +71 -0
- package/.docs/models/providers/google.md +4 -3
- package/.docs/models/providers/kilo.md +6 -4
- package/.docs/models/providers/llmgateway.md +8 -2
- package/.docs/models/providers/nebius.md +37 -55
- package/.docs/models/providers/novita-ai.md +5 -5
- package/.docs/models/providers/nvidia.md +59 -49
- package/.docs/models/providers/ollama-cloud.md +1 -1
- package/.docs/models/providers/openai.md +2 -0
- package/.docs/models/providers/opencode.md +44 -43
- package/.docs/models/providers/poe.md +4 -1
- package/.docs/models/providers/sarvam.md +72 -0
- package/.docs/models/providers/wafer.ai.md +4 -5
- package/.docs/models/providers/xiaomi-token-plan-ams.md +6 -5
- package/.docs/models/providers/xiaomi-token-plan-cn.md +6 -5
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +6 -5
- package/.docs/models/providers.md +4 -1
- package/.docs/reference/agents/agent.md +85 -0
- package/.docs/reference/browser/agent-browser.md +37 -11
- package/.docs/reference/browser/stagehand-browser.md +35 -9
- package/.docs/reference/cli/create-mastra.md +6 -0
- package/.docs/reference/cli/mastra.md +63 -15
- package/.docs/reference/client-js/agents.md +115 -1
- package/.docs/reference/client-js/responses.md +4 -0
- package/.docs/reference/configuration.md +6 -6
- package/.docs/reference/editor/tool-provider.md +3 -3
- package/.docs/reference/harness/harness-class.md +22 -9
- package/.docs/reference/index.md +5 -0
- package/.docs/reference/memory/observational-memory.md +11 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +2 -4
- package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
- package/.docs/reference/observability/tracing/bridges/otel.md +26 -4
- package/.docs/reference/observability/tracing/configuration.md +6 -3
- package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
- package/.docs/reference/observability/tracing/exporters/braintrust.md +2 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +5 -3
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +2 -2
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +7 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +263 -0
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +194 -0
- package/.docs/reference/observability/tracing/exporters/otel.md +12 -8
- package/.docs/reference/observability/tracing/instances.md +2 -2
- package/.docs/reference/observability/tracing/interfaces.md +37 -2
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +22 -0
- package/.docs/reference/observability/tracing/span-filtering.md +2 -2
- package/.docs/reference/processors/prefill-error-handler.md +3 -3
- package/.docs/reference/processors/response-cache.md +114 -0
- package/.docs/reference/processors/tool-call-filter.md +28 -0
- package/.docs/reference/storage/clickhouse.md +8 -8
- package/.docs/reference/storage/cloudflare-d1.md +1 -1
- package/.docs/reference/storage/cloudflare.md +1 -1
- package/.docs/reference/storage/composite.md +1 -1
- package/.docs/reference/storage/convex.md +1 -1
- package/.docs/reference/storage/dsql.md +428 -0
- package/.docs/reference/storage/duckdb.md +3 -3
- package/.docs/reference/storage/dynamodb.md +1 -1
- package/.docs/reference/storage/lance.md +1 -1
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/postgresql.md +1 -1
- package/.docs/reference/storage/upstash.md +1 -1
- package/.docs/reference/streaming/ChunkType.md +44 -0
- package/.docs/reference/tools/brightdata.md +167 -0
- package/.docs/reference/tools/create-tool.md +46 -0
- package/.docs/reference/voice/inworld.md +133 -0
- package/.docs/reference/workflows/workflow-state-reader.md +113 -0
- package/CHANGELOG.md +113 -0
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Xiaomi Token Plan (Singapore)
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 6 Xiaomi Token Plan (Singapore) models through Mastra's model router. Authentication is handled automatically using the `XIAOMI_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Xiaomi Token Plan (Singapore) documentation](https://platform.xiaomimimo.com/#/docs).
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ const agent = new Agent({
|
|
|
15
15
|
id: "my-agent",
|
|
16
16
|
name: "My Agent",
|
|
17
17
|
instructions: "You are a helpful assistant",
|
|
18
|
-
model: "xiaomi-token-plan-sgp/mimo-v2-
|
|
18
|
+
model: "xiaomi-token-plan-sgp/mimo-v2-flash"
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
// Generate a response
|
|
@@ -34,7 +34,8 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
36
|
| ------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
-
| `xiaomi-token-plan-sgp/mimo-v2-
|
|
37
|
+
| `xiaomi-token-plan-sgp/mimo-v2-flash` | 262K | | | | | | — | — |
|
|
38
|
+
| `xiaomi-token-plan-sgp/mimo-v2-omni` | 262K | | | | | | — | — |
|
|
38
39
|
| `xiaomi-token-plan-sgp/mimo-v2-pro` | 1.0M | | | | | | — | — |
|
|
39
40
|
| `xiaomi-token-plan-sgp/mimo-v2-tts` | 8K | | | | | | — | — |
|
|
40
41
|
| `xiaomi-token-plan-sgp/mimo-v2.5` | 1.0M | | | | | | — | — |
|
|
@@ -50,7 +51,7 @@ const agent = new Agent({
|
|
|
50
51
|
name: "custom-agent",
|
|
51
52
|
model: {
|
|
52
53
|
url: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
53
|
-
id: "xiaomi-token-plan-sgp/mimo-v2-
|
|
54
|
+
id: "xiaomi-token-plan-sgp/mimo-v2-flash",
|
|
54
55
|
apiKey: process.env.XIAOMI_API_KEY,
|
|
55
56
|
headers: {
|
|
56
57
|
"X-Custom-Header": "value"
|
|
@@ -69,7 +70,7 @@ const agent = new Agent({
|
|
|
69
70
|
const useAdvanced = requestContext.task === "complex";
|
|
70
71
|
return useAdvanced
|
|
71
72
|
? "xiaomi-token-plan-sgp/mimo-v2.5-pro"
|
|
72
|
-
: "xiaomi-token-plan-sgp/mimo-v2-
|
|
73
|
+
: "xiaomi-token-plan-sgp/mimo-v2-flash";
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
```
|
|
@@ -22,15 +22,18 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
22
22
|
- [Cerebras](https://mastra.ai/models/providers/cerebras)
|
|
23
23
|
- [Chutes](https://mastra.ai/models/providers/chutes)
|
|
24
24
|
- [Clarifai](https://mastra.ai/models/providers/clarifai)
|
|
25
|
+
- [Claudinio](https://mastra.ai/models/providers/claudinio)
|
|
25
26
|
- [CloudFerro Sherlock](https://mastra.ai/models/providers/cloudferro-sherlock)
|
|
26
27
|
- [Cloudflare Workers AI](https://mastra.ai/models/providers/cloudflare-workers-ai)
|
|
27
28
|
- [Cortecs](https://mastra.ai/models/providers/cortecs)
|
|
28
29
|
- [D.Run (China)](https://mastra.ai/models/providers/drun)
|
|
30
|
+
- [Databricks](https://mastra.ai/models/providers/databricks)
|
|
29
31
|
- [Deep Infra](https://mastra.ai/models/providers/deepinfra)
|
|
30
32
|
- [DigitalOcean](https://mastra.ai/models/providers/digitalocean)
|
|
31
33
|
- [DInference](https://mastra.ai/models/providers/dinference)
|
|
32
34
|
- [evroc](https://mastra.ai/models/providers/evroc)
|
|
33
35
|
- [FastRouter](https://mastra.ai/models/providers/fastrouter)
|
|
36
|
+
- [Fireworks (Firepass)](https://mastra.ai/models/providers/firepass)
|
|
34
37
|
- [Fireworks AI](https://mastra.ai/models/providers/fireworks-ai)
|
|
35
38
|
- [Friendli](https://mastra.ai/models/providers/friendli)
|
|
36
39
|
- [FrogBot](https://mastra.ai/models/providers/frogbot)
|
|
@@ -45,7 +48,6 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
45
48
|
- [Jiekou.AI](https://mastra.ai/models/providers/jiekou)
|
|
46
49
|
- [Kilo Gateway](https://mastra.ai/models/providers/kilo)
|
|
47
50
|
- [Kimi For Coding](https://mastra.ai/models/providers/kimi-for-coding)
|
|
48
|
-
- [Kiro](https://mastra.ai/models/providers/kiro)
|
|
49
51
|
- [KUAE Cloud Coding Plan](https://mastra.ai/models/providers/kuae-cloud-coding-plan)
|
|
50
52
|
- [Llama](https://mastra.ai/models/providers/llama)
|
|
51
53
|
- [LLM Gateway](https://mastra.ai/models/providers/llmgateway)
|
|
@@ -80,6 +82,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
80
82
|
- [Qiniu](https://mastra.ai/models/providers/qiniu-ai)
|
|
81
83
|
- [Regolo AI](https://mastra.ai/models/providers/regolo-ai)
|
|
82
84
|
- [Requesty](https://mastra.ai/models/providers/requesty)
|
|
85
|
+
- [Sarvam AI](https://mastra.ai/models/providers/sarvam)
|
|
83
86
|
- [Scaleway](https://mastra.ai/models/providers/scaleway)
|
|
84
87
|
- [SiliconFlow](https://mastra.ai/models/providers/siliconflow)
|
|
85
88
|
- [SiliconFlow (China)](https://mastra.ai/models/providers/siliconflow-cn)
|
|
@@ -94,6 +94,89 @@ export const agent = new Agent({
|
|
|
94
94
|
})
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
## Thread signals
|
|
98
|
+
|
|
99
|
+
Use Agent signals to send real-time context into a memory thread. Signals are useful when a user adds input while an agent is already streaming, or when another process needs to add structured context to the thread.
|
|
100
|
+
|
|
101
|
+
A `user-message` signal represents user input. When the target thread is running, Mastra delivers the signal into the active agent loop. When the thread is idle, Mastra starts a stream with the signal as the first input by default.
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
const subscription = await agent.subscribeToThread({
|
|
105
|
+
resourceId: 'user-123',
|
|
106
|
+
threadId: 'thread-abc',
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
void (async () => {
|
|
110
|
+
for await (const chunk of subscription.stream) {
|
|
111
|
+
console.log(chunk)
|
|
112
|
+
}
|
|
113
|
+
})()
|
|
114
|
+
|
|
115
|
+
agent.sendSignal(
|
|
116
|
+
{ type: 'user-message', contents: 'Use the latest customer note too.' },
|
|
117
|
+
{
|
|
118
|
+
resourceId: 'user-123',
|
|
119
|
+
threadId: 'thread-abc',
|
|
120
|
+
ifIdle: {
|
|
121
|
+
streamOptions: {
|
|
122
|
+
maxSteps: 3,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Use a custom signal type for contextual messages that should reach the model as XML-wrapped context instead of normal user input:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
agent.sendSignal(
|
|
133
|
+
{
|
|
134
|
+
type: 'system-reminder',
|
|
135
|
+
contents: 'Continue from the previous tool result.',
|
|
136
|
+
attributes: { reminderType: 'tool-result' },
|
|
137
|
+
},
|
|
138
|
+
{ resourceId: 'user-123', threadId: 'thread-abc' },
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### `sendSignal(signal, options)`
|
|
143
|
+
|
|
144
|
+
Sends a signal to an active run or memory thread.
|
|
145
|
+
|
|
146
|
+
**signal** (`{ type: 'user-message'; contents: MessageListInput } | { type: string; contents: string }`): \`user-message\` signals are treated as user input. Other signal types are converted to XML context before the next model call.
|
|
147
|
+
|
|
148
|
+
**options.runId** (`string`): Run ID to target directly. Use this when you already know the active run ID.
|
|
149
|
+
|
|
150
|
+
**options.resourceId** (`string`): Resource ID for the memory thread. Required with \`threadId\` for thread-targeted signals.
|
|
151
|
+
|
|
152
|
+
**options.threadId** (`string`): Thread ID to target. Required with \`resourceId\` for thread-targeted signals.
|
|
153
|
+
|
|
154
|
+
**options.ifActive.behavior** (`'deliver' | 'persist' | 'discard'`): Controls what happens when the target thread is active. Defaults to \`deliver\`.
|
|
155
|
+
|
|
156
|
+
**options.ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): Controls what happens when the target thread is idle. Defaults to \`wake\`.
|
|
157
|
+
|
|
158
|
+
**options.ifIdle.streamOptions** (`AgentExecutionOptions`): Options for the stream that starts when \`ifIdle.behavior\` is \`wake\`. Mastra uses the top-level \`resourceId\` and \`threadId\` for memory context.
|
|
159
|
+
|
|
160
|
+
Returns `{ accepted: true, runId: string, signal: CreatedAgentSignal, persisted?: Promise<void> }`. `persisted` is only present for `persist` behavior and resolves when Mastra finishes writing the signal to memory.
|
|
161
|
+
|
|
162
|
+
### `subscribeToThread(options)`
|
|
163
|
+
|
|
164
|
+
Subscribes to raw stream chunks for a memory thread. Use this before calling `sendSignal()` when you need to render stream output, observe signal echoes, or abort the active run.
|
|
165
|
+
|
|
166
|
+
**options.resourceId** (`string`): Resource ID for the memory thread.
|
|
167
|
+
|
|
168
|
+
**options.threadId** (`string`): Thread ID to subscribe to.
|
|
169
|
+
|
|
170
|
+
Returns an `AgentThreadSubscription` object with these members:
|
|
171
|
+
|
|
172
|
+
**stream** (`AsyncIterable<AgentChunkType>`): Raw agent stream chunks for the subscribed thread.
|
|
173
|
+
|
|
174
|
+
**activeRunId** (`() => string | null`): Returns the active run ID for the thread, or \`null\` when no run is active.
|
|
175
|
+
|
|
176
|
+
**abort** (`() => boolean`): Aborts the active run for the thread. Returns \`true\` when a run was aborted.
|
|
177
|
+
|
|
178
|
+
**unsubscribe** (`() => void`): Stops the subscription without aborting the active run.
|
|
179
|
+
|
|
97
180
|
## Constructor parameters
|
|
98
181
|
|
|
99
182
|
**id** (`string`): Unique identifier for the agent. Defaults to \`name\` if not provided.
|
|
@@ -110,6 +193,8 @@ export const agent = new Agent({
|
|
|
110
193
|
|
|
111
194
|
**tools** (`ToolsInput | ({ requestContext: RequestContext }) => ToolsInput | Promise<ToolsInput>`): Tools that the agent can access. Can be provided statically or resolved dynamically.
|
|
112
195
|
|
|
196
|
+
**transform** (`ToolPayloadTransformPolicy`): Shared policy for transforming tool payloads before display streams or user-visible transcript messages receive them. Use per-tool \`transform\` on \`createTool()\` for tool-local rules.
|
|
197
|
+
|
|
113
198
|
**workflows** (`Record<string, Workflow> | ({ requestContext: RequestContext }) => Record<string, Workflow> | Promise<Record<string, Workflow>>`): Workflows that the agent can execute. Can be static or dynamically resolved.
|
|
114
199
|
|
|
115
200
|
**defaultOptions** (`AgentExecutionOptions | ({ requestContext: RequestContext }) => AgentExecutionOptions | Promise<AgentExecutionOptions>`): Default options used when calling \`stream()\` and \`generate()\`.
|
|
@@ -44,22 +44,25 @@ then interact with elements using their refs (e.g., @e5).`,
|
|
|
44
44
|
|
|
45
45
|
**screencast** (`ScreencastOptions`): Configuration for streaming browser frames to Studio.
|
|
46
46
|
|
|
47
|
+
**excludeTools** (`BrowserToolName[]`): Tool names to exclude from the browser toolset. Use this to disable specific tools for models that do not support certain capabilities, such as vision.
|
|
48
|
+
|
|
47
49
|
## Tools
|
|
48
50
|
|
|
49
|
-
`AgentBrowser` provides
|
|
51
|
+
`AgentBrowser` provides 16 deterministic tools for browser automation. All tools that interact with elements use refs from the accessibility tree snapshot.
|
|
50
52
|
|
|
51
53
|
### Core tools
|
|
52
54
|
|
|
53
|
-
| Tool
|
|
54
|
-
|
|
|
55
|
-
| `browser_goto`
|
|
56
|
-
| `browser_snapshot`
|
|
57
|
-
| `browser_click`
|
|
58
|
-
| `browser_type`
|
|
59
|
-
| `browser_press`
|
|
60
|
-
| `browser_select`
|
|
61
|
-
| `browser_scroll`
|
|
62
|
-
| `
|
|
55
|
+
| Tool | Description |
|
|
56
|
+
| -------------------- | ------------------------------------------------------------------------------------- |
|
|
57
|
+
| `browser_goto` | Navigate to a URL |
|
|
58
|
+
| `browser_snapshot` | Get accessibility tree snapshot with element refs |
|
|
59
|
+
| `browser_click` | Click an element by ref |
|
|
60
|
+
| `browser_type` | Type text into an element |
|
|
61
|
+
| `browser_press` | Press keyboard keys |
|
|
62
|
+
| `browser_select` | Select option from dropdown |
|
|
63
|
+
| `browser_scroll` | Scroll the page or element |
|
|
64
|
+
| `browser_screenshot` | Capture a screenshot as PNG (viewport by default; set `fullPage: true` for full page) |
|
|
65
|
+
| `browser_close` | Close the browser |
|
|
63
66
|
|
|
64
67
|
### Extended tools
|
|
65
68
|
|
|
@@ -73,6 +76,14 @@ then interact with elements using their refs (e.g., @e5).`,
|
|
|
73
76
|
| `browser_drag` | Drag and drop elements |
|
|
74
77
|
| `browser_evaluate` | Execute JavaScript in the page (escape hatch) |
|
|
75
78
|
|
|
79
|
+
To exclude specific tools, pass `excludeTools` in the constructor:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
const browser = new AgentBrowser({
|
|
83
|
+
excludeTools: ['browser_screenshot'],
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
76
87
|
## Tool reference
|
|
77
88
|
|
|
78
89
|
### `browser_goto`
|
|
@@ -339,6 +350,21 @@ Execute JavaScript in the page context. Use as an escape hatch when other tools
|
|
|
339
350
|
| `script` | `string` | JavaScript to execute (required) |
|
|
340
351
|
| `returnValue` | `boolean` | Whether to return the result (optional) |
|
|
341
352
|
|
|
353
|
+
### `browser_screenshot`
|
|
354
|
+
|
|
355
|
+
Capture a screenshot of the current page as PNG (viewport by default; set `fullPage: true` for full-page capture). Returns image content that vision-capable models can interpret directly. Use `browser_snapshot` when you only need text or structured data.
|
|
356
|
+
|
|
357
|
+
```text
|
|
358
|
+
// Viewport only (default)
|
|
359
|
+
|
|
360
|
+
// Full scrollable page
|
|
361
|
+
{ "fullPage": true }
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
| Parameter | Type | Description |
|
|
365
|
+
| ---------- | --------- | ---------------------------------------------------------------------------------------- |
|
|
366
|
+
| `fullPage` | `boolean` | Capture the full scrollable page instead of just the viewport (optional, default: false) |
|
|
367
|
+
|
|
342
368
|
### `browser_close`
|
|
343
369
|
|
|
344
370
|
Close the browser and clean up resources.
|
|
@@ -61,18 +61,29 @@ Use stagehand_extract to get data from pages.`,
|
|
|
61
61
|
|
|
62
62
|
**screencast** (`ScreencastOptions`): Configuration for streaming browser frames to Studio.
|
|
63
63
|
|
|
64
|
+
**excludeTools** (`StagehandToolName[]`): Tool names to exclude from the browser toolset. Use this to disable specific tools for models that do not support certain capabilities, such as vision.
|
|
65
|
+
|
|
64
66
|
## Tools
|
|
65
67
|
|
|
66
|
-
`StagehandBrowser` provides
|
|
68
|
+
`StagehandBrowser` provides 7 AI-powered tools for browser automation:
|
|
69
|
+
|
|
70
|
+
| Tool | Description |
|
|
71
|
+
| ---------------------- | ------------------------------------------------------------------------------------- |
|
|
72
|
+
| `stagehand_act` | Perform actions using natural language instructions |
|
|
73
|
+
| `stagehand_extract` | Extract structured data from pages |
|
|
74
|
+
| `stagehand_observe` | Discover actionable elements on a page |
|
|
75
|
+
| `stagehand_navigate` | Navigate to a URL |
|
|
76
|
+
| `stagehand_tabs` | Manage browser tabs |
|
|
77
|
+
| `stagehand_screenshot` | Capture a screenshot as PNG (viewport by default; set `fullPage: true` for full page) |
|
|
78
|
+
| `stagehand_close` | Close the browser |
|
|
67
79
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
| `stagehand_close` | Close the browser |
|
|
80
|
+
To exclude specific tools, pass `excludeTools` in the constructor:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
const browser = new StagehandBrowser({
|
|
84
|
+
excludeTools: ['stagehand_screenshot'],
|
|
85
|
+
})
|
|
86
|
+
```
|
|
76
87
|
|
|
77
88
|
## Tool reference
|
|
78
89
|
|
|
@@ -224,6 +235,21 @@ Manage browser tabs.
|
|
|
224
235
|
{ "action": "close", "index": 1 }
|
|
225
236
|
```
|
|
226
237
|
|
|
238
|
+
### `stagehand_screenshot`
|
|
239
|
+
|
|
240
|
+
Capture a screenshot of the current page as PNG (viewport by default; set `fullPage: true` for full-page capture). Returns image content that vision-capable models can interpret directly. Use `stagehand_observe` or `stagehand_extract` when you only need text or structured data.
|
|
241
|
+
|
|
242
|
+
```text
|
|
243
|
+
// Viewport only (default)
|
|
244
|
+
|
|
245
|
+
// Full scrollable page
|
|
246
|
+
{ "fullPage": true }
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
| Parameter | Type | Description |
|
|
250
|
+
| ---------- | --------- | ---------------------------------------------------------------------------------------- |
|
|
251
|
+
| `fullPage` | `boolean` | Capture the full scrollable page instead of just the viewport (optional, default: false) |
|
|
252
|
+
|
|
227
253
|
### `stagehand_close`
|
|
228
254
|
|
|
229
255
|
Close the browser and clean up resources.
|
|
@@ -118,6 +118,12 @@ Instead of an interactive prompt you can also define these CLI flags.
|
|
|
118
118
|
|
|
119
119
|
**--skills** (`string`): Comma-separated list of agents to install Mastra skills for (e.g., claude-code,cursor,windsurf)
|
|
120
120
|
|
|
121
|
+
**--observability** (`boolean`): Enable Observability on the Mastra platform during project creation. This opens browser login when needed, prompts for an organization, provisions a platform project, and configures the observability exporters.
|
|
122
|
+
|
|
123
|
+
**--no-observability** (`boolean`): Skip the Observability prompt during project creation.
|
|
124
|
+
|
|
125
|
+
**--observability-project** (`string`): Set the platform project name to use when Mastra Observability is enabled.
|
|
126
|
+
|
|
121
127
|
**--help** (`boolean`): Display help for command
|
|
122
128
|
|
|
123
129
|
## Telemetry
|
|
@@ -201,11 +201,13 @@ mastra studio deploy
|
|
|
201
201
|
|
|
202
202
|
The command runs `mastra build`, zips the output, reads an env file from the project directory, and uploads everything to the platform. After uploading, it polls the deploy status and streams build logs until the deploy reaches a terminal state.
|
|
203
203
|
|
|
204
|
+
The deploy command auto-loads the project's `.env` file. If `MASTRA_PROJECT_ID` points to a project that was provisioned for Observability, the deploy links to that project instead of creating a new one. Deploying Studio to an observability-only project converts it into a Studio project on the platform side.
|
|
205
|
+
|
|
204
206
|
The CLI requires at least one `.env` or `.env.*` file (excluding `.env.example`) in the project directory and fails with `Error: No env file found for deploy.` if none exists. When multiple env files are present, the CLI prompts you to pick one (defaulting to `.env.production`); pass `--env-file` to choose explicitly. With `--yes` and multiple env files, you must pass `--env-file` or the deploy errors.
|
|
205
207
|
|
|
206
208
|
Organization and project are resolved in order from: Environment variable flag, `.mastra-project.json` config file, current org from credentials, and lastly interactive prompt. On first deploy, the CLI saves the resolved IDs to `.mastra-project.json` so subsequent deploys skip the prompts.
|
|
207
209
|
|
|
208
|
-
If `--project <value>`
|
|
210
|
+
If `--project <value>` doesn't match an existing project (by ID or slug), the CLI treats `<value>` as a new project name and creates it after confirmation. Combined with `--yes`, this creates and deploys a new project in one non-interactive command:
|
|
209
211
|
|
|
210
212
|
```bash
|
|
211
213
|
mastra studio deploy --project "my-new-project" --yes
|
|
@@ -295,7 +297,7 @@ Shows diagnosis results and suggested fixes for a failed Studio deploy.
|
|
|
295
297
|
mastra studio deploy suggestions [deploy-id]
|
|
296
298
|
```
|
|
297
299
|
|
|
298
|
-
If you omit `deploy-id`, the command uses the latest deploy for the linked project. If a diagnosis
|
|
300
|
+
If you omit `deploy-id`, the command uses the latest deploy for the linked project. If a diagnosis doesn't exist yet, the command starts one and polls until results are ready. If the deploy is healthy, no suggestions are shown.
|
|
299
301
|
|
|
300
302
|
### `mastra studio projects`
|
|
301
303
|
|
|
@@ -303,12 +305,14 @@ Lists all projects in the current organization.
|
|
|
303
305
|
|
|
304
306
|
### `mastra studio projects create`
|
|
305
307
|
|
|
306
|
-
Creates a new project through an interactive prompt. This command
|
|
308
|
+
Creates a new project through an interactive prompt. This command doesn't accept a `--name` flag; for non-interactive project creation, use [`mastra studio deploy --project <name> --yes`](#mastra-studio-deploy) instead, which creates the project and deploys to it in one step.
|
|
307
309
|
|
|
308
310
|
## `mastra server deploy`
|
|
309
311
|
|
|
310
312
|
Builds and deploys your project to Server on Mastra platform. Works the same as [`mastra studio deploy`](#mastra-studio-deploy) with the same flags, arguments, and resolution logic.
|
|
311
313
|
|
|
314
|
+
The deploy command auto-loads the project's `.env` file. If `MASTRA_PROJECT_ID` points to a project that was provisioned for Observability, the deploy links to that project instead of creating a new one. Deploying Server to an observability-only project converts it into a Server project on the platform side.
|
|
315
|
+
|
|
312
316
|
```bash
|
|
313
317
|
mastra server deploy [dir]
|
|
314
318
|
```
|
|
@@ -321,7 +325,7 @@ Shows diagnosis results and suggested fixes for a failed Server deploy.
|
|
|
321
325
|
mastra server deploy suggestions [deploy-id]
|
|
322
326
|
```
|
|
323
327
|
|
|
324
|
-
If you omit `deploy-id`, the command uses the latest deploy for the linked project. If a diagnosis
|
|
328
|
+
If you omit `deploy-id`, the command uses the latest deploy for the linked project. If a diagnosis doesn't exist yet, the command starts one and polls until results are ready. If the deploy is healthy, no suggestions are shown.
|
|
325
329
|
|
|
326
330
|
## `mastra server pause`
|
|
327
331
|
|
|
@@ -339,13 +343,13 @@ Organization ID. Can also be set via the `MASTRA_ORG_ID` environment variable.
|
|
|
339
343
|
|
|
340
344
|
#### `--project`
|
|
341
345
|
|
|
342
|
-
Project ID or slug when `MASTRA_PROJECT_ID`
|
|
346
|
+
Project ID or slug when `MASTRA_PROJECT_ID` isn't set. Slugs are resolved against projects in the current organization.
|
|
343
347
|
|
|
344
348
|
#### `-c, --config`
|
|
345
349
|
|
|
346
350
|
Path to the project config file. Defaults to `.mastra-project.json`.
|
|
347
351
|
|
|
348
|
-
Fails if the instance
|
|
352
|
+
Fails if the instance isn't running.
|
|
349
353
|
|
|
350
354
|
## `mastra server restart`
|
|
351
355
|
|
|
@@ -359,7 +363,7 @@ Same flags as [`mastra server pause`](#mastra-server-pause): **`--org`**, **`--p
|
|
|
359
363
|
mastra server restart
|
|
360
364
|
```
|
|
361
365
|
|
|
362
|
-
Fails if a deployment is still active for this project (running, building, deploying, etc.); that
|
|
366
|
+
Fails if a deployment is still active for this project (running, building, deploying, etc.); that's a platform restriction so you can't restart while another deploy is in progress.
|
|
363
367
|
|
|
364
368
|
## `mastra server env`
|
|
365
369
|
|
|
@@ -440,7 +444,7 @@ Lists all organizations with your role in each. The current organization is mark
|
|
|
440
444
|
|
|
441
445
|
#### `mastra auth orgs switch`
|
|
442
446
|
|
|
443
|
-
Switches the active organization through an interactive prompt.
|
|
447
|
+
Switches the active organization through an interactive prompt. Can't be used when `MASTRA_API_TOKEN` or `MASTRA_ORG_ID` environment variables are set.
|
|
444
448
|
|
|
445
449
|
### `mastra auth tokens`
|
|
446
450
|
|
|
@@ -448,7 +452,7 @@ Lists all API tokens with their last-used date.
|
|
|
448
452
|
|
|
449
453
|
#### `mastra auth tokens create`
|
|
450
454
|
|
|
451
|
-
Creates a new API token. The secret is displayed once and
|
|
455
|
+
Creates a new API token. The secret is displayed once and can't be retrieved again.
|
|
452
456
|
|
|
453
457
|
```bash
|
|
454
458
|
mastra auth tokens create <name>
|
|
@@ -464,10 +468,42 @@ mastra auth tokens revoke <token-id>
|
|
|
464
468
|
|
|
465
469
|
## `mastra lint`
|
|
466
470
|
|
|
467
|
-
The `mastra lint` command validates the structure and code of your Mastra project
|
|
471
|
+
The `mastra lint` command validates the structure and code of your Mastra project.
|
|
472
|
+
|
|
473
|
+
By default, `mastra lint` runs project checks against your source files and configuration. Use `--preflight` to also run bundle checks against `.mastra/output` before deployment.
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
mastra lint --preflight
|
|
477
|
+
```
|
|
468
478
|
|
|
469
479
|
It accepts [common flags](#common-flags).
|
|
470
480
|
|
|
481
|
+
### Flags
|
|
482
|
+
|
|
483
|
+
#### `--preflight`
|
|
484
|
+
|
|
485
|
+
Runs deployment preflight checks against the built Mastra output. This builds the project before checking it unless you also pass `--skip-build`.
|
|
486
|
+
|
|
487
|
+
#### `--skip-build`
|
|
488
|
+
|
|
489
|
+
Skips the build step and reuses the existing `.mastra/output` directory. This flag only applies when `--preflight` is set.
|
|
490
|
+
|
|
491
|
+
#### `--env-file <file>`
|
|
492
|
+
|
|
493
|
+
Uses the specified environment file for preflight validation. This flag only applies when `--preflight` is set.
|
|
494
|
+
|
|
495
|
+
#### `--strict`
|
|
496
|
+
|
|
497
|
+
Treats warnings as errors.
|
|
498
|
+
|
|
499
|
+
#### `--json`
|
|
500
|
+
|
|
501
|
+
Emits machine-readable JSON output.
|
|
502
|
+
|
|
503
|
+
#### `--debug`
|
|
504
|
+
|
|
505
|
+
Enables debug logs.
|
|
506
|
+
|
|
471
507
|
## `mastra scorers`
|
|
472
508
|
|
|
473
509
|
The `mastra scorers` command provides management capabilities for evaluation scorers that measure the quality, accuracy, and performance of AI-generated outputs.
|
|
@@ -534,6 +570,18 @@ Don't include example code. Useful when using the `--default` flag.
|
|
|
534
570
|
|
|
535
571
|
Configure your code editor with Mastra's MCP server. Choose from: `"cursor" | "cursor-global" | "windsurf" | "vscode"`.
|
|
536
572
|
|
|
573
|
+
#### `--observability`
|
|
574
|
+
|
|
575
|
+
Enable Observability on the Mastra platform. The CLI prompts you to select an existing platform project or create a new one, writes the required environment variables, and configures the observability exporters.
|
|
576
|
+
|
|
577
|
+
#### `--no-observability`
|
|
578
|
+
|
|
579
|
+
Skip the Mastra Observability prompt.
|
|
580
|
+
|
|
581
|
+
#### `--observability-project`
|
|
582
|
+
|
|
583
|
+
Set the platform project name to use when Mastra Observability is enabled.
|
|
584
|
+
|
|
537
585
|
## `mastra migrate`
|
|
538
586
|
|
|
539
587
|
Runs database migrations to update your storage schema. This command is useful when upgrading Mastra versions that include storage schema changes.
|
|
@@ -552,7 +600,7 @@ It accepts [common flags](#common-flags).
|
|
|
552
600
|
|
|
553
601
|
## `mastra api`
|
|
554
602
|
|
|
555
|
-
Calls a Mastra runtime server with JSON input and JSON output. Use it for local development servers, deployed Mastra
|
|
603
|
+
Calls a Mastra runtime server with JSON input and JSON output. Use it for local development servers, deployed Mastra platform projects, or self-hosted Mastra servers.
|
|
556
604
|
|
|
557
605
|
```bash
|
|
558
606
|
mastra api agent list --pretty
|
|
@@ -594,9 +642,9 @@ The command resolves the target server in this order:
|
|
|
594
642
|
|
|
595
643
|
1. `--url <url>` for an explicit remote or self-hosted server.
|
|
596
644
|
2. `http://localhost:4111` for a local `mastra dev` server.
|
|
597
|
-
3. `.mastra-project.json` for a Mastra
|
|
645
|
+
3. `.mastra-project.json` for a Mastra platform project.
|
|
598
646
|
|
|
599
|
-
Automatic platform auth is only used when the CLI resolves a Mastra
|
|
647
|
+
Automatic platform auth is only used when the CLI resolves a Mastra platform target from `.mastra-project.json`. Localhost targets and explicit `--url` targets don't receive automatic credentials. Headers passed with `--header` are sent to any target, including localhost.
|
|
600
648
|
|
|
601
649
|
### Flags
|
|
602
650
|
|
|
@@ -628,7 +676,7 @@ Pretty-print JSON output. Defaults to `false`.
|
|
|
628
676
|
|
|
629
677
|
Print the CLI-oriented request schema for a command that accepts JSON input. The schema comes from the target server's route contracts and includes the command shape, positionals, examples, request schemas, and response shape.
|
|
630
678
|
|
|
631
|
-
`--schema` is available on leaf commands that accept JSON input. It
|
|
679
|
+
`--schema` is available on leaf commands that accept JSON input. It isn't available as a top-level `mastra api` flag.
|
|
632
680
|
|
|
633
681
|
```bash
|
|
634
682
|
mastra api agent run --schema
|
|
@@ -637,7 +685,7 @@ mastra api tool execute --schema
|
|
|
637
685
|
|
|
638
686
|
### Input model
|
|
639
687
|
|
|
640
|
-
Commands that accept input take one inline JSON argument.
|
|
688
|
+
Commands that accept input take one inline JSON argument. Don't pass file paths or stdin.
|
|
641
689
|
|
|
642
690
|
```bash
|
|
643
691
|
mastra api workflow run start data-pipeline '{"inputData":{"source":"s3://bucket/data.csv"}}'
|
|
@@ -151,6 +151,95 @@ for await (const part of uiMessageStream) {
|
|
|
151
151
|
}
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
+
### `sendSignal()`
|
|
155
|
+
|
|
156
|
+
Send a signal to an active agent run or memory thread. Use this with `subscribeToThread()` so the client can render the stream that wakes from, or receives, the signal.
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
const agent = mastraClient.getAgent('support-agent')
|
|
160
|
+
|
|
161
|
+
const result = await agent.sendSignal({
|
|
162
|
+
signal: {
|
|
163
|
+
type: 'user-message',
|
|
164
|
+
contents: 'Also consider the customer note I just added.',
|
|
165
|
+
},
|
|
166
|
+
resourceId: 'user-123',
|
|
167
|
+
threadId: 'thread-abc',
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
console.log(result.runId)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Use `ifActive.behavior` and `ifIdle.behavior` to control whether Mastra delivers, persists, discards, or wakes from a signal:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
await agent.sendSignal({
|
|
177
|
+
signal: { type: 'user-message', contents: 'Store this for later.' },
|
|
178
|
+
resourceId: 'user-123',
|
|
179
|
+
threadId: 'thread-abc',
|
|
180
|
+
ifIdle: {
|
|
181
|
+
behavior: 'persist',
|
|
182
|
+
},
|
|
183
|
+
})
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Pass `ifIdle.streamOptions` when the idle wake-up stream needs options such as model settings, tools, or runtime context:
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
await agent.sendSignal({
|
|
190
|
+
signal: { type: 'user-message', contents: 'Start from this signal.' },
|
|
191
|
+
resourceId: 'user-123',
|
|
192
|
+
threadId: 'thread-abc',
|
|
193
|
+
ifIdle: {
|
|
194
|
+
behavior: 'wake',
|
|
195
|
+
streamOptions: {
|
|
196
|
+
maxSteps: 3,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
})
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Returns `{ accepted: true, runId: string }`.
|
|
203
|
+
|
|
204
|
+
**signal** (`{ type: 'user-message'; contents: MessageListInput } | { type: string; contents: string }`): \`user-message\` signals are treated as user input. Other signal types are converted to contextual XML before the next model call.
|
|
205
|
+
|
|
206
|
+
**runId** (`string`): Run ID to target directly.
|
|
207
|
+
|
|
208
|
+
**resourceId** (`string`): Resource ID for the memory thread. Use with \`threadId\` for thread-targeted signals.
|
|
209
|
+
|
|
210
|
+
**threadId** (`string`): Thread ID to target. Use with \`resourceId\` for thread-targeted signals.
|
|
211
|
+
|
|
212
|
+
**ifActive.behavior** (`'deliver' | 'persist' | 'discard'`): Controls what happens when the target thread is active. Defaults to \`deliver\`.
|
|
213
|
+
|
|
214
|
+
**ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): Controls what happens when the target thread is idle. Defaults to \`wake\`.
|
|
215
|
+
|
|
216
|
+
**ifIdle.streamOptions** (`Omit<AgentExecutionOptions, 'messages'>`): Options for the stream that starts when \`ifIdle.behavior\` is \`wake\`.
|
|
217
|
+
|
|
218
|
+
### `subscribeToThread()`
|
|
219
|
+
|
|
220
|
+
Subscribe to raw stream chunks for a memory thread. Use this to render output from a thread that may be started or continued by `sendSignal()`.
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
const agent = mastraClient.getAgent('support-agent')
|
|
224
|
+
|
|
225
|
+
const subscription = await agent.subscribeToThread({
|
|
226
|
+
resourceId: 'user-123',
|
|
227
|
+
threadId: 'thread-abc',
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
await subscription.processDataStream({
|
|
231
|
+
onChunk: async chunk => {
|
|
232
|
+
console.log(chunk)
|
|
233
|
+
},
|
|
234
|
+
})
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
`subscribeToThread()` returns the underlying `Response` plus a `processDataStream()` helper. The helper reads the subscription stream until the connection closes or the request is aborted.
|
|
238
|
+
|
|
239
|
+
**resourceId** (`string`): Resource ID for the memory thread.
|
|
240
|
+
|
|
241
|
+
**threadId** (`string`): Thread ID to subscribe to.
|
|
242
|
+
|
|
154
243
|
### `streamUntilIdle()`
|
|
155
244
|
|
|
156
245
|
Stream a response and keep the stream open until every [background task](https://mastra.ai/docs/agents/background-tasks) dispatched during the run completes. The server re-enters the agentic loop on each task completion so the LLM can react to results in the same call. Requires background tasks to be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) and a memory thread; otherwise the call falls through to a plain `stream()`.
|
|
@@ -161,7 +250,7 @@ const response = await agent.streamUntilIdle('Research solana for me', {
|
|
|
161
250
|
thread: 'thread-1',
|
|
162
251
|
resource: 'resource-1',
|
|
163
252
|
},
|
|
164
|
-
maxIdleMs: 5 * 60_000,
|
|
253
|
+
maxIdleMs: 5 * 60_000, //optional
|
|
165
254
|
})
|
|
166
255
|
|
|
167
256
|
response.processDataStream({
|
|
@@ -173,6 +262,31 @@ response.processDataStream({
|
|
|
173
262
|
})
|
|
174
263
|
```
|
|
175
264
|
|
|
265
|
+
### `resumeStreamUntilIdle()`
|
|
266
|
+
|
|
267
|
+
Resume a suspended agent stream with custom data and keep the stream open until every [background task](https://mastra.ai/docs/agents/background-tasks) dispatched during the run completes. Use this to continue execution after a suspension point, such as a workflow suspend within an agent. Requires background tasks to be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) and a memory thread; otherwise the call falls through to a plain `resumeStream()`:
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
const response = await agent.resumeStreamUntilIdle(
|
|
271
|
+
{ approved: true, selectedOption: 'plan-b' },
|
|
272
|
+
{
|
|
273
|
+
memory: {
|
|
274
|
+
thread: 'thread-1',
|
|
275
|
+
resource: 'resource-1',
|
|
276
|
+
},
|
|
277
|
+
runId: 'run-123',
|
|
278
|
+
toolCallId: 'tool-call-456', // optional
|
|
279
|
+
maxIdleMs: 5 * 60_000, //optional
|
|
280
|
+
},
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
await response.processDataStream({
|
|
284
|
+
onChunk: chunk => {
|
|
285
|
+
console.log(chunk)
|
|
286
|
+
},
|
|
287
|
+
})
|
|
288
|
+
```
|
|
289
|
+
|
|
176
290
|
The stream emits the same chunk types as `stream()`, plus `background-task-*` chunks for task lifecycle events. Visit [`Agent.streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) for the full server-side API and [background task chunks](https://mastra.ai/reference/streaming/ChunkType) for the payload shapes.
|
|
177
291
|
|
|
178
292
|
### `getTool()`
|