@mastra/mcp-docs-server 0.13.7-alpha.5 → 0.13.8-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.
Files changed (97) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +30 -30
  2. package/.docs/organized/changelogs/%40mastra%2Fastra.md +31 -31
  3. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +31 -31
  4. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +31 -31
  5. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +60 -60
  6. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +44 -44
  7. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +34 -34
  8. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +33 -33
  9. package/.docs/organized/changelogs/%40mastra%2Fcore.md +72 -72
  10. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +31 -31
  11. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +56 -56
  12. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +52 -52
  13. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +52 -52
  14. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +73 -73
  15. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +33 -33
  16. package/.docs/organized/changelogs/%40mastra%2Fevals.md +36 -36
  17. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +47 -47
  18. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +31 -31
  19. package/.docs/organized/changelogs/%40mastra%2Flance.md +30 -0
  20. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +50 -50
  21. package/.docs/organized/changelogs/%40mastra%2Floggers.md +31 -31
  22. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +44 -44
  23. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +31 -31
  24. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +43 -43
  25. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +33 -33
  26. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +51 -51
  27. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +48 -48
  28. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +32 -0
  29. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +31 -31
  30. package/.docs/organized/changelogs/%40mastra%2Fpg.md +58 -58
  31. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +31 -31
  32. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +58 -58
  33. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +31 -31
  34. package/.docs/organized/changelogs/%40mastra%2Frag.md +46 -46
  35. package/.docs/organized/changelogs/%40mastra%2Fragie.md +31 -31
  36. package/.docs/organized/changelogs/%40mastra%2Fserver.md +58 -58
  37. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +31 -31
  38. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +49 -49
  39. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +33 -33
  40. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +33 -33
  41. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +33 -33
  42. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +31 -31
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +31 -31
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +31 -31
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +43 -43
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +35 -35
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +45 -45
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +31 -31
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +31 -31
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +31 -31
  51. package/.docs/organized/changelogs/create-mastra.md +10 -10
  52. package/.docs/organized/changelogs/mastra.md +70 -70
  53. package/.docs/raw/agents/streaming.mdx +118 -0
  54. package/.docs/raw/community/contributing-templates.mdx +1 -0
  55. package/.docs/raw/memory/overview.mdx +3 -1
  56. package/.docs/raw/memory/working-memory.mdx +67 -0
  57. package/.docs/raw/observability/logging.mdx +94 -19
  58. package/.docs/raw/reference/agents/streamVNext.mdx +598 -0
  59. package/.docs/raw/reference/observability/logger.mdx +69 -50
  60. package/.docs/raw/reference/observability/providers/langfuse.mdx +47 -14
  61. package/.docs/raw/reference/workflows/dountil.mdx +1 -2
  62. package/.docs/raw/reference/workflows/dowhile.mdx +1 -2
  63. package/.docs/raw/reference/workflows/resume.mdx +13 -3
  64. package/.docs/raw/reference/workflows/step.mdx +0 -1
  65. package/.docs/raw/reference/workflows/streamVNext.mdx +215 -0
  66. package/.docs/raw/workflows/streaming.mdx +115 -0
  67. package/.docs/raw/workflows/suspend-and-resume.mdx +13 -2
  68. package/dist/index.d.ts +5 -0
  69. package/dist/index.d.ts.map +1 -0
  70. package/dist/logger.d.ts +11 -0
  71. package/dist/logger.d.ts.map +1 -0
  72. package/dist/prepare-docs/code-examples.d.ts +5 -0
  73. package/dist/prepare-docs/code-examples.d.ts.map +1 -0
  74. package/dist/prepare-docs/copy-raw.d.ts +2 -0
  75. package/dist/prepare-docs/copy-raw.d.ts.map +1 -0
  76. package/dist/prepare-docs/package-changes.d.ts +5 -0
  77. package/dist/prepare-docs/package-changes.d.ts.map +1 -0
  78. package/dist/prepare-docs/prepare.d.ts +2 -1
  79. package/dist/prepare-docs/prepare.d.ts.map +1 -0
  80. package/dist/stdio.d.ts +2 -0
  81. package/dist/stdio.d.ts.map +1 -0
  82. package/dist/tools/__tests__/test-setup.d.ts +5 -0
  83. package/dist/tools/__tests__/test-setup.d.ts.map +1 -0
  84. package/dist/tools/blog.d.ts +22 -0
  85. package/dist/tools/blog.d.ts.map +1 -0
  86. package/dist/tools/changes.d.ts +22 -0
  87. package/dist/tools/changes.d.ts.map +1 -0
  88. package/dist/tools/course.d.ts +85 -0
  89. package/dist/tools/course.d.ts.map +1 -0
  90. package/dist/tools/docs.d.ts +28 -0
  91. package/dist/tools/docs.d.ts.map +1 -0
  92. package/dist/tools/examples.d.ts +28 -0
  93. package/dist/tools/examples.d.ts.map +1 -0
  94. package/dist/utils.d.ts +62 -0
  95. package/dist/utils.d.ts.map +1 -0
  96. package/package.json +6 -6
  97. package/dist/_tsup-dts-rollup.d.ts +0 -304
