@voltagent/core 2.1.5 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { ToolExecutionOptions, ToolNeedsApprovalFunction, ProviderOptions as ProviderOptions$1, ModelMessage, DataContent as DataContent$1, UserContent, AssistantContent, ToolContent } from '@ai-sdk/provider-utils';
2
2
  export { AssistantContent, FilePart, ImagePart, ProviderOptions, TextPart, ToolContent, UserContent } from '@ai-sdk/provider-utils';
3
- import { Tool as Tool$1, TextStreamPart, generateText, UIMessage, StreamTextResult, LanguageModel, CallSettings, Output, ToolChoice, ToolSet, GenerateTextResult, InferGenerateOutput, GenerateObjectResult, AsyncIterableStream as AsyncIterableStream$1, Warning, LanguageModelUsage, FinishReason, EmbeddingModel, TextUIPart, FileUIPart } from 'ai';
3
+ import { Tool as Tool$1, EmbeddingModel, TextStreamPart, generateText, UIMessage, StreamTextResult, LanguageModel, CallSettings, Output, ToolChoice, ToolSet, GenerateTextResult, InferGenerateOutput, GenerateObjectResult, AsyncIterableStream as AsyncIterableStream$1, Warning, LanguageModelUsage, FinishReason, TextUIPart, FileUIPart } from 'ai';
4
4
  export { LanguageModel, Tool as VercelTool, hasToolCall, stepCountIs } from 'ai';
5
5
  import * as zod from 'zod';
6
6
  import { z } from 'zod';
7
+ import { Span, Tracer, SpanOptions, SpanStatusCode as SpanStatusCode$1, context, trace, SpanKind as SpanKind$1, Context } from '@opentelemetry/api';
8
+ export { ROOT_CONTEXT, Span, SpanOptions, Tracer, context, propagation, trace } from '@opentelemetry/api';
9
+ import { Logger, LogFn, LogBuffer } from '@voltagent/internal';
7
10
  import { AsyncIterableStream } from '@voltagent/internal/utils';
8
11
  export { AsyncIterableStream, createAsyncIterableStream } from '@voltagent/internal/utils';
9
- import { Logger, LogFn, LogBuffer } from '@voltagent/internal';
10
- import { Tracer, SpanOptions, Span, SpanStatusCode as SpanStatusCode$1, context, trace, SpanKind as SpanKind$1, Context } from '@opentelemetry/api';
11
- export { ROOT_CONTEXT, Span, SpanOptions, Tracer, context, propagation, trace } from '@opentelemetry/api';
12
12
  import { LogRecordProcessor, LoggerProvider, ReadableLogRecord, SdkLogRecord } from '@opentelemetry/sdk-logs';
13
13
  import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
14
14
  import { SpanProcessor, BasicTracerProvider, ReadableSpan, Span as Span$1 } from '@opentelemetry/sdk-trace-base';
@@ -114,6 +114,10 @@ declare abstract class BaseToolManager<TItems extends AgentTool | Tool$1 | Toolk
114
114
  * Get all kinds of tools, owned by this manager and inside toolkits as a flattened list.
115
115
  * */
116
116
  getAllTools(): (BaseTool | ProviderTool)[];
117
+ /**
118
+ * Get a tool by name across standalone tools and toolkits.
119
+ */
120
+ getToolByName(toolName: string): BaseTool | ProviderTool | undefined;
117
121
  /**
118
122
  * Get names of all tools (standalone and inside toolkits), deduplicated.
119
123
  */
@@ -217,6 +221,203 @@ type ToolStatusInfo = {
217
221
  parameters?: any;
218
222
  };
219
223
 
224
+ /**
225
+ * THIS FILE IS AUTO-GENERATED - DO NOT EDIT
226
+ * Generated from https://models.dev/api.json
227
+ */
228
+ type EmbeddingModelsMap = {
229
+ readonly azure: readonly [
230
+ "cohere-embed-v-4-0",
231
+ "cohere-embed-v3-english",
232
+ "cohere-embed-v3-multilingual",
233
+ "text-embedding-3-large",
234
+ "text-embedding-3-small",
235
+ "text-embedding-ada-002"
236
+ ];
237
+ readonly "azure-cognitive-services": readonly [
238
+ "cohere-embed-v-4-0",
239
+ "cohere-embed-v3-english",
240
+ "cohere-embed-v3-multilingual",
241
+ "text-embedding-3-large",
242
+ "text-embedding-3-small",
243
+ "text-embedding-ada-002"
244
+ ];
245
+ readonly "cloudflare-ai-gateway": readonly [
246
+ "workers-ai/@cf/pfnet/plamo-embedding-1b",
247
+ "workers-ai/@cf/qwen/qwen3-embedding-0.6b"
248
+ ];
249
+ readonly google: readonly ["gemini-embedding-001"];
250
+ readonly "google-vertex": readonly ["gemini-embedding-001"];
251
+ readonly huggingface: readonly ["Qwen/Qwen3-Embedding-4B", "Qwen/Qwen3-Embedding-8B"];
252
+ readonly inference: readonly ["qwen/qwen3-embedding-4b"];
253
+ readonly mistral: readonly ["mistral-embed"];
254
+ readonly nvidia: readonly ["nvidia/llama-embed-nemotron-8b"];
255
+ readonly openai: readonly [
256
+ "text-embedding-3-large",
257
+ "text-embedding-3-small",
258
+ "text-embedding-ada-002"
259
+ ];
260
+ readonly "privatemode-ai": readonly ["qwen3-embedding-4b"];
261
+ readonly vercel: readonly [
262
+ "alibaba/qwen3-embedding-0.6b",
263
+ "alibaba/qwen3-embedding-4b",
264
+ "alibaba/qwen3-embedding-8b",
265
+ "amazon/titan-embed-text-v2",
266
+ "cohere/embed-v4.0",
267
+ "google/gemini-embedding-001",
268
+ "google/text-embedding-005",
269
+ "google/text-multilingual-embedding-002",
270
+ "mistral/codestral-embed",
271
+ "mistral/mistral-embed",
272
+ "openai/text-embedding-3-large",
273
+ "openai/text-embedding-3-small",
274
+ "openai/text-embedding-ada-002"
275
+ ];
276
+ };
277
+ type EmbeddingProviderId = keyof EmbeddingModelsMap;
278
+ type EmbeddingRouterModelId = {
279
+ [P in EmbeddingProviderId]: `${P}/${EmbeddingModelsMap[P][number]}`;
280
+ }[EmbeddingProviderId] | (string & {});
281
+
282
+ type EmbeddingModelInstance$1 = Exclude<EmbeddingModel, string>;
283
+ type EmbeddingModelReference = EmbeddingRouterModelId | EmbeddingModelInstance$1;
284
+ /**
285
+ * Embedding adapter interface for converting text to vectors
286
+ */
287
+ interface EmbeddingAdapter$1 {
288
+ /**
289
+ * Embed a single text string into a vector
290
+ */
291
+ embed(text: string): Promise<number[]>;
292
+ /**
293
+ * Embed multiple texts in a batch for efficiency
294
+ */
295
+ embedBatch(texts: string[]): Promise<number[][]>;
296
+ /**
297
+ * Get the dimensionality of the embeddings
298
+ * Returns undefined if dimensions are not yet known
299
+ */
300
+ getDimensions(): number | undefined;
301
+ /**
302
+ * Get the model name for debugging/logging
303
+ */
304
+ getModelName(): string;
305
+ }
306
+ /**
307
+ * Options for embedding adapter initialization
308
+ */
309
+ interface EmbeddingOptions {
310
+ /**
311
+ * Maximum number of texts to process in a single batch
312
+ */
313
+ maxBatchSize?: number;
314
+ /**
315
+ * Timeout for embedding operations in milliseconds
316
+ */
317
+ timeout?: number;
318
+ /**
319
+ * Whether to normalize embeddings to unit vectors
320
+ */
321
+ normalize?: boolean;
322
+ }
323
+
324
+ declare const TOOL_ROUTER_SYMBOL: unique symbol;
325
+
326
+ type ToolRouterMode = "agent" | "resolver";
327
+ type ToolRouterSelection = {
328
+ name: string;
329
+ score?: number;
330
+ reason?: string;
331
+ };
332
+ type ToolRouterInput = {
333
+ query: string;
334
+ topK?: number;
335
+ };
336
+ type ToolRouterResultItem = {
337
+ toolName: string;
338
+ toolCallId?: string;
339
+ output?: unknown;
340
+ error?: string;
341
+ };
342
+ type ToolRouterResult = {
343
+ query: string;
344
+ selections: ToolRouterSelection[];
345
+ results: ToolRouterResultItem[];
346
+ };
347
+ type ToolRouterCandidate = {
348
+ name: string;
349
+ description?: string;
350
+ tags?: string[];
351
+ parameters?: unknown;
352
+ tool: Tool<any, any> | ProviderTool;
353
+ };
354
+ type ToolRouterContext = {
355
+ agentId: string;
356
+ agentName: string;
357
+ operationContext: OperationContext;
358
+ routerName?: string;
359
+ parentSpan?: Span;
360
+ };
361
+ type ToolRouterStrategy = {
362
+ select: (params: {
363
+ query: string;
364
+ tools: ToolRouterCandidate[];
365
+ topK: number;
366
+ context: ToolRouterContext;
367
+ }) => Promise<ToolRouterSelection[]>;
368
+ };
369
+ type ToolArgumentResolver = (params: {
370
+ query: string;
371
+ tool: Tool<any, any>;
372
+ context: ToolRouterContext;
373
+ }) => Promise<Record<string, unknown>>;
374
+ type ToolRouterMetadata = {
375
+ strategy: ToolRouterStrategy;
376
+ mode?: ToolRouterMode;
377
+ executionModel?: AgentModelValue;
378
+ resolver?: ToolArgumentResolver;
379
+ topK?: number;
380
+ parallel?: boolean;
381
+ };
382
+ type ToolRouter = Tool<any, any> & {
383
+ [TOOL_ROUTER_SYMBOL]: ToolRouterMetadata;
384
+ };
385
+ type ToolRoutingEmbeddingConfig = {
386
+ model: EmbeddingAdapter$1 | EmbeddingModelReference;
387
+ normalize?: boolean;
388
+ maxBatchSize?: number;
389
+ topK?: number;
390
+ toolText?: (tool: ToolRouterCandidate) => string;
391
+ };
392
+ type ToolRoutingEmbeddingInput = ToolRoutingEmbeddingConfig | EmbeddingAdapter$1 | EmbeddingModelReference;
393
+ type ToolRoutingConfig = {
394
+ routers?: ToolRouter[];
395
+ pool?: (Tool<any, any> | Toolkit | Tool$1)[];
396
+ expose?: (Tool<any, any> | Toolkit | Tool$1)[];
397
+ mode?: ToolRouterMode;
398
+ executionModel?: AgentModelValue;
399
+ embedding?: ToolRoutingEmbeddingInput;
400
+ topK?: number;
401
+ parallel?: boolean;
402
+ };
403
+
404
+ declare const createEmbeddingToolRouterStrategy: (input: ToolRoutingEmbeddingInput) => ToolRouterStrategy;
405
+
406
+ type CreateToolRouterOptions = {
407
+ name: string;
408
+ description: string;
409
+ strategy?: ToolRouterStrategy;
410
+ embedding?: ToolRoutingEmbeddingInput;
411
+ mode?: ToolRouterMode;
412
+ executionModel?: ToolRouterMetadata["executionModel"];
413
+ resolver?: ToolArgumentResolver;
414
+ topK?: number;
415
+ parallel?: boolean;
416
+ parameters?: ToolSchema;
417
+ };
418
+ declare const createToolRouter: (options: CreateToolRouterOptions) => ToolRouter;
419
+ declare const isToolRouter: (tool: unknown) => tool is ToolRouter;
420
+
220
421
  /**
221
422
  * JSON value types (matches AI SDK's JSONValue)
222
423
  */
@@ -224,6 +425,29 @@ type JSONValue = string | number | boolean | null | {
224
425
  [key: string]: JSONValue;
225
426
  } | Array<JSONValue>;
226
427
  type ToolExecutionResult<T> = PromiseLike<T> | AsyncIterable<T> | T;
428
+ interface ToolHookOnStartArgs {
429
+ tool: Tool<any, any>;
430
+ args: unknown;
431
+ options?: ToolExecuteOptions;
432
+ }
433
+ interface ToolHookOnEndArgs {
434
+ tool: Tool<any, any>;
435
+ args: unknown;
436
+ /** The successful output from the tool. Undefined on error. */
437
+ output: unknown | undefined;
438
+ /** The error if the tool execution failed. */
439
+ error: unknown | undefined;
440
+ options?: ToolExecuteOptions;
441
+ }
442
+ interface ToolHookOnEndResult {
443
+ output?: unknown;
444
+ }
445
+ type ToolHookOnStart = (args: ToolHookOnStartArgs) => Promise<void> | void;
446
+ type ToolHookOnEnd = (args: ToolHookOnEndArgs) => Promise<ToolHookOnEndResult | undefined> | Promise<void> | ToolHookOnEndResult | undefined;
447
+ type ToolHooks = {
448
+ onStart?: ToolHookOnStart;
449
+ onEnd?: ToolHookOnEnd;
450
+ };
227
451
  /**
228
452
  * Tool result output format for multi-modal content.
229
453
  * Matches AI SDK's LanguageModelV2ToolResultOutput type.
@@ -342,6 +566,10 @@ type ToolOptions<T extends ToolSchema = ToolSchema, O extends ToolSchema | undef
342
566
  * @returns A result or an AsyncIterable of results (last value is final).
343
567
  */
344
568
  execute?: (args: z.infer<T>, options?: ToolExecuteOptions) => ToolExecutionResult<O extends ToolSchema ? z.infer<O> : unknown>;
569
+ /**
570
+ * Optional tool-specific hooks for lifecycle events.
571
+ */
572
+ hooks?: ToolHooks;
345
573
  };
346
574
  /**
347
575
  * Tool class for defining tools that agents can use
@@ -387,6 +615,10 @@ declare class Tool<T extends ToolSchema = ToolSchema, O extends ToolSchema | und
387
615
  readonly toModelOutput?: (args: {
388
616
  output: O extends ToolSchema ? z.infer<O> : unknown;
389
617
  }) => ToolResultOutput;
618
+ /**
619
+ * Optional tool-specific hooks for lifecycle events.
620
+ */
621
+ readonly hooks?: ToolHooks;
390
622
  /**
391
623
  * Internal discriminator to make runtime/type checks simpler across module boundaries.
392
624
  * Marking our Tool instances with a stable string avoids instanceof issues.
@@ -777,443 +1009,334 @@ type LLMProvider<TProvider> = {
777
1009
  type StopWhen = Parameters<typeof generateText>[0]["stopWhen"];
778
1010
 
779
1011
  /**
780
- * Memory V2 Type Definitions
781
- * Clean separation between conversation memory and telemetry
1012
+ * LoggerProxy implements the Logger interface but delegates all calls to the current global logger.
1013
+ * This allows agents and workflows to be created before VoltAgent sets the global logger,
1014
+ * while still using the correct logger once it's available.
1015
+ *
1016
+ * When the logger package is not available, it also emits logs via OpenTelemetry Logs API.
782
1017
  */
1018
+ declare class LoggerProxy implements Logger {
1019
+ private bindings;
1020
+ private externalLogger?;
1021
+ constructor(bindings?: Record<string, any>, externalLogger?: Logger);
1022
+ /**
1023
+ * Get the actual logger instance with bindings applied
1024
+ */
1025
+ private getActualLogger;
1026
+ /**
1027
+ * Check if a log level should be logged based on the configured level
1028
+ */
1029
+ private shouldLog;
1030
+ /**
1031
+ * Emit log via OpenTelemetry Logs API if available
1032
+ */
1033
+ private emitOtelLog;
1034
+ trace: LogFn;
1035
+ debug: LogFn;
1036
+ info: LogFn;
1037
+ warn: LogFn;
1038
+ error: LogFn;
1039
+ fatal: LogFn;
1040
+ /**
1041
+ * Create a child logger with additional bindings
1042
+ */
1043
+ child(childBindings: Record<string, any>): Logger;
1044
+ }
783
1045
 
1046
+ declare enum ActionType {
1047
+ START = "start",
1048
+ COMPLETE = "complete",
1049
+ ERROR = "error",
1050
+ GENERATION_START = "generationStart",
1051
+ GENERATION_COMPLETE = "generationComplete",
1052
+ STREAM_START = "streamStart",
1053
+ STREAM_COMPLETE = "streamComplete",
1054
+ STREAM_STEP = "streamStep",
1055
+ STREAMING = "streaming",
1056
+ OBJECT_GENERATION_START = "objectGenerationStart",
1057
+ OBJECT_GENERATION_COMPLETE = "objectGenerationComplete",
1058
+ STREAM_OBJECT_START = "streamObjectStart",
1059
+ STREAM_OBJECT_COMPLETE = "streamObjectComplete",
1060
+ TOOL_CALL = "toolCall",
1061
+ TOOL_ERROR = "toolError",
1062
+ DELEGATE = "delegate",
1063
+ EXECUTE = "execute",
1064
+ VALIDATE = "validate",
1065
+ STEP_START = "stepStart",
1066
+ STEP_COMPLETE = "stepComplete",
1067
+ SUSPEND = "suspend",
1068
+ RESUME = "resume",
1069
+ ACCESS = "access",
1070
+ STORE = "store",
1071
+ RETRIEVE = "retrieve"
1072
+ }
784
1073
  /**
785
- * Extended UIMessage type with storage metadata
786
- */
787
- type StoredUIMessage = UIMessage & {
788
- createdAt: Date;
789
- userId: string;
790
- conversationId: string;
791
- };
792
- /**
793
- * Conversation type
1074
+ * Helper to format retriever log messages
794
1075
  */
795
- type Conversation = {
796
- id: string;
797
- resourceId: string;
798
- userId: string;
799
- title: string;
800
- metadata: Record<string, unknown>;
801
- createdAt: string;
802
- updatedAt: string;
803
- };
1076
+ declare function buildRetrieverLogMessage(retrieverName: string, action: ActionType | string, description: string): string;
1077
+
804
1078
  /**
805
- * Input type for creating a conversation
1079
+ * Get the global logger instance from registry or create a default one
806
1080
  */
807
- type CreateConversationInput = {
808
- id: string;
809
- resourceId: string;
810
- userId: string;
811
- title: string;
812
- metadata: Record<string, unknown>;
813
- };
1081
+ declare function getGlobalLogger(): Logger;
814
1082
  /**
815
- * Query builder options for conversations
1083
+ * Get the global log buffer
816
1084
  */
817
- type ConversationQueryOptions = {
818
- userId?: string;
819
- resourceId?: string;
820
- limit?: number;
821
- offset?: number;
822
- orderBy?: "created_at" | "updated_at" | "title";
823
- orderDirection?: "ASC" | "DESC";
824
- };
1085
+ declare function getGlobalLogBuffer(): LogBuffer;
1086
+
825
1087
  /**
826
- * Options for getting messages
1088
+ * Options for configuring the Retriever
827
1089
  */
828
- type GetMessagesOptions = {
829
- limit?: number;
830
- before?: Date;
831
- after?: Date;
832
- roles?: string[];
833
- };
834
- type ConversationStepType = "text" | "tool_call" | "tool_result";
835
- interface ConversationStepRecord {
836
- id: string;
837
- conversationId: string;
838
- userId: string;
839
- agentId: string;
840
- agentName?: string;
841
- operationId: string;
842
- stepIndex: number;
843
- type: ConversationStepType;
844
- role: MessageRole;
845
- content?: string;
846
- arguments?: Record<string, unknown> | null;
847
- result?: Record<string, unknown> | null;
848
- usage?: UsageInfo;
849
- subAgentId?: string;
850
- subAgentName?: string;
851
- createdAt: string;
852
- }
853
- interface GetConversationStepsOptions {
854
- limit?: number;
855
- operationId?: string;
856
- }
857
- /**
858
- * Memory options for MemoryManager
859
- */
860
- type MemoryOptions = {};
1090
+ type RetrieverOptions = {
1091
+ /**
1092
+ * Name for the default tool created from this retriever
1093
+ * This is used for the pre-created 'tool' property
1094
+ * @default "search_knowledge"
1095
+ */
1096
+ toolName?: string;
1097
+ /**
1098
+ * Description for the default tool created from this retriever
1099
+ * This is used for the pre-created 'tool' property
1100
+ * @default "Searches for relevant information in the knowledge base based on the query."
1101
+ */
1102
+ toolDescription?: string;
1103
+ /**
1104
+ * Optional logger instance for the retriever
1105
+ * If not provided, a default logger will be created
1106
+ */
1107
+ logger?: Logger;
1108
+ /**
1109
+ * Additional configuration specific to concrete retriever implementations
1110
+ */
1111
+ [key: string]: any;
1112
+ };
861
1113
  /**
862
- * Workflow state entry for suspension and resumption
863
- * Stores only the essential state needed to resume a workflow
1114
+ * Options passed to retrieve method.
1115
+ * Includes all operation context fields for user-specific and context-aware retrieval.
864
1116
  */
