@voltagent/core 0.1.29 → 0.1.31
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/dist/index.d.ts +255 -223
- package/dist/index.js +217 -131
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +218 -132
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,216 @@ import { SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
|
5
5
|
import { ClientCapabilities } from '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
import { EventEmitter } from 'node:events';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Represents a collection of related tools with optional shared instructions.
|
|
10
|
+
*/
|
|
11
|
+
type Toolkit = {
|
|
12
|
+
/**
|
|
13
|
+
* Unique identifier name for the toolkit. Used for management and potentially logging.
|
|
14
|
+
*/
|
|
15
|
+
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* A brief description of what the toolkit does or what tools it contains.
|
|
18
|
+
* Optional.
|
|
19
|
+
*/
|
|
20
|
+
description?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Shared instructions for the LLM on how to use the tools within this toolkit.
|
|
23
|
+
* These instructions are intended to be added to the system prompt if `addInstructions` is true.
|
|
24
|
+
* Optional.
|
|
25
|
+
*/
|
|
26
|
+
instructions?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to automatically add the toolkit's `instructions` to the agent's system prompt.
|
|
29
|
+
* If true, the instructions from individual tools within this toolkit might be ignored
|
|
30
|
+
* by the Agent's system message generation logic to avoid redundancy.
|
|
31
|
+
* Defaults to false.
|
|
32
|
+
*/
|
|
33
|
+
addInstructions?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* An array of Tool instances that belong to this toolkit.
|
|
36
|
+
*/
|
|
37
|
+
tools: Tool<ToolSchema>[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Helper function for creating a new toolkit.
|
|
41
|
+
* Provides default values and ensures the basic structure is met.
|
|
42
|
+
*
|
|
43
|
+
* @param options - The configuration options for the toolkit.
|
|
44
|
+
* @returns A Toolkit object.
|
|
45
|
+
*/
|
|
46
|
+
declare const createToolkit: (options: Toolkit) => Toolkit;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Status of a tool at any given time
|
|
50
|
+
*/
|
|
51
|
+
type ToolStatus = "idle" | "working" | "error" | "completed";
|
|
52
|
+
/**
|
|
53
|
+
* Tool status information
|
|
54
|
+
*/
|
|
55
|
+
type ToolStatusInfo = {
|
|
56
|
+
name: string;
|
|
57
|
+
status: ToolStatus;
|
|
58
|
+
result?: any;
|
|
59
|
+
error?: any;
|
|
60
|
+
input?: any;
|
|
61
|
+
output?: any;
|
|
62
|
+
timestamp: Date;
|
|
63
|
+
parameters?: any;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Manager class to handle all tool-related operations, including Toolkits.
|
|
67
|
+
*/
|
|
68
|
+
declare class ToolManager {
|
|
69
|
+
/**
|
|
70
|
+
* Standalone tools managed by this manager.
|
|
71
|
+
*/
|
|
72
|
+
private tools;
|
|
73
|
+
/**
|
|
74
|
+
* Toolkits managed by this manager.
|
|
75
|
+
*/
|
|
76
|
+
private toolkits;
|
|
77
|
+
/**
|
|
78
|
+
* Creates a new ToolManager.
|
|
79
|
+
* Accepts both individual tools and toolkits.
|
|
80
|
+
*/
|
|
81
|
+
constructor(items?: (AgentTool | Toolkit)[]);
|
|
82
|
+
/**
|
|
83
|
+
* Get all individual tools and tools within toolkits as a flattened list.
|
|
84
|
+
*/
|
|
85
|
+
getTools(): BaseTool[];
|
|
86
|
+
/**
|
|
87
|
+
* Get all toolkits managed by this manager.
|
|
88
|
+
*/
|
|
89
|
+
getToolkits(): Toolkit[];
|
|
90
|
+
/**
|
|
91
|
+
* Add an individual tool to the manager.
|
|
92
|
+
* If a standalone tool with the same name already exists, it will be replaced.
|
|
93
|
+
* A warning is issued if the name conflicts with a tool inside a toolkit, but the standalone tool is still added/replaced.
|
|
94
|
+
* @returns true if the tool was successfully added or replaced.
|
|
95
|
+
*/
|
|
96
|
+
addTool(tool: AgentTool): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Add a toolkit to the manager.
|
|
99
|
+
* If a toolkit with the same name already exists, it will be replaced.
|
|
100
|
+
* Also checks if any tool within the toolkit conflicts with existing standalone tools or tools in other toolkits.
|
|
101
|
+
* @returns true if the toolkit was successfully added or replaced.
|
|
102
|
+
*/
|
|
103
|
+
addToolkit(toolkit: Toolkit): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Add multiple tools or toolkits to the manager.
|
|
106
|
+
*/
|
|
107
|
+
addItems(items: (AgentTool | Toolkit)[]): void;
|
|
108
|
+
/**
|
|
109
|
+
* Remove a standalone tool by name. Does not remove tools from toolkits.
|
|
110
|
+
* @returns true if the tool was removed, false if it wasn't found.
|
|
111
|
+
*/
|
|
112
|
+
removeTool(toolName: string): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Remove a toolkit by name.
|
|
115
|
+
* @returns true if the toolkit was removed, false if it wasn't found.
|
|
116
|
+
*/
|
|
117
|
+
removeToolkit(toolkitName: string): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Prepare tools for text generation (includes tools from toolkits).
|
|
120
|
+
*/
|
|
121
|
+
prepareToolsForGeneration(dynamicTools?: BaseTool[]): BaseTool[];
|
|
122
|
+
/**
|
|
123
|
+
* Get agent's tools (including those in toolkits) for API exposure.
|
|
124
|
+
*/
|
|
125
|
+
getToolsForApi(): {
|
|
126
|
+
name: string;
|
|
127
|
+
description: string;
|
|
128
|
+
parameters: any;
|
|
129
|
+
}[];
|
|
130
|
+
/**
|
|
131
|
+
* Check if a tool with the given name exists (either standalone or in a toolkit).
|
|
132
|
+
*/
|
|
133
|
+
hasTool(toolName: string): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Get a tool by name (searches standalone tools and tools within toolkits).
|
|
136
|
+
* @param toolName The name of the tool to get
|
|
137
|
+
* @returns The tool (as BaseTool) or undefined if not found
|
|
138
|
+
*/
|
|
139
|
+
getToolByName(toolName: string): BaseTool | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Execute a tool by name
|
|
142
|
+
* @param toolName The name of the tool to execute
|
|
143
|
+
* @param args The arguments to pass to the tool
|
|
144
|
+
* @param options Optional execution options like signal
|
|
145
|
+
* @returns The result of the tool execution
|
|
146
|
+
* @throws Error if the tool doesn't exist or fails to execute
|
|
147
|
+
*/
|
|
148
|
+
executeTool(toolName: string, args: any, options?: ToolExecuteOptions): Promise<any>;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Tool definition compatible with Vercel AI SDK
|
|
153
|
+
*/
|
|
154
|
+
type AgentTool = BaseTool;
|
|
155
|
+
/**
|
|
156
|
+
* Tool options for creating a new tool
|
|
157
|
+
*/
|
|
158
|
+
type ToolOptions<T extends ToolSchema = ToolSchema> = {
|
|
159
|
+
/**
|
|
160
|
+
* Unique identifier for the tool
|
|
161
|
+
*/
|
|
162
|
+
id?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Name of the tool
|
|
165
|
+
*/
|
|
166
|
+
name: string;
|
|
167
|
+
/**
|
|
168
|
+
* Description of the tool
|
|
169
|
+
*/
|
|
170
|
+
description: string;
|
|
171
|
+
/**
|
|
172
|
+
* Tool parameter schema
|
|
173
|
+
*/
|
|
174
|
+
parameters: T;
|
|
175
|
+
/**
|
|
176
|
+
* Function to execute when the tool is called
|
|
177
|
+
*/
|
|
178
|
+
execute: (args: z.infer<T>, options?: ToolExecuteOptions) => Promise<unknown>;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Tool class for defining tools that agents can use
|
|
182
|
+
*/
|
|
183
|
+
declare class Tool<T extends ToolSchema = ToolSchema> {
|
|
184
|
+
/**
|
|
185
|
+
* Unique identifier for the tool
|
|
186
|
+
*/
|
|
187
|
+
readonly id: string;
|
|
188
|
+
/**
|
|
189
|
+
* Name of the tool
|
|
190
|
+
*/
|
|
191
|
+
readonly name: string;
|
|
192
|
+
/**
|
|
193
|
+
* Description of the tool
|
|
194
|
+
*/
|
|
195
|
+
readonly description: string;
|
|
196
|
+
/**
|
|
197
|
+
* Tool parameter schema
|
|
198
|
+
*/
|
|
199
|
+
readonly parameters: T;
|
|
200
|
+
/**
|
|
201
|
+
* Function to execute when the tool is called
|
|
202
|
+
*/
|
|
203
|
+
readonly execute: (args: z.infer<T>, options?: ToolExecuteOptions) => Promise<unknown>;
|
|
204
|
+
/**
|
|
205
|
+
* Create a new tool
|
|
206
|
+
*/
|
|
207
|
+
constructor(options: ToolOptions<T>);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Helper function for creating a new tool
|
|
211
|
+
*/
|
|
212
|
+
declare const createTool: <T extends ToolSchema>(options: ToolOptions<T>) => Tool<T>;
|
|
213
|
+
/**
|
|
214
|
+
* Alias for createTool function
|
|
215
|
+
*/
|
|
216
|
+
declare const tool: <T extends ToolSchema>(options: ToolOptions<T>) => Tool<T>;
|
|
217
|
+
|
|
8
218
|
/**
|
|
9
219
|
* Memory options
|
|
10
220
|
*/
|
|
@@ -455,216 +665,6 @@ declare class VoltAgentExporter {
|
|
|
455
665
|
updateHistoryEntry(history_id: string, updates: Partial<AgentHistoryUpdatableFields>): Promise<void>;
|
|
456
666
|
}
|
|
457
667
|
|
|
458
|
-
/**
|
|
459
|
-
* Represents a collection of related tools with optional shared instructions.
|
|
460
|
-
*/
|
|
461
|
-
type Toolkit = {
|
|
462
|
-
/**
|
|
463
|
-
* Unique identifier name for the toolkit. Used for management and potentially logging.
|
|
464
|
-
*/
|
|
465
|
-
name: string;
|
|
466
|
-
/**
|
|
467
|
-
* A brief description of what the toolkit does or what tools it contains.
|
|
468
|
-
* Optional.
|
|
469
|
-
*/
|
|
470
|
-
description?: string;
|
|
471
|
-
/**
|
|
472
|
-
* Shared instructions for the LLM on how to use the tools within this toolkit.
|
|
473
|
-
* These instructions are intended to be added to the system prompt if `addInstructions` is true.
|
|
474
|
-
* Optional.
|
|
475
|
-
*/
|
|
476
|
-
instructions?: string;
|
|
477
|
-
/**
|
|
478
|
-
* Whether to automatically add the toolkit's `instructions` to the agent's system prompt.
|
|
479
|
-
* If true, the instructions from individual tools within this toolkit might be ignored
|
|
480
|
-
* by the Agent's system message generation logic to avoid redundancy.
|
|
481
|
-
* Defaults to false.
|
|
482
|
-
*/
|
|
483
|
-
addInstructions?: boolean;
|
|
484
|
-
/**
|
|
485
|
-
* An array of Tool instances that belong to this toolkit.
|
|
486
|
-
*/
|
|
487
|
-
tools: Tool<ToolSchema>[];
|
|
488
|
-
};
|
|
489
|
-
/**
|
|
490
|
-
* Helper function for creating a new toolkit.
|
|
491
|
-
* Provides default values and ensures the basic structure is met.
|
|
492
|
-
*
|
|
493
|
-
* @param options - The configuration options for the toolkit.
|
|
494
|
-
* @returns A Toolkit object.
|
|
495
|
-
*/
|
|
496
|
-
declare const createToolkit: (options: Toolkit) => Toolkit;
|
|
497
|
-
|
|
498
|
-
/**
|
|
499
|
-
* Status of a tool at any given time
|
|
500
|
-
*/
|
|
501
|
-
type ToolStatus = "idle" | "working" | "error" | "completed";
|
|
502
|
-
/**
|
|
503
|
-
* Tool status information
|
|
504
|
-
*/
|
|
505
|
-
type ToolStatusInfo = {
|
|
506
|
-
name: string;
|
|
507
|
-
status: ToolStatus;
|
|
508
|
-
result?: any;
|
|
509
|
-
error?: any;
|
|
510
|
-
input?: any;
|
|
511
|
-
output?: any;
|
|
512
|
-
timestamp: Date;
|
|
513
|
-
parameters?: any;
|
|
514
|
-
};
|
|
515
|
-
/**
|
|
516
|
-
* Manager class to handle all tool-related operations, including Toolkits.
|
|
517
|
-
*/
|
|
518
|
-
declare class ToolManager {
|
|
519
|
-
/**
|
|
520
|
-
* Standalone tools managed by this manager.
|
|
521
|
-
*/
|
|
522
|
-
private tools;
|
|
523
|
-
/**
|
|
524
|
-
* Toolkits managed by this manager.
|
|
525
|
-
*/
|
|
526
|
-
private toolkits;
|
|
527
|
-
/**
|
|
528
|
-
* Creates a new ToolManager.
|
|
529
|
-
* Accepts both individual tools and toolkits.
|
|
530
|
-
*/
|
|
531
|
-
constructor(items?: (AgentTool | Toolkit)[]);
|
|
532
|
-
/**
|
|
533
|
-
* Get all individual tools and tools within toolkits as a flattened list.
|
|
534
|
-
*/
|
|
535
|
-
getTools(): BaseTool[];
|
|
536
|
-
/**
|
|
537
|
-
* Get all toolkits managed by this manager.
|
|
538
|
-
*/
|
|
539
|
-
getToolkits(): Toolkit[];
|
|
540
|
-
/**
|
|
541
|
-
* Add an individual tool to the manager.
|
|
542
|
-
* If a standalone tool with the same name already exists, it will be replaced.
|
|
543
|
-
* A warning is issued if the name conflicts with a tool inside a toolkit, but the standalone tool is still added/replaced.
|
|
544
|
-
* @returns true if the tool was successfully added or replaced.
|
|
545
|
-
*/
|
|
546
|
-
addTool(tool: AgentTool): boolean;
|
|
547
|
-
/**
|
|
548
|
-
* Add a toolkit to the manager.
|
|
549
|
-
* If a toolkit with the same name already exists, it will be replaced.
|
|
550
|
-
* Also checks if any tool within the toolkit conflicts with existing standalone tools or tools in other toolkits.
|
|
551
|
-
* @returns true if the toolkit was successfully added or replaced.
|
|
552
|
-
*/
|
|
553
|
-
addToolkit(toolkit: Toolkit): boolean;
|
|
554
|
-
/**
|
|
555
|
-
* Add multiple tools or toolkits to the manager.
|
|
556
|
-
*/
|
|
557
|
-
addItems(items: (AgentTool | Toolkit)[]): void;
|
|
558
|
-
/**
|
|
559
|
-
* Remove a standalone tool by name. Does not remove tools from toolkits.
|
|
560
|
-
* @returns true if the tool was removed, false if it wasn't found.
|
|
561
|
-
*/
|
|
562
|
-
removeTool(toolName: string): boolean;
|
|
563
|
-
/**
|
|
564
|
-
* Remove a toolkit by name.
|
|
565
|
-
* @returns true if the toolkit was removed, false if it wasn't found.
|
|
566
|
-
*/
|
|
567
|
-
removeToolkit(toolkitName: string): boolean;
|
|
568
|
-
/**
|
|
569
|
-
* Prepare tools for text generation (includes tools from toolkits).
|
|
570
|
-
*/
|
|
571
|
-
prepareToolsForGeneration(dynamicTools?: BaseTool[]): BaseTool[];
|
|
572
|
-
/**
|
|
573
|
-
* Get agent's tools (including those in toolkits) for API exposure.
|
|
574
|
-
*/
|
|
575
|
-
getToolsForApi(): {
|
|
576
|
-
name: string;
|
|
577
|
-
description: string;
|
|
578
|
-
parameters: any;
|
|
579
|
-
}[];
|
|
580
|
-
/**
|
|
581
|
-
* Check if a tool with the given name exists (either standalone or in a toolkit).
|
|
582
|
-
*/
|
|
583
|
-
hasTool(toolName: string): boolean;
|
|
584
|
-
/**
|
|
585
|
-
* Get a tool by name (searches standalone tools and tools within toolkits).
|
|
586
|
-
* @param toolName The name of the tool to get
|
|
587
|
-
* @returns The tool (as BaseTool) or undefined if not found
|
|
588
|
-
*/
|
|
589
|
-
getToolByName(toolName: string): BaseTool | undefined;
|
|
590
|
-
/**
|
|
591
|
-
* Execute a tool by name
|
|
592
|
-
* @param toolName The name of the tool to execute
|
|
593
|
-
* @param args The arguments to pass to the tool
|
|
594
|
-
* @param options Optional execution options like signal
|
|
595
|
-
* @returns The result of the tool execution
|
|
596
|
-
* @throws Error if the tool doesn't exist or fails to execute
|
|
597
|
-
*/
|
|
598
|
-
executeTool(toolName: string, args: any, options?: ToolExecuteOptions): Promise<any>;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
* Tool definition compatible with Vercel AI SDK
|
|
603
|
-
*/
|
|
604
|
-
type AgentTool = BaseTool;
|
|
605
|
-
/**
|
|
606
|
-
* Tool options for creating a new tool
|
|
607
|
-
*/
|
|
608
|
-
type ToolOptions<T extends ToolSchema = ToolSchema> = {
|
|
609
|
-
/**
|
|
610
|
-
* Unique identifier for the tool
|
|
611
|
-
*/
|
|
612
|
-
id?: string;
|
|
613
|
-
/**
|
|
614
|
-
* Name of the tool
|
|
615
|
-
*/
|
|
616
|
-
name: string;
|
|
617
|
-
/**
|
|
618
|
-
* Description of the tool
|
|
619
|
-
*/
|
|
620
|
-
description: string;
|
|
621
|
-
/**
|
|
622
|
-
* Tool parameter schema
|
|
623
|
-
*/
|
|
624
|
-
parameters: T;
|
|
625
|
-
/**
|
|
626
|
-
* Function to execute when the tool is called
|
|
627
|
-
*/
|
|
628
|
-
execute: (args: z.infer<T>, options?: ToolExecuteOptions) => Promise<unknown>;
|
|
629
|
-
};
|
|
630
|
-
/**
|
|
631
|
-
* Tool class for defining tools that agents can use
|
|
632
|
-
*/
|
|
633
|
-
declare class Tool<T extends ToolSchema = ToolSchema> {
|
|
634
|
-
/**
|
|
635
|
-
* Unique identifier for the tool
|
|
636
|
-
*/
|
|
637
|
-
readonly id: string;
|
|
638
|
-
/**
|
|
639
|
-
* Name of the tool
|
|
640
|
-
*/
|
|
641
|
-
readonly name: string;
|
|
642
|
-
/**
|
|
643
|
-
* Description of the tool
|
|
644
|
-
*/
|
|
645
|
-
readonly description: string;
|
|
646
|
-
/**
|
|
647
|
-
* Tool parameter schema
|
|
648
|
-
*/
|
|
649
|
-
readonly parameters: T;
|
|
650
|
-
/**
|
|
651
|
-
* Function to execute when the tool is called
|
|
652
|
-
*/
|
|
653
|
-
readonly execute: (args: z.infer<T>, options?: ToolExecuteOptions) => Promise<unknown>;
|
|
654
|
-
/**
|
|
655
|
-
* Create a new tool
|
|
656
|
-
*/
|
|
657
|
-
constructor(options: ToolOptions<T>);
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* Helper function for creating a new tool
|
|
661
|
-
*/
|
|
662
|
-
declare const createTool: <T extends ToolSchema>(options: ToolOptions<T>) => Tool<T>;
|
|
663
|
-
/**
|
|
664
|
-
* Alias for createTool function
|
|
665
|
-
*/
|
|
666
|
-
declare const tool: <T extends ToolSchema>(options: ToolOptions<T>) => Tool<T>;
|
|
667
|
-
|
|
668
668
|
/**
|
|
669
669
|
* Provider options type for LLM configurations
|
|
670
670
|
*/
|
|
@@ -1009,6 +1009,8 @@ interface StreamTextFinishResult {
|
|
|
1009
1009
|
providerResponse?: unknown;
|
|
1010
1010
|
/** Any warnings generated during the completion (if available). */
|
|
1011
1011
|
warnings?: unknown[];
|
|
1012
|
+
/** User context containing any custom metadata from the operation. */
|
|
1013
|
+
userContext?: Map<string | symbol, unknown>;
|
|
1012
1014
|
}
|
|
1013
1015
|
/**
|
|
1014
1016
|
* Type for the onFinish callback function for streamText.
|
|
@@ -1030,6 +1032,8 @@ interface StreamObjectFinishResult<TObject> {
|
|
|
1030
1032
|
warnings?: unknown[];
|
|
1031
1033
|
/** The reason the stream finished (if available). Although less common for object streams. */
|
|
1032
1034
|
finishReason?: string;
|
|
1035
|
+
/** User context containing any custom metadata from the operation. */
|
|
1036
|
+
userContext?: Map<string | symbol, unknown>;
|
|
1033
1037
|
}
|
|
1034
1038
|
/**
|
|
1035
1039
|
* Type for the onFinish callback function for streamObject.
|
|
@@ -1050,6 +1054,8 @@ interface StandardizedTextResult {
|
|
|
1050
1054
|
finishReason?: string;
|
|
1051
1055
|
/** Warnings (if available from provider). */
|
|
1052
1056
|
warnings?: unknown[];
|
|
1057
|
+
/** User context containing any custom metadata from the operation. */
|
|
1058
|
+
userContext?: Map<string | symbol, unknown>;
|
|
1053
1059
|
}
|
|
1054
1060
|
/**
|
|
1055
1061
|
* Standardized success result structure for generateObject.
|
|
@@ -1066,6 +1072,8 @@ interface StandardizedObjectResult<TObject> {
|
|
|
1066
1072
|
finishReason?: string;
|
|
1067
1073
|
/** Warnings (if available from provider). */
|
|
1068
1074
|
warnings?: unknown[];
|
|
1075
|
+
/** User context containing any custom metadata from the operation. */
|
|
1076
|
+
userContext?: Map<string | symbol, unknown>;
|
|
1069
1077
|
}
|
|
1070
1078
|
/**
|
|
1071
1079
|
* Unified output type for the onEnd hook, representing the successful result
|
|
@@ -1457,6 +1465,17 @@ type AgentStartEventMetadata = {
|
|
|
1457
1465
|
} & Record<string, unknown>;
|
|
1458
1466
|
interface AgentSuccessEventMetadata extends BaseEventMetadata {
|
|
1459
1467
|
usage?: Usage;
|
|
1468
|
+
modelParameters?: {
|
|
1469
|
+
model?: string;
|
|
1470
|
+
temperature?: number;
|
|
1471
|
+
maxTokens?: number;
|
|
1472
|
+
topP?: number;
|
|
1473
|
+
frequencyPenalty?: number;
|
|
1474
|
+
presencePenalty?: number;
|
|
1475
|
+
stop?: string[];
|
|
1476
|
+
system?: string;
|
|
1477
|
+
toolChoice?: string;
|
|
1478
|
+
};
|
|
1460
1479
|
}
|
|
1461
1480
|
interface MemoryEventMetadata extends BaseEventMetadata {
|
|
1462
1481
|
type?: string;
|
|
@@ -1998,6 +2017,16 @@ type RetrieverOptions = {
|
|
|
1998
2017
|
*/
|
|
1999
2018
|
[key: string]: any;
|
|
2000
2019
|
};
|
|
2020
|
+
/**
|
|
2021
|
+
* Options passed to retrieve method
|
|
2022
|
+
*/
|
|
2023
|
+
interface RetrieveOptions {
|
|
2024
|
+
/**
|
|
2025
|
+
* User-managed context map for this specific retrieval operation
|
|
2026
|
+
* Can be used to store metadata, results, or any custom data
|
|
2027
|
+
*/
|
|
2028
|
+
userContext?: Map<string | symbol, unknown>;
|
|
2029
|
+
}
|
|
2001
2030
|
/**
|
|
2002
2031
|
* Retriever interface for retrieving relevant information
|
|
2003
2032
|
*/
|
|
@@ -2005,9 +2034,10 @@ type Retriever = {
|
|
|
2005
2034
|
/**
|
|
2006
2035
|
* Retrieve relevant documents based on input text
|
|
2007
2036
|
* @param text The text to use for retrieval
|
|
2008
|
-
* @
|
|
2037
|
+
* @param options Configuration and context for the retrieval
|
|
2038
|
+
* @returns Promise resolving to a string with the retrieved content
|
|
2009
2039
|
*/
|
|
2010
|
-
retrieve(text: string): Promise<string>;
|
|
2040
|
+
retrieve(text: string, options: RetrieveOptions): Promise<string>;
|
|
2011
2041
|
/**
|
|
2012
2042
|
* Configuration options for the retriever
|
|
2013
2043
|
* This is optional and may not be present in all implementations
|
|
@@ -2054,13 +2084,14 @@ declare abstract class BaseRetriever {
|
|
|
2054
2084
|
*/
|
|
2055
2085
|
constructor(options?: RetrieverOptions);
|
|
2056
2086
|
/**
|
|
2057
|
-
*
|
|
2058
|
-
*
|
|
2087
|
+
* Abstract method that must be implemented by concrete retriever classes.
|
|
2088
|
+
* Retrieves relevant information based on the input text or messages.
|
|
2059
2089
|
*
|
|
2060
|
-
* @param input - The input to
|
|
2061
|
-
* @
|
|
2090
|
+
* @param input - The input to use for retrieval (string or BaseMessage array)
|
|
2091
|
+
* @param options - Configuration and context for the retrieval
|
|
2092
|
+
* @returns Promise resolving to a string with the retrieved content
|
|
2062
2093
|
*/
|
|
2063
|
-
abstract retrieve(input: string | BaseMessage[]): Promise<string>;
|
|
2094
|
+
abstract retrieve(input: string | BaseMessage[], options: RetrieveOptions): Promise<string>;
|
|
2064
2095
|
}
|
|
2065
2096
|
|
|
2066
2097
|
/**
|
|
@@ -2376,10 +2407,11 @@ declare class Agent<TProvider extends {
|
|
|
2376
2407
|
/**
|
|
2377
2408
|
* Get the system message for the agent
|
|
2378
2409
|
*/
|
|
2379
|
-
protected getSystemMessage({ input, historyEntryId, contextMessages, }: {
|
|
2410
|
+
protected getSystemMessage({ input, historyEntryId, contextMessages, operationContext, }: {
|
|
2380
2411
|
input?: string | BaseMessage[];
|
|
2381
2412
|
historyEntryId: string;
|
|
2382
2413
|
contextMessages: BaseMessage[];
|
|
2414
|
+
operationContext?: OperationContext;
|
|
2383
2415
|
}): Promise<BaseMessage>;
|
|
2384
2416
|
/**
|
|
2385
2417
|
* Prepare agents memory for the supervisor system message
|
|
@@ -2598,10 +2630,10 @@ declare const ReasoningStepSchema: z.ZodObject<{
|
|
|
2598
2630
|
historyEntryId: z.ZodString;
|
|
2599
2631
|
agentId: z.ZodString;
|
|
2600
2632
|
}, "strip", z.ZodTypeAny, {
|
|
2601
|
-
|
|
2633
|
+
type: "thought" | "analysis";
|
|
2602
2634
|
title: string;
|
|
2635
|
+
id: string;
|
|
2603
2636
|
historyEntryId: string;
|
|
2604
|
-
type: "thought" | "analysis";
|
|
2605
2637
|
agentId: string;
|
|
2606
2638
|
timestamp: string;
|
|
2607
2639
|
reasoning: string;
|
|
@@ -2610,10 +2642,10 @@ declare const ReasoningStepSchema: z.ZodObject<{
|
|
|
2610
2642
|
result?: string | undefined;
|
|
2611
2643
|
next_action?: NextAction | undefined;
|
|
2612
2644
|
}, {
|
|
2613
|
-
|
|
2645
|
+
type: "thought" | "analysis";
|
|
2614
2646
|
title: string;
|
|
2647
|
+
id: string;
|
|
2615
2648
|
historyEntryId: string;
|
|
2616
|
-
type: "thought" | "analysis";
|
|
2617
2649
|
agentId: string;
|
|
2618
2650
|
timestamp: string;
|
|
2619
2651
|
reasoning: string;
|
|
@@ -3355,4 +3387,4 @@ declare class VoltAgent {
|
|
|
3355
3387
|
shutdownTelemetry(): Promise<void>;
|
|
3356
3388
|
}
|
|
3357
3389
|
|
|
3358
|
-
export { Agent, AgentErrorEvent, AgentHistoryEntry, AgentHookOnEnd, AgentHookOnHandoff, AgentHookOnStart, AgentHookOnToolEnd, AgentHookOnToolStart, AgentHooks, AgentOptions, AgentRegistry, AgentResponse, AgentStartEvent, AgentStartEventMetadata, AgentSuccessEvent, AgentSuccessEventMetadata, AgentTool, AllowedVariableValue, AnyToolConfig, BaseEventMetadata, BaseLLMOptions, BaseMessage, BaseRetriever, BaseTimelineEvent, BaseTool, BaseToolCall, ClientInfo, Conversation, CreateConversationInput, CreateReasoningToolsOptions, CustomEndpointDefinition, CustomEndpointError, CustomEndpointHandler, DEFAULT_INSTRUCTIONS, DataContent, EventStatus, ExtractVariableNames, FEW_SHOT_EXAMPLES, FilePart, GenerateObjectOptions, GenerateTextOptions, HTTPServerConfig, HistoryStatus, HttpMethod, ImagePart, InMemoryStorage, InferGenerateObjectResponse, InferGenerateTextResponse, InferMessage, InferModel, InferProviderParams, InferStreamResponse, InferTool, LLMProvider, LibSQLStorage, MCPClient, MCPClientConfig, MCPClientEvents, MCPConfiguration, MCPOptions, MCPServerConfig, MCPToolCall, MCPToolResult, Memory, MemoryEventMetadata, MemoryManager, MemoryMessage, MemoryOptions, MemoryReadErrorEvent, MemoryReadStartEvent, MemoryReadSuccessEvent, MemoryWriteErrorEvent, MemoryWriteStartEvent, MemoryWriteSuccessEvent, MessageContent, MessageFilterOptions, MessageRole, ModelToolCall, NewTimelineEvent, NextAction, NodeType, OnEndHookArgs, OnHandoffHookArgs, OnStartHookArgs, OnToolEndHookArgs, OnToolStartHookArgs, OperationContext, PackageUpdateInfo, PromptCreator, PromptTemplate, ProviderObjectResponse, ProviderObjectStreamResponse, ProviderParams, ProviderResponse, ProviderTextResponse, ProviderTextStreamResponse, ReadableStreamType, ReasoningStep, ReasoningStepSchema, ReasoningToolExecuteOptions, Retriever, RetrieverErrorEvent, RetrieverOptions, RetrieverStartEvent, RetrieverSuccessEvent, RetryConfig, StandardEventData, StandardTimelineEvent, StdioServerConfig, StepChunkCallback, StepFinishCallback, StepWithContent, StreamObjectFinishResult, StreamObjectOnFinishCallback, StreamObjectOptions, StreamTextFinishResult, StreamTextOnFinishCallback, StreamTextOptions, TemplateVariables, TextPart, TimelineEventCoreLevel, TimelineEventCoreStatus, TimelineEventCoreType, Tool, ToolCall, ToolErrorEvent, ToolErrorInfo, ToolExecuteOptions, ToolExecutionContext, ToolManager, ToolOptions, ToolSchema, ToolStartEvent, ToolStatus, ToolStatusInfo, ToolSuccessEvent, Toolkit, ToolsetMap, ToolsetWithTools, TransportError, Usage, UsageInfo, Voice, VoiceEventData, VoiceEventType, VoiceMetadata, VoiceOptions, VoltAgent, VoltAgentError, VoltAgentExporter, VoltAgentExporterOptions, checkForUpdates, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createTool, createToolkit, VoltAgent as default, getNodeTypeFromNodeId, registerCustomEndpoint, registerCustomEndpoints, safeJsonParse, serializeValueForDebug, tool, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|
|
3390
|
+
export { Agent, AgentErrorEvent, AgentHistoryEntry, AgentHookOnEnd, AgentHookOnHandoff, AgentHookOnStart, AgentHookOnToolEnd, AgentHookOnToolStart, AgentHooks, AgentOptions, AgentRegistry, AgentResponse, AgentStartEvent, AgentStartEventMetadata, AgentSuccessEvent, AgentSuccessEventMetadata, AgentTool, AllowedVariableValue, AnyToolConfig, BaseEventMetadata, BaseLLMOptions, BaseMessage, BaseRetriever, BaseTimelineEvent, BaseTool, BaseToolCall, ClientInfo, Conversation, CreateConversationInput, CreateReasoningToolsOptions, CustomEndpointDefinition, CustomEndpointError, CustomEndpointHandler, DEFAULT_INSTRUCTIONS, DataContent, EventStatus, ExtractVariableNames, FEW_SHOT_EXAMPLES, FilePart, GenerateObjectOptions, GenerateTextOptions, HTTPServerConfig, HistoryStatus, HttpMethod, ImagePart, InMemoryStorage, InferGenerateObjectResponse, InferGenerateTextResponse, InferMessage, InferModel, InferProviderParams, InferStreamResponse, InferTool, LLMProvider, LibSQLStorage, MCPClient, MCPClientConfig, MCPClientEvents, MCPConfiguration, MCPOptions, MCPServerConfig, MCPToolCall, MCPToolResult, Memory, MemoryEventMetadata, MemoryManager, MemoryMessage, MemoryOptions, MemoryReadErrorEvent, MemoryReadStartEvent, MemoryReadSuccessEvent, MemoryWriteErrorEvent, MemoryWriteStartEvent, MemoryWriteSuccessEvent, MessageContent, MessageFilterOptions, MessageRole, ModelToolCall, NewTimelineEvent, NextAction, NodeType, OnEndHookArgs, OnHandoffHookArgs, OnStartHookArgs, OnToolEndHookArgs, OnToolStartHookArgs, OperationContext, PackageUpdateInfo, PromptCreator, PromptTemplate, ProviderObjectResponse, ProviderObjectStreamResponse, ProviderParams, ProviderResponse, ProviderTextResponse, ProviderTextStreamResponse, ReadableStreamType, ReasoningStep, ReasoningStepSchema, ReasoningToolExecuteOptions, RetrieveOptions, Retriever, RetrieverErrorEvent, RetrieverOptions, RetrieverStartEvent, RetrieverSuccessEvent, RetryConfig, StandardEventData, StandardTimelineEvent, StdioServerConfig, StepChunkCallback, StepFinishCallback, StepWithContent, StreamObjectFinishResult, StreamObjectOnFinishCallback, StreamObjectOptions, StreamTextFinishResult, StreamTextOnFinishCallback, StreamTextOptions, TemplateVariables, TextPart, TimelineEventCoreLevel, TimelineEventCoreStatus, TimelineEventCoreType, Tool, ToolCall, ToolErrorEvent, ToolErrorInfo, ToolExecuteOptions, ToolExecutionContext, ToolManager, ToolOptions, ToolSchema, ToolStartEvent, ToolStatus, ToolStatusInfo, ToolSuccessEvent, Toolkit, ToolsetMap, ToolsetWithTools, TransportError, Usage, UsageInfo, Voice, VoiceEventData, VoiceEventType, VoiceMetadata, VoiceOptions, VoltAgent, VoltAgentError, VoltAgentExporter, VoltAgentExporterOptions, checkForUpdates, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createTool, createToolkit, VoltAgent as default, getNodeTypeFromNodeId, registerCustomEndpoint, registerCustomEndpoints, safeJsonParse, serializeValueForDebug, tool, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|