@@ -0,0 +1,598 @@
1
+ ---
2
+ title: "Reference: Agent.streamVNext() | Streaming | Agents | Mastra Docs"
3
+ description: Documentation for the `.streamVNext()` method in Mastra agents, which enables real-time streaming of responses.
4
+ ---
5
+
6
+ # `streamVNext()`
7
+
8
+ The `streamVNext()` method enables real-time streaming of responses from an agent. This method accepts `messages` and an optional `options` object as parameters, similar to `generate()`.
9
+
10
+ ## Parameters
11
+
12
+ ### `messages`
13
+
14
+ The `messages` parameter can be:
15
+
16
+ - A single string
17
+ - An array of strings
18
+ - An array of message objects with `role` and `content` properties
19
+
20
+ The message object structure:
21
+
22
+ ```typescript
23
+ interface Message {
24
+ role: "system" | "user" | "assistant";
25
+ content: string;
26
+ }
27
+ ```
28
+
29
+ ### `options` (Optional)
30
+
31
+ An optional object that can include configuration for output structure, memory management, tool usage, telemetry, and more.
32
+
33
+ <PropertiesTable
34
+ content={[
35
+ {
36
+ name: "abortSignal",
37
+ type: "AbortSignal",
38
+ isOptional: true,
39
+ description:
40
+ "Signal object that allows you to abort the agent's execution. When the signal is aborted, all ongoing operations will be terminated.",
41
+ },
42
+ {
43
+ name: "context",
44
+ type: "CoreMessage[]",
45
+ isOptional: true,
46
+ description: "Additional context messages to provide to the agent.",
47
+ },
48
+ {
49
+ name: "experimental_output",
50
+ type: "Zod schema | JsonSchema7",
51
+ isOptional: true,
52
+ description:
53
+ "Enables structured output generation alongside text generation and tool calls. The model will generate responses that conform to the provided schema.",
54
+ },
55
+ {
56
+ name: "instructions",
57
+ type: "string",
58
+ isOptional: true,
59
+ description:
60
+ "Custom instructions that override the agent's default instructions for this specific generation. Useful for dynamically modifying agent behavior without creating a new agent instance.",
61
+ },
62
+ {
63
+ name: "memory",
64
+ type: "object",
65
+ isOptional: true,
66
+ description: "Configuration for memory. This is the preferred way to manage memory.",
67
+ properties: [
68
+ {
69
+ parameters: [{
70
+ name: "thread",
71
+ type: "string | { id: string; metadata?: Record<string, any>, title?: string }",
72
+ isOptional: false,
73
+ description: "The conversation thread, as a string ID or an object with an `id` and optional `metadata`."
74
+ }]
75
+ },
76
+ {
77
+ parameters: [{
78
+ name: "resource",
79
+ type: "string",
80
+ isOptional: false,
81
+ description: "Identifier for the user or resource associated with the thread."
82
+ }]
83
+ },
84
+ {
85
+ parameters: [{
86
+ name: "options",
87
+ type: "MemoryConfig",
88
+ isOptional: true,
89
+ description: "Configuration for memory behavior, like message history and semantic recall. See `MemoryConfig` below."
90
+ }]
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ name: "maxSteps",
96
+ type: "number",
97
+ isOptional: true,
98
+ defaultValue: "5",
99
+ description: "Maximum number of steps allowed during streaming.",
100
+ },
101
+ {
102
+ name: "maxRetries",
103
+ type: "number",
104
+ isOptional: true,
105
+ defaultValue: "2",
106
+ description: "Maximum number of retries. Set to 0 to disable retries.",
107
+ },
108
+ {
109
+ name: "memoryOptions",
110
+ type: "MemoryConfig",
111
+ isOptional: true,
112
+ description:
113
+ "**Deprecated.** Use `memory.options` instead. Configuration options for memory management. See MemoryConfig section below for details.",
114
+ },
115
+ {
116
+ name: "onFinish",
117
+ type: "StreamTextOnFinishCallback | StreamObjectOnFinishCallback",
118
+ isOptional: true,
119
+ description: "Callback function called when streaming is complete.",
120
+ },
121
+ {
122
+ name: "onStepFinish",
123
+ type: "GenerateTextOnStepFinishCallback<any> | never",
124
+ isOptional: true,
125
+ description:
126
+ "Callback function called after each step during streaming. Unavailable for structured output",
127
+ },
128
+ {
129
+ name: "output",
130
+ type: "Zod schema | JsonSchema7",
131
+ isOptional: true,
132
+ description:
133
+ "Defines the expected structure of the output. Can be a JSON Schema object or a Zod schema.",
134
+ },
135
+ {
136
+ name: "telemetry",
137
+ type: "TelemetrySettings",
138
+ isOptional: true,
139
+ description:
140
+ "Settings for telemetry collection during streaming. See TelemetrySettings section below for details.",
141
+ },
142
+ {
143
+ name: "temperature",
144
+ type: "number",
145
+ isOptional: true,
146
+ description:
147
+ "Controls randomness in the model's output. Higher values (e.g., 0.8) make the output more random, lower values (e.g., 0.2) make it more focused and deterministic.",
148
+ },
149
+ {
150
+ name: "toolChoice",
151
+ type: "'auto' | 'none' | 'required' | { type: 'tool'; toolName: string }",
152
+ isOptional: true,
153
+ defaultValue: "'auto'",
154
+ description: "Controls how the agent uses tools during streaming.",
155
+ },
156
+ {
157
+ name: "toolsets",
158
+ type: "ToolsetsInput",
159
+ isOptional: true,
160
+ description:
161
+ "Additional toolsets to make available to the agent during this stream.",
162
+ },
163
+ {
164
+ name: "clientTools",
165
+ type: "ToolsInput",
166
+ isOptional: true,
167
+ description:
168
+ "Tools that are executed on the 'client' side of the request. These tools do not have execute functions in the definition.",
169
+ },
170
+ ]}
171
+ />
172
+
173
+ #### MemoryConfig
174
+
175
+ Configuration options for memory management:
176
+
177
+ <PropertiesTable
178
+ content={[
179
+ {
180
+ name: "lastMessages",
181
+ type: "number | false",
182
+ isOptional: true,
183
+ description:
184
+ "Number of most recent messages to include in context. Set to false to disable.",
185
+ },
186
+ {
187
+ name: "semanticRecall",
188
+ type: "boolean | object",
189
+ isOptional: true,
190
+ description:
191
+ "Configuration for semantic memory recall. Can be boolean or detailed config.",
192
+ properties: [
193
+ {
194
+ type: "number",
195
+ parameters: [
196
+ {
197
+ name: "topK",
198
+ type: "number",
199
+ isOptional: true,
200
+ description:
201
+ "Number of most semantically similar messages to retrieve.",
202
+ },
203
+ ],
204
+ },
205
+ {
206
+ type: "number | object",
207
+ parameters: [
208
+ {
209
+ name: "messageRange",
210
+ type: "number | { before: number; after: number }",
211
+ isOptional: true,
212
+ description:
213
+ "Range of messages to consider for semantic search. Can be a single number or before/after configuration.",
214
+ },
215
+ ],
216
+ },
217
+ ],
218
+ },
219
+ {
220
+ name: "workingMemory",
221
+ type: "object",
222
+ isOptional: true,
223
+ description: "Configuration for working memory.",
224
+ properties: [
225
+ {
226
+ type: "boolean",
227
+ parameters: [
228
+ {
229
+ name: "enabled",
230
+ type: "boolean",
231
+ isOptional: true,
232
+ description: "Whether to enable working memory.",
233
+ },
234
+ ],
235
+ },
236
+ {
237
+ type: "string",
238
+ parameters: [
239
+ {
240
+ name: "template",
241
+ type: "string",
242
+ isOptional: true,
243
+ description: "Template to use for working memory.",
244
+ },
245
+ ],
246
+ },
247
+ ],
248
+ },
249
+ {
250
+ name: "threads",
251
+ type: "object",
252
+ isOptional: true,
253
+ description: "Thread-specific memory configuration.",
254
+ properties: [
255
+ {
256
+ type: "boolean | object",
257
+ parameters: [
258
+ {
259
+ name: "generateTitle",
260
+ type: "boolean | { model: LanguageModelV1 | ((ctx: RuntimeContext) => LanguageModelV1 | Promise<LanguageModelV1>), instructions: string | ((ctx: RuntimeContext) => string | Promise<string>) }",
261
+ isOptional: true,
262
+ description:
263
+ `Controls automatic thread title generation from the user's first message. Can be a boolean to enable/disable using the agent's model, or an object specifying a custom model and/or custom instructions for title generation (useful for cost optimization or title customization).
264
+ Example: { model: openai('gpt-4.1-nano'), instructions: 'Generate a concise title based on the initial user message.' }`,
265
+ },
266
+ ],
267
+ },
268
+ ],
269
+ },
270
+ ]}
271
+ />
272
+
273
+ #### TelemetrySettings
274
+
275
+ Settings for telemetry collection during streaming:
276
+
277
+ <PropertiesTable
278
+ content={[
279
+ {
280
+ name: "isEnabled",
281
+ type: "boolean",
282
+ isOptional: true,
283
+ defaultValue: "false",
284
+ description:
285
+ "Enable or disable telemetry. Disabled by default while experimental.",
286
+ },
287
+ {
288
+ name: "recordInputs",
289
+ type: "boolean",
290
+ isOptional: true,
291
+ defaultValue: "true",
292
+ description:
293
+ "Enable or disable input recording. You might want to disable this to avoid recording sensitive information, reduce data transfers, or increase performance.",
294
+ },
295
+ {
296
+ name: "recordOutputs",
297
+ type: "boolean",
298
+ isOptional: true,
299
+ defaultValue: "true",
300
+ description:
301
+ "Enable or disable output recording. You might want to disable this to avoid recording sensitive information, reduce data transfers, or increase performance.",
302
+ },
303
+ {
304
+ name: "functionId",
305
+ type: "string",
306
+ isOptional: true,
307
+ description:
308
+ "Identifier for this function. Used to group telemetry data by function.",
309
+ },
310
+ {
311
+ name: "metadata",
312
+ type: "Record<string, AttributeValue>",
313
+ isOptional: true,
314
+ description:
315
+ "Additional information to include in the telemetry data. AttributeValue can be string, number, boolean, array of these types, or null.",
316
+ },
317
+ {
318
+ name: "tracer",
319
+ type: "Tracer",
320
+ isOptional: true,
321
+ description:
322
+ "A custom OpenTelemetry tracer instance to use for the telemetry data. See OpenTelemetry documentation for details.",
323
+ },
324
+ ]}
325
+ />
326
+
327
+
328
+
329
+ ## Protocol
330
+
331
+ <PropertiesTable
332
+ content={[
333
+ {
334
+ name: "start",
335
+ type: "object",
336
+ description: "The agent starts",
337
+ isOptional: false,
338
+ properties: [
339
+ {
340
+ type: "object",
341
+ parameters: [
342
+ {
343
+ name: "example",
344
+ type: "{ type: 'start', runId: '1', from: 'AGENT', payload: {} }",
345
+ description: "Example message structure",
346
+ isOptional: false,
347
+ },
348
+ ],
349
+ },
350
+ ],
351
+ },
352
+ {
353
+ name: "step-start",
354
+ type: "object",
355
+ description: "The start of a step",
356
+ isOptional: false,
357
+ properties: [
358
+ {
359
+ type: "object",
360
+ parameters: [
361
+ {
362
+ name: "example",
363
+ type: "{ type: 'step-start', runId: '1', from: 'AGENT', payload: { messageId: 'uuid', request: { /* Raw request object */ }, warnings: [] } }",
364
+ description: "Example message structure",
365
+ isOptional: false,
366
+ },
367
+ ],
368
+ },
369
+ ],
370
+ },
371
+ {
372
+ name: "tool-call",
373
+ type: "object",
374
+ description: "The start of a tool call",
375
+ isOptional: false,
376
+ properties: [
377
+ {
378
+ type: "object",
379
+ parameters: [
380
+ {
381
+ name: "example",
382
+ type: "{ type: 'tool-call', runId: '1', from: 'AGENT', payload: { toolCallId: 'uuid', args: { ... }, toolName: 'my tool' } }",
383
+ description: "Example message structure",
384
+ isOptional: false,
385
+ },
386
+ ],
387
+ },
388
+ ],
389
+ },
390
+ {
391
+ name: "tool-output",
392
+ type: "object",
393
+ description: "Custom output from a step",
394
+ isOptional: false,
395
+ properties: [
396
+ {
397
+ type: "object",
398
+ parameters: [
399
+ {
400
+ name: "example",
401
+ type: "{ type: 'tool-output', runId: '1', from: 'AGENT', payload: { toolName: 'my step', output: { ... }, toolCallId: 'uuid' } }",
402
+ description: "Example message structure",
403
+ isOptional: false,
404
+ },
405
+ ],
406
+ },
407
+ ],
408
+ },
409
+ {
410
+ name: "tool-result",
411
+ type: "object",
412
+ description: "The result of a step",
413
+ isOptional: false,
414
+ properties: [
415
+ {
416
+ type: "object",
417
+ parameters: [
418
+ {
419
+ name: "example",
420
+ type: "{ type: 'tool-result', runId: '1', from: 'AGENT', payload: { toolCallId: 'uuid', result: { ... }, toolName: 'my tool' } }",
421
+ description: "Example message structure",
422
+ isOptional: false,
423
+ },
424
+ ],
425
+ },
426
+ ],
427
+ },
428
+ {
429
+ name: "step-finish",
430
+ type: "object",
431
+ description: "The end of a step",
432
+ isOptional: false,
433
+ properties: [
434
+ {
435
+ type: "object",
436
+ parameters: [
437
+ {
438
+ name: "example",
439
+ type: "{ type: 'step-finish', runId: '1', from: 'AGENT', payload: { reason: 'stop', usage: { promptTokens: 100, completionTokens: 100, totalTokens: 200 }, response: Response, messageId: 'uuid', providerMetadata: { ... } } }",
440
+ description: "Example message structure",
441
+ isOptional: false,
442
+ },
443
+ ],
444
+ },
445
+ ],
446
+ },
447
+ {
448
+ name: "finish",
449
+ type: "object",
450
+ description: "The end of the workflow",
451
+ isOptional: false,
452
+ properties: [
453
+ {
454
+ type: "object",
455
+ parameters: [
456
+ {
457
+ name: "example",
458
+ type: "{ type: 'finish', runId: '1', from: 'AGENT', payload: { totalUsage: { promptTokens: 100, completionTokens: 100, totalTokens: 200 } } }",
459
+ description: "Example message structure",
460
+ isOptional: false,
461
+ },
462
+ ],
463
+ },
464
+ ],
465
+ },
466
+ ]}
467
+ />
468
+
469
+ ## Returns
470
+
471
+ The return value of the `streamVNext()` method is a custom MatraAgentStream. This stream extends a ReadableStream, so all basic stream methods are available.
472
+
473
+ ### PropertiesTable for Return Values
474
+
475
+ <PropertiesTable
476
+ content={[
477
+ {
478
+ name: "textStream",
479
+ type: "ReadableStream<string>",
480
+ isOptional: true,
481
+ description:
482
+ "Stream of text chunks. Present when output is 'text' (no schema provided) or when using `experimental_output`.",
483
+ },
484
+ {
485
+ name: "usage",
486
+ type: "Promise<object>",
487
+ isOptional: true,
488
+ description:
489
+ "Total usage of the agent, including agents/workflows as a tool.",
490
+ properties: [
491
+ {
492
+ type: "number",
493
+ parameters: [
494
+ {
495
+ name: "promptTokens",
496
+ type: "number",
497
+ isOptional: true,
498
+ description: "The number of prompt tokens used by the agent.",
499
+ },
500
+ ],
501
+ },
502
+ {
503
+ type: "number",
504
+ parameters: [
505
+ {
506
+ name: "completionTokens",
507
+ type: "number",
508
+ isOptional: true,
509
+ description: "The number of completion tokens used by the agent.",
510
+ },
511
+ ],
512
+ },
513
+ {
514
+ type: "number",
515
+ parameters: [
516
+ {
517
+ name: "totalTokens",
518
+ type: "number",
519
+ isOptional: true,
520
+ description: "The total number of tokens used by the agent.",
521
+ },
522
+ ],
523
+ },
524
+ ],
525
+ },
526
+ {
527
+ name: "finishReason",
528
+ type: "Promise<string>",
529
+ isOptional: true,
530
+ description:
531
+ "The reason the agent stopped streaming.",
532
+ },
533
+ {
534
+ name: "toolCalls",
535
+ type: "Promise<object>",
536
+ isOptional: true,
537
+ description:
538
+ "The tool calls made by the agent.",
539
+ },
540
+ {
541
+ name: "toolResults",
542
+ type: "Promise<object>",
543
+ isOptional: true,
544
+ description:
545
+ "The tool results returned by the agent.",
546
+ },
547
+ {
548
+ name: "text",
549
+ type: "Promise<string>",
550
+ isOptional: true,
551
+ description:
552
+ "The full text of the agent's response.",
553
+ },
554
+ {
555
+ name: "object",
556
+ type: "Promise<object>",
557
+ isOptional: true,
558
+ description:
559
+ "The object of the agent's response, if you use output or experimental output.",
560
+ },
561
+ ]}
562
+ />
563
+
564
+ ## Examples
565
+
566
+ ### Basic Text Streaming
567
+
568
+ ```typescript
569
+ const stream = await myAgent.streamVNext([
570
+ { role: "user", content: "Tell me a story." },
571
+ ]);
572
+
573
+ for await (const chunk of stream.textStream) {
574
+ process.stdout.write(chunk);
575
+ }
576
+ ```
577
+
578
+ ### Structured Output Streaming with Thread Context
579
+
580
+ ```typescript
581
+ import { z } from "zod";
582
+
583
+ const schema = z.object({
584
+ summary: z.string(),
585
+ nextSteps: z.array(z.string()),
586
+ });
587
+
588
+ const response = await myAgent.streamVNext("What should we do next?", {
589
+ output: schema,
590
+ memory: {
591
+ thread: "project-123",
592
+ },
593
+ });
594
+
595
+ const result = await response.object;
596
+ console.log("Final structured result:", result);
597
+ ```
598
+