865
- interface WorkflowStateEntry {
866
- /** Unique execution ID */
867
- id: string;
868
- /** Workflow definition ID */
869
- workflowId: string;
870
- /** Workflow name for reference */
871
- workflowName: string;
872
- /** Current status */
873
- status: "running" | "suspended" | "completed" | "cancelled" | "error";
874
- /** Original input to the workflow */
875
- input?: unknown;
876
- /** Execution context */
877
- context?: Array<[string | symbol, unknown]>;
878
- /** Suspension metadata including checkpoint data */
879
- suspension?: {
880
- suspendedAt: Date;
881
- reason?: string;
882
- stepIndex: number;
883
- lastEventSequence?: number;
884
- checkpoint?: {
885
- stepExecutionState?: any;
886
- completedStepsData?: any[];
887
- };
888
- suspendData?: any;
889
- };
1117
+ interface RetrieveOptions extends Partial<OperationContext> {
890
1118
  /**
891
- * Stream events collected during execution
892
- * Used for timeline visualization in UI
1119
+ * User-managed context map for this specific retrieval operation
1120
+ * Can be used to store metadata, results, or any custom data
1121
+ *
1122
+ * Inherited from OperationContext but explicitly documented here for clarity
1123
+ */
1124
+ context?: Map<string | symbol, unknown>;
1125
+ /**
1126
+ * Optional logger instance for this retrieval operation.
1127
+ * Provides execution-scoped logging with full context.
1128
+ * Available when retriever is called from an agent or workflow context.
1129
+ *
1130
+ * Inherited from OperationContext but explicitly documented here for clarity
1131
+ */
1132
+ logger?: Logger;
1133
+ /**
1134
+ * Optional user identifier for user-specific retrieval.
1135
+ * Can be used to filter results by user or implement multi-tenant retrieval.
1136
+ *
1137
+ * Inherited from OperationContext
893
1138
  */
894
- events?: Array<{
895
- id: string;
896
- type: string;
897
- name?: string;
898
- from?: string;
899
- startTime: string;
900
- endTime?: string;
901
- status?: string;
902
- input?: any;
903
- output?: any;
904
- metadata?: Record<string, unknown>;
905
- context?: Record<string, unknown>;
906
- }>;
907
- /** Final output of the workflow execution */
908
- output?: unknown;
909
- /** Cancellation metadata */
910
- cancellation?: {
911
- cancelledAt: Date;
912
- reason?: string;
913
- };
914
- /** User ID if applicable */
915
1139
  userId?: string;
916
- /** Conversation ID if applicable */
1140
+ /**
1141
+ * Optional conversation identifier for conversation-aware retrieval.
1142
+ * Can be used to retrieve conversation-specific context or history.
1143
+ *
1144
+ * Inherited from OperationContext
1145
+ */
917
1146
  conversationId?: string;
918
- /** Additional metadata */
919
- metadata?: Record<string, unknown>;
920
- /** Timestamps */
921
- createdAt: Date;
922
- updatedAt: Date;
923
- }
924
- interface WorkflowRunQuery {
925
- workflowId?: string;
926
- status?: WorkflowStateEntry["status"];
927
- from?: Date;
928
- to?: Date;
929
- limit?: number;
930
- offset?: number;
931
1147
  }
932
1148
  /**
933
- * Working memory scope - conversation or user level
934
- */
935
- type WorkingMemoryScope = "conversation" | "user";
936
- /**
937
- * Simple memory update modes
938
- */
939
- type MemoryUpdateMode = "replace" | "append";
940
- /**
941
- * Options for updating working memory (simplified)
1149
+ * Retriever interface for retrieving relevant information
942
1150
  */
943
- type WorkingMemoryUpdateOptions = {
944
- /** How to update the memory (default: "replace") */
945
- mode?: MemoryUpdateMode;
1151
+ type Retriever = {
1152
+ /**
1153
+ * Retrieve relevant documents based on input text
1154
+ * @param text The text to use for retrieval
1155
+ * @param options Configuration and context for the retrieval
1156
+ * @returns Promise resolving to a string with the retrieved content
1157
+ */
1158
+ retrieve(text: string, options: RetrieveOptions): Promise<string>;
1159
+ /**
1160
+ * Configuration options for the retriever
1161
+ * This is optional and may not be present in all implementations
1162
+ */
1163
+ options?: RetrieverOptions;
1164
+ /**
1165
+ * Pre-created tool for easy destructuring
1166
+ * This is optional and may not be present in all implementations
1167
+ */
1168
+ tool?: any;
1169
+ /**
1170
+ * Optional observability attributes for retriever spans.
1171
+ */
1172
+ getObservabilityAttributes?: () => Record<string, unknown>;
946
1173
  };
1174
+
947
1175
  /**
948
- * Working memory configuration
949
- * Auto-detects format: schema JSON, template markdown
950
- */
951
- type WorkingMemoryConfig = {
952
- enabled: boolean;
953
- scope?: WorkingMemoryScope;
954
- } & ({
955
- template: string;
956
- schema?: never;
957
- } | {
958
- schema: z.ZodObject<any>;
959
- template?: never;
960
- } | {
961
- template?: never;
962
- schema?: never;
963
- });
964
- /**
965
- * Memory V2 configuration options
1176
+ * Abstract base class for Retriever implementations.
1177
+ * This class provides a common structure for different types of retrievers.
966
1178
  */
967
- interface MemoryConfig {
968
- /**
969
- * Storage adapter for conversations and messages
970
- */
971
- storage: StorageAdapter;
1179
+ declare abstract class BaseRetriever {
972
1180
  /**
973
- * Optional embedding adapter for semantic operations
1181
+ * Options that configure the retriever's behavior
974
1182
  */
975
- embedding?: EmbeddingAdapter$1;
1183
+ protected options: RetrieverOptions;
976
1184
  /**
977
- * Optional vector adapter for similarity search
1185
+ * Logger instance for the retriever
978
1186
  */
979
- vector?: VectorAdapter$1;
1187
+ protected logger: Logger;
980
1188
  /**
981
- * Enable caching for embeddings
982
- * @default false
1189
+ * Ready-to-use tool property for direct destructuring
1190
+ * This can be used with object destructuring syntax
1191
+ *
1192
+ * @example
1193
+ * ```typescript
1194
+ * // ✅ You can use destructuring with the tool property
1195
+ * const { tool } = new SimpleRetriever();
1196
+ *
1197
+ * // And use it directly in an agent
1198
+ * const agent = new Agent({
1199
+ * name: "RAG Agent",
1200
+ * model: "gpt-4",
1201
+ * provider,
1202
+ * tools: [tool],
1203
+ * });
1204
+ * ```
983
1205
  */
984
- enableCache?: boolean;
1206
+ readonly tool: AgentTool;
985
1207
  /**
986
- * Maximum number of embeddings to cache
987
- * @default 1000
1208
+ * Constructor for the BaseRetriever class.
1209
+ * @param options - Configuration options for the retriever.
988
1210
  */
989
- cacheSize?: number;
1211
+ constructor(options?: RetrieverOptions);
990
1212
  /**
991
- * Cache TTL in milliseconds
992
- * @default 3600000 (1 hour)
1213
+ * Abstract method that must be implemented by concrete retriever classes.
1214
+ * Retrieves relevant information based on the input text or messages.
1215
+ *
1216
+ * @param input - The input to use for retrieval (string or BaseMessage array)
1217
+ * @param options - Configuration and context for the retrieval
1218
+ * @returns Promise resolving to a string with the retrieved content
993
1219
  */
994
- cacheTTL?: number;
1220
+ abstract retrieve(input: string | BaseMessage[], options: RetrieveOptions): Promise<string>;
995
1221
  /**
996
- * Working memory configuration
997
- * Enables agents to maintain important context
1222
+ * Optional observability attributes for retriever spans.
1223
+ * Override in subclasses to add context (e.g. knowledge base metadata).
998
1224
  */
999
- workingMemory?: WorkingMemoryConfig;
1225
+ getObservabilityAttributes(): Record<string, unknown>;
1000
1226
  }
1227
+
1001
1228
  /**
1002
- * Metadata about the underlying storage adapter
1229
+ * ReadableStream type for voice responses
1003
1230
  */
1004
- interface MemoryStorageMetadata {
1005
- /** Name of the configured storage adapter */
1006
- adapter: string;
1007
- }
1008
- /**
1009
- * Summary of working memory configuration exposed to the UI
1010
- */
1011
- interface WorkingMemorySummary {
1012
- /** Whether working memory support is enabled */
1013
- enabled: boolean;
1014
- /** Scope of working memory persistence */
1015
- scope?: WorkingMemoryScope;
1016
- /** Output format (markdown/json) */
1017
- format: "markdown" | "json" | null;
1018
- /** Indicates if a template is configured */
1019
- hasTemplate: boolean;
1020
- /** Indicates if a schema is configured */
1021
- hasSchema: boolean;
1022
- /** Template content if configured */
1023
- template?: string | null;
1024
- /** Simplified schema field map if configured */
1025
- schema?: Record<string, string> | null;
1026
- }
1231
+ type ReadableStreamType = ReadableStream | NodeJS.ReadableStream | any;
1027
1232
  /**
1028
- * Document type for RAG operations
1233
+ * Voice provider options
1029
1234
  */
1030
- interface Document {
1031
- id: string;
1032
- content: string;
1033
- metadata?: Record<string, unknown>;
1034
- }
1235
+ type VoiceOptions = {
1236
+ /**
1237
+ * API key for the voice provider
1238
+ */
1239
+ apiKey?: string;
1240
+ /**
1241
+ * Model to use for speech recognition
1242
+ */
1243
+ speechModel?: string;
1244
+ /**
1245
+ * Model to use for text-to-speech
1246
+ */
1247
+ ttsModel?: string;
1248
+ /**
1249
+ * Voice ID to use for text-to-speech
1250
+ */
1251
+ voice?: string;
1252
+ /**
1253
+ * Additional provider-specific options
1254
+ */
1255
+ options?: Record<string, unknown>;
1256
+ };
1035
1257
  /**
1036
- * Search options for semantic search
1258
+ * Voice event types
1037
1259
  */
1038
- interface SearchOptions {
1039
- limit?: number;
1040
- threshold?: number;
1041
- filter?: Record<string, unknown>;
1042
- }
1260
+ type VoiceEventType = "speaking" | "listening" | "error" | "connected" | "disconnected";
1043
1261
  /**
1044
- * Search result from vector operations
1262
+ * Voice event data types
1045
1263
  */
1046
- interface SearchResult$1 {
1047
- id: string;
1048
- score: number;
1049
- content?: string;
1050
- metadata?: Record<string, unknown>;
1051
- }
1264
+ type VoiceEventData = {
1265
+ speaking: {
1266
+ text: string;
1267
+ audio?: NodeJS.ReadableStream;
1268
+ };
1269
+ listening: {
1270
+ audio: NodeJS.ReadableStream;
1271
+ };
1272
+ error: {
1273
+ message: string;
1274
+ code?: string;
1275
+ details?: unknown;
1276
+ };
1277
+ connected: undefined;
1278
+ disconnected: undefined;
1279
+ };
1052
1280
  /**
1053
- * Vector item for batch operations
1281
+ * Voice metadata
1054
1282
  */
1055
- interface VectorItem$1 {
1283
+ type VoiceMetadata = {
1056
1284
  id: string;
1057
- vector: number[];
1285
+ name: string;
1286
+ language: string;
1287
+ gender?: "male" | "female" | "neutral";
1058
1288
  metadata?: Record<string, unknown>;
1059
- }
1060
- /**
1061
- * Storage Adapter Interface
1062
- * Handles persistence of conversations and messages
1063
- */
1064
- interface StorageAdapter {
1065
- addMessage(message: UIMessage, userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1066
- addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1067
- getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage<{
1068
- createdAt: Date;
1069
- }>[]>;
1070
- clearMessages(userId: string, conversationId?: string, context?: OperationContext): Promise<void>;
1071
- createConversation(input: CreateConversationInput): Promise<Conversation>;
1072
- getConversation(id: string): Promise<Conversation | null>;
1073
- getConversations(resourceId: string): Promise<Conversation[]>;
1074
- getConversationsByUserId(userId: string, options?: Omit<ConversationQueryOptions, "userId">): Promise<Conversation[]>;
1075
- queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
1076
- updateConversation(id: string, updates: Partial<Omit<Conversation, "id" | "createdAt" | "updatedAt">>): Promise<Conversation>;
1077
- deleteConversation(id: string): Promise<void>;
1078
- saveConversationSteps?(steps: ConversationStepRecord[]): Promise<void>;
1079
- getConversationSteps?(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
1080
- getWorkingMemory(params: {
1081
- conversationId?: string;
1082
- userId?: string;
1083
- scope: WorkingMemoryScope;
1084
- }): Promise<string | null>;
1085
- setWorkingMemory(params: {
1086
- conversationId?: string;
1087
- userId?: string;
1088
- content: string;
1089
- scope: WorkingMemoryScope;
1090
- }): Promise<void>;
1091
- deleteWorkingMemory(params: {
1092
- conversationId?: string;
1093
- userId?: string;
1094
- scope: WorkingMemoryScope;
1095
- }): Promise<void>;
1096
- getWorkflowState(executionId: string): Promise<WorkflowStateEntry | null>;
1097
- queryWorkflowRuns(query: WorkflowRunQuery): Promise<WorkflowStateEntry[]>;
1098
- setWorkflowState(executionId: string, state: WorkflowStateEntry): Promise<void>;
1099
- updateWorkflowState(executionId: string, updates: Partial<WorkflowStateEntry>): Promise<void>;
1100
- getSuspendedWorkflowStates(workflowId: string): Promise<WorkflowStateEntry[]>;
1101
- }
1289
+ };
1102
1290
  /**
1103
- * Embedding Adapter Interface
1104
- * Handles text to vector conversions
1291
+ * Base interface for voice providers
1105
1292
  */
1106
- interface EmbeddingAdapter$1 {
1107
- /**
1108
- * Embed a single text
1109
- */
1110
- embed(text: string): Promise<number[]>;
1111
- /**
1112
- * Embed multiple texts in batch
1113
- */
1114
- embedBatch(texts: string[]): Promise<number[][]>;
1293
+ type Voice = {
1115
1294
  /**
1116
- * Get embedding dimensions
1295
+ * Convert text to speech
1117
1296
  */
1118
- getDimensions(): number;
1297
+ speak(text: string | NodeJS.ReadableStream, options?: {
1298
+ voice?: string;
1299
+ speed?: number;
1300
+ pitch?: number;
1301
+ }): Promise<NodeJS.ReadableStream>;
1119
1302
  /**
1120
- * Get model name
1303
+ * Convert speech to text
1121
1304
  */
1122
- getModelName(): string;
1123
- }
1124
- /**
1125
- * Vector Adapter Interface
1126
- * Handles vector storage and similarity search
1127
- */
1128
- interface VectorAdapter$1 {
1305
+ listen(audio: NodeJS.ReadableStream, options?: {
1306
+ language?: string;
1307
+ model?: string;
1308
+ stream?: boolean;
1309
+ }): Promise<string | ReadableStreamType>;
1129
1310
  /**
1130
- * Store a single vector
1311
+ * Connect to real-time voice service
1131
1312
  */
1132
- store(id: string, vector: number[], metadata?: Record<string, unknown>): Promise<void>;
1313
+ connect(options?: Record<string, unknown>): Promise<void>;
1133
1314
  /**
1134
- * Store multiple vectors in batch
1315
+ * Disconnect from real-time voice service
1135
1316
  */
1136
- storeBatch(items: VectorItem$1[]): Promise<void>;
1317
+ disconnect(): void;
1137
1318
  /**
1138
- * Search for similar vectors
1319
+ * Send audio data to real-time service
1139
1320
  */
1140
- search(vector: number[], options?: {
1141
- limit?: number;
1142
- filter?: Record<string, unknown>;
1143
- threshold?: number;
1144
- }): Promise<SearchResult$1[]>;
1321
+ send(audioData: NodeJS.ReadableStream | Int16Array): Promise<void>;
1145
1322
  /**
1146
- * Delete a vector by ID
1323
+ * Register event listener
1147
1324
  */
1148
- delete(id: string): Promise<void>;
1325
+ on<E extends VoiceEventType>(event: E, callback: (data: VoiceEventData[E]) => void): void;
1149
1326
  /**
1150
- * Delete multiple vectors by IDs
1327
+ * Remove event listener
1151
1328
  */
1152
- deleteBatch(ids: string[]): Promise<void>;
1329
+ off<E extends VoiceEventType>(event: E, callback: (data: VoiceEventData[E]) => void): void;
1153
1330
  /**
1154
- * Clear all vectors
1331
+ * Get available voices
1155
1332
  */
1156
- clear(): Promise<void>;
1157
- }
1158
-
1159
- /**
1160
- * Custom error classes for Memory V2
1161
- */
1162
- /**
1163
- * Base error class for Memory V2
1164
- */
1165
- declare class MemoryV2Error extends Error {
1166
- readonly code: string;
1167
- readonly details?: Record<string, unknown> | undefined;
1168
- constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
1169
- }
1170
- /**
1171
- * Error thrown when a storage operation fails
1172
- */
1173
- declare class StorageError extends MemoryV2Error {
1174
- constructor(message: string, details?: Record<string, unknown>);
1175
- }
1176
- /**
1177
- * Error thrown when an embedding operation fails
1178
- */
1179
- declare class EmbeddingError extends MemoryV2Error {
1180
- constructor(message: string, details?: Record<string, unknown>);
1181
- }
1182
- /**
1183
- * Error thrown when a vector operation fails
1184
- */
1185
- declare class VectorError extends MemoryV2Error {
1186
- constructor(message: string, details?: Record<string, unknown>);
1187
- }
1188
- /**
1189
- * Error thrown when a conversation is not found
1190
- */
1191
- declare class ConversationNotFoundError extends MemoryV2Error {
1192
- constructor(conversationId: string);
1193
- }
1194
- /**
1195
- * Error thrown when trying to create a conversation that already exists
1196
- */
1197
- declare class ConversationAlreadyExistsError extends MemoryV2Error {
1198
- constructor(conversationId: string);
1199
- }
1200
- /**
1201
- * Error thrown when vector adapter is required but not configured
1202
- */
1203
- declare class VectorAdapterNotConfiguredError extends MemoryV2Error {
1204
- constructor(operation: string);
1205
- }
1206
- /**
1207
- * Error thrown when embedding adapter is required but not configured
1208
- */
1209
- declare class EmbeddingAdapterNotConfiguredError extends MemoryV2Error {
1210
- constructor(operation: string);
1211
- }
1333
+ getVoices(): Promise<VoiceMetadata[]>;
1334
+ };
1212
1335
 
1213
1336
  /**
1214
1337
  * Vector adapter interface for vector storage and similarity search
1215
1338
  */
1216
- interface VectorAdapter {
1339
+ interface VectorAdapter$1 {
1217
1340
  /**
1218
1341
  * Store a vector with associated metadata
1219
1342
  */
@@ -1221,11 +1344,11 @@ interface VectorAdapter {
1221
1344
  /**
1222
1345
  * Store multiple vectors in batch
1223
1346
  */
1224
- storeBatch(items: VectorItem[]): Promise<void>;
1347
+ storeBatch(items: VectorItem$1[]): Promise<void>;
1225
1348
  /**
1226
1349
  * Search for similar vectors using cosine similarity
1227
1350
  */
1228
- search(vector: number[], options?: VectorSearchOptions): Promise<SearchResult[]>;
1351
+ search(vector: number[], options?: VectorSearchOptions): Promise<SearchResult$1[]>;
1229
1352
  /**
1230
1353
  * Delete a vector by ID
1231
1354
  */
@@ -1245,12 +1368,12 @@ interface VectorAdapter {
1245
1368
  /**
1246
1369
  * Get a specific vector by ID
1247
1370
  */
1248
- get(id: string): Promise<VectorItem | null>;
1371
+ get(id: string): Promise<VectorItem$1 | null>;
1249
1372
  }
1250
1373
  /**
1251
1374
  * Item to store in vector database
1252
1375
  */
1253
- interface VectorItem {
1376
+ interface VectorItem$1 {
1254
1377
  /**
1255
1378
  * Unique identifier for the vector
1256
1379
  */
@@ -1288,7 +1411,7 @@ interface VectorSearchOptions {
1288
1411
  /**
1289
1412
  * Search result with similarity score
1290
1413
  */
1291
- interface SearchResult extends VectorItem {
1414
+ interface SearchResult$1 extends VectorItem$1 {
1292
1415
  /**
1293
1416
  * Similarity score (0-1, higher is more similar)
1294
1417
  */
@@ -1300,678 +1423,511 @@ interface SearchResult extends VectorItem {
1300
1423
  }
1301
1424
 
1302
1425
  /**
1303
- * Vector math utilities for similarity calculations
1426
+ * Memory V2 Type Definitions
1427
+ * Clean separation between conversation memory and telemetry
1304
1428
  */
1429
+
1305
1430
  /**
1306
- * Calculate cosine similarity between two vectors
1307
- * Returns a value between -1 and 1, where 1 means identical direction,
1308
- * 0 means perpendicular, and -1 means opposite direction
1431
+ * Extended UIMessage type with storage metadata
1309
1432
  */
1310
- declare function cosineSimilarity(a: number[], b: number[]): number;
1311
-
1433
+ type StoredUIMessage = UIMessage & {
1434
+ createdAt: Date;
1435
+ userId: string;
1436
+ conversationId: string;
1437
+ };
1312
1438
  /**
1313
- * Memory - Clean architecture for conversation memory and state management
1439
+ * Conversation type
1314
1440
  */
1315
-
1441
+ type Conversation = {
1442
+ id: string;
1443
+ resourceId: string;
1444
+ userId: string;
1445
+ title: string;
1446
+ metadata: Record<string, unknown>;
1447
+ createdAt: string;
1448
+ updatedAt: string;
1449
+ };
1316
1450
  /**
1317
- * Memory Class
1318
- * Handles conversation memory with optional vector search capabilities
1451
+ * Input type for creating a conversation
1319
1452
  */
1320
- declare class Memory {
1321
- private readonly storage;
1322
- private readonly embedding?;
1323
- private readonly vector?;
1324
- private embeddingCache?;
1325
- private readonly workingMemoryConfig?;
1326
- private resourceId?;
1327
- private logger?;
1328
- constructor(options: MemoryConfig);
1329
- /**
1330
- * Get messages from a conversation
1331
- */
1332
- getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage<{
1333
- createdAt: Date;
1334
- }>[]>;
1335
- /**
1336
- * Save a single message
1337
- */
1338
- saveMessage(message: UIMessage, userId: string, conversationId: string): Promise<void>;
1339
- saveConversationSteps(steps: ConversationStepRecord[]): Promise<void>;
1340
- /**
1341
- * Add a single message (alias for consistency with existing API)
1342
- */
1343
- addMessage(message: UIMessage, userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1453
+ type CreateConversationInput = {
1454
+ id: string;
1455
+ resourceId: string;
1456
+ userId: string;
1457
+ title: string;
1458
+ metadata: Record<string, unknown>;
1459
+ };
1460
+ /**
1461
+ * Query builder options for conversations
1462
+ */
1463
+ type ConversationQueryOptions = {
1464
+ userId?: string;
1465
+ resourceId?: string;
1466
+ limit?: number;
1467
+ offset?: number;
1468
+ orderBy?: "created_at" | "updated_at" | "title";
1469
+ orderDirection?: "ASC" | "DESC";
1470
+ };
1471
+ /**
1472
+ * Options for getting messages
1473
+ */
1474
+ type GetMessagesOptions = {
1475
+ limit?: number;
1476
+ before?: Date;
1477
+ after?: Date;
1478
+ roles?: string[];
1479
+ };
1480
+ type ConversationStepType = "text" | "tool_call" | "tool_result";
1481
+ interface ConversationStepRecord {
1482
+ id: string;
1483
+ conversationId: string;
1484
+ userId: string;
1485
+ agentId: string;
1486
+ agentName?: string;
1487
+ operationId: string;
1488
+ stepIndex: number;
1489
+ type: ConversationStepType;
1490
+ role: MessageRole;
1491
+ content?: string;
1492
+ arguments?: Record<string, unknown> | null;
1493
+ result?: Record<string, unknown> | null;
1494
+ usage?: UsageInfo;
1495
+ subAgentId?: string;
1496
+ subAgentName?: string;
1497
+ createdAt: string;
1498
+ }
1499
+ interface GetConversationStepsOptions {
1500
+ limit?: number;
1501
+ operationId?: string;
1502
+ }
1503
+ /**
1504
+ * Memory options for MemoryManager
1505
+ */
1506
+ type MemoryOptions = {};
1507
+ type ConversationTitleConfig = {
1508
+ enabled?: boolean;
1509
+ model?: AgentModelValue;
1510
+ maxOutputTokens?: number;
1511
+ maxLength?: number;
1512
+ systemPrompt?: string | null;
1513
+ };
1514
+ type ConversationTitleGenerator = (params: {
1515
+ input: OperationContext["input"] | UIMessage;
1516
+ context: OperationContext;
1517
+ defaultTitle: string;
1518
+ }) => Promise<string | null>;
1519
+ /**
1520
+ * Workflow state entry for suspension and resumption
1521
+ * Stores only the essential state needed to resume a workflow
1522
+ */
1523
+ interface WorkflowStateEntry {
1524
+ /** Unique execution ID */
1525
+ id: string;
1526
+ /** Workflow definition ID */
1527
+ workflowId: string;
1528
+ /** Workflow name for reference */
1529
+ workflowName: string;
1530
+ /** Current status */
1531
+ status: "running" | "suspended" | "completed" | "cancelled" | "error";
1532
+ /** Original input to the workflow */
1533
+ input?: unknown;
1534
+ /** Execution context */
1535
+ context?: Array<[string | symbol, unknown]>;
1536
+ /** Shared workflow state at the time of persistence */
1537
+ workflowState?: Record<string, unknown>;
1538
+ /** Suspension metadata including checkpoint data */
1539
+ suspension?: {
1540
+ suspendedAt: Date;
1541
+ reason?: string;
1542
+ stepIndex: number;
1543
+ lastEventSequence?: number;
1544
+ checkpoint?: {
1545
+ stepExecutionState?: any;
1546
+ completedStepsData?: any[];
1547
+ workflowState?: Record<string, unknown>;
1548
+ };
1549
+ suspendData?: any;
1550
+ };
1344
1551
  /**
1345
- * Add multiple messages in batch
1552
+ * Stream events collected during execution
1553
+ * Used for timeline visualization in UI
1346
1554
  */
1347
- addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1555
+ events?: Array<{
1556
+ id: string;
1557
+ type: string;
1558
+ name?: string;
1559
+ from?: string;
1560
+ startTime: string;
1561
+ endTime?: string;
1562
+ status?: string;
1563
+ input?: any;
1564
+ output?: any;
1565
+ metadata?: Record<string, unknown>;
1566
+ context?: Record<string, unknown>;
1567
+ }>;
1568
+ /** Final output of the workflow execution */
1569
+ output?: unknown;
1570
+ /** Cancellation metadata */
1571
+ cancellation?: {
1572
+ cancelledAt: Date;
1573
+ reason?: string;
1574
+ };
1575
+ /** User ID if applicable */
1576
+ userId?: string;
1577
+ /** Conversation ID if applicable */
1578
+ conversationId?: string;
1579
+ /** Additional metadata */
1580
+ metadata?: Record<string, unknown>;
1581
+ /** Timestamps */
1582
+ createdAt: Date;
1583
+ updatedAt: Date;
1584
+ }
1585
+ interface WorkflowRunQuery {
1586
+ workflowId?: string;
1587
+ status?: WorkflowStateEntry["status"];
1588
+ from?: Date;
1589
+ to?: Date;
1590
+ limit?: number;
1591
+ offset?: number;
1592
+ }
1593
+ /**
1594
+ * Working memory scope - conversation or user level
1595
+ */
1596
+ type WorkingMemoryScope = "conversation" | "user";
1597
+ /**
1598
+ * Simple memory update modes
1599
+ */
1600
+ type MemoryUpdateMode = "replace" | "append";
1601
+ /**
1602
+ * Options for updating working memory (simplified)
1603
+ */
1604
+ type WorkingMemoryUpdateOptions = {
1605
+ /** How to update the memory (default: "replace") */
1606
+ mode?: MemoryUpdateMode;
1607
+ };
1608
+ /**
1609
+ * Working memory configuration
1610
+ * Auto-detects format: schema → JSON, template → markdown
1611
+ */
1612
+ type WorkingMemoryConfig = {
1613
+ enabled: boolean;
1614
+ scope?: WorkingMemoryScope;
1615
+ } & ({
1616
+ template: string;
1617
+ schema?: never;
1618
+ } | {
1619
+ schema: z.ZodObject<any>;
1620
+ template?: never;
1621
+ } | {
1622
+ template?: never;
1623
+ schema?: never;
1624
+ });
1625
+ /**
1626
+ * Memory V2 configuration options
1627
+ */
1628
+ interface MemoryConfig {
1348
1629
  /**
1349
- * Clear messages for a user
1630
+ * Storage adapter for conversations and messages
1350
1631
  */
1351
- clearMessages(userId: string, conversationId?: string, context?: OperationContext): Promise<void>;
1352
- getConversationSteps(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
1632
+ storage: StorageAdapter;
1353
1633
  /**
1354
- * Get a conversation by ID
1634
+ * Optional embedding adapter or model reference for semantic operations
1355
1635
  */
1356
- getConversation(id: string): Promise<Conversation | null>;
1636
+ embedding?: EmbeddingAdapterInput;
1357
1637
  /**
1358
- * Get conversations for a resource
1638
+ * Optional vector adapter for similarity search
1359
1639
  */
1360
- getConversations(resourceId: string): Promise<Conversation[]>;
1640
+ vector?: VectorAdapter;
1361
1641
  /**
1362
- * Get conversations by user ID with query options
1642
+ * Enable caching for embeddings
1643
+ * @default false
1363
1644
  */
1364
- getConversationsByUserId(userId: string, options?: Omit<ConversationQueryOptions, "userId">): Promise<Conversation[]>;
1645
+ enableCache?: boolean;
1365
1646
  /**
1366
- * Query conversations with advanced options
1647
+ * Maximum number of embeddings to cache
1648
+ * @default 1000
1367
1649
  */
1368
- queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
1650
+ cacheSize?: number;
1369
1651
  /**
1370
- * Create a new conversation
1652
+ * Cache TTL in milliseconds
1653
+ * @default 3600000 (1 hour)
1371
1654
  */
1372
- createConversation(input: CreateConversationInput): Promise<Conversation>;
1655
+ cacheTTL?: number;
1373
1656
  /**
1374
- * Update a conversation
1657
+ * Working memory configuration
1658
+ * Enables agents to maintain important context
1375
1659
  */
1376
- updateConversation(id: string, updates: Partial<Omit<Conversation, "id" | "createdAt" | "updatedAt">>): Promise<Conversation>;
1660
+ workingMemory?: WorkingMemoryConfig;
1377
1661
  /**
1378
- * Delete a conversation
1662
+ * Automatically generate a title for new conversations using the agent's model
1663
+ * (or the override model if provided).
1664
+ * @default false
1379
1665
  */
1380
- deleteConversation(id: string): Promise<void>;
1381
- /**
1382
- * Get messages with semantic search
1383
- * Combines recent messages with semantically similar messages
1384
- */
1385
- getMessagesWithSemanticSearch(userId: string, conversationId: string, currentQuery?: string, options?: {
1386
- limit?: number;
1387
- semanticLimit?: number;
1388
- semanticThreshold?: number;
1389
- mergeStrategy?: "prepend" | "append" | "interleave";
1390
- }): Promise<UIMessage<{
1666
+ generateTitle?: boolean | ConversationTitleConfig;
1667
+ }
1668
+ /**
1669
+ * Embedding adapter config for Memory
1670
+ */
1671
+ type EmbeddingAdapterConfig = EmbeddingOptions & {
1672
+ model: EmbeddingModelReference;
1673
+ };
1674
+ /**
1675
+ * Embedding input options for Memory
1676
+ */
1677
+ type EmbeddingAdapterInput = EmbeddingAdapter | EmbeddingModelReference | EmbeddingAdapterConfig;
1678
+ /**
1679
+ * Metadata about the underlying storage adapter
1680
+ */
1681
+ interface MemoryStorageMetadata {
1682
+ /** Name of the configured storage adapter */
1683
+ adapter: string;
1684
+ }
1685
+ /**
1686
+ * Summary of working memory configuration exposed to the UI
1687
+ */
1688
+ interface WorkingMemorySummary {
1689
+ /** Whether working memory support is enabled */
1690
+ enabled: boolean;
1691
+ /** Scope of working memory persistence */
1692
+ scope?: WorkingMemoryScope;
1693
+ /** Output format (markdown/json) */
1694
+ format: "markdown" | "json" | null;
1695
+ /** Indicates if a template is configured */
1696
+ hasTemplate: boolean;
1697
+ /** Indicates if a schema is configured */
1698
+ hasSchema: boolean;
1699
+ /** Template content if configured */
1700
+ template?: string | null;
1701
+ /** Simplified schema field map if configured */
1702
+ schema?: Record<string, string> | null;
1703
+ }
1704
+ /**
1705
+ * Document type for RAG operations
1706
+ */
1707
+ interface Document {
1708
+ id: string;
1709
+ content: string;
1710
+ metadata?: Record<string, unknown>;
1711
+ }
1712
+ /**
1713
+ * Search options for semantic search
1714
+ */
1715
+ interface SearchOptions {
1716
+ limit?: number;
1717
+ threshold?: number;
1718
+ filter?: Record<string, unknown>;
1719
+ }
1720
+ /**
1721
+ * Search result from vector operations
1722
+ */
1723
+ interface SearchResult {
1724
+ id: string;
1725
+ score: number;
1726
+ content?: string;
1727
+ metadata?: Record<string, unknown>;
1728
+ }
1729
+ /**
1730
+ * Vector item for batch operations
1731
+ */
1732
+ interface VectorItem {
1733
+ id: string;
1734
+ vector: number[];
1735
+ metadata?: Record<string, unknown>;
1736
+ }
1737
+ /**
1738
+ * Storage Adapter Interface
1739
+ * Handles persistence of conversations and messages
1740
+ */
1741
+ interface StorageAdapter {
1742
+ addMessage(message: UIMessage, userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1743
+ addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1744
+ getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage<{
1391
1745
  createdAt: Date;
1392
1746
  }>[]>;
1747
+ clearMessages(userId: string, conversationId?: string, context?: OperationContext): Promise<void>;
1393
1748
  /**
1394
- * Get messages by their IDs
1395
- */
1396
- private getMessagesByIds;
1397
- /**
1398
- * Merge two arrays of messages, removing duplicates
1399
- */
1400
- private mergeMessages;
1401
- /**
1402
- * Check if vector support is configured
1403
- */
1404
- hasVectorSupport(): boolean;
1405
- /**
1406
- * Search for similar content
1407
- */
1408
- searchSimilar(query: string, options?: SearchOptions): Promise<SearchResult$1[]>;
1409
- /**
1410
- * Add a document for RAG
1411
- */
1412
- addDocument(document: Document): Promise<void>;
1413
- /**
1414
- * Remove a document
1415
- */
1416
- removeDocument(id: string): Promise<void>;
1417
- /**
1418
- * Get embedding with caching
1419
- */
1420
- private getEmbedding;
1421
- /**
1422
- * Embed and store a message
1423
- */
1424
- private embedAndStoreMessage;
1425
- /**
1426
- * Embed and store multiple messages
1749
+ * Delete specific messages by ID for a conversation.
1750
+ * Adapters should perform an atomic delete when possible. If atomic deletes or transactions
1751
+ * are unavailable, a best-effort deletion (for example, clear + rehydrate) may be used.
1427
1752
  */
1428
- private embedAndStoreMessages;
1753
+ deleteMessages(messageIds: string[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1754
+ createConversation(input: CreateConversationInput): Promise<Conversation>;
1755
+ getConversation(id: string): Promise<Conversation | null>;
1756
+ getConversations(resourceId: string): Promise<Conversation[]>;
1757
+ getConversationsByUserId(userId: string, options?: Omit<ConversationQueryOptions, "userId">): Promise<Conversation[]>;
1758
+ queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
1429
1759
  /**
1430
- * Get working memory for a conversation or user
1760
+ * Count conversations matching query filters (limit/offset ignored).
1431
1761
  */
1762
+ countConversations(options: ConversationQueryOptions): Promise<number>;
1763
+ updateConversation(id: string, updates: Partial<Omit<Conversation, "id" | "createdAt" | "updatedAt">>): Promise<Conversation>;
1764
+ deleteConversation(id: string): Promise<void>;
1765
+ saveConversationSteps?(steps: ConversationStepRecord[]): Promise<void>;
1766
+ getConversationSteps?(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
1432
1767
  getWorkingMemory(params: {
1433
1768
  conversationId?: string;
1434
1769
  userId?: string;
1770
+ scope: WorkingMemoryScope;
1435
1771
  }): Promise<string | null>;
1436
- /**
1437
- * Update working memory (simplified)
1438
- */
1439
- updateWorkingMemory(params: {
1772
+ setWorkingMemory(params: {
1440
1773
  conversationId?: string;
1441
1774
  userId?: string;
1442
- content: string | Record<string, unknown>;
1443
- options?: WorkingMemoryUpdateOptions;
1775
+ content: string;
1776
+ scope: WorkingMemoryScope;
1444
1777
  }): Promise<void>;
1445
- /**
1446
- * Process content to string format
1447
- */
1448
- private processContent;
1449
- /**
1450
- * Simple deep merge for JSON objects
1451
- */
1452
- private simpleDeepMerge;
1453
- /**
1454
- * Clear working memory
1455
- */
1456
- clearWorkingMemory(params: {
1778
+ deleteWorkingMemory(params: {
1457
1779
  conversationId?: string;
1458
1780
  userId?: string;
1781
+ scope: WorkingMemoryScope;
1459
1782
  }): Promise<void>;
1783
+ getWorkflowState(executionId: string): Promise<WorkflowStateEntry | null>;
1784
+ queryWorkflowRuns(query: WorkflowRunQuery): Promise<WorkflowStateEntry[]>;
1785
+ setWorkflowState(executionId: string, state: WorkflowStateEntry): Promise<void>;
1786
+ updateWorkflowState(executionId: string, updates: Partial<WorkflowStateEntry>): Promise<void>;
1787
+ getSuspendedWorkflowStates(workflowId: string): Promise<WorkflowStateEntry[]>;
1788
+ }
1789
+ /**
1790
+ * Embedding Adapter Interface
1791
+ * Handles text to vector conversions
1792
+ */
1793
+ interface EmbeddingAdapter {
1460
1794
  /**
1461
- * Get working memory template
1462
- */
1463
- getWorkingMemoryTemplate(): string | null;
1464
- /**
1465
- * Get working memory schema
1795
+ * Embed a single text
1466
1796
  */
1467
- getWorkingMemorySchema(): z.ZodObject<any> | null;
1797
+ embed(text: string): Promise<number[]>;
1468
1798
  /**
1469
- * Get working memory format
1799
+ * Embed multiple texts in batch
1470
1800
  */
1471
- getWorkingMemoryFormat(): "markdown" | "json" | null;
1801
+ embedBatch(texts: string[]): Promise<number[][]>;
1472
1802
  /**
1473
- * Check if working memory is supported
1803
+ * Get embedding dimensions
1474
1804
  */
1475
- hasWorkingMemorySupport(): boolean;
1805
+ getDimensions(): number;
1476
1806
  /**
1477
- * Generate system instructions for working memory usage
1807
+ * Get model name
1478
1808
  */
1479
- getWorkingMemoryInstructions(params: {
1480
- conversationId?: string;
1481
- userId?: string;
1482
- }): Promise<string | null>;
1809
+ getModelName(): string;
1810
+ }
1811
+ /**
1812
+ * Vector Adapter Interface
1813
+ * Handles vector storage and similarity search
1814
+ */
1815
+ interface VectorAdapter {
1483
1816
  /**
1484
- * Get configured adapters info
1817
+ * Store a single vector
1485
1818
  */
1486
- getAdaptersInfo(): {
1487
- storage: boolean;
1488
- embedding: {
1489
- configured: boolean;
1490
- model?: string;
1491
- dimensions?: number;
1492
- };
1493
- vector: boolean;
1494
- cache: boolean;
1495
- };
1819
+ store(id: string, vector: number[], metadata?: Record<string, unknown>): Promise<void>;
1496
1820
  /**
1497
- * Save a message to memory
1498
- * Simple version without event publishing (handled by MemoryManagerV2)
1821
+ * Store multiple vectors in batch
1499
1822
  */
1500
- saveMessageWithContext(message: UIMessage, userId: string, conversationId: string, context?: {
1501
- logger?: Logger;
1502
- }, operationContext?: OperationContext): Promise<void>;
1823
+ storeBatch(items: VectorItem[]): Promise<void>;
1503
1824
  /**
1504
- * Get messages with semantic search support
1505
- * Simple version without event publishing (handled by MemoryManagerV2)
1825
+ * Search for similar vectors
1506
1826
  */
1507
- getMessagesWithContext(userId: string, conversationId: string, options?: {
1827
+ search(vector: number[], options?: {
1508
1828
  limit?: number;
1509
- useSemanticSearch?: boolean;
1510
- currentQuery?: string;
1511
- traceId?: string;
1512
- logger?: Logger;
1513
- semanticLimit?: number;
1514
- semanticThreshold?: number;
1515
- mergeStrategy?: "prepend" | "append" | "interleave";
1516
- }, operationContext?: OperationContext): Promise<UIMessage<{
1517
- createdAt: Date;
1518
- }>[]>;
1519
- /**
1520
- * Internal: Set resource ID (agent ID)
1521
- */
1522
- _setResourceId(id: string): void;
1523
- /**
1524
- * Internal: Set logger
1525
- */
1526
- _setLogger(logger: Logger): void;
1527
- /**
1528
- * Get vector adapter if configured
1529
- */
1530
- getVectorAdapter(): VectorAdapter$1 | undefined;
1531
- /**
1532
- * Get embedding adapter if configured
1533
- */
1534
- getEmbeddingAdapter(): EmbeddingAdapter$1 | undefined;
1535
- /**
1536
- * Get metadata about the configured storage adapter
1537
- */
1538
- getStorageMetadata(): MemoryStorageMetadata;
1829
+ filter?: Record<string, unknown>;
1830
+ threshold?: number;
1831
+ }): Promise<SearchResult[]>;
1539
1832
  /**
1540
- * Get a UI-friendly summary of working memory configuration
1833
+ * Delete a vector by ID
1541
1834
  */
1542
- getWorkingMemorySummary(): WorkingMemorySummary | null;
1835
+ delete(id: string): Promise<void>;
1543
1836
  /**
1544
- * Get workflow state by execution ID
1837
+ * Delete multiple vectors by IDs
1545
1838
  */
1546
- getWorkflowState(executionId: string): Promise<WorkflowStateEntry | null>;
1839
+ deleteBatch(ids: string[]): Promise<void>;
1547
1840
  /**
1548
- * Query workflow states with filters
1841
+ * Clear all vectors
1549
1842
  */
1550
- queryWorkflowRuns(query: WorkflowRunQuery): Promise<WorkflowStateEntry[]>;
1551
- /**
1552
- * Set workflow state
1553
- */
1554
- setWorkflowState(executionId: string, state: WorkflowStateEntry): Promise<void>;
1555
- /**
1556
- * Update workflow state
1557
- */
1558
- updateWorkflowState(executionId: string, updates: Partial<WorkflowStateEntry>): Promise<void>;
1559
- /**
1560
- * Get suspended workflow states for a workflow
1561
- */
1562
- getSuspendedWorkflowStates(workflowId: string): Promise<WorkflowStateEntry[]>;
1843
+ clear(): Promise<void>;
1563
1844
  }
1564
1845
 
1565
1846
  /**
1566
- * LoggerProxy implements the Logger interface but delegates all calls to the current global logger.
1567
- * This allows agents and workflows to be created before VoltAgent sets the global logger,
1568
- * while still using the correct logger once it's available.
1847
+ * VoltOps Client Type Definitions
1569
1848
  *
1570
- * When the logger package is not available, it also emits logs via OpenTelemetry Logs API.
1849
+ * All types related to VoltOps client functionality including
1850
+ * prompt management, telemetry, and API interactions.
1571
1851
  */
1572
- declare class LoggerProxy implements Logger {
1573
- private bindings;
1574
- private externalLogger?;
1575
- constructor(bindings?: Record<string, any>, externalLogger?: Logger);
1576
- /**
1577
- * Get the actual logger instance with bindings applied
1578
- */
1579
- private getActualLogger;
1580
- /**
1581
- * Check if a log level should be logged based on the configured level
1582
- */
1583
- private shouldLog;
1584
- /**
1585
- * Emit log via OpenTelemetry Logs API if available
1586
- */
1587
- private emitOtelLog;
1588
- trace: LogFn;
1589
- debug: LogFn;
1590
- info: LogFn;
1591
- warn: LogFn;
1592
- error: LogFn;
1593
- fatal: LogFn;
1594
- /**
1595
- * Create a child logger with additional bindings
1596
- */
1597
- child(childBindings: Record<string, any>): Logger;
1598
- }
1852
+ type ManagedMemoryStatus = "provisioning" | "ready" | "failed";
1599
1853
 
1600
- declare enum ActionType {
1601
- START = "start",
1602
- COMPLETE = "complete",
1603
- ERROR = "error",
1604
- GENERATION_START = "generationStart",
1605
- GENERATION_COMPLETE = "generationComplete",
1606
- STREAM_START = "streamStart",
1607
- STREAM_COMPLETE = "streamComplete",
1608
- STREAM_STEP = "streamStep",
1609
- STREAMING = "streaming",
1610
- OBJECT_GENERATION_START = "objectGenerationStart",
1611
- OBJECT_GENERATION_COMPLETE = "objectGenerationComplete",
1612
- STREAM_OBJECT_START = "streamObjectStart",
1613
- STREAM_OBJECT_COMPLETE = "streamObjectComplete",
1614
- TOOL_CALL = "toolCall",
1615
- TOOL_ERROR = "toolError",
1616
- DELEGATE = "delegate",
1617
- EXECUTE = "execute",
1618
- VALIDATE = "validate",
1619
- STEP_START = "stepStart",
1620
- STEP_COMPLETE = "stepComplete",
1621
- SUSPEND = "suspend",
1622
- RESUME = "resume",
1623
- ACCESS = "access",
1624
- STORE = "store",
1625
- RETRIEVE = "retrieve"
1626
- }
1627
1854
  /**
1628
- * Helper to format retriever log messages
1855
+ * Reference to a prompt in the VoltOps system
1629
1856
  */
1630
- declare function buildRetrieverLogMessage(retrieverName: string, action: ActionType | string, description: string): string;
1631
-
1857
+ type PromptReference = {
1858
+ /** Name of the prompt */
1859
+ promptName: string;
1860
+ /** Specific version number (takes precedence over label) */
1861
+ version?: number;
1862
+ /** Label to fetch (e.g., 'latest', 'production', 'staging') */
1863
+ label?: string;
1864
+ /** Variables to substitute in the template */
1865
+ variables?: Record<string, any>;
1866
+ /** Per-prompt cache configuration (overrides global settings) */
1867
+ promptCache?: {
1868
+ enabled?: boolean;
1869
+ ttl?: number;
1870
+ maxSize?: number;
1871
+ };
1872
+ };
1632
1873
  /**
1633
- * Get the global logger instance from registry or create a default one
1874
+ * Helper interface for prompt operations in agent instructions
1634
1875
  */
1635
- declare function getGlobalLogger(): Logger;
1876
+ type PromptHelper = {
1877
+ /** Get prompt content by reference */
1878
+ getPrompt: (reference: PromptReference) => Promise<PromptContent>;
1879
+ };
1636
1880
  /**
1637
- * Get the global log buffer
1881
+ * Enhanced dynamic value options with prompts support
1638
1882
  */
1639
- declare function getGlobalLogBuffer(): LogBuffer;
1640
-
1883
+ interface DynamicValueOptions {
1884
+ /** User context map */
1885
+ context: Map<string | symbol, unknown>;
1886
+ /** Prompt helper (available when VoltOpsClient is configured) */
1887
+ prompts: PromptHelper;
1888
+ }
1641
1889
  /**
1642
- * Options for configuring the Retriever
1890
+ * Dynamic value type for agent configuration
1643
1891
  */
1644
- type RetrieverOptions = {
1645
- /**
1646
- * Name for the default tool created from this retriever
1647
- * This is used for the pre-created 'tool' property
1648
- * @default "search_knowledge"
1649
- */
1650
- toolName?: string;
1651
- /**
1652
- * Description for the default tool created from this retriever
1653
- * This is used for the pre-created 'tool' property
1654
- * @default "Searches for relevant information in the knowledge base based on the query."
1655
- */
1656
- toolDescription?: string;
1657
- /**
1658
- * Optional logger instance for the retriever
1659
- * If not provided, a default logger will be created
1660
- */
1661
- logger?: Logger;
1662
- /**
1663
- * Additional configuration specific to concrete retriever implementations
1664
- */
1665
- [key: string]: any;
1666
- };
1892
+ type DynamicValue<T> = (options: DynamicValueOptions) => Promise<T> | T;
1667
1893
  /**
1668
- * Options passed to retrieve method.
1669
- * Includes all operation context fields for user-specific and context-aware retrieval.
1894
+ * VoltOps client configuration options
1670
1895
  */
1671
- interface RetrieveOptions extends Partial<OperationContext> {
1896
+ type VoltOpsClientOptions = {
1897
+ /** Base URL of the VoltOps API (default: https://api.voltagent.dev) */
1898
+ baseUrl?: string;
1672
1899
  /**
1673
- * User-managed context map for this specific retrieval operation
1674
- * Can be used to store metadata, results, or any custom data
1900
+ * Public API key for VoltOps authentication
1675
1901
  *
1676
- * Inherited from OperationContext but explicitly documented here for clarity
1677
- */
1678
- context?: Map<string | symbol, unknown>;
1679
- /**
1680
- * Optional logger instance for this retrieval operation.
1681
- * Provides execution-scoped logging with full context.
1682
- * Available when retriever is called from an agent or workflow context.
1902
+ * @description Your VoltOps public key used for API authentication and prompt management.
1903
+ * This key is safe to use in client-side applications as it only provides read access.
1683
1904
  *
1684
- * Inherited from OperationContext but explicitly documented here for clarity
1685
- */
1686
- logger?: Logger;
1687
- /**
1688
- * Optional user identifier for user-specific retrieval.
1689
- * Can be used to filter results by user or implement multi-tenant retrieval.
1905
+ * @format Should start with `pk_` prefix (e.g., `pk_1234567890abcdef`)
1690
1906
  *
1691
- * Inherited from OperationContext
1692
- */
1693
- userId?: string;
1694
- /**
1695
- * Optional conversation identifier for conversation-aware retrieval.
1696
- * Can be used to retrieve conversation-specific context or history.
1907
+ * @example
1908
+ * ```typescript
1909
+ * publicKey: process.env.VOLTAGENT_PUBLIC_KEY
1910
+ * ```
1697
1911
  *
1698
- * Inherited from OperationContext
1699
- */
1700
- conversationId?: string;
1701
- }
1702
- /**
1703
- * Retriever interface for retrieving relevant information
1704
- */
1705
- type Retriever = {
1706
- /**
1707
- * Retrieve relevant documents based on input text
1708
- * @param text The text to use for retrieval
1709
- * @param options Configuration and context for the retrieval
1710
- * @returns Promise resolving to a string with the retrieved content
1711
- */
1712
- retrieve(text: string, options: RetrieveOptions): Promise<string>;
1713
- /**
1714
- * Configuration options for the retriever
1715
- * This is optional and may not be present in all implementations
1716
- */
1717
- options?: RetrieverOptions;
1718
- /**
1719
- * Pre-created tool for easy destructuring
1720
- * This is optional and may not be present in all implementations
1721
- */
1722
- tool?: any;
1723
- /**
1724
- * Optional observability attributes for retriever spans.
1725
- */
1726
- getObservabilityAttributes?: () => Record<string, unknown>;
1727
- };
1728
-
1729
- /**
1730
- * Abstract base class for Retriever implementations.
1731
- * This class provides a common structure for different types of retrievers.
1732
- */
1733
- declare abstract class BaseRetriever {
1734
- /**
1735
- * Options that configure the retriever's behavior
1736
- */
1737
- protected options: RetrieverOptions;
1738
- /**
1739
- * Logger instance for the retriever
1912
+ *
1913
+ * @obtain Get your API keys from: https://console.voltagent.dev/settings/projects
1740
1914
  */
1741
- protected logger: Logger;
1915
+ publicKey?: string;
1742
1916
  /**
1743
- * Ready-to-use tool property for direct destructuring
1744
- * This can be used with object destructuring syntax
1917
+ * Secret API key for VoltOps authentication
1918
+ *
1919
+ * @description Your VoltOps secret key used for secure API operations and analytics.
1920
+ * This key provides full access to your VoltOps project and should be kept secure.
1921
+ *
1922
+ * @format Should start with `sk_` prefix (e.g., `sk_abcdef1234567890`)
1745
1923
  *
1746
1924
  * @example
1747
1925
  * ```typescript
1748
- * // ✅ You can use destructuring with the tool property
1749
- * const { tool } = new SimpleRetriever();
1750
- *
1751
- * // And use it directly in an agent
1752
- * const agent = new Agent({
1753
- * name: "RAG Agent",
1754
- * model: "gpt-4",
1755
- * provider,
1756
- * tools: [tool],
1757
- * });
1926
+ * secretKey: process.env.VOLTAGENT_SECRET_KEY
1758
1927
  * ```
1759
- */
1760
- readonly tool: AgentTool;
1761
- /**
1762
- * Constructor for the BaseRetriever class.
1763
- * @param options - Configuration options for the retriever.
1764
- */
1765
- constructor(options?: RetrieverOptions);
1766
- /**
1767
- * Abstract method that must be implemented by concrete retriever classes.
1768
- * Retrieves relevant information based on the input text or messages.
1769
1928
  *
1770
- * @param input - The input to use for retrieval (string or BaseMessage array)
1771
- * @param options - Configuration and context for the retrieval
1772
- * @returns Promise resolving to a string with the retrieved content
1773
- */
1774
- abstract retrieve(input: string | BaseMessage[], options: RetrieveOptions): Promise<string>;
1775
- /**
1776
- * Optional observability attributes for retriever spans.
1777
- * Override in subclasses to add context (e.g. knowledge base metadata).
1778
- */
1779
- getObservabilityAttributes(): Record<string, unknown>;
1780
- }
1781
-
1782
- /**
1783
- * ReadableStream type for voice responses
1784
- */
1785
- type ReadableStreamType = ReadableStream | NodeJS.ReadableStream | any;
1786
- /**
1787
- * Voice provider options
1788
- */
1789
- type VoiceOptions = {
1790
- /**
1791
- * API key for the voice provider
1792
- */
1793
- apiKey?: string;
1794
- /**
1795
- * Model to use for speech recognition
1796
- */
1797
- speechModel?: string;
1798
- /**
1799
- * Model to use for text-to-speech
1800
- */
1801
- ttsModel?: string;
1802
- /**
1803
- * Voice ID to use for text-to-speech
1804
- */
1805
- voice?: string;
1806
- /**
1807
- * Additional provider-specific options
1808
- */
1809
- options?: Record<string, unknown>;
1810
- };
1811
- /**
1812
- * Voice event types
1813
- */
1814
- type VoiceEventType = "speaking" | "listening" | "error" | "connected" | "disconnected";
1815
- /**
1816
- * Voice event data types
1817
- */
1818
- type VoiceEventData = {
1819
- speaking: {
1820
- text: string;
1821
- audio?: NodeJS.ReadableStream;
1822
- };
1823
- listening: {
1824
- audio: NodeJS.ReadableStream;
1825
- };
1826
- error: {
1827
- message: string;
1828
- code?: string;
1829
- details?: unknown;
1830
- };
1831
- connected: undefined;
1832
- disconnected: undefined;
1833
- };
1834
- /**
1835
- * Voice metadata
1836
- */
1837
- type VoiceMetadata = {
1838
- id: string;
1839
- name: string;
1840
- language: string;
1841
- gender?: "male" | "female" | "neutral";
1842
- metadata?: Record<string, unknown>;
1843
- };
1844
- /**
1845
- * Base interface for voice providers
1846
- */
1847
- type Voice = {
1848
- /**
1849
- * Convert text to speech
1850
- */
1851
- speak(text: string | NodeJS.ReadableStream, options?: {
1852
- voice?: string;
1853
- speed?: number;
1854
- pitch?: number;
1855
- }): Promise<NodeJS.ReadableStream>;
1856
- /**
1857
- * Convert speech to text
1858
- */
1859
- listen(audio: NodeJS.ReadableStream, options?: {
1860
- language?: string;
1861
- model?: string;
1862
- stream?: boolean;
1863
- }): Promise<string | ReadableStreamType>;
1864
- /**
1865
- * Connect to real-time voice service
1866
- */
1867
- connect(options?: Record<string, unknown>): Promise<void>;
1868
- /**
1869
- * Disconnect from real-time voice service
1870
- */
1871
- disconnect(): void;
1872
- /**
1873
- * Send audio data to real-time service
1874
- */
1875
- send(audioData: NodeJS.ReadableStream | Int16Array): Promise<void>;
1876
- /**
1877
- * Register event listener
1878
- */
1879
- on<E extends VoiceEventType>(event: E, callback: (data: VoiceEventData[E]) => void): void;
1880
- /**
1881
- * Remove event listener
1882
- */
1883
- off<E extends VoiceEventType>(event: E, callback: (data: VoiceEventData[E]) => void): void;
1884
- /**
1885
- * Get available voices
1886
- */
1887
- getVoices(): Promise<VoiceMetadata[]>;
1888
- };
1889
-
1890
- /**
1891
- * VoltOps Client Type Definitions
1892
- *
1893
- * All types related to VoltOps client functionality including
1894
- * prompt management, telemetry, and API interactions.
1895
- */
1896
- type ManagedMemoryStatus = "provisioning" | "ready" | "failed";
1897
-
1898
- /**
1899
- * Reference to a prompt in the VoltOps system
1900
- */
1901
- type PromptReference = {
1902
- /** Name of the prompt */
1903
- promptName: string;
1904
- /** Specific version number (takes precedence over label) */
1905
- version?: number;
1906
- /** Label to fetch (e.g., 'latest', 'production', 'staging') */
1907
- label?: string;
1908
- /** Variables to substitute in the template */
1909
- variables?: Record<string, any>;
1910
- /** Per-prompt cache configuration (overrides global settings) */
1911
- promptCache?: {
1912
- enabled?: boolean;
1913
- ttl?: number;
1914
- maxSize?: number;
1915
- };
1916
- };
1917
- /**
1918
- * Helper interface for prompt operations in agent instructions
1919
- */
1920
- type PromptHelper = {
1921
- /** Get prompt content by reference */
1922
- getPrompt: (reference: PromptReference) => Promise<PromptContent>;
1923
- };
1924
- /**
1925
- * Enhanced dynamic value options with prompts support
1926
- */
1927
- interface DynamicValueOptions {
1928
- /** User context map */
1929
- context: Map<string | symbol, unknown>;
1930
- /** Prompt helper (available when VoltOpsClient is configured) */
1931
- prompts: PromptHelper;
1932
- }
1933
- /**
1934
- * Dynamic value type for agent configuration
1935
- */
1936
- type DynamicValue<T> = (options: DynamicValueOptions) => Promise<T> | T;
1937
- /**
1938
- * VoltOps client configuration options
1939
- */
1940
- type VoltOpsClientOptions = {
1941
- /** Base URL of the VoltOps API (default: https://api.voltagent.dev) */
1942
- baseUrl?: string;
1943
- /**
1944
- * Public API key for VoltOps authentication
1945
- *
1946
- * @description Your VoltOps public key used for API authentication and prompt management.
1947
- * This key is safe to use in client-side applications as it only provides read access.
1948
- *
1949
- * @format Should start with `pk_` prefix (e.g., `pk_1234567890abcdef`)
1950
- *
1951
- * @example
1952
- * ```typescript
1953
- * publicKey: process.env.VOLTAGENT_PUBLIC_KEY
1954
- * ```
1955
- *
1956
- *
1957
- * @obtain Get your API keys from: https://console.voltagent.dev/settings/projects
1958
- */
1959
- publicKey?: string;
1960
- /**
1961
- * Secret API key for VoltOps authentication
1962
- *
1963
- * @description Your VoltOps secret key used for secure API operations and analytics.
1964
- * This key provides full access to your VoltOps project and should be kept secure.
1965
- *
1966
- * @format Should start with `sk_` prefix (e.g., `sk_abcdef1234567890`)
1967
- *
1968
- * @example
1969
- * ```typescript
1970
- * secretKey: process.env.VOLTAGENT_SECRET_KEY
1971
- * ```
1972
- *
1973
- *
1974
- * @obtain Get your API keys from: https://console.voltagent.dev/settings/projects
1929
+ *
1930
+ * @obtain Get your API keys from: https://console.voltagent.dev/settings/projects
1975
1931
  */
1976
1932
  secretKey?: string;
1977
1933
  /** Custom fetch implementation (optional) */
@@ -2842,6 +2798,11 @@ interface ManagedMemoryClearMessagesInput {
2842
2798
  userId: string;
2843
2799
  conversationId?: string;
2844
2800
  }
2801
+ interface ManagedMemoryDeleteMessagesInput {
2802
+ conversationId: string;
2803
+ userId: string;
2804
+ messageIds: string[];
2805
+ }
2845
2806
  interface ManagedMemoryGetConversationStepsInput {
2846
2807
  conversationId: string;
2847
2808
  userId: string;
@@ -2894,6 +2855,7 @@ interface ManagedMemoryMessagesClient {
2894
2855
  addBatch(databaseId: string, input: ManagedMemoryAddMessagesInput): Promise<void>;
2895
2856
  list(databaseId: string, input: ManagedMemoryGetMessagesInput): Promise<UIMessage[]>;
2896
2857
  clear(databaseId: string, input: ManagedMemoryClearMessagesInput): Promise<void>;
2858
+ delete(databaseId: string, input: ManagedMemoryDeleteMessagesInput): Promise<void>;
2897
2859
  }
2898
2860
  interface ManagedMemoryConversationsClient {
2899
2861
  create(databaseId: string, input: CreateConversationInput): Promise<Conversation>;
@@ -2922,8 +2884,8 @@ interface ManagedMemoryStepsClient {
2922
2884
  interface ManagedMemoryVectorsClient {
2923
2885
  store(databaseId: string, input: ManagedMemoryStoreVectorInput): Promise<void>;
2924
2886
  storeBatch(databaseId: string, input: ManagedMemoryStoreVectorsBatchInput): Promise<void>;
2925
- search(databaseId: string, input: ManagedMemorySearchVectorsInput): Promise<SearchResult[]>;
2926
- get(databaseId: string, vectorId: string): Promise<VectorItem | null>;
2887
+ search(databaseId: string, input: ManagedMemorySearchVectorsInput): Promise<SearchResult$1[]>;
2888
+ get(databaseId: string, vectorId: string): Promise<VectorItem$1 | null>;
2927
2889
  delete(databaseId: string, vectorId: string): Promise<void>;
2928
2890
  deleteBatch(databaseId: string, input: ManagedMemoryDeleteVectorsInput): Promise<void>;
2929
2891
  clear(databaseId: string): Promise<void>;
@@ -3161,6 +3123,7 @@ declare class VoltOpsClient implements VoltOpsClient$1 {
3161
3123
  private addManagedMemoryMessages;
3162
3124
  private getManagedMemoryMessages;
3163
3125
  private clearManagedMemoryMessages;
3126
+ private deleteManagedMemoryMessages;
3164
3127
  private storeManagedMemoryVector;
3165
3128
  private storeManagedMemoryVectors;
3166
3129
  private searchManagedMemoryVectors;
@@ -6833,6 +6796,9 @@ interface OnToolEndHookArgs {
6833
6796
  context: OperationContext;
6834
6797
  options?: ToolExecuteOptions;
6835
6798
  }
6799
+ interface OnToolEndHookResult {
6800
+ output?: unknown;
6801
+ }
6836
6802
  interface OnPrepareMessagesHookArgs {
6837
6803
  /** The messages that will be sent to the LLM (AI SDK UIMessage). */
6838
6804
  messages: UIMessage[];
@@ -6917,7 +6883,7 @@ type AgentHookOnEnd = (args: OnEndHookArgs) => Promise<void> | void;
6917
6883
  type AgentHookOnHandoff = (args: OnHandoffHookArgs) => Promise<void> | void;
6918
6884
  type AgentHookOnHandoffComplete = (args: OnHandoffCompleteHookArgs) => Promise<void> | void;
6919
6885
  type AgentHookOnToolStart = (args: OnToolStartHookArgs) => Promise<void> | void;
6920
- type AgentHookOnToolEnd = (args: OnToolEndHookArgs) => Promise<void> | void;
6886
+ type AgentHookOnToolEnd = (args: OnToolEndHookArgs) => Promise<OnToolEndHookResult | undefined> | Promise<void> | OnToolEndHookResult | undefined;
6921
6887
  type AgentHookOnPrepareMessages = (args: OnPrepareMessagesHookArgs) => Promise<OnPrepareMessagesHookResult> | OnPrepareMessagesHookResult;
6922
6888
  type AgentHookOnPrepareModelMessages = (args: OnPrepareModelMessagesHookArgs) => Promise<OnPrepareModelMessagesHookResult> | OnPrepareModelMessagesHookResult;
6923
6889
  type AgentHookOnError = (args: OnErrorHookArgs) => Promise<void> | void;
@@ -7061,6 +7027,11 @@ interface ApiToolInfo {
7061
7027
  description: string;
7062
7028
  parameters?: any;
7063
7029
  }
7030
+ interface AgentToolRoutingState {
7031
+ routers?: ApiToolInfo[];
7032
+ expose?: ApiToolInfo[];
7033
+ pool?: ApiToolInfo[];
7034
+ }
7064
7035
  type AgentFeedbackOptions = {
7065
7036
  key?: string;
7066
7037
  feedbackConfig?: VoltOpsFeedbackConfig | null;
@@ -7078,9 +7049,9 @@ type AgentFeedbackMetadata = {
7078
7049
  /**
7079
7050
  * Tool with node_id for agent state
7080
7051
  */
7081
- interface ToolWithNodeId extends BaseTool {
7052
+ type ToolWithNodeId = (BaseTool | ProviderTool) & {
7082
7053
  node_id: string;
7083
- }
7054
+ };
7084
7055
  interface AgentScorerState {
7085
7056
  key: string;
7086
7057
  id: string;
@@ -7150,6 +7121,7 @@ interface AgentFullState {
7150
7121
  model: string;
7151
7122
  node_id: string;
7152
7123
  tools: ToolWithNodeId[];
7124
+ toolRouting?: AgentToolRoutingState;
7153
7125
  subAgents: SubAgentStateData[];
7154
7126
  memory: AgentMemoryState;
7155
7127
  scorers?: AgentScorerState[];
@@ -7454,6 +7426,7 @@ type AgentOptions = {
7454
7426
  instructions: InstructionsDynamicValue;
7455
7427
  tools?: (Tool<any, any> | Toolkit | Tool$1)[] | DynamicValue<(Tool<any, any> | Toolkit)[]>;
7456
7428
  toolkits?: Toolkit[];
7429
+ toolRouting?: ToolRoutingConfig | false;
7457
7430
  memory?: Memory | false;
7458
7431
  summarization?: AgentSummarizationOptions | false;
7459
7432
  retriever?: BaseRetriever;
@@ -7492,7 +7465,7 @@ type AgentOptions = {
7492
7465
  context?: ContextInput;
7493
7466
  eval?: AgentEvalConfig;
7494
7467
  };
7495
- type AgentEvalOperationType = "generateText" | "streamText" | "generateObject" | "streamObject" | "workflow";
7468
+ type AgentEvalOperationType = "generateText" | "generateTitle" | "streamText" | "generateObject" | "streamObject" | "workflow";
7496
7469
  interface AgentEvalPayload {
7497
7470
  operationId: string;
7498
7471
  operationType: AgentEvalOperationType;
@@ -7596,170 +7569,501 @@ type ClientSideToolResult = {
7596
7569
  */
7597
7570
  type AgentResponse = {
7598
7571
  /**
7599
- * Response content
7572
+ * Response content
7573
+ */
7574
+ content: string;
7575
+ /**
7576
+ * Tool calls made by the model (if any)
7577
+ */
7578
+ toolCalls?: ToolCall$1[];
7579
+ /**
7580
+ * Additional metadata
7581
+ */
7582
+ metadata: {
7583
+ agentId: string;
7584
+ agentName: string;
7585
+ [key: string]: unknown;
7586
+ };
7587
+ };
7588
+ /**
7589
+ * Context for a specific agent operation (e.g., one generateText call)
7590
+ */
7591
+ type OperationContext = {
7592
+ /** Unique identifier for the operation */
7593
+ readonly operationId: string;
7594
+ /** Optional user identifier associated with this operation */
7595
+ userId?: string;
7596
+ /** Optional conversation identifier associated with this operation */
7597
+ conversationId?: string;
7598
+ /** User-managed context map for this operation */
7599
+ readonly context: Map<string | symbol, unknown>;
7600
+ /** System-managed context map for internal operation tracking */
7601
+ readonly systemContext: Map<string | symbol, unknown>;
7602
+ /** Whether this operation is still active */
7603
+ isActive: boolean;
7604
+ /** Parent agent ID if part of a delegation chain */
7605
+ parentAgentId?: string;
7606
+ /** Optional elicitation bridge for requesting user input */
7607
+ elicitation?: (request: unknown) => Promise<unknown>;
7608
+ /** Trace context for managing span hierarchy and common attributes */
7609
+ traceContext: AgentTraceContext;
7610
+ /** Execution-scoped logger with full context (userId, conversationId, executionId) */
7611
+ logger: Logger;
7612
+ /** Conversation steps for building full message history including tool calls/results */
7613
+ conversationSteps?: StepWithContent[];
7614
+ /** AbortController for cancelling the operation and accessing the signal */
7615
+ abortController: AbortController;
7616
+ /** Start time of the operation (Date object) */
7617
+ startTime: Date;
7618
+ /** Cancellation error to be thrown when operation is aborted */
7619
+ cancellationError?: CancellationError;
7620
+ /** Input provided to the agent operation (string, UIMessages, or BaseMessages) */
7621
+ input?: string | UIMessage[] | BaseMessage[];
7622
+ /** Output generated by the agent operation (text or object) */
7623
+ output?: string | object;
7624
+ };
7625
+ /**
7626
+ * Specific information related to a tool execution error.
7627
+ */
7628
+ interface ToolErrorInfo {
7629
+ /** The unique identifier of the tool call. */
7630
+ toolCallId: string;
7631
+ /** The name of the tool that was executed. */
7632
+ toolName: string;
7633
+ /** The original error thrown directly by the tool during execution (if available). */
7634
+ toolExecutionError?: unknown;
7635
+ /** The arguments passed to the tool when the error occurred (for debugging). */
7636
+ toolArguments?: unknown;
7637
+ }
7638
+ /**
7639
+ * Type for onError callbacks in streaming operations.
7640
+ * Providers must pass an error conforming to the VoltAgentError structure.
7641
+ */
7642
+ type StreamOnErrorCallback = (error: VoltAgentError) => Promise<void> | void;
7643
+ type UserContext = Map<string | symbol, unknown>;
7644
+ /**
7645
+ * Standardized object structure passed to the onFinish callback
7646
+ * when streamText completes successfully.
7647
+ */
7648
+ interface StreamTextFinishResult {
7649
+ /** The final, consolidated text output from the stream. */
7650
+ text: string;
7651
+ /** Token usage information (if available). */
7652
+ usage?: UsageInfo;
7653
+ /** Feedback metadata for the trace, if enabled. */
7654
+ feedback?: AgentFeedbackMetadata | null;
7655
+ /** The reason the stream finished (if available, e.g., 'stop', 'length', 'tool-calls'). */
7656
+ finishReason?: string;
7657
+ /** The original completion response object from the provider (if available). */
7658
+ providerResponse?: unknown;
7659
+ /** Any warnings generated during the completion (if available). */
7660
+ warnings?: unknown[];
7661
+ /** User context containing any custom metadata from the operation. */
7662
+ context?: UserContext;
7663
+ }
7664
+ /**
7665
+ * Type for the onFinish callback function for streamText.
7666
+ */
7667
+ type StreamTextOnFinishCallback = (result: StreamTextFinishResult) => Promise<void> | void;
7668
+ /**
7669
+ * Standardized object structure passed to the onFinish callback
7670
+ * when streamObject completes successfully.
7671
+ * @template TObject The expected type of the fully formed object.
7672
+ */
7673
+ interface StreamObjectFinishResult<TObject> {
7674
+ /** The final, fully formed object from the stream. */
7675
+ object: TObject;
7676
+ /** Token usage information (if available). */
7677
+ usage?: UsageInfo;
7678
+ /** The original completion response object from the provider (if available). */
7679
+ providerResponse?: unknown;
7680
+ /** Any warnings generated during the completion (if available). */
7681
+ warnings?: unknown[];
7682
+ /** The reason the stream finished (if available). Although less common for object streams. */
7683
+ finishReason?: string;
7684
+ /** User context containing any custom metadata from the operation. */
7685
+ context?: UserContext;
7686
+ }
7687
+ /**
7688
+ * Type for the onFinish callback function for streamObject.
7689
+ * @template TObject The expected type of the fully formed object.
7690
+ */
7691
+ type StreamObjectOnFinishCallback<TObject> = (result: StreamObjectFinishResult<TObject>) => Promise<void> | void;
7692
+ /**
7693
+ * Standardized success result structure for generateText.
7694
+ */
7695
+ interface StandardizedTextResult {
7696
+ /** The generated text. */
7697
+ text: string;
7698
+ /** Token usage information (if available). */
7699
+ usage?: UsageInfo;
7700
+ /** Feedback metadata for the trace, if enabled. */
7701
+ feedback?: AgentFeedbackMetadata | null;
7702
+ /** Original provider response (if needed). */
7703
+ providerResponse?: unknown;
7704
+ /** Finish reason (if available from provider). */
7705
+ finishReason?: string;
7706
+ /** Warnings (if available from provider). */
7707
+ warnings?: unknown[];
7708
+ /** User context containing any custom metadata from the operation. */
7709
+ context?: UserContext;
7710
+ }
7711
+ /**
7712
+ * Standardized success result structure for generateObject.
7713
+ * @template TObject The expected type of the generated object.
7714
+ */
7715
+ interface StandardizedObjectResult<TObject> {
7716
+ /** The generated object. */
7717
+ object: TObject;
7718
+ /** Token usage information (if available). */
7719
+ usage?: UsageInfo;
7720
+ /** Original provider response (if needed). */
7721
+ providerResponse?: unknown;
7722
+ /** Finish reason (if available from provider). */
7723
+ finishReason?: string;
7724
+ /** Warnings (if available from provider). */
7725
+ warnings?: unknown[];
7726
+ /** User context containing any custom metadata from the operation. */
7727
+ context?: UserContext;
7728
+ }
7729
+ /**
7730
+ * Unified output type for the onEnd hook, representing the successful result
7731
+ * of any core agent operation. Use 'type guarding' or check specific fields
7732
+ * within the hook implementation to determine the concrete type.
7733
+ * Object types are generalized to 'unknown' here for the union.
7734
+ */
7735
+ type AgentOperationOutput = StandardizedTextResult | StreamTextFinishResult | StandardizedObjectResult<unknown> | StreamObjectFinishResult<unknown>;
7736
+
7737
+ /**
7738
+ * Custom error classes for Memory V2
7739
+ */
7740
+ /**
7741
+ * Base error class for Memory V2
7742
+ */
7743
+ declare class MemoryV2Error extends Error {
7744
+ readonly code: string;
7745
+ readonly details?: Record<string, unknown> | undefined;
7746
+ constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
7747
+ }
7748
+ /**
7749
+ * Error thrown when a storage operation fails
7750
+ */
7751
+ declare class StorageError extends MemoryV2Error {
7752
+ constructor(message: string, details?: Record<string, unknown>);
7753
+ }
7754
+ /**
7755
+ * Error thrown when an embedding operation fails
7756
+ */
7757
+ declare class EmbeddingError extends MemoryV2Error {
7758
+ constructor(message: string, details?: Record<string, unknown>);
7759
+ }
7760
+ /**
7761
+ * Error thrown when a vector operation fails
7762
+ */
7763
+ declare class VectorError extends MemoryV2Error {
7764
+ constructor(message: string, details?: Record<string, unknown>);
7765
+ }
7766
+ /**
7767
+ * Error thrown when a conversation is not found
7768
+ */
7769
+ declare class ConversationNotFoundError extends MemoryV2Error {
7770
+ constructor(conversationId: string);
7771
+ }
7772
+ /**
7773
+ * Error thrown when trying to create a conversation that already exists
7774
+ */
7775
+ declare class ConversationAlreadyExistsError extends MemoryV2Error {
7776
+ constructor(conversationId: string);
7777
+ }
7778
+ /**
7779
+ * Error thrown when vector adapter is required but not configured
7780
+ */
7781
+ declare class VectorAdapterNotConfiguredError extends MemoryV2Error {
7782
+ constructor(operation: string);
7783
+ }
7784
+ /**
7785
+ * Error thrown when embedding adapter is required but not configured
7786
+ */
7787
+ declare class EmbeddingAdapterNotConfiguredError extends MemoryV2Error {
7788
+ constructor(operation: string);
7789
+ }
7790
+
7791
+ /**
7792
+ * Vector math utilities for similarity calculations
7793
+ */
7794
+ /**
7795
+ * Calculate cosine similarity between two vectors
7796
+ * Returns a value between -1 and 1, where 1 means identical direction,
7797
+ * 0 means perpendicular, and -1 means opposite direction
7798
+ */
7799
+ declare function cosineSimilarity(a: number[], b: number[]): number;
7800
+
7801
+ /**
7802
+ * Memory - Clean architecture for conversation memory and state management
7803
+ */
7804
+
7805
+ /**
7806
+ * Memory Class
7807
+ * Handles conversation memory with optional vector search capabilities
7808
+ */
7809
+ declare class Memory {
7810
+ private readonly storage;
7811
+ private readonly embedding?;
7812
+ private readonly vector?;
7813
+ private embeddingCache?;
7814
+ private readonly workingMemoryConfig?;
7815
+ private readonly titleGenerationConfig?;
7816
+ private resourceId?;
7817
+ private logger?;
7818
+ constructor(options: MemoryConfig);
7819
+ /**
7820
+ * Get messages from a conversation
7821
+ */
7822
+ getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage<{
7823
+ createdAt: Date;
7824
+ }>[]>;
7825
+ /**
7826
+ * Save a single message
7827
+ */
7828
+ saveMessage(message: UIMessage, userId: string, conversationId: string): Promise<void>;
7829
+ saveConversationSteps(steps: ConversationStepRecord[]): Promise<void>;
7830
+ /**
7831
+ * Add a single message (alias for consistency with existing API)
7832
+ */
7833
+ addMessage(message: UIMessage, userId: string, conversationId: string, context?: OperationContext): Promise<void>;
7834
+ /**
7835
+ * Add multiple messages in batch
7836
+ */
7837
+ addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
7838
+ /**
7839
+ * Clear messages for a user
7840
+ */
7841
+ clearMessages(userId: string, conversationId?: string, context?: OperationContext): Promise<void>;
7842
+ /**
7843
+ * Delete specific messages by ID for a conversation
7844
+ * Adapters should delete atomically when possible; otherwise a best-effort delete may be used.
7845
+ */
7846
+ deleteMessages(messageIds: string[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
7847
+ getConversationSteps(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
7848
+ /**
7849
+ * Get a conversation by ID
7850
+ */
7851
+ getConversation(id: string): Promise<Conversation | null>;
7852
+ /**
7853
+ * Get conversations for a resource
7854
+ */
7855
+ getConversations(resourceId: string): Promise<Conversation[]>;
7856
+ /**
7857
+ * Get conversations by user ID with query options
7858
+ */
7859
+ getConversationsByUserId(userId: string, options?: Omit<ConversationQueryOptions, "userId">): Promise<Conversation[]>;
7860
+ /**
7861
+ * Query conversations with advanced options
7862
+ */
7863
+ queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
7864
+ /**
7865
+ * Count conversations with the same filtering as queryConversations (ignores limit/offset)
7866
+ */
7867
+ countConversations(options: ConversationQueryOptions): Promise<number>;
7868
+ /**
7869
+ * Create a new conversation
7870
+ */
7871
+ createConversation(input: CreateConversationInput): Promise<Conversation>;
7872
+ /**
7873
+ * Update a conversation
7874
+ */
7875
+ updateConversation(id: string, updates: Partial<Omit<Conversation, "id" | "createdAt" | "updatedAt">>): Promise<Conversation>;
7876
+ /**
7877
+ * Delete a conversation
7878
+ */
7879
+ deleteConversation(id: string): Promise<void>;
7880
+ /**
7881
+ * Get messages with semantic search
7882
+ * Combines recent messages with semantically similar messages
7883
+ */
7884
+ getMessagesWithSemanticSearch(userId: string, conversationId: string, currentQuery?: string, options?: {
7885
+ limit?: number;
7886
+ semanticLimit?: number;
7887
+ semanticThreshold?: number;
7888
+ mergeStrategy?: "prepend" | "append" | "interleave";
7889
+ }): Promise<UIMessage<{
7890
+ createdAt: Date;
7891
+ }>[]>;
7892
+ /**
7893
+ * Get messages by their IDs
7894
+ */
7895
+ private getMessagesByIds;
7896
+ /**
7897
+ * Merge two arrays of messages, removing duplicates
7898
+ */
7899
+ private mergeMessages;
7900
+ /**
7901
+ * Check if vector support is configured
7902
+ */
7903
+ hasVectorSupport(): boolean;
7904
+ /**
7905
+ * Search for similar content
7906
+ */
7907
+ searchSimilar(query: string, options?: SearchOptions): Promise<SearchResult[]>;
7908
+ /**
7909
+ * Add a document for RAG
7910
+ */
7911
+ addDocument(document: Document): Promise<void>;
7912
+ /**
7913
+ * Remove a document
7914
+ */
7915
+ removeDocument(id: string): Promise<void>;
7916
+ /**
7917
+ * Get embedding with caching
7918
+ */
7919
+ private getEmbedding;
7920
+ /**
7921
+ * Embed and store a message
7922
+ */
7923
+ private embedAndStoreMessage;
7924
+ /**
7925
+ * Embed and store multiple messages
7926
+ */
7927
+ private embedAndStoreMessages;
7928
+ /**
7929
+ * Get working memory for a conversation or user
7930
+ */
7931
+ getWorkingMemory(params: {
7932
+ conversationId?: string;
7933
+ userId?: string;
7934
+ }): Promise<string | null>;
7935
+ /**
7936
+ * Update working memory (simplified)
7937
+ */
7938
+ updateWorkingMemory(params: {
7939
+ conversationId?: string;
7940
+ userId?: string;
7941
+ content: string | Record<string, unknown>;
7942
+ options?: WorkingMemoryUpdateOptions;
7943
+ }): Promise<void>;
7944
+ /**
7945
+ * Process content to string format
7946
+ */
7947
+ private processContent;
7948
+ /**
7949
+ * Simple deep merge for JSON objects
7950
+ */
7951
+ private simpleDeepMerge;
7952
+ /**
7953
+ * Clear working memory
7954
+ */
7955
+ clearWorkingMemory(params: {
7956
+ conversationId?: string;
7957
+ userId?: string;
7958
+ }): Promise<void>;
7959
+ /**
7960
+ * Get working memory template
7961
+ */
7962
+ getWorkingMemoryTemplate(): string | null;
7963
+ /**
7964
+ * Get working memory schema
7965
+ */
7966
+ getWorkingMemorySchema(): z.ZodObject<any> | null;
7967
+ /**
7968
+ * Get working memory format
7969
+ */
7970
+ getWorkingMemoryFormat(): "markdown" | "json" | null;
7971
+ /**
7972
+ * Check if working memory is supported
7973
+ */
7974
+ hasWorkingMemorySupport(): boolean;
7975
+ /**
7976
+ * Generate system instructions for working memory usage
7977
+ */
7978
+ getWorkingMemoryInstructions(params: {
7979
+ conversationId?: string;
7980
+ userId?: string;
7981
+ }): Promise<string | null>;
7982
+ /**
7983
+ * Get configured adapters info
7984
+ */
7985
+ getAdaptersInfo(): {
7986
+ storage: boolean;
7987
+ embedding: {
7988
+ configured: boolean;
7989
+ model?: string;
7990
+ dimensions?: number;
7991
+ };
7992
+ vector: boolean;
7993
+ cache: boolean;
7994
+ };
7995
+ /**
7996
+ * Save a message to memory
7997
+ * Simple version without event publishing (handled by MemoryManagerV2)
7998
+ */
7999
+ saveMessageWithContext(message: UIMessage, userId: string, conversationId: string, context?: {
8000
+ logger?: Logger;
8001
+ }, operationContext?: OperationContext): Promise<void>;
8002
+ /**
8003
+ * Get messages with semantic search support
8004
+ * Simple version without event publishing (handled by MemoryManagerV2)
8005
+ */
8006
+ getMessagesWithContext(userId: string, conversationId: string, options?: {
8007
+ limit?: number;
8008
+ useSemanticSearch?: boolean;
8009
+ currentQuery?: string;
8010
+ traceId?: string;
8011
+ logger?: Logger;
8012
+ semanticLimit?: number;
8013
+ semanticThreshold?: number;
8014
+ mergeStrategy?: "prepend" | "append" | "interleave";
8015
+ }, operationContext?: OperationContext): Promise<UIMessage<{
8016
+ createdAt: Date;
8017
+ }>[]>;
8018
+ /**
8019
+ * Internal: Set resource ID (agent ID)
8020
+ */
8021
+ _setResourceId(id: string): void;
8022
+ /**
8023
+ * Internal: Set logger
8024
+ */
8025
+ _setLogger(logger: Logger): void;
8026
+ /**
8027
+ * Get vector adapter if configured
8028
+ */
8029
+ getVectorAdapter(): VectorAdapter | undefined;
8030
+ /**
8031
+ * Get embedding adapter if configured
7600
8032
  */
7601
- content: string;
8033
+ getEmbeddingAdapter(): EmbeddingAdapter | undefined;
7602
8034
  /**
7603
- * Tool calls made by the model (if any)
8035
+ * Get metadata about the configured storage adapter
7604
8036
  */
7605
- toolCalls?: ToolCall$1[];
8037
+ getStorageMetadata(): MemoryStorageMetadata;
7606
8038
  /**
7607
- * Additional metadata
8039
+ * Get conversation title generation configuration
7608
8040
  */
7609
- metadata: {
7610
- agentId: string;
7611
- agentName: string;
7612
- [key: string]: unknown;
7613
- };
7614
- };
7615
- /**
7616
- * Context for a specific agent operation (e.g., one generateText call)
7617
- */
7618
- type OperationContext = {
7619
- /** Unique identifier for the operation */
7620
- readonly operationId: string;
7621
- /** Optional user identifier associated with this operation */
7622
- userId?: string;
7623
- /** Optional conversation identifier associated with this operation */
7624
- conversationId?: string;
7625
- /** User-managed context map for this operation */
7626
- readonly context: Map<string | symbol, unknown>;
7627
- /** System-managed context map for internal operation tracking */
7628
- readonly systemContext: Map<string | symbol, unknown>;
7629
- /** Whether this operation is still active */
7630
- isActive: boolean;
7631
- /** Parent agent ID if part of a delegation chain */
7632
- parentAgentId?: string;
7633
- /** Optional elicitation bridge for requesting user input */
7634
- elicitation?: (request: unknown) => Promise<unknown>;
7635
- /** Trace context for managing span hierarchy and common attributes */
7636
- traceContext: AgentTraceContext;
7637
- /** Execution-scoped logger with full context (userId, conversationId, executionId) */
7638
- logger: Logger;
7639
- /** Conversation steps for building full message history including tool calls/results */
7640
- conversationSteps?: StepWithContent[];
7641
- /** AbortController for cancelling the operation and accessing the signal */
7642
- abortController: AbortController;
7643
- /** Start time of the operation (Date object) */
7644
- startTime: Date;
7645
- /** Cancellation error to be thrown when operation is aborted */
7646
- cancellationError?: CancellationError;
7647
- /** Input provided to the agent operation (string, UIMessages, or BaseMessages) */
7648
- input?: string | UIMessage[] | BaseMessage[];
7649
- /** Output generated by the agent operation (text or object) */
7650
- output?: string | object;
7651
- };
7652
- /**
7653
- * Specific information related to a tool execution error.
7654
- */
7655
- interface ToolErrorInfo {
7656
- /** The unique identifier of the tool call. */
7657
- toolCallId: string;
7658
- /** The name of the tool that was executed. */
7659
- toolName: string;
7660
- /** The original error thrown directly by the tool during execution (if available). */
7661
- toolExecutionError?: unknown;
7662
- /** The arguments passed to the tool when the error occurred (for debugging). */
7663
- toolArguments?: unknown;
7664
- }
7665
- /**
7666
- * Type for onError callbacks in streaming operations.
7667
- * Providers must pass an error conforming to the VoltAgentError structure.
7668
- */
7669
- type StreamOnErrorCallback = (error: VoltAgentError) => Promise<void> | void;
7670
- type UserContext = Map<string | symbol, unknown>;
7671
- /**
7672
- * Standardized object structure passed to the onFinish callback
7673
- * when streamText completes successfully.
7674
- */
7675
- interface StreamTextFinishResult {
7676
- /** The final, consolidated text output from the stream. */
7677
- text: string;
7678
- /** Token usage information (if available). */
7679
- usage?: UsageInfo;
7680
- /** Feedback metadata for the trace, if enabled. */
7681
- feedback?: AgentFeedbackMetadata | null;
7682
- /** The reason the stream finished (if available, e.g., 'stop', 'length', 'tool-calls'). */
7683
- finishReason?: string;
7684
- /** The original completion response object from the provider (if available). */
7685
- providerResponse?: unknown;
7686
- /** Any warnings generated during the completion (if available). */
7687
- warnings?: unknown[];
7688
- /** User context containing any custom metadata from the operation. */
7689
- context?: UserContext;
7690
- }
7691
- /**
7692
- * Type for the onFinish callback function for streamText.
7693
- */
7694
- type StreamTextOnFinishCallback = (result: StreamTextFinishResult) => Promise<void> | void;
7695
- /**
7696
- * Standardized object structure passed to the onFinish callback
7697
- * when streamObject completes successfully.
7698
- * @template TObject The expected type of the fully formed object.
7699
- */
7700
- interface StreamObjectFinishResult<TObject> {
7701
- /** The final, fully formed object from the stream. */
7702
- object: TObject;
7703
- /** Token usage information (if available). */
7704
- usage?: UsageInfo;
7705
- /** The original completion response object from the provider (if available). */
7706
- providerResponse?: unknown;
7707
- /** Any warnings generated during the completion (if available). */
7708
- warnings?: unknown[];
7709
- /** The reason the stream finished (if available). Although less common for object streams. */
7710
- finishReason?: string;
7711
- /** User context containing any custom metadata from the operation. */
7712
- context?: UserContext;
7713
- }
7714
- /**
7715
- * Type for the onFinish callback function for streamObject.
7716
- * @template TObject The expected type of the fully formed object.
7717
- */
7718
- type StreamObjectOnFinishCallback<TObject> = (result: StreamObjectFinishResult<TObject>) => Promise<void> | void;
7719
- /**
7720
- * Standardized success result structure for generateText.
7721
- */
7722
- interface StandardizedTextResult {
7723
- /** The generated text. */
7724
- text: string;
7725
- /** Token usage information (if available). */
7726
- usage?: UsageInfo;
7727
- /** Feedback metadata for the trace, if enabled. */
7728
- feedback?: AgentFeedbackMetadata | null;
7729
- /** Original provider response (if needed). */
7730
- providerResponse?: unknown;
7731
- /** Finish reason (if available from provider). */
7732
- finishReason?: string;
7733
- /** Warnings (if available from provider). */
7734
- warnings?: unknown[];
7735
- /** User context containing any custom metadata from the operation. */
7736
- context?: UserContext;
7737
- }
7738
- /**
7739
- * Standardized success result structure for generateObject.
7740
- * @template TObject The expected type of the generated object.
7741
- */
7742
- interface StandardizedObjectResult<TObject> {
7743
- /** The generated object. */
7744
- object: TObject;
7745
- /** Token usage information (if available). */
7746
- usage?: UsageInfo;
7747
- /** Original provider response (if needed). */
7748
- providerResponse?: unknown;
7749
- /** Finish reason (if available from provider). */
7750
- finishReason?: string;
7751
- /** Warnings (if available from provider). */
7752
- warnings?: unknown[];
7753
- /** User context containing any custom metadata from the operation. */
7754
- context?: UserContext;
8041
+ getTitleGenerationConfig(): MemoryConfig["generateTitle"] | undefined;
8042
+ /**
8043
+ * Get a UI-friendly summary of working memory configuration
8044
+ */
8045
+ getWorkingMemorySummary(): WorkingMemorySummary | null;
8046
+ /**
8047
+ * Get workflow state by execution ID
8048
+ */
8049
+ getWorkflowState(executionId: string): Promise<WorkflowStateEntry | null>;
8050
+ /**
8051
+ * Query workflow states with filters
8052
+ */
8053
+ queryWorkflowRuns(query: WorkflowRunQuery): Promise<WorkflowStateEntry[]>;
8054
+ /**
8055
+ * Set workflow state
8056
+ */
8057
+ setWorkflowState(executionId: string, state: WorkflowStateEntry): Promise<void>;
8058
+ /**
8059
+ * Update workflow state
8060
+ */
8061
+ updateWorkflowState(executionId: string, updates: Partial<WorkflowStateEntry>): Promise<void>;
8062
+ /**
8063
+ * Get suspended workflow states for a workflow
8064
+ */
8065
+ getSuspendedWorkflowStates(workflowId: string): Promise<WorkflowStateEntry[]>;
7755
8066
  }
7756
- /**
7757
- * Unified output type for the onEnd hook, representing the successful result
7758
- * of any core agent operation. Use 'type guarding' or check specific fields
7759
- * within the hook implementation to determine the concrete type.
7760
- * Object types are generalized to 'unknown' here for the union.
7761
- */
7762
- type AgentOperationOutput = StandardizedTextResult | StreamTextFinishResult | StandardizedObjectResult<unknown> | StreamObjectFinishResult<unknown>;
7763
8067
 
7764
8068
  /**
7765
8069
  * MemoryManager - Unified manager for Memory and OpenTelemetry observability
@@ -7791,10 +8095,14 @@ declare class MemoryManager {
7791
8095
  * Background queue for memory operations
7792
8096
  */
7793
8097
  private backgroundQueue;
8098
+ /**
8099
+ * Optional title generator for new conversations
8100
+ */
8101
+ private titleGenerator?;
7794
8102
  /**
7795
8103
  * Creates a new MemoryManager V2 with same signature as original
7796
8104
  */
7797
- constructor(resourceId: string, memory?: Memory | false, options?: MemoryOptions, logger?: Logger);
8105
+ constructor(resourceId: string, memory?: Memory | false, options?: MemoryOptions, logger?: Logger, titleGenerator?: ConversationTitleGenerator);
7798
8106
  /**
7799
8107
  * Save a message to memory
7800
8108
  * PRESERVED FROM ORIGINAL WITH MEMORY V2 INTEGRATION
@@ -7851,6 +8159,10 @@ declare class MemoryManager {
7851
8159
  * Ensures conversation exists and then saves input without blocking.
7852
8160
  */
7853
8161
  queueSaveInput(context: OperationContext, input: string | UIMessage[], userId: string, conversationId: string): void;
8162
+ /**
8163
+ * Resolve conversation title using optional generator
8164
+ */
8165
+ private resolveConversationTitle;
7854
8166
  /**
7855
8167
  * Ensure conversation exists (background task)
7856
8168
  * PRESERVED FROM ORIGINAL
@@ -8022,6 +8334,10 @@ interface BaseGenerationOptions extends Partial<CallSettings> {
8022
8334
  */
8023
8335
  stopWhen?: StopWhen;
8024
8336
  tools?: (Tool<any, any> | Toolkit)[];
8337
+ /**
8338
+ * Optional per-call tool routing override.
8339
+ */
8340
+ toolRouting?: ToolRoutingConfig | false;
8025
8341
  hooks?: AgentHooks;
8026
8342
  inputGuardrails?: InputGuardrail[];
8027
8343
  outputGuardrails?: OutputGuardrail<any>[];
@@ -8080,6 +8396,7 @@ declare class Agent {
8080
8396
  private readonly summarization?;
8081
8397
  private defaultObservability?;
8082
8398
  private readonly toolManager;
8399
+ private readonly toolPoolManager;
8083
8400
  private readonly subAgentManager;
8084
8401
  private readonly voltOpsClient?;
8085
8402
  private readonly prompts?;
@@ -8091,6 +8408,10 @@ declare class Agent {
8091
8408
  private readonly outputMiddlewares;
8092
8409
  private readonly maxMiddlewareRetries;
8093
8410
  private readonly observabilityAuthWarningState;
8411
+ private toolRouting?;
8412
+ private toolRoutingConfigured;
8413
+ private toolRoutingExposedNames;
8414
+ private toolRoutingPoolExplicit;
8094
8415
  constructor(options: AgentOptions);
8095
8416
  /**
8096
8417
  * Generate text response
@@ -8168,6 +8489,7 @@ declare class Agent {
8168
8489
  * Extract user query from input for semantic search
8169
8490
  */
8170
8491
  private extractUserQuery;
8492
+ private createConversationTitleGenerator;
8171
8493
  /**
8172
8494
  * Prepare messages with system prompt and memory
8173
8495
  */
@@ -8218,6 +8540,20 @@ declare class Agent {
8218
8540
  */
8219
8541
  private validateToolOutput;
8220
8542
  private createToolExecutionFactory;
8543
+ /**
8544
+ * Internal: execute a tool router with access to the agent runtime.
8545
+ */
8546
+ __executeToolRouter(params: {
8547
+ router: ToolRouter;
8548
+ input: ToolRouterInput;
8549
+ options?: ToolExecuteOptions;
8550
+ }): Promise<ToolRouterResult>;
8551
+ private buildToolRouterCandidates;
8552
+ private resolveRoutedToolArgs;
8553
+ private resolveProviderToolArgs;
8554
+ private executeProviderToolViaRouter;
8555
+ private ensureToolApproval;
8556
+ private runInternalGenerateText;
8221
8557
  /**
8222
8558
  * Create step handler for memory and hooks
8223
8559
  */
@@ -8317,6 +8653,14 @@ declare class Agent {
8317
8653
  * Internal: apply a default Memory instance when none was configured explicitly.
8318
8654
  */
8319
8655
  __setDefaultMemory(memory: Memory): void;
8656
+ /**
8657
+ * Internal: apply a default tool routing config when none was configured explicitly.
8658
+ */
8659
+ __setDefaultToolRouting(toolRouting?: ToolRoutingConfig): void;
8660
+ private applyToolRoutingConfig;
8661
+ private resolveToolRoutingRouters;
8662
+ private resolveToolRouting;
8663
+ private getToolRoutingExposedNames;
8320
8664
  /**
8321
8665
  * Convert this agent into a tool that can be used by other agents.
8322
8666
  * This enables supervisor/coordinator patterns where one agent can delegate
@@ -8388,6 +8732,8 @@ type WorkflowState<INPUT, RESULT> = {
8388
8732
  input: InternalExtractWorkflowInputData<INPUT>;
8389
8733
  /** current data being processed */
8390
8734
  data: DangerouslyAllowAny;
8735
+ /** shared workflow state across steps */
8736
+ workflowState: WorkflowStateStore;
8391
8737
  /** the result of workflow execution, null until execution is complete */
8392
8738
  result: RESULT | null;
8393
8739
  error: Error | null;
@@ -8416,6 +8762,8 @@ interface WorkflowSuspensionMetadata<SUSPEND_DATA = DangerouslyAllowAny> {
8416
8762
  stepExecutionState?: DangerouslyAllowAny;
8417
8763
  /** Results from completed steps that need to be preserved */
8418
8764
  completedStepsData?: DangerouslyAllowAny[];
8765
+ /** Shared workflow state snapshot */
8766
+ workflowState?: WorkflowStateStore;
8419
8767
  };
8420
8768
  }
8421
8769
  interface WorkflowCancellationMetadata {
@@ -8570,6 +8918,8 @@ interface WorkflowRetryConfig {
8570
8918
  */
8571
8919
  delayMs?: number;
8572
8920
  }
8921
+ type WorkflowStateStore = Record<string, unknown>;
8922
+ type WorkflowStateUpdater = WorkflowStateStore | ((previous: WorkflowStateStore) => WorkflowStateStore);
8573
8923
  interface WorkflowRunOptions {
8574
8924
  /**
8575
8925
  * The active step, this can be used to track the current step in a workflow
@@ -8593,6 +8943,10 @@ interface WorkflowRunOptions {
8593
8943
  * The user context, this can be used to track the current user context in a workflow
8594
8944
  */
8595
8945
  context?: UserContext;
8946
+ /**
8947
+ * Shared workflow state available to all steps
8948
+ */
8949
+ workflowState?: WorkflowStateStore;
8596
8950
  /**
8597
8951
  * Override Memory V2 for this specific execution
8598
8952
  * Takes priority over workflow config memory and global memory
@@ -8646,6 +9000,7 @@ interface WorkflowResumeOptions {
8646
9000
  checkpoint?: {
8647
9001
  stepExecutionState?: DangerouslyAllowAny;
8648
9002
  completedStepsData?: DangerouslyAllowAny[];
9003
+ workflowState?: WorkflowStateStore;
8649
9004
  };
8650
9005
  /**
8651
9006
  * The step index to resume from
@@ -8951,11 +9306,12 @@ interface WorkflowStats {
8951
9306
  /**
8952
9307
  * Event emitted during workflow streaming
8953
9308
  */
9309
+ type WorkflowStreamEventType = "workflow-start" | "workflow-suspended" | "workflow-complete" | "workflow-cancelled" | "workflow-error" | "step-start" | "step-complete" | (string & {});
8954
9310
  interface WorkflowStreamEvent {
8955
9311
  /**
8956
9312
  * Type of the event (e.g., "step-start", "step-complete", "custom", "agent-stream")
8957
9313
  */
8958
- type: "workflow-start" | "workflow-suspended" | "workflow-complete" | "workflow-cancelled" | "workflow-error" | "step-start" | "step-complete";
9314
+ type: WorkflowStreamEventType;
8959
9315
  /**
8960
9316
  * Unique execution ID for this workflow run
8961
9317
  */
@@ -9008,8 +9364,8 @@ interface WorkflowStreamWriter {
9008
9364
  /**
9009
9365
  * Write a custom event to the stream
9010
9366
  */
9011
- write(event: Partial<WorkflowStreamEvent> & {
9012
- type: string;
9367
+ write(event: Omit<Partial<WorkflowStreamEvent>, "type"> & {
9368
+ type: WorkflowStreamEventType;
9013
9369
  }): void;
9014
9370
  /**
9015
9371
  * Pipe events from an agent's fullStream to the workflow stream
@@ -9177,6 +9533,10 @@ interface WorkflowExecutionContext {
9177
9533
  * User-defined context passed around during execution
9178
9534
  */
9179
9535
  context: Map<string | symbol, unknown>;
9536
+ /**
9537
+ * Shared workflow state available to all steps
9538
+ */
9539
+ workflowState: WorkflowStateStore;
9180
9540
  /**
9181
9541
  * Whether the workflow is still actively running
9182
9542
  */
@@ -9278,6 +9638,8 @@ interface WorkflowExecuteContext<INPUT, DATA, SUSPEND_DATA, RESUME_DATA> {
9278
9638
  suspend: (reason?: string, suspendData?: SUSPEND_DATA) => Promise<never>;
9279
9639
  resumeData?: RESUME_DATA;
9280
9640
  retryCount?: number;
9641
+ workflowState: WorkflowStateStore;
9642
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
9281
9643
  /**
9282
9644
  * Logger instance for this workflow execution.
9283
9645
  * Provides execution-scoped logging with full context (userId, conversationId, executionId).
@@ -9495,14 +9857,20 @@ interface WorkflowStepSleepUntil<INPUT, DATA> extends InternalBaseWorkflowStep<I
9495
9857
  type: "sleep-until";
9496
9858
  date: Date | InternalWorkflowFunc<INPUT, DATA, Date, any, any>;
9497
9859
  }
9498
- type WorkflowStepForEachConfig<INPUT, ITEM, RESULT> = InternalWorkflowStepConfig<{
9499
- step: InternalAnyWorkflowStep<INPUT, ITEM, RESULT>;
9860
+ type WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM> = InternalWorkflowFunc<INPUT, DATA, ITEM[], any, any>;
9861
+ type WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA> = (context: WorkflowExecuteContext<INPUT, DATA, any, any>, item: ITEM, index: number) => Promise<MAP_DATA> | MAP_DATA;
9862
+ type WorkflowStepForEachConfig<INPUT, DATA, ITEM, RESULT, MAP_DATA = ITEM> = InternalWorkflowStepConfig<{
9863
+ step: InternalAnyWorkflowStep<INPUT, MAP_DATA, RESULT>;
9500
9864
  concurrency?: number;
9865
+ items?: WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM>;
9866
+ map?: WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA>;
9501
9867
  }>;
9502
- interface WorkflowStepForEach<INPUT, ITEM, RESULT> extends InternalBaseWorkflowStep<INPUT, ITEM[], RESULT[], any, any> {
9868
+ interface WorkflowStepForEach<INPUT, DATA, ITEM, RESULT, MAP_DATA = ITEM> extends InternalBaseWorkflowStep<INPUT, DATA, RESULT[], any, any> {
9503
9869
  type: "foreach";
9504
- step: InternalAnyWorkflowStep<INPUT, ITEM, RESULT>;
9870
+ step: InternalAnyWorkflowStep<INPUT, MAP_DATA, RESULT>;
9505
9871
  concurrency?: number;
9872
+ items?: WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM>;
9873
+ map?: WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA>;
9506
9874
  }
9507
9875
  type WorkflowStepLoopConfig<INPUT, DATA, RESULT> = InternalWorkflowStepConfig<{
9508
9876
  step: InternalAnyWorkflowStep<INPUT, DATA, RESULT>;
@@ -9569,7 +9937,7 @@ interface WorkflowStepMap<INPUT, DATA, MAP extends Record<string, WorkflowStepMa
9569
9937
  }
9570
9938
  type WorkflowStepParallelDynamicStepsFunc<INPUT, DATA, RESULT> = (context: WorkflowExecuteContext<INPUT, DATA, any, any>) => Promise<WorkflowStepParallelSteps<INPUT, DATA, RESULT>>;
9571
9939
  type WorkflowStepParallelSteps<INPUT, DATA, RESULT> = ReadonlyArray<InternalAnyWorkflowStep<INPUT, DATA, RESULT>>;
9572
- type WorkflowStep<INPUT, DATA, RESULT, SUSPEND_DATA = any> = WorkflowStepAgent<INPUT, DATA, RESULT> | WorkflowStepFunc<INPUT, DATA, RESULT, SUSPEND_DATA> | WorkflowStepConditionalWhen<INPUT, DATA, RESULT> | WorkflowStepGuardrail<INPUT, DATA> | WorkflowStepParallelAll<INPUT, DATA, RESULT> | WorkflowStepTap<INPUT, DATA, RESULT, SUSPEND_DATA> | WorkflowStepParallelRace<INPUT, DATA, RESULT> | WorkflowStepWorkflow<INPUT, DATA, RESULT, SUSPEND_DATA> | WorkflowStepSleep<INPUT, DATA> | WorkflowStepSleepUntil<INPUT, DATA> | WorkflowStepForEach<INPUT, any, any> | WorkflowStepLoop<INPUT, DATA, RESULT> | WorkflowStepBranch<INPUT, DATA, RESULT> | WorkflowStepMap<INPUT, DATA, Record<string, WorkflowStepMapEntry<INPUT, DATA>>>;
9940
+ type WorkflowStep<INPUT, DATA, RESULT, SUSPEND_DATA = any> = WorkflowStepAgent<INPUT, DATA, RESULT> | WorkflowStepFunc<INPUT, DATA, RESULT, SUSPEND_DATA> | WorkflowStepConditionalWhen<INPUT, DATA, RESULT> | WorkflowStepGuardrail<INPUT, DATA> | WorkflowStepParallelAll<INPUT, DATA, RESULT> | WorkflowStepTap<INPUT, DATA, RESULT, SUSPEND_DATA> | WorkflowStepParallelRace<INPUT, DATA, RESULT> | WorkflowStepWorkflow<INPUT, DATA, RESULT, SUSPEND_DATA> | WorkflowStepSleep<INPUT, DATA> | WorkflowStepSleepUntil<INPUT, DATA> | WorkflowStepForEach<INPUT, any, any, any> | WorkflowStepLoop<INPUT, DATA, RESULT> | WorkflowStepBranch<INPUT, DATA, RESULT> | WorkflowStepMap<INPUT, DATA, Record<string, WorkflowStepMapEntry<INPUT, DATA>>>;
9573
9941
  /**
9574
9942
  * Internal type to allow overriding the run method for the workflow
9575
9943
  */
@@ -9848,12 +10216,15 @@ declare function andSleepUntil<INPUT, DATA>({ date, ...config }: WorkflowStepSle
9848
10216
 
9849
10217
  /**
9850
10218
  * Creates a foreach step that runs a step for each item in an array.
10219
+ * Use items to select the array and map to shape each item before execution.
9851
10220
  */
9852
- declare function andForEach<INPUT, ITEM, RESULT>({ step, concurrency, ...config }: WorkflowStepForEachConfig<INPUT, ITEM, RESULT>): {
10221
+ declare function andForEach<INPUT, DATA, ITEM, RESULT, MAP_DATA = ITEM>({ step, concurrency, items, map, ...config }: WorkflowStepForEachConfig<INPUT, DATA, ITEM, RESULT, MAP_DATA>): {
9853
10222
  type: "foreach";
9854
- step: InternalAnyWorkflowStep<INPUT, ITEM, RESULT>;
10223
+ step: InternalAnyWorkflowStep<INPUT, MAP_DATA, RESULT>;
9855
10224
  concurrency: number;
9856
- execute: (context: WorkflowExecuteContext<INPUT, ITEM[], any, any>) => Promise<RESULT[]>;
10225
+ items: WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM> | undefined;
10226
+ map: WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA> | undefined;
10227
+ execute: (context: WorkflowExecuteContext<INPUT, DATA, any, any>) => Promise<RESULT[]>;
9857
10228
  id: string;
9858
10229
  name: string;
9859
10230
  purpose: string;
@@ -10149,6 +10520,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10149
10520
  execute: (context: {
10150
10521
  data: z.infer<IS>;
10151
10522
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10523
+ workflowState: WorkflowStateStore;
10524
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10152
10525
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10153
10526
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10154
10527
  resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
@@ -10174,6 +10547,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10174
10547
  execute: (context: {
10175
10548
  data: z.infer<IS>;
10176
10549
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10550
+ workflowState: WorkflowStateStore;
10551
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10177
10552
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10178
10553
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10179
10554
  resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
@@ -10199,6 +10574,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10199
10574
  execute: (context: {
10200
10575
  data: CURRENT_DATA;
10201
10576
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10577
+ workflowState: WorkflowStateStore;
10578
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10202
10579
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10203
10580
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10204
10581
  resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
@@ -10224,6 +10601,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10224
10601
  execute: (context: {
10225
10602
  data: CURRENT_DATA;
10226
10603
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10604
+ workflowState: WorkflowStateStore;
10605
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10227
10606
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10228
10607
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10229
10608
  resumeData?: z.infer<RS>;
@@ -10265,6 +10644,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10265
10644
  execute: (context: {
10266
10645
  data: CURRENT_DATA;
10267
10646
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10647
+ workflowState: WorkflowStateStore;
10648
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10268
10649
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10269
10650
  suspend: (reason?: string, suspendData?: z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10270
10651
  resumeData?: z.infer<RESUME_SCHEMA>;
@@ -10294,6 +10675,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10294
10675
  condition: (context: {
10295
10676
  data: z.infer<IS>;
10296
10677
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10678
+ workflowState: WorkflowStateStore;
10679
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10297
10680
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10298
10681
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10299
10682
  resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
@@ -10352,6 +10735,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10352
10735
  execute: (context: {
10353
10736
  data: z.infer<IS>;
10354
10737
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10738
+ workflowState: WorkflowStateStore;
10739
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10355
10740
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10356
10741
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10357
10742
  resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
@@ -10392,6 +10777,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10392
10777
  execute: (context: {
10393
10778
  data: CURRENT_DATA;
10394
10779
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10780
+ workflowState: WorkflowStateStore;
10781
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10395
10782
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10396
10783
  suspend: (reason?: string, suspendData?: z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10397
10784
  resumeData?: z.infer<RESUME_SCHEMA>;
@@ -10426,7 +10813,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10426
10813
  /**
10427
10814
  * Add a foreach step that runs a step for each item in an array
10428
10815
  */
10429
- andForEach<ITEM, NEW_DATA>(config: WorkflowStepForEachConfig<WorkflowInput<INPUT_SCHEMA>, ITEM, NEW_DATA>): WorkflowChain<INPUT_SCHEMA, RESULT_SCHEMA, NEW_DATA[], SUSPEND_SCHEMA, RESUME_SCHEMA>;
10816
+ andForEach<ITEM, NEW_DATA, MAP_DATA = ITEM>(config: WorkflowStepForEachConfig<WorkflowInput<INPUT_SCHEMA>, CURRENT_DATA, ITEM, NEW_DATA, MAP_DATA>): WorkflowChain<INPUT_SCHEMA, RESULT_SCHEMA, NEW_DATA[], SUSPEND_SCHEMA, RESUME_SCHEMA>;
10430
10817
  /**
10431
10818
  * Add a do-while loop step
10432
10819
  */
@@ -10885,6 +11272,7 @@ type PlanAgentOptions = Omit<AgentOptions, "instructions" | "tools" | "toolkits"
10885
11272
  systemPrompt?: InstructionsDynamicValue;
10886
11273
  tools?: (Tool<any, any> | Toolkit | Tool$1)[];
10887
11274
  toolkits?: Toolkit[];
11275
+ toolRouting?: ToolRoutingConfig | false;
10888
11276
  subagents?: PlanAgentSubagentDefinition[];
10889
11277
  generalPurposeAgent?: boolean;
10890
11278
  planning?: PlanningToolkitOptions | false;
@@ -12678,6 +13066,10 @@ type VoltAgentOptions = {
12678
13066
  * Falls back to `memory` when not provided.
12679
13067
  */
12680
13068
  workflowMemory?: Memory;
13069
+ /**
13070
+ * Global tool routing defaults (applied to agents without explicit toolRouting config).
13071
+ */
13072
+ toolRouting?: ToolRoutingConfig;
12681
13073
  /** Optional VoltOps trigger handlers */
12682
13074
  triggers?: VoltAgentTriggersConfig;
12683
13075
  /**
@@ -13431,6 +13823,10 @@ declare class InMemoryStorageAdapter implements StorageAdapter {
13431
13823
  }>[]>;
13432
13824
  saveConversationSteps(steps: ConversationStepRecord[]): Promise<void>;
13433
13825
  getConversationSteps(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
13826
+ /**
13827
+ * Delete specific messages by ID for a conversation
13828
+ */
13829
+ deleteMessages(messageIds: string[], userId: string, conversationId: string, _context?: OperationContext): Promise<void>;
13434
13830
  /**
13435
13831
  * Clear messages for a user
13436
13832
  */
@@ -13455,6 +13851,10 @@ declare class InMemoryStorageAdapter implements StorageAdapter {
13455
13851
  * Query conversations with advanced options
13456
13852
  */
13457
13853
  queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
13854
+ /**
13855
+ * Count conversations matching query filters
13856
+ */
13857
+ countConversations(options: ConversationQueryOptions): Promise<number>;
13458
13858
  /**
13459
13859
  * Update a conversation
13460
13860
  */
@@ -13535,22 +13935,22 @@ declare class InMemoryStorageAdapter implements StorageAdapter {
13535
13935
  * Lightweight in-memory vector database adapter
13536
13936
  * Suitable for development, testing, and small datasets (< 10k vectors)
13537
13937
  */
13538
- declare class InMemoryVectorAdapter implements VectorAdapter {
13938
+ declare class InMemoryVectorAdapter implements VectorAdapter$1 {
13539
13939
  private vectors;
13540
13940
  private dimensions;
13541
13941
  constructor();
13542
13942
  store(id: string, vector: number[], metadata?: Record<string, unknown>): Promise<void>;
13543
- storeBatch(items: VectorItem[]): Promise<void>;
13943
+ storeBatch(items: VectorItem$1[]): Promise<void>;
13544
13944
  search(queryVector: number[], options?: {
13545
13945
  limit?: number;
13546
13946
  filter?: Record<string, unknown>;
13547
13947
  threshold?: number;
13548
- }): Promise<SearchResult[]>;
13948
+ }): Promise<SearchResult$1[]>;
13549
13949
  delete(id: string): Promise<void>;
13550
13950
  deleteBatch(ids: string[]): Promise<void>;
13551
13951
  clear(): Promise<void>;
13552
13952
  count(): Promise<number>;
13553
- get(id: string): Promise<VectorItem | null>;
13953
+ get(id: string): Promise<VectorItem$1 | null>;
13554
13954
  /**
13555
13955
  * Check if metadata matches the filter criteria
13556
13956
  */
@@ -13565,56 +13965,18 @@ declare class InMemoryVectorAdapter implements VectorAdapter {
13565
13965
  }>;
13566
13966
  }
13567
13967
 
13568
- /**
13569
- * Embedding adapter interface for converting text to vectors
13570
- */
13571
- interface EmbeddingAdapter {
13572
- /**
13573
- * Embed a single text string into a vector
13574
- */
13575
- embed(text: string): Promise<number[]>;
13576
- /**
13577
- * Embed multiple texts in a batch for efficiency
13578
- */
13579
- embedBatch(texts: string[]): Promise<number[][]>;
13580
- /**
13581
- * Get the dimensionality of the embeddings
13582
- * Returns undefined if dimensions are not yet known
13583
- */
13584
- getDimensions(): number | undefined;
13585
- /**
13586
- * Get the model name for debugging/logging
13587
- */
13588
- getModelName(): string;
13589
- }
13590
- /**
13591
- * Options for embedding adapter initialization
13592
- */
13593
- interface EmbeddingOptions {
13594
- /**
13595
- * Maximum number of texts to process in a single batch
13596
- */
13597
- maxBatchSize?: number;
13598
- /**
13599
- * Timeout for embedding operations in milliseconds
13600
- */
13601
- timeout?: number;
13602
- /**
13603
- * Whether to normalize embeddings to unit vectors
13604
- */
13605
- normalize?: boolean;
13606
- }
13607
-
13608
13968
  /**
13609
13969
  * AI SDK Embedding Adapter
13610
13970
  * Wraps Vercel AI SDK embedding models for use with Memory V2
13611
13971
  */
13612
- declare class AiSdkEmbeddingAdapter implements EmbeddingAdapter {
13972
+ declare class AiSdkEmbeddingAdapter implements EmbeddingAdapter$1 {
13613
13973
  private model;
13614
13974
  private dimensions;
13615
13975
  private modelName;
13616
13976
  private options;
13617
- constructor(model: EmbeddingModel, options?: EmbeddingOptions);
13977
+ private modelResolvePromise?;
13978
+ constructor(model: EmbeddingModelReference, options?: EmbeddingOptions);
13979
+ private resolveModel;
13618
13980
  embed(text: string): Promise<number[]>;
13619
13981
  embedBatch(texts: string[]): Promise<number[][]>;
13620
13982
  getDimensions(): number;
@@ -13626,8 +13988,14 @@ declare class AiSdkEmbeddingAdapter implements EmbeddingAdapter {
13626
13988
  }
13627
13989
 
13628
13990
  type LanguageModelFactory = (modelId: string) => LanguageModel;
13991
+ type EmbeddingModelInstance = Exclude<EmbeddingModel, string>;
13992
+ type EmbeddingModelFactory = (modelId: string) => EmbeddingModelInstance;
13629
13993
  type ModelProvider = {
13630
13994
  languageModel: LanguageModelFactory;
13995
+ embeddingModel?: EmbeddingModelFactory;
13996
+ embedding?: EmbeddingModelFactory;
13997
+ textEmbeddingModel?: EmbeddingModelFactory;
13998
+ textEmbedding?: EmbeddingModelFactory;
13631
13999
  };
13632
14000
  type ModelProviderEntry = ModelProvider | LanguageModelFactory;
13633
14001
  type ModelProviderLoader = () => Promise<ModelProviderEntry>;
@@ -13636,8 +14004,9 @@ declare global {
13636
14004
  }
13637
14005
  declare class ModelProviderRegistry {
13638
14006
  private providers;
14007
+ private providerEntries;
13639
14008
  private loaders;
13640
- private loading;
14009
+ private entryLoading;
13641
14010
  private dynamicRegistry;
13642
14011
  private refreshInterval;
13643
14012
  private lastRefreshTime;
@@ -13661,7 +14030,9 @@ declare class ModelProviderRegistry {
13661
14030
  unregisterProvider(providerId: string): void;
13662
14031
  listProviders(): string[];
13663
14032
  resolveLanguageModel(modelId: string): Promise<LanguageModel>;
14033
+ resolveEmbeddingModel(modelId: string): Promise<EmbeddingModelInstance>;
13664
14034
  private getProvider;
14035
+ private getProviderEntry;
13665
14036
  private normalizeProvider;
13666
14037
  }
13667
14038
 
@@ -14252,6 +14623,7 @@ declare class AgentRegistry {
14252
14623
  private globalMemory?;
14253
14624
  private globalAgentMemory?;
14254
14625
  private globalWorkflowMemory?;
14626
+ private globalToolRouting?;
14255
14627
  /**
14256
14628
  * Track parent-child relationships between agents (child -> parents)
14257
14629
  */
@@ -14362,6 +14734,14 @@ declare class AgentRegistry {
14362
14734
  * Get the global default Memory instance for workflows.
14363
14735
  */
14364
14736
  getGlobalWorkflowMemory(): Memory | undefined;
14737
+ /**
14738
+ * Set the global default tool routing configuration.
14739
+ */
14740
+ setGlobalToolRouting(toolRouting: ToolRoutingConfig | undefined): void;
14741
+ /**
14742
+ * Get the global default tool routing configuration.
14743
+ */
14744
+ getGlobalToolRouting(): ToolRoutingConfig | undefined;
14365
14745
  }
14366
14746
 
14367
14747
  type UpdateOptions = {
@@ -14533,4 +14913,4 @@ declare class VoltAgent {
14533
14913
  */
14534
14914
  declare function convertUsage(usage: LanguageModelUsage | undefined): UsageInfo | undefined;
14535
14915
 
14536
- export { A2AServerRegistry, AbortError, Agent, type AgentEvalConfig, type AgentEvalContext, type AgentEvalFeedbackHelper, type AgentEvalFeedbackSaveInput, type AgentEvalOperationType, type AgentEvalPayload, type AgentEvalResult, type AgentEvalResultCallbackArgs, type AgentEvalSamplingPolicy, type AgentEvalScorerConfig, type AgentEvalScorerFactory, type AgentEvalScorerReference, type AgentFeedbackMetadata, type AgentFeedbackOptions, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnFallback, type AgentHookOnHandoff, type AgentHookOnHandoffComplete, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnRetry, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentModelConfig, type AgentModelReference, type AgentModelValue, type AgentOptions, AgentRegistry, type AgentResponse, type AgentScorerState, type AgentStatus, type AgentSummarizationOptions, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type BuildScorerOptions, type BuildScorerRunArgs, type BuildScorerRunResult, type BuilderAnalyzeContext, type BuilderPrepareContext, type BuilderReasonContext, type BuilderScoreContext, type CachedPrompt, type ChatMessage, ClientHTTPError, type ClientSideToolResult, type CloudflareFetchHandler, CompositeFilesystemBackend, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type ConversationStepRecord, type ConversationStepType, ConversationTodoBackend, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateInputGuardrailOptions, type CreateInputMiddlewareOptions, type CreateOutputGuardrailOptions, type CreateOutputMiddlewareOptions, type CreateReasoningToolsOptions, type CreateScorerOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, EDIT_FILE_TOOL_DESCRIPTION, type EditResult, type EmbeddingAdapter$1 as EmbeddingAdapter, EmbeddingAdapterNotConfiguredError, EmbeddingError, type ExtractVariableNames, FEW_SHOT_EXAMPLES, FILESYSTEM_SYSTEM_PROMPT, type FallbackStage, type FileData, type FileInfo, type FilesystemBackend, type FilesystemBackendContext, type FilesystemBackendFactory, type FilesystemToolkitOptions, GLOB_TOOL_DESCRIPTION, GREP_TOOL_DESCRIPTION, type GenerateObjectOptions, type GenerateObjectResultWithContext, type GenerateObjectSubAgentConfig, type GenerateReasonResult, type GenerateScoreResult, type GenerateScoreStep, type GenerateTextOptions, type GenerateTextResultWithContext, type GenerateTextSubAgentConfig, type GetConversationStepsOptions, type GetMessagesOptions, type GrepMatch, type GuardrailAction, type GuardrailContext, type GuardrailDefinition, type GuardrailFunction, type GuardrailSeverity, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryFilesystemBackend, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type InputGuardrail, type InputGuardrailArgs, type InputGuardrailResult, type InputMiddleware, type InputMiddlewareArgs, type InputMiddlewareResult, type KnowledgeBaseTagFilter, type LLMProvider, LS_TOOL_DESCRIPTION, type LanguageModelFactory, LazyRemoteExportProcessor, type LocalScorerDefinition, type LocalScorerExecutionResult, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, type MCPAuthorizationAction, type MCPAuthorizationConfig, type MCPAuthorizationContext, MCPAuthorizationError, type MCPCanFunction, type MCPCanParams, type MCPCanResult, MCPClient, type MCPClientCallOptions, type MCPClientConfig, MCPConfiguration, type MCPConfigurationOptions, type MCPElicitationAdapter, type MCPElicitationHandler, type MCPLoggingAdapter, type MCPPromptsAdapter, type MCPResourcesAdapter, MCPServerRegistry, type ManagedMemoryAddMessageInput, type ManagedMemoryAddMessagesInput, type ManagedMemoryClearMessagesInput, type ManagedMemoryConnectionInfo, type ManagedMemoryConversationsClient, type ManagedMemoryCredentialCreateResult, type ManagedMemoryCredentialListResult, type ManagedMemoryCredentialSummary, type ManagedMemoryDatabaseSummary, type ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, type ManagedMemoryQueryWorkflowRunsInput, type ManagedMemorySetWorkingMemoryInput, type ManagedMemoryStatus, type ManagedMemoryUpdateConversationInput, type ManagedMemoryVoltOpsClient, type ManagedMemoryWorkflowStateUpdateInput, type ManagedMemoryWorkflowStatesClient, type ManagedMemoryWorkingMemoryClient, type ManagedMemoryWorkingMemoryInput, Memory, type MemoryConfig, type MemoryOptions, type MemoryStorageMetadata, type MemoryUpdateMode, Memory as MemoryV2, MemoryV2Error, type MessageContent, MessageContentBuilder, type MessageRole, MiddlewareAbortError, type MiddlewareAbortOptions, type MiddlewareContext, type MiddlewareDefinition, type MiddlewareDirection, type MiddlewareFunction, type ModelForProvider, type ModelProvider, type ModelProviderEntry, type ModelProviderLoader, ModelProviderRegistry, type ModelRouterModelId, type ModelToolCall, NextAction, NodeFilesystemBackend, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnFallbackHookArgs, type OnHandoffCompleteHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnRetryHookArgs, type OnRetryHookArgsBase, type OnRetryLLMHookArgs, type OnRetryMiddlewareHookArgs, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolStartHookArgs, type OperationContext, type OutputGuardrail, type OutputGuardrailArgs, type OutputGuardrailResult, type OutputMiddleware, type OutputMiddlewareArgs, type OutputMiddlewareResult, type OutputSpec$1 as OutputSpec, type PackageUpdateInfo, PlanAgent, type PlanAgentExtension, type PlanAgentExtensionContext, type PlanAgentExtensionResult, type PlanAgentFileData, type PlanAgentOptions, type PlanAgentState, type PlanAgentSubagentDefinition, type PlanAgentTodoItem, type PlanAgentTodoStatus, type PlanningToolkitOptions, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderId, type ProviderModelsMap, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ProviderTool, READ_FILE_TOOL_DESCRIPTION, type RagKnowledgeBaseSummary, type RagSearchKnowledgeBaseChildChunk, type RagSearchKnowledgeBaseRequest, type RagSearchKnowledgeBaseResponse, type RagSearchKnowledgeBaseResult, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredTrigger, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type ResumableStreamAdapter, type ResumableStreamContext, type RetrieveOptions, type Retriever, type RetrieverOptions, type RetrySource, type RunLocalScorersArgs, type RunLocalScorersResult, SERVERLESS_ENV_CONTEXT_KEY, type SamplingMetadata, type SamplingPolicy, type ScorerBuilder, type ScorerContext, type ScorerLifecycleScope, type ScorerPipelineContext, type ScorerReasonContext, type ScorerResult, type SearchOptions, type SearchResult, type ServerAgentResponse, type ServerApiResponse, type ServerProviderDeps, type ServerProviderFactory, type ServerWorkflowResponse, type ServerlessProviderFactory, type ServerlessRemoteEndpointConfig, type ServerlessRemoteExportConfig, type ServerlessRequestHandler, ServerlessVoltAgentObservability, type SpanAttributes, type SpanEvent, type SpanFilterConfig, SpanFilterProcessor, SpanKind, type SpanLink, type SpanStatus, SpanStatusCode, type SpanTreeNode, type StepChunkCallback, type StepFinishCallback, type StepWithContent, type StopWhen, type StorageAdapter, StorageError, StorageLogProcessor, type StoredUIMessage, type StreamObjectFinishResult, type StreamObjectOnFinishCallback, type StreamObjectOptions, type StreamObjectResultWithContext, type StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextResultWithContext, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, TRIGGER_CONTEXT_KEY, type TaskToolOptions, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, type TodoBackend, type TodoBackendFactory, Tool, type ToolCall, type ToolContext, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, type ToolExecutionResult, ToolManager, type ToolOptions, type ToolResultOutput, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type TriggerHandler, type TriggerHandlerBody, type TriggerHandlerContext, type TriggerHandlerResponse, type TriggerHandlerResult, type TriggerHandlerReturn, type TriggerHttpMethod, TriggerRegistry, type Usage, type UsageInfo, UserInputBridge, type UserInputHandler, type VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, VoltAgentRagRetriever, type VoltAgentRagRetrieverOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, type VoltAgentTriggerConfig, type VoltAgentTriggersConfig, type VoltOpsActionExecutionResult, type VoltOpsActionsApi, VoltOpsActionsClient, type VoltOpsActionsTransport, type VoltOpsAirtableCreateRecordParams, type VoltOpsAirtableCredential, type VoltOpsAirtableDeleteRecordParams, type VoltOpsAirtableGetRecordParams, type VoltOpsAirtableListRecordsParams, type VoltOpsAirtableUpdateRecordParams, type VoltOpsAppendEvalRunResultPayload, type VoltOpsAppendEvalRunResultsRequest, VoltOpsClient, type VoltOpsClientOptions, type VoltOpsCompleteEvalRunRequest, type VoltOpsCreateEvalRunRequest, type VoltOpsCreateScorerRequest, type VoltOpsDiscordChannelMessageParams, type VoltOpsDiscordChannelType, type VoltOpsDiscordConfig, type VoltOpsDiscordCreateChannelParams, type VoltOpsDiscordCredential, type VoltOpsDiscordDeleteChannelParams, type VoltOpsDiscordGetChannelParams, type VoltOpsDiscordListChannelsParams, type VoltOpsDiscordListMembersParams, type VoltOpsDiscordListMessagesParams, type VoltOpsDiscordMemberRoleParams, type VoltOpsDiscordReactionParams, type VoltOpsDiscordSendMessageParams, type VoltOpsDiscordSendWebhookMessageParams, type VoltOpsDiscordUpdateChannelParams, type VoltOpsEvalResultStatus, type VoltOpsEvalRunCompletionSummaryPayload, type VoltOpsEvalRunErrorPayload, type VoltOpsEvalRunResultLiveMetadata, type VoltOpsEvalRunResultScorePayload, type VoltOpsEvalRunStatus, type VoltOpsEvalRunSummary, type VoltOpsFeedback, type VoltOpsFeedbackConfig, type VoltOpsFeedbackCreateInput, type VoltOpsFeedbackExpiresIn, type VoltOpsFeedbackToken, type VoltOpsFeedbackTokenCreateInput, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, type VoltOpsScorerSummary, type VoltOpsSlackCredential, type VoltOpsSlackDeleteMessageParams, type VoltOpsSlackPostMessageParams, type VoltOpsSlackSearchMessagesParams, type VoltOpsTerminalEvalRunStatus, type VoltOpsTriggerDefinition, VoltOpsTriggerDefinitions, type VoltOpsTriggerEnvelope, type VoltOpsTriggerGroupMap, type VoltOpsTriggerName, VoltOpsTriggerNames, WRITE_FILE_TOOL_DESCRIPTION, WRITE_TODOS_TOOL_DESCRIPTION, WRITE_TODOS_TOOL_NAME, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type WeightedBlendComponent, type WeightedBlendOptions, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, type WorkflowHookContext, type WorkflowHookStatus, type WorkflowHooks, WorkflowRegistry, type WorkflowRunQuery, type WorkflowStateEntry, type WorkflowStats, type WorkflowStepContext, type WorkflowStepData, type WorkflowStepStatus, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, type WriteResult, addTimestampToMessage, andAgent, andAll, andBranch, andDoUntil, andDoWhile, andForEach, andGuardrail, andMap, andRace, andSleep, andSleepUntil, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSamplingMetadata, buildScorer, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createDefaultInputSafetyGuardrails, createDefaultPIIGuardrails, createDefaultSafetyGuardrails, createEmailRedactorGuardrail, createFilesystemToolkit, createHTMLSanitizerInputGuardrail, createHooks, createInputGuardrail, createInputLengthGuardrail, createInputMiddleware, createMaxLengthGuardrail, createNodeId, createOutputGuardrail, createOutputMiddleware, createPIIInputGuardrail, createPhoneNumberGuardrail, createPlanningToolkit, createProfanityGuardrail, createProfanityInputGuardrail, createPrompt, createPromptInjectionGuardrail, createReasoningTools, createRetrieverTool, createScorer, createSensitiveNumberGuardrail, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolResultEvictor, createToolkit, createTriggers, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, defineVoltOpsTrigger, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getGlobalVoltOpsClient, getNodeTypeFromNodeId, getVoltOpsTriggerDefinition, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isMiddlewareAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeScorerResult, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, runLocalScorers, safeJsonParse, serializeValueForDebug, setWaitUntil, shouldSample, tool, transformTextContent, updateAllPackages, updateSinglePackage, weightedBlend, zodSchemaToJsonUI };
14916
+ export { A2AServerRegistry, AbortError, Agent, type AgentEvalConfig, type AgentEvalContext, type AgentEvalFeedbackHelper, type AgentEvalFeedbackSaveInput, type AgentEvalOperationType, type AgentEvalPayload, type AgentEvalResult, type AgentEvalResultCallbackArgs, type AgentEvalSamplingPolicy, type AgentEvalScorerConfig, type AgentEvalScorerFactory, type AgentEvalScorerReference, type AgentFeedbackMetadata, type AgentFeedbackOptions, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnFallback, type AgentHookOnHandoff, type AgentHookOnHandoffComplete, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnRetry, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentModelConfig, type AgentModelReference, type AgentModelValue, type AgentOptions, AgentRegistry, type AgentResponse, type AgentScorerState, type AgentStatus, type AgentSummarizationOptions, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type BuildScorerOptions, type BuildScorerRunArgs, type BuildScorerRunResult, type BuilderAnalyzeContext, type BuilderPrepareContext, type BuilderReasonContext, type BuilderScoreContext, type CachedPrompt, type ChatMessage, ClientHTTPError, type ClientSideToolResult, type CloudflareFetchHandler, CompositeFilesystemBackend, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type ConversationStepRecord, type ConversationStepType, type ConversationTitleConfig, type ConversationTitleGenerator, ConversationTodoBackend, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateInputGuardrailOptions, type CreateInputMiddlewareOptions, type CreateOutputGuardrailOptions, type CreateOutputMiddlewareOptions, type CreateReasoningToolsOptions, type CreateScorerOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, EDIT_FILE_TOOL_DESCRIPTION, type EditResult, type EmbeddingAdapter, type EmbeddingAdapterConfig, type EmbeddingAdapterInput, EmbeddingAdapterNotConfiguredError, EmbeddingError, type EmbeddingModelFactory, type EmbeddingModelReference, type EmbeddingRouterModelId, type ExtractVariableNames, FEW_SHOT_EXAMPLES, FILESYSTEM_SYSTEM_PROMPT, type FallbackStage, type FileData, type FileInfo, type FilesystemBackend, type FilesystemBackendContext, type FilesystemBackendFactory, type FilesystemToolkitOptions, GLOB_TOOL_DESCRIPTION, GREP_TOOL_DESCRIPTION, type GenerateObjectOptions, type GenerateObjectResultWithContext, type GenerateObjectSubAgentConfig, type GenerateReasonResult, type GenerateScoreResult, type GenerateScoreStep, type GenerateTextOptions, type GenerateTextResultWithContext, type GenerateTextSubAgentConfig, type GetConversationStepsOptions, type GetMessagesOptions, type GrepMatch, type GuardrailAction, type GuardrailContext, type GuardrailDefinition, type GuardrailFunction, type GuardrailSeverity, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryFilesystemBackend, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type InputGuardrail, type InputGuardrailArgs, type InputGuardrailResult, type InputMiddleware, type InputMiddlewareArgs, type InputMiddlewareResult, type KnowledgeBaseTagFilter, type LLMProvider, LS_TOOL_DESCRIPTION, type LanguageModelFactory, LazyRemoteExportProcessor, type LocalScorerDefinition, type LocalScorerExecutionResult, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, type MCPAuthorizationAction, type MCPAuthorizationConfig, type MCPAuthorizationContext, MCPAuthorizationError, type MCPCanFunction, type MCPCanParams, type MCPCanResult, MCPClient, type MCPClientCallOptions, type MCPClientConfig, MCPConfiguration, type MCPConfigurationOptions, type MCPElicitationAdapter, type MCPElicitationHandler, type MCPLoggingAdapter, type MCPPromptsAdapter, type MCPResourcesAdapter, MCPServerRegistry, type ManagedMemoryAddMessageInput, type ManagedMemoryAddMessagesInput, type ManagedMemoryClearMessagesInput, type ManagedMemoryConnectionInfo, type ManagedMemoryConversationsClient, type ManagedMemoryCredentialCreateResult, type ManagedMemoryCredentialListResult, type ManagedMemoryCredentialSummary, type ManagedMemoryDatabaseSummary, type ManagedMemoryDeleteMessagesInput, type ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, type ManagedMemoryQueryWorkflowRunsInput, type ManagedMemorySetWorkingMemoryInput, type ManagedMemoryStatus, type ManagedMemoryUpdateConversationInput, type ManagedMemoryVoltOpsClient, type ManagedMemoryWorkflowStateUpdateInput, type ManagedMemoryWorkflowStatesClient, type ManagedMemoryWorkingMemoryClient, type ManagedMemoryWorkingMemoryInput, Memory, type MemoryConfig, type MemoryOptions, type MemoryStorageMetadata, type MemoryUpdateMode, Memory as MemoryV2, MemoryV2Error, type MessageContent, MessageContentBuilder, type MessageRole, MiddlewareAbortError, type MiddlewareAbortOptions, type MiddlewareContext, type MiddlewareDefinition, type MiddlewareDirection, type MiddlewareFunction, type ModelForProvider, type ModelProvider, type ModelProviderEntry, type ModelProviderLoader, ModelProviderRegistry, type ModelRouterModelId, type ModelToolCall, NextAction, NodeFilesystemBackend, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnFallbackHookArgs, type OnHandoffCompleteHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnRetryHookArgs, type OnRetryHookArgsBase, type OnRetryLLMHookArgs, type OnRetryMiddlewareHookArgs, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolEndHookResult, type OnToolStartHookArgs, type OperationContext, type OutputGuardrail, type OutputGuardrailArgs, type OutputGuardrailResult, type OutputMiddleware, type OutputMiddlewareArgs, type OutputMiddlewareResult, type OutputSpec$1 as OutputSpec, type PackageUpdateInfo, PlanAgent, type PlanAgentExtension, type PlanAgentExtensionContext, type PlanAgentExtensionResult, type PlanAgentFileData, type PlanAgentOptions, type PlanAgentState, type PlanAgentSubagentDefinition, type PlanAgentTodoItem, type PlanAgentTodoStatus, type PlanningToolkitOptions, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderId, type ProviderModelsMap, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ProviderTool, READ_FILE_TOOL_DESCRIPTION, type RagKnowledgeBaseSummary, type RagSearchKnowledgeBaseChildChunk, type RagSearchKnowledgeBaseRequest, type RagSearchKnowledgeBaseResponse, type RagSearchKnowledgeBaseResult, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredTrigger, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type ResumableStreamAdapter, type ResumableStreamContext, type RetrieveOptions, type Retriever, type RetrieverOptions, type RetrySource, type RunLocalScorersArgs, type RunLocalScorersResult, SERVERLESS_ENV_CONTEXT_KEY, type SamplingMetadata, type SamplingPolicy, type ScorerBuilder, type ScorerContext, type ScorerLifecycleScope, type ScorerPipelineContext, type ScorerReasonContext, type ScorerResult, type SearchOptions, type SearchResult$1 as SearchResult, type ServerAgentResponse, type ServerApiResponse, type ServerProviderDeps, type ServerProviderFactory, type ServerWorkflowResponse, type ServerlessProviderFactory, type ServerlessRemoteEndpointConfig, type ServerlessRemoteExportConfig, type ServerlessRequestHandler, ServerlessVoltAgentObservability, type SpanAttributes, type SpanEvent, type SpanFilterConfig, SpanFilterProcessor, SpanKind, type SpanLink, type SpanStatus, SpanStatusCode, type SpanTreeNode, type StepChunkCallback, type StepFinishCallback, type StepWithContent, type StopWhen, type StorageAdapter, StorageError, StorageLogProcessor, type StoredUIMessage, type StreamObjectFinishResult, type StreamObjectOnFinishCallback, type StreamObjectOptions, type StreamObjectResultWithContext, type StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextResultWithContext, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, TRIGGER_CONTEXT_KEY, type TaskToolOptions, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, type TodoBackend, type TodoBackendFactory, Tool, type ToolArgumentResolver, type ToolCall, type ToolContext, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, type ToolExecutionResult, type ToolHookOnEnd, type ToolHookOnEndArgs, type ToolHookOnEndResult, type ToolHookOnStart, type ToolHookOnStartArgs, type ToolHooks, ToolManager, type ToolOptions, type ToolResultOutput, type ToolRouter, type ToolRouterCandidate, type ToolRouterContext, type ToolRouterInput, type ToolRouterMode, type ToolRouterResult, type ToolRouterResultItem, type ToolRouterSelection, type ToolRouterStrategy, type ToolRoutingConfig, type ToolRoutingEmbeddingConfig, type ToolRoutingEmbeddingInput, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type TriggerHandler, type TriggerHandlerBody, type TriggerHandlerContext, type TriggerHandlerResponse, type TriggerHandlerResult, type TriggerHandlerReturn, type TriggerHttpMethod, TriggerRegistry, type Usage, type UsageInfo, UserInputBridge, type UserInputHandler, type VectorAdapter$1 as VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem$1 as VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, VoltAgentRagRetriever, type VoltAgentRagRetrieverOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, type VoltAgentTriggerConfig, type VoltAgentTriggersConfig, type VoltOpsActionExecutionResult, type VoltOpsActionsApi, VoltOpsActionsClient, type VoltOpsActionsTransport, type VoltOpsAirtableCreateRecordParams, type VoltOpsAirtableCredential, type VoltOpsAirtableDeleteRecordParams, type VoltOpsAirtableGetRecordParams, type VoltOpsAirtableListRecordsParams, type VoltOpsAirtableUpdateRecordParams, type VoltOpsAppendEvalRunResultPayload, type VoltOpsAppendEvalRunResultsRequest, VoltOpsClient, type VoltOpsClientOptions, type VoltOpsCompleteEvalRunRequest, type VoltOpsCreateEvalRunRequest, type VoltOpsCreateScorerRequest, type VoltOpsDiscordChannelMessageParams, type VoltOpsDiscordChannelType, type VoltOpsDiscordConfig, type VoltOpsDiscordCreateChannelParams, type VoltOpsDiscordCredential, type VoltOpsDiscordDeleteChannelParams, type VoltOpsDiscordGetChannelParams, type VoltOpsDiscordListChannelsParams, type VoltOpsDiscordListMembersParams, type VoltOpsDiscordListMessagesParams, type VoltOpsDiscordMemberRoleParams, type VoltOpsDiscordReactionParams, type VoltOpsDiscordSendMessageParams, type VoltOpsDiscordSendWebhookMessageParams, type VoltOpsDiscordUpdateChannelParams, type VoltOpsEvalResultStatus, type VoltOpsEvalRunCompletionSummaryPayload, type VoltOpsEvalRunErrorPayload, type VoltOpsEvalRunResultLiveMetadata, type VoltOpsEvalRunResultScorePayload, type VoltOpsEvalRunStatus, type VoltOpsEvalRunSummary, type VoltOpsFeedback, type VoltOpsFeedbackConfig, type VoltOpsFeedbackCreateInput, type VoltOpsFeedbackExpiresIn, type VoltOpsFeedbackToken, type VoltOpsFeedbackTokenCreateInput, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, type VoltOpsScorerSummary, type VoltOpsSlackCredential, type VoltOpsSlackDeleteMessageParams, type VoltOpsSlackPostMessageParams, type VoltOpsSlackSearchMessagesParams, type VoltOpsTerminalEvalRunStatus, type VoltOpsTriggerDefinition, VoltOpsTriggerDefinitions, type VoltOpsTriggerEnvelope, type VoltOpsTriggerGroupMap, type VoltOpsTriggerName, VoltOpsTriggerNames, WRITE_FILE_TOOL_DESCRIPTION, WRITE_TODOS_TOOL_DESCRIPTION, WRITE_TODOS_TOOL_NAME, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type WeightedBlendComponent, type WeightedBlendOptions, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, type WorkflowHookContext, type WorkflowHookStatus, type WorkflowHooks, WorkflowRegistry, type WorkflowRunQuery, type WorkflowStateEntry, type WorkflowStateStore, type WorkflowStateUpdater, type WorkflowStats, type WorkflowStepContext, type WorkflowStepData, type WorkflowStepStatus, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, type WriteResult, addTimestampToMessage, andAgent, andAll, andBranch, andDoUntil, andDoWhile, andForEach, andGuardrail, andMap, andRace, andSleep, andSleepUntil, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSamplingMetadata, buildScorer, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createDefaultInputSafetyGuardrails, createDefaultPIIGuardrails, createDefaultSafetyGuardrails, createEmailRedactorGuardrail, createEmbeddingToolRouterStrategy, createFilesystemToolkit, createHTMLSanitizerInputGuardrail, createHooks, createInputGuardrail, createInputLengthGuardrail, createInputMiddleware, createMaxLengthGuardrail, createNodeId, createOutputGuardrail, createOutputMiddleware, createPIIInputGuardrail, createPhoneNumberGuardrail, createPlanningToolkit, createProfanityGuardrail, createProfanityInputGuardrail, createPrompt, createPromptInjectionGuardrail, createReasoningTools, createRetrieverTool, createScorer, createSensitiveNumberGuardrail, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolResultEvictor, createToolRouter, createToolkit, createTriggers, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, defineVoltOpsTrigger, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getGlobalVoltOpsClient, getNodeTypeFromNodeId, getVoltOpsTriggerDefinition, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isMiddlewareAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isToolRouter, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeScorerResult, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, runLocalScorers, safeJsonParse, serializeValueForDebug, setWaitUntil, shouldSample, tool, transformTextContent, updateAllPackages, updateSinglePackage, weightedBlend, zodSchemaToJsonUI };