@voltagent/core 2.1.6 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,367 +1009,336 @@ 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
- }
1289
+ };
1060
1290
  /**
1061
- * Storage Adapter Interface
1062
- * Handles persistence of conversations and messages
1291
+ * Base interface for voice providers
1063
1292
  */
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>;
1293
+ type Voice = {
1071
1294
  /**
1072
- * Delete specific messages by ID for a conversation.
1073
- * Adapters should perform an atomic delete when possible. If atomic deletes or transactions
1074
- * are unavailable, a best-effort deletion (for example, clear + rehydrate) may be used.
1295
+ * Convert text to speech
1075
1296
  */
1076
- deleteMessages(messageIds: string[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1077
- createConversation(input: CreateConversationInput): Promise<Conversation>;
1078
- getConversation(id: string): Promise<Conversation | null>;
1079
- getConversations(resourceId: string): Promise<Conversation[]>;
1080
- getConversationsByUserId(userId: string, options?: Omit<ConversationQueryOptions, "userId">): Promise<Conversation[]>;
1081
- queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
1297
+ speak(text: string | NodeJS.ReadableStream, options?: {
1298
+ voice?: string;
1299
+ speed?: number;
1300
+ pitch?: number;
1301
+ }): Promise<NodeJS.ReadableStream>;
1082
1302
  /**
1083
- * Count conversations matching query filters (limit/offset ignored).
1303
+ * Convert speech to text
1084
1304
  */
1085
- countConversations(options: ConversationQueryOptions): Promise<number>;
1086
- updateConversation(id: string, updates: Partial<Omit<Conversation, "id" | "createdAt" | "updatedAt">>): Promise<Conversation>;
1087
- deleteConversation(id: string): Promise<void>;
1088
- saveConversationSteps?(steps: ConversationStepRecord[]): Promise<void>;
1089
- getConversationSteps?(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
1090
- getWorkingMemory(params: {
1091
- conversationId?: string;
1092
- userId?: string;
1093
- scope: WorkingMemoryScope;
1094
- }): Promise<string | null>;
1095
- setWorkingMemory(params: {
1096
- conversationId?: string;
1097
- userId?: string;
1098
- content: string;
1099
- scope: WorkingMemoryScope;
1100
- }): Promise<void>;
1101
- deleteWorkingMemory(params: {
1102
- conversationId?: string;
1103
- userId?: string;
1104
- scope: WorkingMemoryScope;
1105
- }): Promise<void>;
1106
- getWorkflowState(executionId: string): Promise<WorkflowStateEntry | null>;
1107
- queryWorkflowRuns(query: WorkflowRunQuery): Promise<WorkflowStateEntry[]>;
1108
- setWorkflowState(executionId: string, state: WorkflowStateEntry): Promise<void>;
1109
- updateWorkflowState(executionId: string, updates: Partial<WorkflowStateEntry>): Promise<void>;
1110
- getSuspendedWorkflowStates(workflowId: string): Promise<WorkflowStateEntry[]>;
1111
- }
1112
- /**
1113
- * Embedding Adapter Interface
1114
- * Handles text to vector conversions
1115
- */
1116
- interface EmbeddingAdapter$1 {
1305
+ listen(audio: NodeJS.ReadableStream, options?: {
1306
+ language?: string;
1307
+ model?: string;
1308
+ stream?: boolean;
1309
+ }): Promise<string | ReadableStreamType>;
1117
1310
  /**
1118
- * Embed a single text
1311
+ * Connect to real-time voice service
1119
1312
  */
1120
- embed(text: string): Promise<number[]>;
1313
+ connect(options?: Record<string, unknown>): Promise<void>;
1121
1314
  /**
1122
- * Embed multiple texts in batch
1315
+ * Disconnect from real-time voice service
1123
1316
  */
1124
- embedBatch(texts: string[]): Promise<number[][]>;
1317
+ disconnect(): void;
1125
1318
  /**
1126
- * Get embedding dimensions
1319
+ * Send audio data to real-time service
1127
1320
  */
1128
- getDimensions(): number;
1321
+ send(audioData: NodeJS.ReadableStream | Int16Array): Promise<void>;
1129
1322
  /**
1130
- * Get model name
1323
+ * Register event listener
1131
1324
  */
1132
- getModelName(): string;
1133
- }
1325
+ on<E extends VoiceEventType>(event: E, callback: (data: VoiceEventData[E]) => void): void;
1326
+ /**
1327
+ * Remove event listener
1328
+ */
1329
+ off<E extends VoiceEventType>(event: E, callback: (data: VoiceEventData[E]) => void): void;
1330
+ /**
1331
+ * Get available voices
1332
+ */
1333
+ getVoices(): Promise<VoiceMetadata[]>;
1334
+ };
1335
+
1134
1336
  /**
1135
- * Vector Adapter Interface
1136
- * Handles vector storage and similarity search
1337
+ * Vector adapter interface for vector storage and similarity search
1137
1338
  */
1138
1339
  interface VectorAdapter$1 {
1139
1340
  /**
1140
- * Store a single vector
1341
+ * Store a vector with associated metadata
1141
1342
  */
1142
1343
  store(id: string, vector: number[], metadata?: Record<string, unknown>): Promise<void>;
1143
1344
  /**
@@ -1145,13 +1346,9 @@ interface VectorAdapter$1 {
1145
1346
  */
1146
1347
  storeBatch(items: VectorItem$1[]): Promise<void>;
1147
1348
  /**
1148
- * Search for similar vectors
1349
+ * Search for similar vectors using cosine similarity
1149
1350
  */
1150
- search(vector: number[], options?: {
1151
- limit?: number;
1152
- filter?: Record<string, unknown>;
1153
- threshold?: number;
1154
- }): Promise<SearchResult$1[]>;
1351
+ search(vector: number[], options?: VectorSearchOptions): Promise<SearchResult$1[]>;
1155
1352
  /**
1156
1353
  * Delete a vector by ID
1157
1354
  */
@@ -1164,856 +1361,596 @@ interface VectorAdapter$1 {
1164
1361
  * Clear all vectors
1165
1362
  */
1166
1363
  clear(): Promise<void>;
1364
+ /**
1365
+ * Get total count of stored vectors
1366
+ */
1367
+ count(): Promise<number>;
1368
+ /**
1369
+ * Get a specific vector by ID
1370
+ */
1371
+ get(id: string): Promise<VectorItem$1 | null>;
1167
1372
  }
1168
-
1169
1373
  /**
1170
- * Custom error classes for Memory V2
1374
+ * Item to store in vector database
1171
1375
  */
1376
+ interface VectorItem$1 {
1377
+ /**
1378
+ * Unique identifier for the vector
1379
+ */
1380
+ id: string;
1381
+ /**
1382
+ * The embedding vector
1383
+ */
1384
+ vector: number[];
1385
+ /**
1386
+ * Optional metadata associated with the vector
1387
+ */
1388
+ metadata?: Record<string, unknown>;
1389
+ /**
1390
+ * Optional text content that was embedded
1391
+ */
1392
+ content?: string;
1393
+ }
1172
1394
  /**
1173
- * Base error class for Memory V2
1395
+ * Options for vector search
1174
1396
  */
1175
- declare class MemoryV2Error extends Error {
1176
- readonly code: string;
1177
- readonly details?: Record<string, unknown> | undefined;
1178
- constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
1397
+ interface VectorSearchOptions {
1398
+ /**
1399
+ * Maximum number of results to return
1400
+ */
1401
+ limit?: number;
1402
+ /**
1403
+ * Minimum similarity threshold (0-1)
1404
+ */
1405
+ threshold?: number;
1406
+ /**
1407
+ * Filter results by metadata
1408
+ */
1409
+ filter?: Record<string, unknown>;
1179
1410
  }
1180
1411
  /**
1181
- * Error thrown when a storage operation fails
1412
+ * Search result with similarity score
1182
1413
  */
1183
- declare class StorageError extends MemoryV2Error {
1184
- constructor(message: string, details?: Record<string, unknown>);
1414
+ interface SearchResult$1 extends VectorItem$1 {
1415
+ /**
1416
+ * Similarity score (0-1, higher is more similar)
1417
+ */
1418
+ score: number;
1419
+ /**
1420
+ * Distance from query vector (lower is closer)
1421
+ */
1422
+ distance?: number;
1185
1423
  }
1424
+
1186
1425
  /**
1187
- * Error thrown when an embedding operation fails
1426
+ * Memory V2 Type Definitions
1427
+ * Clean separation between conversation memory and telemetry
1188
1428
  */
1189
- declare class EmbeddingError extends MemoryV2Error {
1190
- constructor(message: string, details?: Record<string, unknown>);
1191
- }
1429
+
1192
1430
  /**
1193
- * Error thrown when a vector operation fails
1431
+ * Extended UIMessage type with storage metadata
1194
1432
  */
1195
- declare class VectorError extends MemoryV2Error {
1196
- constructor(message: string, details?: Record<string, unknown>);
1197
- }
1433
+ type StoredUIMessage = UIMessage & {
1434
+ createdAt: Date;
1435
+ userId: string;
1436
+ conversationId: string;
1437
+ };
1198
1438
  /**
1199
- * Error thrown when a conversation is not found
1439
+ * Conversation type
1200
1440
  */
1201
- declare class ConversationNotFoundError extends MemoryV2Error {
1202
- constructor(conversationId: string);
1203
- }
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
+ };
1204
1450
  /**
1205
- * Error thrown when trying to create a conversation that already exists
1451
+ * Input type for creating a conversation
1206
1452
  */
1207
- declare class ConversationAlreadyExistsError extends MemoryV2Error {
1208
- constructor(conversationId: string);
1209
- }
1453
+ type CreateConversationInput = {
1454
+ id: string;
1455
+ resourceId: string;
1456
+ userId: string;
1457
+ title: string;
1458
+ metadata: Record<string, unknown>;
1459
+ };
1210
1460
  /**
1211
- * Error thrown when vector adapter is required but not configured
1461
+ * Query builder options for conversations
1212
1462
  */
1213
- declare class VectorAdapterNotConfiguredError extends MemoryV2Error {
1214
- constructor(operation: string);
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;
1215
1502
  }
1216
1503
  /**
1217
- * Error thrown when embedding adapter is required but not configured
1504
+ * Memory options for MemoryManager
1218
1505
  */
1219
- declare class EmbeddingAdapterNotConfiguredError extends MemoryV2Error {
1220
- constructor(operation: string);
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
+ };
1551
+ /**
1552
+ * Stream events collected during execution
1553
+ * Used for timeline visualization in UI
1554
+ */
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;
1221
1592
  }
1222
-
1223
1593
  /**
1224
- * Vector adapter interface for vector storage and similarity search
1594
+ * Working memory scope - conversation or user level
1225
1595
  */
1226
- interface VectorAdapter {
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 {
1227
1629
  /**
1228
- * Store a vector with associated metadata
1630
+ * Storage adapter for conversations and messages
1229
1631
  */
1230
- store(id: string, vector: number[], metadata?: Record<string, unknown>): Promise<void>;
1632
+ storage: StorageAdapter;
1231
1633
  /**
1232
- * Store multiple vectors in batch
1634
+ * Optional embedding adapter or model reference for semantic operations
1233
1635
  */
1234
- storeBatch(items: VectorItem[]): Promise<void>;
1636
+ embedding?: EmbeddingAdapterInput;
1235
1637
  /**
1236
- * Search for similar vectors using cosine similarity
1638
+ * Optional vector adapter for similarity search
1237
1639
  */
1238
- search(vector: number[], options?: VectorSearchOptions): Promise<SearchResult[]>;
1640
+ vector?: VectorAdapter;
1239
1641
  /**
1240
- * Delete a vector by ID
1642
+ * Enable caching for embeddings
1643
+ * @default false
1241
1644
  */
1242
- delete(id: string): Promise<void>;
1645
+ enableCache?: boolean;
1243
1646
  /**
1244
- * Delete multiple vectors by IDs
1647
+ * Maximum number of embeddings to cache
1648
+ * @default 1000
1245
1649
  */
1246
- deleteBatch(ids: string[]): Promise<void>;
1650
+ cacheSize?: number;
1247
1651
  /**
1248
- * Clear all vectors
1652
+ * Cache TTL in milliseconds
1653
+ * @default 3600000 (1 hour)
1249
1654
  */
1250
- clear(): Promise<void>;
1655
+ cacheTTL?: number;
1251
1656
  /**
1252
- * Get total count of stored vectors
1657
+ * Working memory configuration
1658
+ * Enables agents to maintain important context
1253
1659
  */
1254
- count(): Promise<number>;
1660
+ workingMemory?: WorkingMemoryConfig;
1255
1661
  /**
1256
- * Get a specific vector by ID
1662
+ * Automatically generate a title for new conversations using the agent's model
1663
+ * (or the override model if provided).
1664
+ * @default false
1257
1665
  */
1258
- get(id: string): Promise<VectorItem | null>;
1666
+ generateTitle?: boolean | ConversationTitleConfig;
1259
1667
  }
1260
1668
  /**
1261
- * Item to store in vector database
1669
+ * Embedding adapter config for Memory
1262
1670
  */
1263
- interface VectorItem {
1264
- /**
1265
- * Unique identifier for the vector
1266
- */
1267
- id: string;
1268
- /**
1269
- * The embedding vector
1270
- */
1271
- vector: number[];
1272
- /**
1273
- * Optional metadata associated with the vector
1274
- */
1275
- metadata?: Record<string, unknown>;
1276
- /**
1277
- * Optional text content that was embedded
1278
- */
1279
- content?: string;
1280
- }
1671
+ type EmbeddingAdapterConfig = EmbeddingOptions & {
1672
+ model: EmbeddingModelReference;
1673
+ };
1281
1674
  /**
1282
- * Options for vector search
1675
+ * Embedding input options for Memory
1283
1676
  */
1284
- interface VectorSearchOptions {
1285
- /**
1286
- * Maximum number of results to return
1287
- */
1288
- limit?: number;
1289
- /**
1290
- * Minimum similarity threshold (0-1)
1291
- */
1292
- threshold?: number;
1293
- /**
1294
- * Filter results by metadata
1295
- */
1296
- filter?: Record<string, unknown>;
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;
1297
1684
  }
1298
1685
  /**
1299
- * Search result with similarity score
1686
+ * Summary of working memory configuration exposed to the UI
1300
1687
  */
1301
- interface SearchResult extends VectorItem {
1302
- /**
1303
- * Similarity score (0-1, higher is more similar)
1304
- */
1305
- score: number;
1306
- /**
1307
- * Distance from query vector (lower is closer)
1308
- */
1309
- distance?: number;
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;
1310
1703
  }
1311
-
1312
1704
  /**
1313
- * Vector math utilities for similarity calculations
1705
+ * Document type for RAG operations
1314
1706
  */
1707
+ interface Document {
1708
+ id: string;
1709
+ content: string;
1710
+ metadata?: Record<string, unknown>;
1711
+ }
1315
1712
  /**
1316
- * Calculate cosine similarity between two vectors
1317
- * Returns a value between -1 and 1, where 1 means identical direction,
1318
- * 0 means perpendicular, and -1 means opposite direction
1713
+ * Search options for semantic search
1319
1714
  */
1320
- declare function cosineSimilarity(a: number[], b: number[]): number;
1321
-
1715
+ interface SearchOptions {
1716
+ limit?: number;
1717
+ threshold?: number;
1718
+ filter?: Record<string, unknown>;
1719
+ }
1322
1720
  /**
1323
- * Memory - Clean architecture for conversation memory and state management
1721
+ * Search result from vector operations
1324
1722
  */
1325
-
1723
+ interface SearchResult {
1724
+ id: string;
1725
+ score: number;
1726
+ content?: string;
1727
+ metadata?: Record<string, unknown>;
1728
+ }
1326
1729
  /**
1327
- * Memory Class
1328
- * Handles conversation memory with optional vector search capabilities
1730
+ * Vector item for batch operations
1329
1731
  */
1330
- declare class Memory {
1331
- private readonly storage;
1332
- private readonly embedding?;
1333
- private readonly vector?;
1334
- private embeddingCache?;
1335
- private readonly workingMemoryConfig?;
1336
- private resourceId?;
1337
- private logger?;
1338
- constructor(options: MemoryConfig);
1339
- /**
1340
- * Get messages from a conversation
1341
- */
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>;
1342
1744
  getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage<{
1343
1745
  createdAt: Date;
1344
1746
  }>[]>;
1345
- /**
1346
- * Save a single message
1347
- */
1348
- saveMessage(message: UIMessage, userId: string, conversationId: string): Promise<void>;
1349
- saveConversationSteps(steps: ConversationStepRecord[]): Promise<void>;
1350
- /**
1351
- * Add a single message (alias for consistency with existing API)
1352
- */
1353
- addMessage(message: UIMessage, userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1354
- /**
1355
- * Add multiple messages in batch
1356
- */
1357
- addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1358
- /**
1359
- * Clear messages for a user
1360
- */
1361
1747
  clearMessages(userId: string, conversationId?: string, context?: OperationContext): Promise<void>;
1362
1748
  /**
1363
- * Delete specific messages by ID for a conversation
1364
- * Adapters should delete atomically when possible; otherwise a best-effort delete may be used.
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.
1365
1752
  */
1366
1753
  deleteMessages(messageIds: string[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
1367
- getConversationSteps(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
1368
- /**
1369
- * Get a conversation by ID
1370
- */
1754
+ createConversation(input: CreateConversationInput): Promise<Conversation>;
1371
1755
  getConversation(id: string): Promise<Conversation | null>;
1372
- /**
1373
- * Get conversations for a resource
1374
- */
1375
1756
  getConversations(resourceId: string): Promise<Conversation[]>;
1376
- /**
1377
- * Get conversations by user ID with query options
1378
- */
1379
1757
  getConversationsByUserId(userId: string, options?: Omit<ConversationQueryOptions, "userId">): Promise<Conversation[]>;
1380
- /**
1381
- * Query conversations with advanced options
1382
- */
1383
1758
  queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
1384
1759
  /**
1385
- * Count conversations with the same filtering as queryConversations (ignores limit/offset)
1760
+ * Count conversations matching query filters (limit/offset ignored).
1386
1761
  */
1387
1762
  countConversations(options: ConversationQueryOptions): Promise<number>;
1388
- /**
1389
- * Create a new conversation
1390
- */
1391
- createConversation(input: CreateConversationInput): Promise<Conversation>;
1392
- /**
1393
- * Update a conversation
1394
- */
1395
1763
  updateConversation(id: string, updates: Partial<Omit<Conversation, "id" | "createdAt" | "updatedAt">>): Promise<Conversation>;
1396
- /**
1397
- * Delete a conversation
1398
- */
1399
1764
  deleteConversation(id: string): Promise<void>;
1400
- /**
1401
- * Get messages with semantic search
1402
- * Combines recent messages with semantically similar messages
1403
- */
1404
- getMessagesWithSemanticSearch(userId: string, conversationId: string, currentQuery?: string, options?: {
1405
- limit?: number;
1406
- semanticLimit?: number;
1407
- semanticThreshold?: number;
1408
- mergeStrategy?: "prepend" | "append" | "interleave";
1409
- }): Promise<UIMessage<{
1410
- createdAt: Date;
1411
- }>[]>;
1412
- /**
1413
- * Get messages by their IDs
1414
- */
1415
- private getMessagesByIds;
1416
- /**
1417
- * Merge two arrays of messages, removing duplicates
1418
- */
1419
- private mergeMessages;
1420
- /**
1421
- * Check if vector support is configured
1422
- */
1423
- hasVectorSupport(): boolean;
1424
- /**
1425
- * Search for similar content
1426
- */
1427
- searchSimilar(query: string, options?: SearchOptions): Promise<SearchResult$1[]>;
1428
- /**
1429
- * Add a document for RAG
1430
- */
1431
- addDocument(document: Document): Promise<void>;
1432
- /**
1433
- * Remove a document
1434
- */
1435
- removeDocument(id: string): Promise<void>;
1436
- /**
1437
- * Get embedding with caching
1438
- */
1439
- private getEmbedding;
1440
- /**
1441
- * Embed and store a message
1442
- */
1443
- private embedAndStoreMessage;
1444
- /**
1445
- * Embed and store multiple messages
1446
- */
1447
- private embedAndStoreMessages;
1448
- /**
1449
- * Get working memory for a conversation or user
1450
- */
1765
+ saveConversationSteps?(steps: ConversationStepRecord[]): Promise<void>;
1766
+ getConversationSteps?(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
1451
1767
  getWorkingMemory(params: {
1452
1768
  conversationId?: string;
1453
1769
  userId?: string;
1770
+ scope: WorkingMemoryScope;
1454
1771
  }): Promise<string | null>;
1455
- /**
1456
- * Update working memory (simplified)
1457
- */
1458
- updateWorkingMemory(params: {
1772
+ setWorkingMemory(params: {
1459
1773
  conversationId?: string;
1460
1774
  userId?: string;
1461
- content: string | Record<string, unknown>;
1462
- options?: WorkingMemoryUpdateOptions;
1775
+ content: string;
1776
+ scope: WorkingMemoryScope;
1777
+ }): Promise<void>;
1778
+ deleteWorkingMemory(params: {
1779
+ conversationId?: string;
1780
+ userId?: string;
1781
+ scope: WorkingMemoryScope;
1463
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 {
1464
1794
  /**
1465
- * Process content to string format
1795
+ * Embed a single text
1466
1796
  */
1467
- private processContent;
1797
+ embed(text: string): Promise<number[]>;
1468
1798
  /**
1469
- * Simple deep merge for JSON objects
1799
+ * Embed multiple texts in batch
1470
1800
  */
1471
- private simpleDeepMerge;
1801
+ embedBatch(texts: string[]): Promise<number[][]>;
1472
1802
  /**
1473
- * Clear working memory
1803
+ * Get embedding dimensions
1474
1804
  */
1475
- clearWorkingMemory(params: {
1476
- conversationId?: string;
1477
- userId?: string;
1478
- }): Promise<void>;
1805
+ getDimensions(): number;
1479
1806
  /**
1480
- * Get working memory template
1807
+ * Get model name
1481
1808
  */
1482
- getWorkingMemoryTemplate(): 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 working memory schema
1817
+ * Store a single vector
1485
1818
  */
1486
- getWorkingMemorySchema(): z.ZodObject<any> | null;
1819
+ store(id: string, vector: number[], metadata?: Record<string, unknown>): Promise<void>;
1487
1820
  /**
1488
- * Get working memory format
1821
+ * Store multiple vectors in batch
1489
1822
  */
1490
- getWorkingMemoryFormat(): "markdown" | "json" | null;
1823
+ storeBatch(items: VectorItem[]): Promise<void>;
1491
1824
  /**
1492
- * Check if working memory is supported
1825
+ * Search for similar vectors
1493
1826
  */
1494
- hasWorkingMemorySupport(): boolean;
1495
- /**
1496
- * Generate system instructions for working memory usage
1497
- */
1498
- getWorkingMemoryInstructions(params: {
1499
- conversationId?: string;
1500
- userId?: string;
1501
- }): Promise<string | null>;
1502
- /**
1503
- * Get configured adapters info
1504
- */
1505
- getAdaptersInfo(): {
1506
- storage: boolean;
1507
- embedding: {
1508
- configured: boolean;
1509
- model?: string;
1510
- dimensions?: number;
1511
- };
1512
- vector: boolean;
1513
- cache: boolean;
1514
- };
1515
- /**
1516
- * Save a message to memory
1517
- * Simple version without event publishing (handled by MemoryManagerV2)
1518
- */
1519
- saveMessageWithContext(message: UIMessage, userId: string, conversationId: string, context?: {
1520
- logger?: Logger;
1521
- }, operationContext?: OperationContext): Promise<void>;
1522
- /**
1523
- * Get messages with semantic search support
1524
- * Simple version without event publishing (handled by MemoryManagerV2)
1525
- */
1526
- getMessagesWithContext(userId: string, conversationId: string, options?: {
1827
+ search(vector: number[], options?: {
1527
1828
  limit?: number;
1528
- useSemanticSearch?: boolean;
1529
- currentQuery?: string;
1530
- traceId?: string;
1531
- logger?: Logger;
1532
- semanticLimit?: number;
1533
- semanticThreshold?: number;
1534
- mergeStrategy?: "prepend" | "append" | "interleave";
1535
- }, operationContext?: OperationContext): Promise<UIMessage<{
1536
- createdAt: Date;
1537
- }>[]>;
1538
- /**
1539
- * Internal: Set resource ID (agent ID)
1540
- */
1541
- _setResourceId(id: string): void;
1542
- /**
1543
- * Internal: Set logger
1544
- */
1545
- _setLogger(logger: Logger): void;
1546
- /**
1547
- * Get vector adapter if configured
1548
- */
1549
- getVectorAdapter(): VectorAdapter$1 | undefined;
1550
- /**
1551
- * Get embedding adapter if configured
1552
- */
1553
- getEmbeddingAdapter(): EmbeddingAdapter$1 | undefined;
1554
- /**
1555
- * Get metadata about the configured storage adapter
1556
- */
1557
- getStorageMetadata(): MemoryStorageMetadata;
1558
- /**
1559
- * Get a UI-friendly summary of working memory configuration
1560
- */
1561
- getWorkingMemorySummary(): WorkingMemorySummary | null;
1562
- /**
1563
- * Get workflow state by execution ID
1564
- */
1565
- getWorkflowState(executionId: string): Promise<WorkflowStateEntry | null>;
1566
- /**
1567
- * Query workflow states with filters
1568
- */
1569
- queryWorkflowRuns(query: WorkflowRunQuery): Promise<WorkflowStateEntry[]>;
1829
+ filter?: Record<string, unknown>;
1830
+ threshold?: number;
1831
+ }): Promise<SearchResult[]>;
1570
1832
  /**
1571
- * Set workflow state
1833
+ * Delete a vector by ID
1572
1834
  */
1573
- setWorkflowState(executionId: string, state: WorkflowStateEntry): Promise<void>;
1835
+ delete(id: string): Promise<void>;
1574
1836
  /**
1575
- * Update workflow state
1837
+ * Delete multiple vectors by IDs
1576
1838
  */
1577
- updateWorkflowState(executionId: string, updates: Partial<WorkflowStateEntry>): Promise<void>;
1839
+ deleteBatch(ids: string[]): Promise<void>;
1578
1840
  /**
1579
- * Get suspended workflow states for a workflow
1841
+ * Clear all vectors
1580
1842
  */
1581
- getSuspendedWorkflowStates(workflowId: string): Promise<WorkflowStateEntry[]>;
1843
+ clear(): Promise<void>;
1582
1844
  }
1583
1845
 
1584
1846
  /**
1585
- * LoggerProxy implements the Logger interface but delegates all calls to the current global logger.
1586
- * This allows agents and workflows to be created before VoltAgent sets the global logger,
1587
- * while still using the correct logger once it's available.
1847
+ * VoltOps Client Type Definitions
1588
1848
  *
1589
- * 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.
1590
1851
  */
1591
- declare class LoggerProxy implements Logger {
1592
- private bindings;
1593
- private externalLogger?;
1594
- constructor(bindings?: Record<string, any>, externalLogger?: Logger);
1595
- /**
1596
- * Get the actual logger instance with bindings applied
1597
- */
1598
- private getActualLogger;
1599
- /**
1600
- * Check if a log level should be logged based on the configured level
1601
- */
1602
- private shouldLog;
1603
- /**
1604
- * Emit log via OpenTelemetry Logs API if available
1605
- */
1606
- private emitOtelLog;
1607
- trace: LogFn;
1608
- debug: LogFn;
1609
- info: LogFn;
1610
- warn: LogFn;
1611
- error: LogFn;
1612
- fatal: LogFn;
1613
- /**
1614
- * Create a child logger with additional bindings
1615
- */
1616
- child(childBindings: Record<string, any>): Logger;
1617
- }
1852
+ type ManagedMemoryStatus = "provisioning" | "ready" | "failed";
1618
1853
 
1619
- declare enum ActionType {
1620
- START = "start",
1621
- COMPLETE = "complete",
1622
- ERROR = "error",
1623
- GENERATION_START = "generationStart",
1624
- GENERATION_COMPLETE = "generationComplete",
1625
- STREAM_START = "streamStart",
1626
- STREAM_COMPLETE = "streamComplete",
1627
- STREAM_STEP = "streamStep",
1628
- STREAMING = "streaming",
1629
- OBJECT_GENERATION_START = "objectGenerationStart",
1630
- OBJECT_GENERATION_COMPLETE = "objectGenerationComplete",
1631
- STREAM_OBJECT_START = "streamObjectStart",
1632
- STREAM_OBJECT_COMPLETE = "streamObjectComplete",
1633
- TOOL_CALL = "toolCall",
1634
- TOOL_ERROR = "toolError",
1635
- DELEGATE = "delegate",
1636
- EXECUTE = "execute",
1637
- VALIDATE = "validate",
1638
- STEP_START = "stepStart",
1639
- STEP_COMPLETE = "stepComplete",
1640
- SUSPEND = "suspend",
1641
- RESUME = "resume",
1642
- ACCESS = "access",
1643
- STORE = "store",
1644
- RETRIEVE = "retrieve"
1645
- }
1646
1854
  /**
1647
- * Helper to format retriever log messages
1855
+ * Reference to a prompt in the VoltOps system
1648
1856
  */
1649
- declare function buildRetrieverLogMessage(retrieverName: string, action: ActionType | string, description: string): string;
1650
-
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
+ };
1651
1873
  /**
1652
- * Get the global logger instance from registry or create a default one
1874
+ * Helper interface for prompt operations in agent instructions
1653
1875
  */
1654
- declare function getGlobalLogger(): Logger;
1876
+ type PromptHelper = {
1877
+ /** Get prompt content by reference */
1878
+ getPrompt: (reference: PromptReference) => Promise<PromptContent>;
1879
+ };
1655
1880
  /**
1656
- * Get the global log buffer
1881
+ * Enhanced dynamic value options with prompts support
1657
1882
  */
1658
- declare function getGlobalLogBuffer(): LogBuffer;
1659
-
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
+ }
1660
1889
  /**
1661
- * Options for configuring the Retriever
1890
+ * Dynamic value type for agent configuration
1662
1891
  */
1663
- type RetrieverOptions = {
1664
- /**
1665
- * Name for the default tool created from this retriever
1666
- * This is used for the pre-created 'tool' property
1667
- * @default "search_knowledge"
1668
- */
1669
- toolName?: string;
1670
- /**
1671
- * Description for the default tool created from this retriever
1672
- * This is used for the pre-created 'tool' property
1673
- * @default "Searches for relevant information in the knowledge base based on the query."
1674
- */
1675
- toolDescription?: string;
1676
- /**
1677
- * Optional logger instance for the retriever
1678
- * If not provided, a default logger will be created
1679
- */
1680
- logger?: Logger;
1681
- /**
1682
- * Additional configuration specific to concrete retriever implementations
1683
- */
1684
- [key: string]: any;
1685
- };
1892
+ type DynamicValue<T> = (options: DynamicValueOptions) => Promise<T> | T;
1686
1893
  /**
1687
- * Options passed to retrieve method.
1688
- * Includes all operation context fields for user-specific and context-aware retrieval.
1894
+ * VoltOps client configuration options
1689
1895
  */
1690
- interface RetrieveOptions extends Partial<OperationContext> {
1896
+ type VoltOpsClientOptions = {
1897
+ /** Base URL of the VoltOps API (default: https://api.voltagent.dev) */
1898
+ baseUrl?: string;
1691
1899
  /**
1692
- * User-managed context map for this specific retrieval operation
1693
- * Can be used to store metadata, results, or any custom data
1900
+ * Public API key for VoltOps authentication
1694
1901
  *
1695
- * Inherited from OperationContext but explicitly documented here for clarity
1696
- */
1697
- context?: Map<string | symbol, unknown>;
1698
- /**
1699
- * Optional logger instance for this retrieval operation.
1700
- * Provides execution-scoped logging with full context.
1701
- * 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.
1702
1904
  *
1703
- * Inherited from OperationContext but explicitly documented here for clarity
1704
- */
1705
- logger?: Logger;
1706
- /**
1707
- * Optional user identifier for user-specific retrieval.
1708
- * Can be used to filter results by user or implement multi-tenant retrieval.
1905
+ * @format Should start with `pk_` prefix (e.g., `pk_1234567890abcdef`)
1709
1906
  *
1710
- * Inherited from OperationContext
1907
+ * @example
1908
+ * ```typescript
1909
+ * publicKey: process.env.VOLTAGENT_PUBLIC_KEY
1910
+ * ```
1911
+ *
1912
+ *
1913
+ * @obtain Get your API keys from: https://console.voltagent.dev/settings/projects
1711
1914
  */
1712
- userId?: string;
1915
+ publicKey?: string;
1713
1916
  /**
1714
- * Optional conversation identifier for conversation-aware retrieval.
1715
- * Can be used to retrieve conversation-specific context or history.
1917
+ * Secret API key for VoltOps authentication
1716
1918
  *
1717
- * Inherited from OperationContext
1718
- */
1719
- conversationId?: string;
1720
- }
1721
- /**
1722
- * Retriever interface for retrieving relevant information
1723
- */
1724
- type Retriever = {
1725
- /**
1726
- * Retrieve relevant documents based on input text
1727
- * @param text The text to use for retrieval
1728
- * @param options Configuration and context for the retrieval
1729
- * @returns Promise resolving to a string with the retrieved content
1730
- */
1731
- retrieve(text: string, options: RetrieveOptions): Promise<string>;
1732
- /**
1733
- * Configuration options for the retriever
1734
- * This is optional and may not be present in all implementations
1735
- */
1736
- options?: RetrieverOptions;
1737
- /**
1738
- * Pre-created tool for easy destructuring
1739
- * This is optional and may not be present in all implementations
1740
- */
1741
- tool?: any;
1742
- /**
1743
- * Optional observability attributes for retriever spans.
1744
- */
1745
- getObservabilityAttributes?: () => Record<string, unknown>;
1746
- };
1747
-
1748
- /**
1749
- * Abstract base class for Retriever implementations.
1750
- * This class provides a common structure for different types of retrievers.
1751
- */
1752
- declare abstract class BaseRetriever {
1753
- /**
1754
- * Options that configure the retriever's behavior
1755
- */
1756
- protected options: RetrieverOptions;
1757
- /**
1758
- * Logger instance for the retriever
1759
- */
1760
- protected logger: Logger;
1761
- /**
1762
- * Ready-to-use tool property for direct destructuring
1763
- * This can be used with object destructuring syntax
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`)
1764
1923
  *
1765
1924
  * @example
1766
1925
  * ```typescript
1767
- * // ✅ You can use destructuring with the tool property
1768
- * const { tool } = new SimpleRetriever();
1769
- *
1770
- * // And use it directly in an agent
1771
- * const agent = new Agent({
1772
- * name: "RAG Agent",
1773
- * model: "gpt-4",
1774
- * provider,
1775
- * tools: [tool],
1776
- * });
1926
+ * secretKey: process.env.VOLTAGENT_SECRET_KEY
1777
1927
  * ```
1778
- */
1779
- readonly tool: AgentTool;
1780
- /**
1781
- * Constructor for the BaseRetriever class.
1782
- * @param options - Configuration options for the retriever.
1783
- */
1784
- constructor(options?: RetrieverOptions);
1785
- /**
1786
- * Abstract method that must be implemented by concrete retriever classes.
1787
- * Retrieves relevant information based on the input text or messages.
1788
1928
  *
1789
- * @param input - The input to use for retrieval (string or BaseMessage array)
1790
- * @param options - Configuration and context for the retrieval
1791
- * @returns Promise resolving to a string with the retrieved content
1792
- */
1793
- abstract retrieve(input: string | BaseMessage[], options: RetrieveOptions): Promise<string>;
1794
- /**
1795
- * Optional observability attributes for retriever spans.
1796
- * Override in subclasses to add context (e.g. knowledge base metadata).
1797
- */
1798
- getObservabilityAttributes(): Record<string, unknown>;
1799
- }
1800
-
1801
- /**
1802
- * ReadableStream type for voice responses
1803
- */
1804
- type ReadableStreamType = ReadableStream | NodeJS.ReadableStream | any;
1805
- /**
1806
- * Voice provider options
1807
- */
1808
- type VoiceOptions = {
1809
- /**
1810
- * API key for the voice provider
1811
- */
1812
- apiKey?: string;
1813
- /**
1814
- * Model to use for speech recognition
1815
- */
1816
- speechModel?: string;
1817
- /**
1818
- * Model to use for text-to-speech
1819
- */
1820
- ttsModel?: string;
1821
- /**
1822
- * Voice ID to use for text-to-speech
1823
- */
1824
- voice?: string;
1825
- /**
1826
- * Additional provider-specific options
1827
- */
1828
- options?: Record<string, unknown>;
1829
- };
1830
- /**
1831
- * Voice event types
1832
- */
1833
- type VoiceEventType = "speaking" | "listening" | "error" | "connected" | "disconnected";
1834
- /**
1835
- * Voice event data types
1836
- */
1837
- type VoiceEventData = {
1838
- speaking: {
1839
- text: string;
1840
- audio?: NodeJS.ReadableStream;
1841
- };
1842
- listening: {
1843
- audio: NodeJS.ReadableStream;
1844
- };
1845
- error: {
1846
- message: string;
1847
- code?: string;
1848
- details?: unknown;
1849
- };
1850
- connected: undefined;
1851
- disconnected: undefined;
1852
- };
1853
- /**
1854
- * Voice metadata
1855
- */
1856
- type VoiceMetadata = {
1857
- id: string;
1858
- name: string;
1859
- language: string;
1860
- gender?: "male" | "female" | "neutral";
1861
- metadata?: Record<string, unknown>;
1862
- };
1863
- /**
1864
- * Base interface for voice providers
1865
- */
1866
- type Voice = {
1867
- /**
1868
- * Convert text to speech
1869
- */
1870
- speak(text: string | NodeJS.ReadableStream, options?: {
1871
- voice?: string;
1872
- speed?: number;
1873
- pitch?: number;
1874
- }): Promise<NodeJS.ReadableStream>;
1875
- /**
1876
- * Convert speech to text
1877
- */
1878
- listen(audio: NodeJS.ReadableStream, options?: {
1879
- language?: string;
1880
- model?: string;
1881
- stream?: boolean;
1882
- }): Promise<string | ReadableStreamType>;
1883
- /**
1884
- * Connect to real-time voice service
1885
- */
1886
- connect(options?: Record<string, unknown>): Promise<void>;
1887
- /**
1888
- * Disconnect from real-time voice service
1889
- */
1890
- disconnect(): void;
1891
- /**
1892
- * Send audio data to real-time service
1893
- */
1894
- send(audioData: NodeJS.ReadableStream | Int16Array): Promise<void>;
1895
- /**
1896
- * Register event listener
1897
- */
1898
- on<E extends VoiceEventType>(event: E, callback: (data: VoiceEventData[E]) => void): void;
1899
- /**
1900
- * Remove event listener
1901
- */
1902
- off<E extends VoiceEventType>(event: E, callback: (data: VoiceEventData[E]) => void): void;
1903
- /**
1904
- * Get available voices
1929
+ *
1930
+ * @obtain Get your API keys from: https://console.voltagent.dev/settings/projects
1905
1931
  */
1906
- getVoices(): Promise<VoiceMetadata[]>;
1907
- };
1908
-
1909
- /**
1910
- * VoltOps Client Type Definitions
1911
- *
1912
- * All types related to VoltOps client functionality including
1913
- * prompt management, telemetry, and API interactions.
1914
- */
1915
- type ManagedMemoryStatus = "provisioning" | "ready" | "failed";
1916
-
1917
- /**
1918
- * Reference to a prompt in the VoltOps system
1919
- */
1920
- type PromptReference = {
1921
- /** Name of the prompt */
1922
- promptName: string;
1923
- /** Specific version number (takes precedence over label) */
1924
- version?: number;
1925
- /** Label to fetch (e.g., 'latest', 'production', 'staging') */
1926
- label?: string;
1927
- /** Variables to substitute in the template */
1928
- variables?: Record<string, any>;
1929
- /** Per-prompt cache configuration (overrides global settings) */
1932
+ secretKey?: string;
1933
+ /** Custom fetch implementation (optional) */
1934
+ fetch?: typeof fetch;
1935
+ /** Enable prompt management (default: true) */
1936
+ prompts?: boolean;
1937
+ /** Optional configuration for prompt caching */
1930
1938
  promptCache?: {
1931
1939
  enabled?: boolean;
1932
1940
  ttl?: number;
1933
1941
  maxSize?: number;
1934
1942
  };
1935
1943
  };
1936
- /**
1937
- * Helper interface for prompt operations in agent instructions
1938
- */
1939
- type PromptHelper = {
1940
- /** Get prompt content by reference */
1941
- getPrompt: (reference: PromptReference) => Promise<PromptContent>;
1942
- };
1943
- /**
1944
- * Enhanced dynamic value options with prompts support
1945
- */
1946
- interface DynamicValueOptions {
1947
- /** User context map */
1948
- context: Map<string | symbol, unknown>;
1949
- /** Prompt helper (available when VoltOpsClient is configured) */
1950
- prompts: PromptHelper;
1951
- }
1952
- /**
1953
- * Dynamic value type for agent configuration
1954
- */
1955
- type DynamicValue<T> = (options: DynamicValueOptions) => Promise<T> | T;
1956
- /**
1957
- * VoltOps client configuration options
1958
- */
1959
- type VoltOpsClientOptions = {
1960
- /** Base URL of the VoltOps API (default: https://api.voltagent.dev) */
1961
- baseUrl?: string;
1962
- /**
1963
- * Public API key for VoltOps authentication
1964
- *
1965
- * @description Your VoltOps public key used for API authentication and prompt management.
1966
- * This key is safe to use in client-side applications as it only provides read access.
1967
- *
1968
- * @format Should start with `pk_` prefix (e.g., `pk_1234567890abcdef`)
1969
- *
1970
- * @example
1971
- * ```typescript
1972
- * publicKey: process.env.VOLTAGENT_PUBLIC_KEY
1973
- * ```
1974
- *
1975
- *
1976
- * @obtain Get your API keys from: https://console.voltagent.dev/settings/projects
1977
- */
1978
- publicKey?: string;
1979
- /**
1980
- * Secret API key for VoltOps authentication
1981
- *
1982
- * @description Your VoltOps secret key used for secure API operations and analytics.
1983
- * This key provides full access to your VoltOps project and should be kept secure.
1984
- *
1985
- * @format Should start with `sk_` prefix (e.g., `sk_abcdef1234567890`)
1986
- *
1987
- * @example
1988
- * ```typescript
1989
- * secretKey: process.env.VOLTAGENT_SECRET_KEY
1990
- * ```
1991
- *
1992
- *
1993
- * @obtain Get your API keys from: https://console.voltagent.dev/settings/projects
1994
- */
1995
- secretKey?: string;
1996
- /** Custom fetch implementation (optional) */
1997
- fetch?: typeof fetch;
1998
- /** Enable prompt management (default: true) */
1999
- prompts?: boolean;
2000
- /** Optional configuration for prompt caching */
2001
- promptCache?: {
2002
- enabled?: boolean;
2003
- ttl?: number;
2004
- maxSize?: number;
2005
- };
2006
- };
2007
- type VoltOpsFeedbackConfig = {
2008
- type: "continuous" | "categorical" | "freeform";
2009
- min?: number;
2010
- max?: number;
2011
- categories?: Array<{
2012
- value: string | number;
2013
- label?: string;
2014
- description?: string;
2015
- }>;
2016
- [key: string]: any;
1944
+ type VoltOpsFeedbackConfig = {
1945
+ type: "continuous" | "categorical" | "freeform";
1946
+ min?: number;
1947
+ max?: number;
1948
+ categories?: Array<{
1949
+ value: string | number;
1950
+ label?: string;
1951
+ description?: string;
1952
+ }>;
1953
+ [key: string]: any;
2017
1954
  };
2018
1955
  type VoltOpsFeedbackExpiresIn = {
2019
1956
  days?: number;
@@ -2947,8 +2884,8 @@ interface ManagedMemoryStepsClient {
2947
2884
  interface ManagedMemoryVectorsClient {
2948
2885
  store(databaseId: string, input: ManagedMemoryStoreVectorInput): Promise<void>;
2949
2886
  storeBatch(databaseId: string, input: ManagedMemoryStoreVectorsBatchInput): Promise<void>;
2950
- search(databaseId: string, input: ManagedMemorySearchVectorsInput): Promise<SearchResult[]>;
2951
- 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>;
2952
2889
  delete(databaseId: string, vectorId: string): Promise<void>;
2953
2890
  deleteBatch(databaseId: string, input: ManagedMemoryDeleteVectorsInput): Promise<void>;
2954
2891
  clear(databaseId: string): Promise<void>;
@@ -6859,6 +6796,9 @@ interface OnToolEndHookArgs {
6859
6796
  context: OperationContext;
6860
6797
  options?: ToolExecuteOptions;
6861
6798
  }
6799
+ interface OnToolEndHookResult {
6800
+ output?: unknown;
6801
+ }
6862
6802
  interface OnPrepareMessagesHookArgs {
6863
6803
  /** The messages that will be sent to the LLM (AI SDK UIMessage). */
6864
6804
  messages: UIMessage[];
@@ -6943,7 +6883,7 @@ type AgentHookOnEnd = (args: OnEndHookArgs) => Promise<void> | void;
6943
6883
  type AgentHookOnHandoff = (args: OnHandoffHookArgs) => Promise<void> | void;
6944
6884
  type AgentHookOnHandoffComplete = (args: OnHandoffCompleteHookArgs) => Promise<void> | void;
6945
6885
  type AgentHookOnToolStart = (args: OnToolStartHookArgs) => Promise<void> | void;
6946
- type AgentHookOnToolEnd = (args: OnToolEndHookArgs) => Promise<void> | void;
6886
+ type AgentHookOnToolEnd = (args: OnToolEndHookArgs) => Promise<OnToolEndHookResult | undefined> | Promise<void> | OnToolEndHookResult | undefined;
6947
6887
  type AgentHookOnPrepareMessages = (args: OnPrepareMessagesHookArgs) => Promise<OnPrepareMessagesHookResult> | OnPrepareMessagesHookResult;
6948
6888
  type AgentHookOnPrepareModelMessages = (args: OnPrepareModelMessagesHookArgs) => Promise<OnPrepareModelMessagesHookResult> | OnPrepareModelMessagesHookResult;
6949
6889
  type AgentHookOnError = (args: OnErrorHookArgs) => Promise<void> | void;
@@ -6981,811 +6921,1155 @@ declare function createHooks(hooks?: Partial<AgentHooks>): AgentHooks;
6981
6921
  * 3. Context propagation works correctly across async operations
6982
6922
  * 4. Clean integration with VoltAgentObservability for WebSocket and storage
6983
6923
  */
6984
-
6985
- interface TraceContextOptions {
6986
- agentId: string;
6987
- agentName?: string;
6988
- userId?: string;
6989
- conversationId?: string;
6990
- operationId: string;
6991
- parentSpan?: Span;
6992
- parentAgentId?: string;
6993
- input?: string | UIMessage[] | BaseMessage[];
6924
+
6925
+ interface TraceContextOptions {
6926
+ agentId: string;
6927
+ agentName?: string;
6928
+ userId?: string;
6929
+ conversationId?: string;
6930
+ operationId: string;
6931
+ parentSpan?: Span;
6932
+ inheritParentSpan?: boolean;
6933
+ parentAgentId?: string;
6934
+ input?: string | UIMessage[] | BaseMessage[];
6935
+ }
6936
+ declare class AgentTraceContext {
6937
+ private rootSpan;
6938
+ private tracer;
6939
+ private commonAttributes;
6940
+ private activeContext;
6941
+ constructor(observability: VoltAgentObservability, operationName: string, options: TraceContextOptions);
6942
+ /**
6943
+ * Create a child span with automatic parent context and attribute inheritance
6944
+ */
6945
+ createChildSpan(name: string, type: "tool" | "memory" | "retriever" | "embedding" | "vector" | "agent" | "guardrail" | "middleware" | "llm" | "summary", options?: {
6946
+ label?: string;
6947
+ attributes?: Record<string, any>;
6948
+ kind?: SpanKind$1;
6949
+ }): Span;
6950
+ /**
6951
+ * Create a child span with a specific parent span
6952
+ */
6953
+ createChildSpanWithParent(parentSpan: Span, name: string, type: "tool" | "memory" | "retriever" | "embedding" | "vector" | "agent" | "guardrail" | "middleware" | "llm" | "summary", options?: {
6954
+ label?: string;
6955
+ attributes?: Record<string, any>;
6956
+ kind?: SpanKind$1;
6957
+ }): Span;
6958
+ /**
6959
+ * Execute a function within a span's context
6960
+ */
6961
+ withSpan<T>(span: Span, fn: () => T | Promise<T>): Promise<T>;
6962
+ /**
6963
+ * Get the root span
6964
+ */
6965
+ getRootSpan(): Span;
6966
+ /**
6967
+ * Set input on the root span
6968
+ */
6969
+ setInput(input: any): void;
6970
+ /**
6971
+ * Set output on the root span
6972
+ */
6973
+ setOutput(output: any): void;
6974
+ /**
6975
+ * Set instructions (system prompt) on the root span
6976
+ */
6977
+ setInstructions(instructions: any): void;
6978
+ /**
6979
+ * Set model attributes on the root span
6980
+ */
6981
+ setModelAttributes(modelName: string, temperature?: number, maxTokens?: number, topP?: number, frequencyPenalty?: number, presencePenalty?: number, maxSteps?: number): void;
6982
+ /**
6983
+ * Set usage information on the root span
6984
+ */
6985
+ setUsage(usage: {
6986
+ promptTokens?: number;
6987
+ completionTokens?: number;
6988
+ totalTokens?: number;
6989
+ cachedTokens?: number;
6990
+ reasoningTokens?: number;
6991
+ }): void;
6992
+ /**
6993
+ * Set finish reason on the root span
6994
+ */
6995
+ setFinishReason(finishReason: string | null | undefined): void;
6996
+ /**
6997
+ * Set stop condition metadata when maxSteps is reached
6998
+ */
6999
+ setStopConditionMet(stepCount: number, maxSteps: number): void;
7000
+ /**
7001
+ * End the root span with a status
7002
+ */
7003
+ end(status: "completed" | "error", error?: Error | any): void;
7004
+ /**
7005
+ * End a child span with proper status
7006
+ */
7007
+ endChildSpan(span: Span, status: "completed" | "error", options?: {
7008
+ output?: any;
7009
+ error?: Error | any;
7010
+ attributes?: Record<string, any>;
7011
+ }): void;
7012
+ private resolveParentSpan;
7013
+ /**
7014
+ * Get the active context for manual context propagation
7015
+ */
7016
+ getActiveContext(): Context;
7017
+ /**
7018
+ * Update active context with a new span
7019
+ */
7020
+ updateActiveContext(span: Span): void;
7021
+ }
7022
+
7023
+ /**
7024
+ * Tool representation for API responses
7025
+ */
7026
+ interface ApiToolInfo {
7027
+ name: string;
7028
+ description: string;
7029
+ parameters?: any;
7030
+ }
7031
+ interface AgentToolRoutingState {
7032
+ routers?: ApiToolInfo[];
7033
+ expose?: ApiToolInfo[];
7034
+ pool?: ApiToolInfo[];
7035
+ }
7036
+ type AgentFeedbackOptions = {
7037
+ key?: string;
7038
+ feedbackConfig?: VoltOpsFeedbackConfig | null;
7039
+ expiresAt?: Date | string;
7040
+ expiresIn?: VoltOpsFeedbackExpiresIn;
7041
+ };
7042
+ type AgentFeedbackMetadata = {
7043
+ traceId: string;
7044
+ key: string;
7045
+ url: string;
7046
+ tokenId?: string;
7047
+ expiresAt?: string;
7048
+ feedbackConfig?: VoltOpsFeedbackConfig | null;
7049
+ };
7050
+ /**
7051
+ * Tool with node_id for agent state
7052
+ */
7053
+ type ToolWithNodeId = (BaseTool | ProviderTool) & {
7054
+ node_id: string;
7055
+ };
7056
+ interface AgentScorerState {
7057
+ key: string;
7058
+ id: string;
7059
+ name: string;
7060
+ node_id: string;
7061
+ sampling?: SamplingPolicy;
7062
+ metadata?: Record<string, unknown> | null;
7063
+ params?: Record<string, unknown> | null;
7064
+ }
7065
+ /**
7066
+ * SubAgent data structure for agent state
7067
+ */
7068
+ interface SubAgentStateData {
7069
+ id: string;
7070
+ name: string;
7071
+ instructions?: string;
7072
+ status: string;
7073
+ model: string;
7074
+ tools: ApiToolInfo[];
7075
+ memory?: AgentMemoryState;
7076
+ node_id: string;
7077
+ subAgents?: SubAgentStateData[];
7078
+ scorers?: AgentScorerState[];
7079
+ guardrails?: AgentGuardrailStateGroup;
7080
+ methodConfig?: {
7081
+ method: string;
7082
+ schema?: string;
7083
+ options?: string[];
7084
+ };
7085
+ [key: string]: unknown;
7086
+ }
7087
+ /**
7088
+ * Memory block representation shared across agent and sub-agent state
7089
+ */
7090
+ interface AgentMemoryState extends Record<string, unknown> {
7091
+ node_id: string;
7092
+ type?: string;
7093
+ resourceId?: string;
7094
+ options?: MemoryOptions;
7095
+ available?: boolean;
7096
+ status?: string;
7097
+ storage?: MemoryStorageMetadata;
7098
+ workingMemory?: WorkingMemorySummary | null;
7099
+ vectorDB?: {
7100
+ enabled: boolean;
7101
+ adapter?: string;
7102
+ dimension?: number;
7103
+ status?: string;
7104
+ node_id?: string;
7105
+ } | null;
7106
+ embeddingModel?: {
7107
+ enabled: boolean;
7108
+ model?: string;
7109
+ dimension?: number;
7110
+ status?: string;
7111
+ node_id?: string;
7112
+ } | null;
7113
+ }
7114
+ /**
7115
+ * Full state of an agent including all properties
7116
+ */
7117
+ interface AgentFullState {
7118
+ id: string;
7119
+ name: string;
7120
+ instructions?: string;
7121
+ status: string;
7122
+ model: string;
7123
+ node_id: string;
7124
+ tools: ToolWithNodeId[];
7125
+ toolRouting?: AgentToolRoutingState;
7126
+ subAgents: SubAgentStateData[];
7127
+ memory: AgentMemoryState;
7128
+ scorers?: AgentScorerState[];
7129
+ retriever?: {
7130
+ name: string;
7131
+ description?: string;
7132
+ status?: string;
7133
+ node_id: string;
7134
+ } | null;
7135
+ guardrails?: AgentGuardrailStateGroup;
7136
+ }
7137
+ /**
7138
+ * Enhanced dynamic value for instructions that supports prompt management
7139
+ */
7140
+ type InstructionsDynamicValue = string | DynamicValue<string | PromptContent>;
7141
+ /**
7142
+ * Enhanced dynamic value for models that supports static or dynamic values
7143
+ */
7144
+ type ModelDynamicValue<T> = T | DynamicValue<T>;
7145
+ /**
7146
+ * Supported model references for agents (AI SDK models or provider/model strings)
7147
+ */
7148
+ type AgentModelReference = LanguageModel | ModelRouterModelId;
7149
+ /**
7150
+ * Model fallback configuration for agents.
7151
+ */
7152
+ type AgentModelConfig = {
7153
+ /**
7154
+ * Optional stable identifier for the model entry (useful for logging).
7155
+ */
7156
+ id?: string;
7157
+ /**
7158
+ * Model reference (static or dynamic).
7159
+ */
7160
+ model: ModelDynamicValue<AgentModelReference>;
7161
+ /**
7162
+ * Maximum number of retries for this model before falling back.
7163
+ * Defaults to the agent's maxRetries.
7164
+ */
7165
+ maxRetries?: number;
7166
+ /**
7167
+ * Whether this model is enabled for fallback selection.
7168
+ * @default true
7169
+ */
7170
+ enabled?: boolean;
7171
+ };
7172
+ /**
7173
+ * Agent model value that can be static, dynamic, or a fallback list.
7174
+ */
7175
+ type AgentModelValue = ModelDynamicValue<AgentModelReference> | AgentModelConfig[];
7176
+ /**
7177
+ * Provider options type for LLM configurations
7178
+ */
7179
+ type ProviderOptions = {
7180
+ temperature?: number;
7181
+ maxTokens?: number;
7182
+ topP?: number;
7183
+ frequencyPenalty?: number;
7184
+ presencePenalty?: number;
7185
+ seed?: number;
7186
+ stopSequences?: string[];
7187
+ extraOptions?: Record<string, unknown>;
7188
+ onStepFinish?: (step: StepWithContent) => Promise<void>;
7189
+ onFinish?: (result: unknown) => Promise<void>;
7190
+ onError?: (error: unknown) => Promise<void>;
7191
+ [key: string]: unknown;
7192
+ };
7193
+ /**
7194
+ * Configuration for supervisor agents that have subagents
7195
+ */
7196
+ /**
7197
+ * StreamEventType derived from AI SDK's TextStreamPart
7198
+ * Includes all event types from AI SDK
7199
+ */
7200
+ type StreamEventType = TextStreamPart<any>["type"];
7201
+ /**
7202
+ * Configuration for forwarding events from subagents to the parent agent's stream
7203
+ */
7204
+ type FullStreamEventForwardingConfig = {
7205
+ /**
7206
+ * Array of event types to forward from subagents
7207
+ * Uses AI SDK's TextStreamPart types:
7208
+ * - Text: 'text-start', 'text-end', 'text-delta'
7209
+ * - Reasoning: 'reasoning-start', 'reasoning-end', 'reasoning-delta'
7210
+ * - Tool: 'tool-input-start', 'tool-input-end', 'tool-input-delta',
7211
+ * 'tool-call', 'tool-result', 'tool-error'
7212
+ * - Other: 'source', 'file', 'start-step', 'finish-step',
7213
+ * 'start', 'finish', 'abort', 'error', 'raw'
7214
+ * @default ['tool-call', 'tool-result']
7215
+ * @example ['tool-call', 'tool-result', 'text-delta']
7216
+ */
7217
+ types?: StreamEventType[];
7218
+ };
7219
+ type SupervisorConfig = {
7220
+ /**
7221
+ * Complete custom system message for the supervisor agent
7222
+ * If provided, this completely replaces the default template
7223
+ * Only agents memory section will be appended if includeAgentsMemory is true
7224
+ */
7225
+ systemMessage?: string;
7226
+ /**
7227
+ * Whether to include agents memory in the supervisor system message
7228
+ * @default true
7229
+ */
7230
+ includeAgentsMemory?: boolean;
7231
+ /**
7232
+ * Additional custom guidelines for the supervisor agent
7233
+ */
7234
+ customGuidelines?: string[];
7235
+ /**
7236
+ * Configuration for forwarding events from subagents to the parent agent's full stream
7237
+ * Controls which event types are forwarded
7238
+ * @default { types: ['tool-call', 'tool-result'] }
7239
+ */
7240
+ fullStreamEventForwarding?: FullStreamEventForwardingConfig;
7241
+ /**
7242
+ * Whether to throw an exception when a subagent stream encounters an error
7243
+ * If true, stream errors will cause the handoff to throw an exception
7244
+ * If false, errors will be captured and returned in the result
7245
+ * @default false
7246
+ */
7247
+ throwOnStreamError?: boolean;
7248
+ /**
7249
+ * Whether to include error message in the result when no text content was produced
7250
+ * Only applies when throwOnStreamError is false
7251
+ * If true, the error message will be included in the result field
7252
+ * If false, the result will be empty but status will still be 'error'
7253
+ * @default true
7254
+ */
7255
+ includeErrorInEmptyResponse?: boolean;
7256
+ };
7257
+ type GuardrailSeverity = "info" | "warning" | "critical";
7258
+ type GuardrailAction = "allow" | "modify" | "block";
7259
+ interface GuardrailBaseResult {
7260
+ pass: boolean;
7261
+ action?: GuardrailAction;
7262
+ message?: string;
7263
+ metadata?: Record<string, unknown>;
7264
+ }
7265
+ interface OutputGuardrailStreamArgs extends GuardrailContext {
7266
+ part: VoltAgentTextStreamPart;
7267
+ streamParts: VoltAgentTextStreamPart[];
7268
+ state: Record<string, any>;
7269
+ abort: (reason?: string) => never;
7270
+ }
7271
+ type OutputGuardrailStreamResult = VoltAgentTextStreamPart | null | undefined | Promise<VoltAgentTextStreamPart | null | undefined>;
7272
+ type OutputGuardrailStreamHandler = (args: OutputGuardrailStreamArgs) => OutputGuardrailStreamResult;
7273
+ type GuardrailFunctionMetadata = {
7274
+ guardrailId?: string;
7275
+ guardrailName?: string;
7276
+ guardrailDescription?: string;
7277
+ guardrailTags?: string[];
7278
+ guardrailSeverity?: GuardrailSeverity;
7279
+ };
7280
+ type GuardrailFunction<TArgs, TResult> = ((args: TArgs) => TResult | Promise<TResult>) & GuardrailFunctionMetadata;
7281
+ interface GuardrailDefinition<TArgs, TResult> {
7282
+ id?: string;
7283
+ name?: string;
7284
+ description?: string;
7285
+ tags?: string[];
7286
+ severity?: GuardrailSeverity;
7287
+ metadata?: Record<string, unknown>;
7288
+ handler: GuardrailFunction<TArgs, TResult>;
7289
+ }
7290
+ type GuardrailConfig<TArgs, TResult> = GuardrailFunction<TArgs, TResult> | GuardrailDefinition<TArgs, TResult>;
7291
+ interface AgentGuardrailState {
7292
+ id?: string;
7293
+ name: string;
7294
+ direction: "input" | "output";
7295
+ description?: string;
7296
+ severity?: GuardrailSeverity;
7297
+ tags?: string[];
7298
+ metadata?: Record<string, unknown> | null;
7299
+ node_id: string;
7300
+ }
7301
+ interface AgentGuardrailStateGroup {
7302
+ input: AgentGuardrailState[];
7303
+ output: AgentGuardrailState[];
7304
+ }
7305
+ interface GuardrailContext {
7306
+ agent: Agent;
7307
+ context: OperationContext;
7308
+ operation: AgentEvalOperationType;
7309
+ }
7310
+ interface InputGuardrailArgs extends GuardrailContext {
7311
+ /**
7312
+ * The latest value after any previous guardrail modifications.
7313
+ */
7314
+ input: string | UIMessage[] | BaseMessage[];
7315
+ /**
7316
+ * Plain text representation of the latest input value.
7317
+ */
7318
+ inputText: string;
7319
+ /**
7320
+ * The original user provided value before any guardrail modifications.
7321
+ */
7322
+ originalInput: string | UIMessage[] | BaseMessage[];
7323
+ /**
7324
+ * Plain text representation of the original input value.
7325
+ */
7326
+ originalInputText: string;
7327
+ }
7328
+ interface InputGuardrailResult extends GuardrailBaseResult {
7329
+ modifiedInput?: string | UIMessage[] | BaseMessage[];
7330
+ }
7331
+ interface OutputGuardrailArgs<TOutput = unknown> extends GuardrailContext {
7332
+ /**
7333
+ * The latest value after any previous guardrail modifications.
7334
+ */
7335
+ output: TOutput;
7336
+ /**
7337
+ * Optional plain text representation of the latest output value.
7338
+ */
7339
+ outputText?: string;
7340
+ /**
7341
+ * The original value produced by the model before guardrail modifications.
7342
+ */
7343
+ originalOutput: TOutput;
7344
+ /**
7345
+ * Optional plain text representation of the original output value.
7346
+ */
7347
+ originalOutputText?: string;
7348
+ /**
7349
+ * Optional usage metrics for the generation.
7350
+ */
7351
+ usage?: UsageInfo;
7352
+ /**
7353
+ * Optional finish reason from the model/provider.
7354
+ */
7355
+ finishReason?: string | null;
7356
+ /**
7357
+ * Optional warnings or diagnostics returned by the provider.
7358
+ */
7359
+ warnings?: unknown[] | null;
7360
+ }
7361
+ interface OutputGuardrailResult<TOutput = unknown> extends GuardrailBaseResult {
7362
+ modifiedOutput?: TOutput;
7363
+ }
7364
+ type InputGuardrail = GuardrailConfig<InputGuardrailArgs, InputGuardrailResult>;
7365
+ type OutputGuardrailFunction<TOutput = unknown> = GuardrailFunction<OutputGuardrailArgs<TOutput>, OutputGuardrailResult<TOutput>> & {
7366
+ guardrailStreamHandler?: OutputGuardrailStreamHandler;
7367
+ };
7368
+ interface OutputGuardrailDefinition<TOutput = unknown> extends GuardrailDefinition<OutputGuardrailArgs<TOutput>, OutputGuardrailResult<TOutput>> {
7369
+ streamHandler?: OutputGuardrailStreamHandler;
7370
+ }
7371
+ type OutputGuardrail<TOutput = unknown> = OutputGuardrailFunction<TOutput> | OutputGuardrailDefinition<TOutput>;
7372
+ type MiddlewareDirection = "input" | "output";
7373
+ type MiddlewareFunctionMetadata = {
7374
+ middlewareId?: string;
7375
+ middlewareName?: string;
7376
+ middlewareDescription?: string;
7377
+ middlewareTags?: string[];
7378
+ };
7379
+ type MiddlewareFunction<TArgs, TResult> = ((args: TArgs) => TResult | Promise<TResult>) & MiddlewareFunctionMetadata;
7380
+ interface MiddlewareDefinition<TArgs, TResult> {
7381
+ id?: string;
7382
+ name?: string;
7383
+ description?: string;
7384
+ tags?: string[];
7385
+ metadata?: Record<string, unknown>;
7386
+ handler: MiddlewareFunction<TArgs, TResult>;
7387
+ }
7388
+ interface MiddlewareContext {
7389
+ agent: Agent;
7390
+ context: OperationContext;
7391
+ operation: AgentEvalOperationType;
7392
+ retryCount: number;
7393
+ }
7394
+ interface InputMiddlewareArgs extends MiddlewareContext {
7395
+ input: string | UIMessage[] | BaseMessage[];
7396
+ originalInput: string | UIMessage[] | BaseMessage[];
7397
+ abort: <TMetadata = unknown>(reason?: string, options?: MiddlewareAbortOptions<TMetadata>) => never;
7398
+ }
7399
+ type InputMiddlewareResult = string | UIMessage[] | BaseMessage[] | undefined;
7400
+ interface OutputMiddlewareArgs<TOutput = unknown> extends MiddlewareContext {
7401
+ output: TOutput;
7402
+ originalOutput: TOutput;
7403
+ usage?: UsageInfo;
7404
+ finishReason?: string | null;
7405
+ warnings?: unknown[] | null;
7406
+ abort: <TMetadata = unknown>(reason?: string, options?: MiddlewareAbortOptions<TMetadata>) => never;
7407
+ }
7408
+ type OutputMiddlewareResult<TOutput = unknown> = TOutput | undefined;
7409
+ type InputMiddleware = MiddlewareDefinition<InputMiddlewareArgs, InputMiddlewareResult> | MiddlewareFunction<InputMiddlewareArgs, InputMiddlewareResult>;
7410
+ type OutputMiddleware<TOutput = unknown> = MiddlewareDefinition<OutputMiddlewareArgs<TOutput>, OutputMiddlewareResult<TOutput>> | MiddlewareFunction<OutputMiddlewareArgs<TOutput>, OutputMiddlewareResult<TOutput>>;
7411
+ type AgentSummarizationOptions = {
7412
+ enabled?: boolean;
7413
+ triggerTokens?: number;
7414
+ keepMessages?: number;
7415
+ maxOutputTokens?: number;
7416
+ systemPrompt?: string | null;
7417
+ model?: AgentModelValue;
7418
+ };
7419
+ /**
7420
+ * Agent configuration options
7421
+ */
7422
+ type AgentOptions = {
7423
+ id?: string;
7424
+ name: string;
7425
+ purpose?: string;
7426
+ model: AgentModelValue;
7427
+ instructions: InstructionsDynamicValue;
7428
+ tools?: (Tool<any, any> | Toolkit | Tool$1)[] | DynamicValue<(Tool<any, any> | Toolkit)[]>;
7429
+ toolkits?: Toolkit[];
7430
+ toolRouting?: ToolRoutingConfig | false;
7431
+ memory?: Memory | false;
7432
+ summarization?: AgentSummarizationOptions | false;
7433
+ retriever?: BaseRetriever;
7434
+ subAgents?: SubAgentConfig[];
7435
+ supervisorConfig?: SupervisorConfig;
7436
+ maxHistoryEntries?: number;
7437
+ hooks?: AgentHooks;
7438
+ inputGuardrails?: InputGuardrail[];
7439
+ outputGuardrails?: OutputGuardrail<any>[];
7440
+ inputMiddlewares?: InputMiddleware[];
7441
+ outputMiddlewares?: OutputMiddleware<any>[];
7442
+ /**
7443
+ * Default retry count for middleware-triggered retries.
7444
+ * Per-call maxMiddlewareRetries overrides this value.
7445
+ */
7446
+ maxMiddlewareRetries?: number;
7447
+ temperature?: number;
7448
+ maxOutputTokens?: number;
7449
+ maxSteps?: number;
7450
+ /**
7451
+ * Default retry count for model calls before falling back.
7452
+ * Overridden by per-model maxRetries or per-call maxRetries.
7453
+ */
7454
+ maxRetries?: number;
7455
+ feedback?: AgentFeedbackOptions | boolean;
7456
+ /**
7457
+ * Default stop condition for step execution (ai-sdk `stopWhen`).
7458
+ * Per-call `stopWhen` in method options overrides this.
7459
+ */
7460
+ stopWhen?: StopWhen;
7461
+ markdown?: boolean;
7462
+ /**
7463
+ * When true, use the active VoltAgent span as the parent if parentSpan is not provided.
7464
+ * Defaults to true.
7465
+ */
7466
+ inheritParentSpan?: boolean;
7467
+ voice?: Voice;
7468
+ logger?: Logger;
7469
+ voltOpsClient?: VoltOpsClient;
7470
+ observability?: VoltAgentObservability;
7471
+ context?: ContextInput;
7472
+ eval?: AgentEvalConfig;
7473
+ };
7474
+ type AgentEvalOperationType = "generateText" | "generateTitle" | "streamText" | "generateObject" | "streamObject" | "workflow";
7475
+ interface AgentEvalPayload {
7476
+ operationId: string;
7477
+ operationType: AgentEvalOperationType;
7478
+ input?: string | null;
7479
+ output?: string | null;
7480
+ rawInput?: string | UIMessage[] | BaseMessage[];
7481
+ rawOutput?: unknown;
7482
+ userId?: string;
7483
+ conversationId?: string;
7484
+ traceId: string;
7485
+ spanId: string;
7486
+ metadata?: Record<string, unknown>;
7487
+ }
7488
+ type AgentEvalContext = AgentEvalPayload & Record<string, unknown> & {
7489
+ agentId: string;
7490
+ agentName: string;
7491
+ timestamp: string;
7492
+ rawPayload: AgentEvalPayload;
7493
+ };
7494
+ type AgentEvalParams = Record<string, unknown>;
7495
+ type AgentEvalSamplingPolicy = SamplingPolicy;
7496
+ type AgentEvalScorerFactory = () => LocalScorerDefinition<AgentEvalContext, Record<string, unknown>> | Promise<LocalScorerDefinition<AgentEvalContext, Record<string, unknown>>>;
7497
+ type AgentEvalScorerReference = LocalScorerDefinition<AgentEvalContext, Record<string, unknown>> | AgentEvalScorerFactory;
7498
+ interface AgentEvalResult {
7499
+ scorerId: string;
7500
+ scorerName?: string;
7501
+ status: "success" | "error" | "skipped";
7502
+ score?: number | null;
7503
+ metadata?: Record<string, unknown> | null;
7504
+ error?: unknown;
7505
+ durationMs?: number;
7506
+ payload: AgentEvalPayload;
7507
+ rawPayload: AgentEvalPayload;
7508
+ }
7509
+ type AgentEvalFeedbackSaveInput = Omit<VoltOpsFeedbackCreateInput, "traceId"> & {
7510
+ traceId?: string;
7511
+ };
7512
+ type AgentEvalFeedbackHelper = {
7513
+ save: (input: AgentEvalFeedbackSaveInput) => Promise<VoltOpsFeedback | null>;
7514
+ };
7515
+ type AgentEvalResultCallbackArgs = AgentEvalResult & {
7516
+ result: AgentEvalResult;
7517
+ feedback: AgentEvalFeedbackHelper;
7518
+ };
7519
+ interface AgentEvalScorerConfig {
7520
+ scorer: AgentEvalScorerReference;
7521
+ params?: AgentEvalParams | ((context: AgentEvalContext) => AgentEvalParams | undefined | Promise<AgentEvalParams | undefined>);
7522
+ sampling?: AgentEvalSamplingPolicy;
7523
+ id?: string;
7524
+ onResult?: (result: AgentEvalResultCallbackArgs) => void | Promise<void>;
7525
+ buildPayload?: (context: AgentEvalContext) => Record<string, unknown> | Promise<Record<string, unknown>>;
7526
+ buildParams?: (context: AgentEvalContext) => AgentEvalParams | undefined | Promise<AgentEvalParams | undefined>;
7527
+ }
7528
+ interface AgentEvalConfig {
7529
+ scorers: Record<string, AgentEvalScorerConfig>;
7530
+ triggerSource?: string;
7531
+ environment?: string;
7532
+ sampling?: AgentEvalSamplingPolicy;
7533
+ redact?: (payload: AgentEvalPayload) => AgentEvalPayload;
7534
+ }
7535
+ /**
7536
+ * Agent status information
7537
+ */
7538
+ type AgentStatus = "idle" | "working" | "error" | "completed" | "cancelled";
7539
+ /**
7540
+ * Tool call definition
7541
+ */
7542
+ type ToolCall$1 = {
7543
+ id: string;
7544
+ type: "function";
7545
+ function: {
7546
+ name: string;
7547
+ arguments: string;
7548
+ };
7549
+ };
7550
+ /**
7551
+ * Model tool call format
7552
+ */
7553
+ type ModelToolCall = {
7554
+ type: "tool-call";
7555
+ toolCallId: string;
7556
+ toolName: string;
7557
+ args: Record<string, unknown>;
7558
+ };
7559
+ /**
7560
+ * Represents the payload used when sending a tool's result back to the chat runtime
7561
+ * via useChat().addToolResult in the Vercel AI SDK.
7562
+ */
7563
+ type ClientSideToolResult = {
7564
+ tool: string;
7565
+ toolCallId: string;
7566
+ output: unknown;
7567
+ } | {
7568
+ tool: string;
7569
+ toolCallId: string;
7570
+ state: "output-error";
7571
+ errorText: string;
7572
+ };
7573
+ /**
7574
+ * Agent response format
7575
+ */
7576
+ type AgentResponse = {
7577
+ /**
7578
+ * Response content
7579
+ */
7580
+ content: string;
7581
+ /**
7582
+ * Tool calls made by the model (if any)
7583
+ */
7584
+ toolCalls?: ToolCall$1[];
7585
+ /**
7586
+ * Additional metadata
7587
+ */
7588
+ metadata: {
7589
+ agentId: string;
7590
+ agentName: string;
7591
+ [key: string]: unknown;
7592
+ };
7593
+ };
7594
+ /**
7595
+ * Context for a specific agent operation (e.g., one generateText call)
7596
+ */
7597
+ type OperationContext = {
7598
+ /** Unique identifier for the operation */
7599
+ readonly operationId: string;
7600
+ /** Optional user identifier associated with this operation */
7601
+ userId?: string;
7602
+ /** Optional conversation identifier associated with this operation */
7603
+ conversationId?: string;
7604
+ /** User-managed context map for this operation */
7605
+ readonly context: Map<string | symbol, unknown>;
7606
+ /** System-managed context map for internal operation tracking */
7607
+ readonly systemContext: Map<string | symbol, unknown>;
7608
+ /** Whether this operation is still active */
7609
+ isActive: boolean;
7610
+ /** Parent agent ID if part of a delegation chain */
7611
+ parentAgentId?: string;
7612
+ /** Optional elicitation bridge for requesting user input */
7613
+ elicitation?: (request: unknown) => Promise<unknown>;
7614
+ /** Trace context for managing span hierarchy and common attributes */
7615
+ traceContext: AgentTraceContext;
7616
+ /** Execution-scoped logger with full context (userId, conversationId, executionId) */
7617
+ logger: Logger;
7618
+ /** Conversation steps for building full message history including tool calls/results */
7619
+ conversationSteps?: StepWithContent[];
7620
+ /** AbortController for cancelling the operation and accessing the signal */
7621
+ abortController: AbortController;
7622
+ /** Start time of the operation (Date object) */
7623
+ startTime: Date;
7624
+ /** Cancellation error to be thrown when operation is aborted */
7625
+ cancellationError?: CancellationError;
7626
+ /** Input provided to the agent operation (string, UIMessages, or BaseMessages) */
7627
+ input?: string | UIMessage[] | BaseMessage[];
7628
+ /** Output generated by the agent operation (text or object) */
7629
+ output?: string | object;
7630
+ };
7631
+ /**
7632
+ * Specific information related to a tool execution error.
7633
+ */
7634
+ interface ToolErrorInfo {
7635
+ /** The unique identifier of the tool call. */
7636
+ toolCallId: string;
7637
+ /** The name of the tool that was executed. */
7638
+ toolName: string;
7639
+ /** The original error thrown directly by the tool during execution (if available). */
7640
+ toolExecutionError?: unknown;
7641
+ /** The arguments passed to the tool when the error occurred (for debugging). */
7642
+ toolArguments?: unknown;
7643
+ }
7644
+ /**
7645
+ * Type for onError callbacks in streaming operations.
7646
+ * Providers must pass an error conforming to the VoltAgentError structure.
7647
+ */
7648
+ type StreamOnErrorCallback = (error: VoltAgentError) => Promise<void> | void;
7649
+ type UserContext = Map<string | symbol, unknown>;
7650
+ /**
7651
+ * Standardized object structure passed to the onFinish callback
7652
+ * when streamText completes successfully.
7653
+ */
7654
+ interface StreamTextFinishResult {
7655
+ /** The final, consolidated text output from the stream. */
7656
+ text: string;
7657
+ /** Token usage information (if available). */
7658
+ usage?: UsageInfo;
7659
+ /** Feedback metadata for the trace, if enabled. */
7660
+ feedback?: AgentFeedbackMetadata | null;
7661
+ /** The reason the stream finished (if available, e.g., 'stop', 'length', 'tool-calls'). */
7662
+ finishReason?: string;
7663
+ /** The original completion response object from the provider (if available). */
7664
+ providerResponse?: unknown;
7665
+ /** Any warnings generated during the completion (if available). */
7666
+ warnings?: unknown[];
7667
+ /** User context containing any custom metadata from the operation. */
7668
+ context?: UserContext;
7669
+ }
7670
+ /**
7671
+ * Type for the onFinish callback function for streamText.
7672
+ */
7673
+ type StreamTextOnFinishCallback = (result: StreamTextFinishResult) => Promise<void> | void;
7674
+ /**
7675
+ * Standardized object structure passed to the onFinish callback
7676
+ * when streamObject completes successfully.
7677
+ * @template TObject The expected type of the fully formed object.
7678
+ */
7679
+ interface StreamObjectFinishResult<TObject> {
7680
+ /** The final, fully formed object from the stream. */
7681
+ object: TObject;
7682
+ /** Token usage information (if available). */
7683
+ usage?: UsageInfo;
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
+ /** The reason the stream finished (if available). Although less common for object streams. */
7689
+ finishReason?: string;
7690
+ /** User context containing any custom metadata from the operation. */
7691
+ context?: UserContext;
7692
+ }
7693
+ /**
7694
+ * Type for the onFinish callback function for streamObject.
7695
+ * @template TObject The expected type of the fully formed object.
7696
+ */
7697
+ type StreamObjectOnFinishCallback<TObject> = (result: StreamObjectFinishResult<TObject>) => Promise<void> | void;
7698
+ /**
7699
+ * Standardized success result structure for generateText.
7700
+ */
7701
+ interface StandardizedTextResult {
7702
+ /** The generated text. */
7703
+ text: string;
7704
+ /** Token usage information (if available). */
7705
+ usage?: UsageInfo;
7706
+ /** Feedback metadata for the trace, if enabled. */
7707
+ feedback?: AgentFeedbackMetadata | null;
7708
+ /** Original provider response (if needed). */
7709
+ providerResponse?: unknown;
7710
+ /** Finish reason (if available from provider). */
7711
+ finishReason?: string;
7712
+ /** Warnings (if available from provider). */
7713
+ warnings?: unknown[];
7714
+ /** User context containing any custom metadata from the operation. */
7715
+ context?: UserContext;
7716
+ }
7717
+ /**
7718
+ * Standardized success result structure for generateObject.
7719
+ * @template TObject The expected type of the generated object.
7720
+ */
7721
+ interface StandardizedObjectResult<TObject> {
7722
+ /** The generated object. */
7723
+ object: TObject;
7724
+ /** Token usage information (if available). */
7725
+ usage?: UsageInfo;
7726
+ /** Original provider response (if needed). */
7727
+ providerResponse?: unknown;
7728
+ /** Finish reason (if available from provider). */
7729
+ finishReason?: string;
7730
+ /** Warnings (if available from provider). */
7731
+ warnings?: unknown[];
7732
+ /** User context containing any custom metadata from the operation. */
7733
+ context?: UserContext;
7734
+ }
7735
+ /**
7736
+ * Unified output type for the onEnd hook, representing the successful result
7737
+ * of any core agent operation. Use 'type guarding' or check specific fields
7738
+ * within the hook implementation to determine the concrete type.
7739
+ * Object types are generalized to 'unknown' here for the union.
7740
+ */
7741
+ type AgentOperationOutput = StandardizedTextResult | StreamTextFinishResult | StandardizedObjectResult<unknown> | StreamObjectFinishResult<unknown>;
7742
+
7743
+ /**
7744
+ * Custom error classes for Memory V2
7745
+ */
7746
+ /**
7747
+ * Base error class for Memory V2
7748
+ */
7749
+ declare class MemoryV2Error extends Error {
7750
+ readonly code: string;
7751
+ readonly details?: Record<string, unknown> | undefined;
7752
+ constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
6994
7753
  }
6995
- declare class AgentTraceContext {
6996
- private rootSpan;
6997
- private tracer;
6998
- private commonAttributes;
6999
- private activeContext;
7000
- constructor(observability: VoltAgentObservability, operationName: string, options: TraceContextOptions);
7001
- /**
7002
- * Create a child span with automatic parent context and attribute inheritance
7003
- */
7004
- createChildSpan(name: string, type: "tool" | "memory" | "retriever" | "embedding" | "vector" | "agent" | "guardrail" | "middleware" | "llm" | "summary", options?: {
7005
- label?: string;
7006
- attributes?: Record<string, any>;
7007
- kind?: SpanKind$1;
7008
- }): Span;
7009
- /**
7010
- * Create a child span with a specific parent span
7011
- */
7012
- createChildSpanWithParent(parentSpan: Span, name: string, type: "tool" | "memory" | "retriever" | "embedding" | "vector" | "agent" | "guardrail" | "middleware" | "llm" | "summary", options?: {
7013
- label?: string;
7014
- attributes?: Record<string, any>;
7015
- kind?: SpanKind$1;
7016
- }): Span;
7017
- /**
7018
- * Execute a function within a span's context
7019
- */
7020
- withSpan<T>(span: Span, fn: () => T | Promise<T>): Promise<T>;
7021
- /**
7022
- * Get the root span
7023
- */
7024
- getRootSpan(): Span;
7025
- /**
7026
- * Set input on the root span
7027
- */
7028
- setInput(input: any): void;
7029
- /**
7030
- * Set output on the root span
7031
- */
7032
- setOutput(output: any): void;
7033
- /**
7034
- * Set instructions (system prompt) on the root span
7035
- */
7036
- setInstructions(instructions: any): void;
7037
- /**
7038
- * Set model attributes on the root span
7039
- */
7040
- setModelAttributes(modelName: string, temperature?: number, maxTokens?: number, topP?: number, frequencyPenalty?: number, presencePenalty?: number, maxSteps?: number): void;
7041
- /**
7042
- * Set usage information on the root span
7043
- */
7044
- setUsage(usage: {
7045
- promptTokens?: number;
7046
- completionTokens?: number;
7047
- totalTokens?: number;
7048
- cachedTokens?: number;
7049
- reasoningTokens?: number;
7050
- }): void;
7051
- /**
7052
- * Set finish reason on the root span
7053
- */
7054
- setFinishReason(finishReason: string | null | undefined): void;
7055
- /**
7056
- * Set stop condition metadata when maxSteps is reached
7057
- */
7058
- setStopConditionMet(stepCount: number, maxSteps: number): void;
7059
- /**
7060
- * End the root span with a status
7061
- */
7062
- end(status: "completed" | "error", error?: Error | any): void;
7063
- /**
7064
- * End a child span with proper status
7065
- */
7066
- endChildSpan(span: Span, status: "completed" | "error", options?: {
7067
- output?: any;
7068
- error?: Error | any;
7069
- attributes?: Record<string, any>;
7070
- }): void;
7071
- private resolveParentSpan;
7072
- /**
7073
- * Get the active context for manual context propagation
7074
- */
7075
- getActiveContext(): Context;
7076
- /**
7077
- * Update active context with a new span
7078
- */
7079
- updateActiveContext(span: Span): void;
7754
+ /**
7755
+ * Error thrown when a storage operation fails
7756
+ */
7757
+ declare class StorageError extends MemoryV2Error {
7758
+ constructor(message: string, details?: Record<string, unknown>);
7080
7759
  }
7081
-
7082
7760
  /**
7083
- * Tool representation for API responses
7761
+ * Error thrown when an embedding operation fails
7084
7762
  */
7085
- interface ApiToolInfo {
7086
- name: string;
7087
- description: string;
7088
- parameters?: any;
7763
+ declare class EmbeddingError extends MemoryV2Error {
7764
+ constructor(message: string, details?: Record<string, unknown>);
7089
7765
  }
7090
- type AgentFeedbackOptions = {
7091
- key?: string;
7092
- feedbackConfig?: VoltOpsFeedbackConfig | null;
7093
- expiresAt?: Date | string;
7094
- expiresIn?: VoltOpsFeedbackExpiresIn;
7095
- };
7096
- type AgentFeedbackMetadata = {
7097
- traceId: string;
7098
- key: string;
7099
- url: string;
7100
- tokenId?: string;
7101
- expiresAt?: string;
7102
- feedbackConfig?: VoltOpsFeedbackConfig | null;
7103
- };
7104
7766
  /**
7105
- * Tool with node_id for agent state
7767
+ * Error thrown when a vector operation fails
7106
7768
  */
7107
- interface ToolWithNodeId extends BaseTool {
7108
- node_id: string;
7769
+ declare class VectorError extends MemoryV2Error {
7770
+ constructor(message: string, details?: Record<string, unknown>);
7109
7771
  }
7110
- interface AgentScorerState {
7111
- key: string;
7112
- id: string;
7113
- name: string;
7114
- node_id: string;
7115
- sampling?: SamplingPolicy;
7116
- metadata?: Record<string, unknown> | null;
7117
- params?: Record<string, unknown> | null;
7772
+ /**
7773
+ * Error thrown when a conversation is not found
7774
+ */
7775
+ declare class ConversationNotFoundError extends MemoryV2Error {
7776
+ constructor(conversationId: string);
7118
7777
  }
7119
7778
  /**
7120
- * SubAgent data structure for agent state
7779
+ * Error thrown when trying to create a conversation that already exists
7121
7780
  */
7122
- interface SubAgentStateData {
7123
- id: string;
7124
- name: string;
7125
- instructions?: string;
7126
- status: string;
7127
- model: string;
7128
- tools: ApiToolInfo[];
7129
- memory?: AgentMemoryState;
7130
- node_id: string;
7131
- subAgents?: SubAgentStateData[];
7132
- scorers?: AgentScorerState[];
7133
- guardrails?: AgentGuardrailStateGroup;
7134
- methodConfig?: {
7135
- method: string;
7136
- schema?: string;
7137
- options?: string[];
7138
- };
7139
- [key: string]: unknown;
7781
+ declare class ConversationAlreadyExistsError extends MemoryV2Error {
7782
+ constructor(conversationId: string);
7140
7783
  }
7141
7784
  /**
7142
- * Memory block representation shared across agent and sub-agent state
7785
+ * Error thrown when vector adapter is required but not configured
7143
7786
  */
7144
- interface AgentMemoryState extends Record<string, unknown> {
7145
- node_id: string;
7146
- type?: string;
7147
- resourceId?: string;
7148
- options?: MemoryOptions;
7149
- available?: boolean;
7150
- status?: string;
7151
- storage?: MemoryStorageMetadata;
7152
- workingMemory?: WorkingMemorySummary | null;
7153
- vectorDB?: {
7154
- enabled: boolean;
7155
- adapter?: string;
7156
- dimension?: number;
7157
- status?: string;
7158
- node_id?: string;
7159
- } | null;
7160
- embeddingModel?: {
7161
- enabled: boolean;
7162
- model?: string;
7163
- dimension?: number;
7164
- status?: string;
7165
- node_id?: string;
7166
- } | null;
7787
+ declare class VectorAdapterNotConfiguredError extends MemoryV2Error {
7788
+ constructor(operation: string);
7167
7789
  }
7168
7790
  /**
7169
- * Full state of an agent including all properties
7791
+ * Error thrown when embedding adapter is required but not configured
7170
7792
  */
7171
- interface AgentFullState {
7172
- id: string;
7173
- name: string;
7174
- instructions?: string;
7175
- status: string;
7176
- model: string;
7177
- node_id: string;
7178
- tools: ToolWithNodeId[];
7179
- subAgents: SubAgentStateData[];
7180
- memory: AgentMemoryState;
7181
- scorers?: AgentScorerState[];
7182
- retriever?: {
7183
- name: string;
7184
- description?: string;
7185
- status?: string;
7186
- node_id: string;
7187
- } | null;
7188
- guardrails?: AgentGuardrailStateGroup;
7793
+ declare class EmbeddingAdapterNotConfiguredError extends MemoryV2Error {
7794
+ constructor(operation: string);
7189
7795
  }
7796
+
7190
7797
  /**
7191
- * Enhanced dynamic value for instructions that supports prompt management
7798
+ * Vector math utilities for similarity calculations
7192
7799
  */
7193
- type InstructionsDynamicValue = string | DynamicValue<string | PromptContent>;
7194
7800
  /**
7195
- * Enhanced dynamic value for models that supports static or dynamic values
7801
+ * Calculate cosine similarity between two vectors
7802
+ * Returns a value between -1 and 1, where 1 means identical direction,
7803
+ * 0 means perpendicular, and -1 means opposite direction
7196
7804
  */
7197
- type ModelDynamicValue<T> = T | DynamicValue<T>;
7805
+ declare function cosineSimilarity(a: number[], b: number[]): number;
7806
+
7198
7807
  /**
7199
- * Supported model references for agents (AI SDK models or provider/model strings)
7808
+ * Memory - Clean architecture for conversation memory and state management
7200
7809
  */
7201
- type AgentModelReference = LanguageModel | ModelRouterModelId;
7810
+
7202
7811
  /**
7203
- * Model fallback configuration for agents.
7812
+ * Memory Class
7813
+ * Handles conversation memory with optional vector search capabilities
7204
7814
  */
7205
- type AgentModelConfig = {
7815
+ declare class Memory {
7816
+ private readonly storage;
7817
+ private readonly embedding?;
7818
+ private readonly vector?;
7819
+ private embeddingCache?;
7820
+ private readonly workingMemoryConfig?;
7821
+ private readonly titleGenerationConfig?;
7822
+ private resourceId?;
7823
+ private logger?;
7824
+ constructor(options: MemoryConfig);
7825
+ /**
7826
+ * Get messages from a conversation
7827
+ */
7828
+ getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage<{
7829
+ createdAt: Date;
7830
+ }>[]>;
7831
+ /**
7832
+ * Save a single message
7833
+ */
7834
+ saveMessage(message: UIMessage, userId: string, conversationId: string): Promise<void>;
7835
+ saveConversationSteps(steps: ConversationStepRecord[]): Promise<void>;
7206
7836
  /**
7207
- * Optional stable identifier for the model entry (useful for logging).
7837
+ * Add a single message (alias for consistency with existing API)
7208
7838
  */
7209
- id?: string;
7839
+ addMessage(message: UIMessage, userId: string, conversationId: string, context?: OperationContext): Promise<void>;
7210
7840
  /**
7211
- * Model reference (static or dynamic).
7841
+ * Add multiple messages in batch
7212
7842
  */
7213
- model: ModelDynamicValue<AgentModelReference>;
7843
+ addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
7214
7844
  /**
7215
- * Maximum number of retries for this model before falling back.
7216
- * Defaults to the agent's maxRetries.
7845
+ * Clear messages for a user
7217
7846
  */
7218
- maxRetries?: number;
7847
+ clearMessages(userId: string, conversationId?: string, context?: OperationContext): Promise<void>;
7219
7848
  /**
7220
- * Whether this model is enabled for fallback selection.
7221
- * @default true
7849
+ * Delete specific messages by ID for a conversation
7850
+ * Adapters should delete atomically when possible; otherwise a best-effort delete may be used.
7222
7851
  */
7223
- enabled?: boolean;
7224
- };
7225
- /**
7226
- * Agent model value that can be static, dynamic, or a fallback list.
7227
- */
7228
- type AgentModelValue = ModelDynamicValue<AgentModelReference> | AgentModelConfig[];
7229
- /**
7230
- * Provider options type for LLM configurations
7231
- */
7232
- type ProviderOptions = {
7233
- temperature?: number;
7234
- maxTokens?: number;
7235
- topP?: number;
7236
- frequencyPenalty?: number;
7237
- presencePenalty?: number;
7238
- seed?: number;
7239
- stopSequences?: string[];
7240
- extraOptions?: Record<string, unknown>;
7241
- onStepFinish?: (step: StepWithContent) => Promise<void>;
7242
- onFinish?: (result: unknown) => Promise<void>;
7243
- onError?: (error: unknown) => Promise<void>;
7244
- [key: string]: unknown;
7245
- };
7246
- /**
7247
- * Configuration for supervisor agents that have subagents
7248
- */
7249
- /**
7250
- * StreamEventType derived from AI SDK's TextStreamPart
7251
- * Includes all event types from AI SDK
7252
- */
7253
- type StreamEventType = TextStreamPart<any>["type"];
7254
- /**
7255
- * Configuration for forwarding events from subagents to the parent agent's stream
7256
- */
7257
- type FullStreamEventForwardingConfig = {
7852
+ deleteMessages(messageIds: string[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
7853
+ getConversationSteps(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
7258
7854
  /**
7259
- * Array of event types to forward from subagents
7260
- * Uses AI SDK's TextStreamPart types:
7261
- * - Text: 'text-start', 'text-end', 'text-delta'
7262
- * - Reasoning: 'reasoning-start', 'reasoning-end', 'reasoning-delta'
7263
- * - Tool: 'tool-input-start', 'tool-input-end', 'tool-input-delta',
7264
- * 'tool-call', 'tool-result', 'tool-error'
7265
- * - Other: 'source', 'file', 'start-step', 'finish-step',
7266
- * 'start', 'finish', 'abort', 'error', 'raw'
7267
- * @default ['tool-call', 'tool-result']
7268
- * @example ['tool-call', 'tool-result', 'text-delta']
7855
+ * Get a conversation by ID
7269
7856
  */
7270
- types?: StreamEventType[];
7271
- };
7272
- type SupervisorConfig = {
7857
+ getConversation(id: string): Promise<Conversation | null>;
7273
7858
  /**
7274
- * Complete custom system message for the supervisor agent
7275
- * If provided, this completely replaces the default template
7276
- * Only agents memory section will be appended if includeAgentsMemory is true
7859
+ * Get conversations for a resource
7277
7860
  */
7278
- systemMessage?: string;
7861
+ getConversations(resourceId: string): Promise<Conversation[]>;
7279
7862
  /**
7280
- * Whether to include agents memory in the supervisor system message
7281
- * @default true
7863
+ * Get conversations by user ID with query options
7282
7864
  */
7283
- includeAgentsMemory?: boolean;
7865
+ getConversationsByUserId(userId: string, options?: Omit<ConversationQueryOptions, "userId">): Promise<Conversation[]>;
7284
7866
  /**
7285
- * Additional custom guidelines for the supervisor agent
7867
+ * Query conversations with advanced options
7286
7868
  */
7287
- customGuidelines?: string[];
7869
+ queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
7288
7870
  /**
7289
- * Configuration for forwarding events from subagents to the parent agent's full stream
7290
- * Controls which event types are forwarded
7291
- * @default { types: ['tool-call', 'tool-result'] }
7871
+ * Count conversations with the same filtering as queryConversations (ignores limit/offset)
7292
7872
  */
7293
- fullStreamEventForwarding?: FullStreamEventForwardingConfig;
7873
+ countConversations(options: ConversationQueryOptions): Promise<number>;
7294
7874
  /**
7295
- * Whether to throw an exception when a subagent stream encounters an error
7296
- * If true, stream errors will cause the handoff to throw an exception
7297
- * If false, errors will be captured and returned in the result
7298
- * @default false
7875
+ * Create a new conversation
7299
7876
  */
7300
- throwOnStreamError?: boolean;
7877
+ createConversation(input: CreateConversationInput): Promise<Conversation>;
7301
7878
  /**
7302
- * Whether to include error message in the result when no text content was produced
7303
- * Only applies when throwOnStreamError is false
7304
- * If true, the error message will be included in the result field
7305
- * If false, the result will be empty but status will still be 'error'
7306
- * @default true
7879
+ * Update a conversation
7307
7880
  */
7308
- includeErrorInEmptyResponse?: boolean;
7309
- };
7310
- type GuardrailSeverity = "info" | "warning" | "critical";
7311
- type GuardrailAction = "allow" | "modify" | "block";
7312
- interface GuardrailBaseResult {
7313
- pass: boolean;
7314
- action?: GuardrailAction;
7315
- message?: string;
7316
- metadata?: Record<string, unknown>;
7317
- }
7318
- interface OutputGuardrailStreamArgs extends GuardrailContext {
7319
- part: VoltAgentTextStreamPart;
7320
- streamParts: VoltAgentTextStreamPart[];
7321
- state: Record<string, any>;
7322
- abort: (reason?: string) => never;
7323
- }
7324
- type OutputGuardrailStreamResult = VoltAgentTextStreamPart | null | undefined | Promise<VoltAgentTextStreamPart | null | undefined>;
7325
- type OutputGuardrailStreamHandler = (args: OutputGuardrailStreamArgs) => OutputGuardrailStreamResult;
7326
- type GuardrailFunctionMetadata = {
7327
- guardrailId?: string;
7328
- guardrailName?: string;
7329
- guardrailDescription?: string;
7330
- guardrailTags?: string[];
7331
- guardrailSeverity?: GuardrailSeverity;
7332
- };
7333
- type GuardrailFunction<TArgs, TResult> = ((args: TArgs) => TResult | Promise<TResult>) & GuardrailFunctionMetadata;
7334
- interface GuardrailDefinition<TArgs, TResult> {
7335
- id?: string;
7336
- name?: string;
7337
- description?: string;
7338
- tags?: string[];
7339
- severity?: GuardrailSeverity;
7340
- metadata?: Record<string, unknown>;
7341
- handler: GuardrailFunction<TArgs, TResult>;
7342
- }
7343
- type GuardrailConfig<TArgs, TResult> = GuardrailFunction<TArgs, TResult> | GuardrailDefinition<TArgs, TResult>;
7344
- interface AgentGuardrailState {
7345
- id?: string;
7346
- name: string;
7347
- direction: "input" | "output";
7348
- description?: string;
7349
- severity?: GuardrailSeverity;
7350
- tags?: string[];
7351
- metadata?: Record<string, unknown> | null;
7352
- node_id: string;
7353
- }
7354
- interface AgentGuardrailStateGroup {
7355
- input: AgentGuardrailState[];
7356
- output: AgentGuardrailState[];
7357
- }
7358
- interface GuardrailContext {
7359
- agent: Agent;
7360
- context: OperationContext;
7361
- operation: AgentEvalOperationType;
7362
- }
7363
- interface InputGuardrailArgs extends GuardrailContext {
7881
+ updateConversation(id: string, updates: Partial<Omit<Conversation, "id" | "createdAt" | "updatedAt">>): Promise<Conversation>;
7364
7882
  /**
7365
- * The latest value after any previous guardrail modifications.
7883
+ * Delete a conversation
7366
7884
  */
7367
- input: string | UIMessage[] | BaseMessage[];
7885
+ deleteConversation(id: string): Promise<void>;
7368
7886
  /**
7369
- * Plain text representation of the latest input value.
7887
+ * Get messages with semantic search
7888
+ * Combines recent messages with semantically similar messages
7370
7889
  */
7371
- inputText: string;
7890
+ getMessagesWithSemanticSearch(userId: string, conversationId: string, currentQuery?: string, options?: {
7891
+ limit?: number;
7892
+ semanticLimit?: number;
7893
+ semanticThreshold?: number;
7894
+ mergeStrategy?: "prepend" | "append" | "interleave";
7895
+ }): Promise<UIMessage<{
7896
+ createdAt: Date;
7897
+ }>[]>;
7372
7898
  /**
7373
- * The original user provided value before any guardrail modifications.
7899
+ * Get messages by their IDs
7374
7900
  */
7375
- originalInput: string | UIMessage[] | BaseMessage[];
7901
+ private getMessagesByIds;
7376
7902
  /**
7377
- * Plain text representation of the original input value.
7903
+ * Merge two arrays of messages, removing duplicates
7378
7904
  */
7379
- originalInputText: string;
7380
- }
7381
- interface InputGuardrailResult extends GuardrailBaseResult {
7382
- modifiedInput?: string | UIMessage[] | BaseMessage[];
7383
- }
7384
- interface OutputGuardrailArgs<TOutput = unknown> extends GuardrailContext {
7905
+ private mergeMessages;
7385
7906
  /**
7386
- * The latest value after any previous guardrail modifications.
7907
+ * Check if vector support is configured
7387
7908
  */
7388
- output: TOutput;
7909
+ hasVectorSupport(): boolean;
7389
7910
  /**
7390
- * Optional plain text representation of the latest output value.
7911
+ * Search for similar content
7391
7912
  */
7392
- outputText?: string;
7913
+ searchSimilar(query: string, options?: SearchOptions): Promise<SearchResult[]>;
7393
7914
  /**
7394
- * The original value produced by the model before guardrail modifications.
7915
+ * Add a document for RAG
7395
7916
  */
7396
- originalOutput: TOutput;
7917
+ addDocument(document: Document): Promise<void>;
7918
+ /**
7919
+ * Remove a document
7920
+ */
7921
+ removeDocument(id: string): Promise<void>;
7922
+ /**
7923
+ * Get embedding with caching
7924
+ */
7925
+ private getEmbedding;
7926
+ /**
7927
+ * Embed and store a message
7928
+ */
7929
+ private embedAndStoreMessage;
7930
+ /**
7931
+ * Embed and store multiple messages
7932
+ */
7933
+ private embedAndStoreMessages;
7934
+ /**
7935
+ * Get working memory for a conversation or user
7936
+ */
7937
+ getWorkingMemory(params: {
7938
+ conversationId?: string;
7939
+ userId?: string;
7940
+ }): Promise<string | null>;
7941
+ /**
7942
+ * Update working memory (simplified)
7943
+ */
7944
+ updateWorkingMemory(params: {
7945
+ conversationId?: string;
7946
+ userId?: string;
7947
+ content: string | Record<string, unknown>;
7948
+ options?: WorkingMemoryUpdateOptions;
7949
+ }): Promise<void>;
7950
+ /**
7951
+ * Process content to string format
7952
+ */
7953
+ private processContent;
7954
+ /**
7955
+ * Simple deep merge for JSON objects
7956
+ */
7957
+ private simpleDeepMerge;
7958
+ /**
7959
+ * Clear working memory
7960
+ */
7961
+ clearWorkingMemory(params: {
7962
+ conversationId?: string;
7963
+ userId?: string;
7964
+ }): Promise<void>;
7965
+ /**
7966
+ * Get working memory template
7967
+ */
7968
+ getWorkingMemoryTemplate(): string | null;
7969
+ /**
7970
+ * Get working memory schema
7971
+ */
7972
+ getWorkingMemorySchema(): z.ZodObject<any> | null;
7397
7973
  /**
7398
- * Optional plain text representation of the original output value.
7974
+ * Get working memory format
7399
7975
  */
7400
- originalOutputText?: string;
7976
+ getWorkingMemoryFormat(): "markdown" | "json" | null;
7401
7977
  /**
7402
- * Optional usage metrics for the generation.
7978
+ * Check if working memory is supported
7403
7979
  */
7404
- usage?: UsageInfo;
7980
+ hasWorkingMemorySupport(): boolean;
7405
7981
  /**
7406
- * Optional finish reason from the model/provider.
7982
+ * Generate system instructions for working memory usage
7407
7983
  */
7408
- finishReason?: string | null;
7984
+ getWorkingMemoryInstructions(params: {
7985
+ conversationId?: string;
7986
+ userId?: string;
7987
+ }): Promise<string | null>;
7409
7988
  /**
7410
- * Optional warnings or diagnostics returned by the provider.
7989
+ * Get configured adapters info
7411
7990
  */
7412
- warnings?: unknown[] | null;
7413
- }
7414
- interface OutputGuardrailResult<TOutput = unknown> extends GuardrailBaseResult {
7415
- modifiedOutput?: TOutput;
7416
- }
7417
- type InputGuardrail = GuardrailConfig<InputGuardrailArgs, InputGuardrailResult>;
7418
- type OutputGuardrailFunction<TOutput = unknown> = GuardrailFunction<OutputGuardrailArgs<TOutput>, OutputGuardrailResult<TOutput>> & {
7419
- guardrailStreamHandler?: OutputGuardrailStreamHandler;
7420
- };
7421
- interface OutputGuardrailDefinition<TOutput = unknown> extends GuardrailDefinition<OutputGuardrailArgs<TOutput>, OutputGuardrailResult<TOutput>> {
7422
- streamHandler?: OutputGuardrailStreamHandler;
7423
- }
7424
- type OutputGuardrail<TOutput = unknown> = OutputGuardrailFunction<TOutput> | OutputGuardrailDefinition<TOutput>;
7425
- type MiddlewareDirection = "input" | "output";
7426
- type MiddlewareFunctionMetadata = {
7427
- middlewareId?: string;
7428
- middlewareName?: string;
7429
- middlewareDescription?: string;
7430
- middlewareTags?: string[];
7431
- };
7432
- type MiddlewareFunction<TArgs, TResult> = ((args: TArgs) => TResult | Promise<TResult>) & MiddlewareFunctionMetadata;
7433
- interface MiddlewareDefinition<TArgs, TResult> {
7434
- id?: string;
7435
- name?: string;
7436
- description?: string;
7437
- tags?: string[];
7438
- metadata?: Record<string, unknown>;
7439
- handler: MiddlewareFunction<TArgs, TResult>;
7440
- }
7441
- interface MiddlewareContext {
7442
- agent: Agent;
7443
- context: OperationContext;
7444
- operation: AgentEvalOperationType;
7445
- retryCount: number;
7446
- }
7447
- interface InputMiddlewareArgs extends MiddlewareContext {
7448
- input: string | UIMessage[] | BaseMessage[];
7449
- originalInput: string | UIMessage[] | BaseMessage[];
7450
- abort: <TMetadata = unknown>(reason?: string, options?: MiddlewareAbortOptions<TMetadata>) => never;
7451
- }
7452
- type InputMiddlewareResult = string | UIMessage[] | BaseMessage[] | undefined;
7453
- interface OutputMiddlewareArgs<TOutput = unknown> extends MiddlewareContext {
7454
- output: TOutput;
7455
- originalOutput: TOutput;
7456
- usage?: UsageInfo;
7457
- finishReason?: string | null;
7458
- warnings?: unknown[] | null;
7459
- abort: <TMetadata = unknown>(reason?: string, options?: MiddlewareAbortOptions<TMetadata>) => never;
7460
- }
7461
- type OutputMiddlewareResult<TOutput = unknown> = TOutput | undefined;
7462
- type InputMiddleware = MiddlewareDefinition<InputMiddlewareArgs, InputMiddlewareResult> | MiddlewareFunction<InputMiddlewareArgs, InputMiddlewareResult>;
7463
- type OutputMiddleware<TOutput = unknown> = MiddlewareDefinition<OutputMiddlewareArgs<TOutput>, OutputMiddlewareResult<TOutput>> | MiddlewareFunction<OutputMiddlewareArgs<TOutput>, OutputMiddlewareResult<TOutput>>;
7464
- type AgentSummarizationOptions = {
7465
- enabled?: boolean;
7466
- triggerTokens?: number;
7467
- keepMessages?: number;
7468
- maxOutputTokens?: number;
7469
- systemPrompt?: string | null;
7470
- model?: AgentModelValue;
7471
- };
7472
- /**
7473
- * Agent configuration options
7474
- */
7475
- type AgentOptions = {
7476
- id?: string;
7477
- name: string;
7478
- purpose?: string;
7479
- model: AgentModelValue;
7480
- instructions: InstructionsDynamicValue;
7481
- tools?: (Tool<any, any> | Toolkit | Tool$1)[] | DynamicValue<(Tool<any, any> | Toolkit)[]>;
7482
- toolkits?: Toolkit[];
7483
- memory?: Memory | false;
7484
- summarization?: AgentSummarizationOptions | false;
7485
- retriever?: BaseRetriever;
7486
- subAgents?: SubAgentConfig[];
7487
- supervisorConfig?: SupervisorConfig;
7488
- maxHistoryEntries?: number;
7489
- hooks?: AgentHooks;
7490
- inputGuardrails?: InputGuardrail[];
7491
- outputGuardrails?: OutputGuardrail<any>[];
7492
- inputMiddlewares?: InputMiddleware[];
7493
- outputMiddlewares?: OutputMiddleware<any>[];
7991
+ getAdaptersInfo(): {
7992
+ storage: boolean;
7993
+ embedding: {
7994
+ configured: boolean;
7995
+ model?: string;
7996
+ dimensions?: number;
7997
+ };
7998
+ vector: boolean;
7999
+ cache: boolean;
8000
+ };
7494
8001
  /**
7495
- * Default retry count for middleware-triggered retries.
7496
- * Per-call maxMiddlewareRetries overrides this value.
8002
+ * Save a message to memory
8003
+ * Simple version without event publishing (handled by MemoryManagerV2)
7497
8004
  */
7498
- maxMiddlewareRetries?: number;
7499
- temperature?: number;
7500
- maxOutputTokens?: number;
7501
- maxSteps?: number;
8005
+ saveMessageWithContext(message: UIMessage, userId: string, conversationId: string, context?: {
8006
+ logger?: Logger;
8007
+ }, operationContext?: OperationContext): Promise<void>;
7502
8008
  /**
7503
- * Default retry count for model calls before falling back.
7504
- * Overridden by per-model maxRetries or per-call maxRetries.
8009
+ * Get messages with semantic search support
8010
+ * Simple version without event publishing (handled by MemoryManagerV2)
7505
8011
  */
7506
- maxRetries?: number;
7507
- feedback?: AgentFeedbackOptions | boolean;
8012
+ getMessagesWithContext(userId: string, conversationId: string, options?: {
8013
+ limit?: number;
8014
+ useSemanticSearch?: boolean;
8015
+ currentQuery?: string;
8016
+ traceId?: string;
8017
+ logger?: Logger;
8018
+ semanticLimit?: number;
8019
+ semanticThreshold?: number;
8020
+ mergeStrategy?: "prepend" | "append" | "interleave";
8021
+ }, operationContext?: OperationContext): Promise<UIMessage<{
8022
+ createdAt: Date;
8023
+ }>[]>;
7508
8024
  /**
7509
- * Default stop condition for step execution (ai-sdk `stopWhen`).
7510
- * Per-call `stopWhen` in method options overrides this.
8025
+ * Internal: Set resource ID (agent ID)
7511
8026
  */
7512
- stopWhen?: StopWhen;
7513
- markdown?: boolean;
7514
- voice?: Voice;
7515
- logger?: Logger;
7516
- voltOpsClient?: VoltOpsClient;
7517
- observability?: VoltAgentObservability;
7518
- context?: ContextInput;
7519
- eval?: AgentEvalConfig;
7520
- };
7521
- type AgentEvalOperationType = "generateText" | "streamText" | "generateObject" | "streamObject" | "workflow";
7522
- interface AgentEvalPayload {
7523
- operationId: string;
7524
- operationType: AgentEvalOperationType;
7525
- input?: string | null;
7526
- output?: string | null;
7527
- rawInput?: string | UIMessage[] | BaseMessage[];
7528
- rawOutput?: unknown;
7529
- userId?: string;
7530
- conversationId?: string;
7531
- traceId: string;
7532
- spanId: string;
7533
- metadata?: Record<string, unknown>;
7534
- }
7535
- type AgentEvalContext = AgentEvalPayload & Record<string, unknown> & {
7536
- agentId: string;
7537
- agentName: string;
7538
- timestamp: string;
7539
- rawPayload: AgentEvalPayload;
7540
- };
7541
- type AgentEvalParams = Record<string, unknown>;
7542
- type AgentEvalSamplingPolicy = SamplingPolicy;
7543
- type AgentEvalScorerFactory = () => LocalScorerDefinition<AgentEvalContext, Record<string, unknown>> | Promise<LocalScorerDefinition<AgentEvalContext, Record<string, unknown>>>;
7544
- type AgentEvalScorerReference = LocalScorerDefinition<AgentEvalContext, Record<string, unknown>> | AgentEvalScorerFactory;
7545
- interface AgentEvalResult {
7546
- scorerId: string;
7547
- scorerName?: string;
7548
- status: "success" | "error" | "skipped";
7549
- score?: number | null;
7550
- metadata?: Record<string, unknown> | null;
7551
- error?: unknown;
7552
- durationMs?: number;
7553
- payload: AgentEvalPayload;
7554
- rawPayload: AgentEvalPayload;
7555
- }
7556
- type AgentEvalFeedbackSaveInput = Omit<VoltOpsFeedbackCreateInput, "traceId"> & {
7557
- traceId?: string;
7558
- };
7559
- type AgentEvalFeedbackHelper = {
7560
- save: (input: AgentEvalFeedbackSaveInput) => Promise<VoltOpsFeedback | null>;
7561
- };
7562
- type AgentEvalResultCallbackArgs = AgentEvalResult & {
7563
- result: AgentEvalResult;
7564
- feedback: AgentEvalFeedbackHelper;
7565
- };
7566
- interface AgentEvalScorerConfig {
7567
- scorer: AgentEvalScorerReference;
7568
- params?: AgentEvalParams | ((context: AgentEvalContext) => AgentEvalParams | undefined | Promise<AgentEvalParams | undefined>);
7569
- sampling?: AgentEvalSamplingPolicy;
7570
- id?: string;
7571
- onResult?: (result: AgentEvalResultCallbackArgs) => void | Promise<void>;
7572
- buildPayload?: (context: AgentEvalContext) => Record<string, unknown> | Promise<Record<string, unknown>>;
7573
- buildParams?: (context: AgentEvalContext) => AgentEvalParams | undefined | Promise<AgentEvalParams | undefined>;
7574
- }
7575
- interface AgentEvalConfig {
7576
- scorers: Record<string, AgentEvalScorerConfig>;
7577
- triggerSource?: string;
7578
- environment?: string;
7579
- sampling?: AgentEvalSamplingPolicy;
7580
- redact?: (payload: AgentEvalPayload) => AgentEvalPayload;
7581
- }
7582
- /**
7583
- * Agent status information
7584
- */
7585
- type AgentStatus = "idle" | "working" | "error" | "completed" | "cancelled";
7586
- /**
7587
- * Tool call definition
7588
- */
7589
- type ToolCall$1 = {
7590
- id: string;
7591
- type: "function";
7592
- function: {
7593
- name: string;
7594
- arguments: string;
7595
- };
7596
- };
7597
- /**
7598
- * Model tool call format
7599
- */
7600
- type ModelToolCall = {
7601
- type: "tool-call";
7602
- toolCallId: string;
7603
- toolName: string;
7604
- args: Record<string, unknown>;
7605
- };
7606
- /**
7607
- * Represents the payload used when sending a tool's result back to the chat runtime
7608
- * via useChat().addToolResult in the Vercel AI SDK.
7609
- */
7610
- type ClientSideToolResult = {
7611
- tool: string;
7612
- toolCallId: string;
7613
- output: unknown;
7614
- } | {
7615
- tool: string;
7616
- toolCallId: string;
7617
- state: "output-error";
7618
- errorText: string;
7619
- };
7620
- /**
7621
- * Agent response format
7622
- */
7623
- type AgentResponse = {
8027
+ _setResourceId(id: string): void;
8028
+ /**
8029
+ * Internal: Set logger
8030
+ */
8031
+ _setLogger(logger: Logger): void;
7624
8032
  /**
7625
- * Response content
8033
+ * Get vector adapter if configured
7626
8034
  */
7627
- content: string;
8035
+ getVectorAdapter(): VectorAdapter | undefined;
7628
8036
  /**
7629
- * Tool calls made by the model (if any)
8037
+ * Get embedding adapter if configured
7630
8038
  */
7631
- toolCalls?: ToolCall$1[];
8039
+ getEmbeddingAdapter(): EmbeddingAdapter | undefined;
7632
8040
  /**
7633
- * Additional metadata
8041
+ * Get metadata about the configured storage adapter
7634
8042
  */
7635
- metadata: {
7636
- agentId: string;
7637
- agentName: string;
7638
- [key: string]: unknown;
7639
- };
7640
- };
7641
- /**
7642
- * Context for a specific agent operation (e.g., one generateText call)
7643
- */
7644
- type OperationContext = {
7645
- /** Unique identifier for the operation */
7646
- readonly operationId: string;
7647
- /** Optional user identifier associated with this operation */
7648
- userId?: string;
7649
- /** Optional conversation identifier associated with this operation */
7650
- conversationId?: string;
7651
- /** User-managed context map for this operation */
7652
- readonly context: Map<string | symbol, unknown>;
7653
- /** System-managed context map for internal operation tracking */
7654
- readonly systemContext: Map<string | symbol, unknown>;
7655
- /** Whether this operation is still active */
7656
- isActive: boolean;
7657
- /** Parent agent ID if part of a delegation chain */
7658
- parentAgentId?: string;
7659
- /** Optional elicitation bridge for requesting user input */
7660
- elicitation?: (request: unknown) => Promise<unknown>;
7661
- /** Trace context for managing span hierarchy and common attributes */
7662
- traceContext: AgentTraceContext;
7663
- /** Execution-scoped logger with full context (userId, conversationId, executionId) */
7664
- logger: Logger;
7665
- /** Conversation steps for building full message history including tool calls/results */
7666
- conversationSteps?: StepWithContent[];
7667
- /** AbortController for cancelling the operation and accessing the signal */
7668
- abortController: AbortController;
7669
- /** Start time of the operation (Date object) */
7670
- startTime: Date;
7671
- /** Cancellation error to be thrown when operation is aborted */
7672
- cancellationError?: CancellationError;
7673
- /** Input provided to the agent operation (string, UIMessages, or BaseMessages) */
7674
- input?: string | UIMessage[] | BaseMessage[];
7675
- /** Output generated by the agent operation (text or object) */
7676
- output?: string | object;
7677
- };
7678
- /**
7679
- * Specific information related to a tool execution error.
7680
- */
7681
- interface ToolErrorInfo {
7682
- /** The unique identifier of the tool call. */
7683
- toolCallId: string;
7684
- /** The name of the tool that was executed. */
7685
- toolName: string;
7686
- /** The original error thrown directly by the tool during execution (if available). */
7687
- toolExecutionError?: unknown;
7688
- /** The arguments passed to the tool when the error occurred (for debugging). */
7689
- toolArguments?: unknown;
7690
- }
7691
- /**
7692
- * Type for onError callbacks in streaming operations.
7693
- * Providers must pass an error conforming to the VoltAgentError structure.
7694
- */
7695
- type StreamOnErrorCallback = (error: VoltAgentError) => Promise<void> | void;
7696
- type UserContext = Map<string | symbol, unknown>;
7697
- /**
7698
- * Standardized object structure passed to the onFinish callback
7699
- * when streamText completes successfully.
7700
- */
7701
- interface StreamTextFinishResult {
7702
- /** The final, consolidated text output from the stream. */
7703
- text: string;
7704
- /** Token usage information (if available). */
7705
- usage?: UsageInfo;
7706
- /** Feedback metadata for the trace, if enabled. */
7707
- feedback?: AgentFeedbackMetadata | null;
7708
- /** The reason the stream finished (if available, e.g., 'stop', 'length', 'tool-calls'). */
7709
- finishReason?: string;
7710
- /** The original completion response object from the provider (if available). */
7711
- providerResponse?: unknown;
7712
- /** Any warnings generated during the completion (if available). */
7713
- warnings?: unknown[];
7714
- /** User context containing any custom metadata from the operation. */
7715
- context?: UserContext;
7716
- }
7717
- /**
7718
- * Type for the onFinish callback function for streamText.
7719
- */
7720
- type StreamTextOnFinishCallback = (result: StreamTextFinishResult) => Promise<void> | void;
7721
- /**
7722
- * Standardized object structure passed to the onFinish callback
7723
- * when streamObject completes successfully.
7724
- * @template TObject The expected type of the fully formed object.
7725
- */
7726
- interface StreamObjectFinishResult<TObject> {
7727
- /** The final, fully formed object from the stream. */
7728
- object: TObject;
7729
- /** Token usage information (if available). */
7730
- usage?: UsageInfo;
7731
- /** The original completion response object from the provider (if available). */
7732
- providerResponse?: unknown;
7733
- /** Any warnings generated during the completion (if available). */
7734
- warnings?: unknown[];
7735
- /** The reason the stream finished (if available). Although less common for object streams. */
7736
- finishReason?: string;
7737
- /** User context containing any custom metadata from the operation. */
7738
- context?: UserContext;
7739
- }
7740
- /**
7741
- * Type for the onFinish callback function for streamObject.
7742
- * @template TObject The expected type of the fully formed object.
7743
- */
7744
- type StreamObjectOnFinishCallback<TObject> = (result: StreamObjectFinishResult<TObject>) => Promise<void> | void;
7745
- /**
7746
- * Standardized success result structure for generateText.
7747
- */
7748
- interface StandardizedTextResult {
7749
- /** The generated text. */
7750
- text: string;
7751
- /** Token usage information (if available). */
7752
- usage?: UsageInfo;
7753
- /** Feedback metadata for the trace, if enabled. */
7754
- feedback?: AgentFeedbackMetadata | null;
7755
- /** Original provider response (if needed). */
7756
- providerResponse?: unknown;
7757
- /** Finish reason (if available from provider). */
7758
- finishReason?: string;
7759
- /** Warnings (if available from provider). */
7760
- warnings?: unknown[];
7761
- /** User context containing any custom metadata from the operation. */
7762
- context?: UserContext;
7763
- }
7764
- /**
7765
- * Standardized success result structure for generateObject.
7766
- * @template TObject The expected type of the generated object.
7767
- */
7768
- interface StandardizedObjectResult<TObject> {
7769
- /** The generated object. */
7770
- object: TObject;
7771
- /** Token usage information (if available). */
7772
- usage?: UsageInfo;
7773
- /** Original provider response (if needed). */
7774
- providerResponse?: unknown;
7775
- /** Finish reason (if available from provider). */
7776
- finishReason?: string;
7777
- /** Warnings (if available from provider). */
7778
- warnings?: unknown[];
7779
- /** User context containing any custom metadata from the operation. */
7780
- context?: UserContext;
8043
+ getStorageMetadata(): MemoryStorageMetadata;
8044
+ /**
8045
+ * Get conversation title generation configuration
8046
+ */
8047
+ getTitleGenerationConfig(): MemoryConfig["generateTitle"] | undefined;
8048
+ /**
8049
+ * Get a UI-friendly summary of working memory configuration
8050
+ */
8051
+ getWorkingMemorySummary(): WorkingMemorySummary | null;
8052
+ /**
8053
+ * Get workflow state by execution ID
8054
+ */
8055
+ getWorkflowState(executionId: string): Promise<WorkflowStateEntry | null>;
8056
+ /**
8057
+ * Query workflow states with filters
8058
+ */
8059
+ queryWorkflowRuns(query: WorkflowRunQuery): Promise<WorkflowStateEntry[]>;
8060
+ /**
8061
+ * Set workflow state
8062
+ */
8063
+ setWorkflowState(executionId: string, state: WorkflowStateEntry): Promise<void>;
8064
+ /**
8065
+ * Update workflow state
8066
+ */
8067
+ updateWorkflowState(executionId: string, updates: Partial<WorkflowStateEntry>): Promise<void>;
8068
+ /**
8069
+ * Get suspended workflow states for a workflow
8070
+ */
8071
+ getSuspendedWorkflowStates(workflowId: string): Promise<WorkflowStateEntry[]>;
7781
8072
  }
7782
- /**
7783
- * Unified output type for the onEnd hook, representing the successful result
7784
- * of any core agent operation. Use 'type guarding' or check specific fields
7785
- * within the hook implementation to determine the concrete type.
7786
- * Object types are generalized to 'unknown' here for the union.
7787
- */
7788
- type AgentOperationOutput = StandardizedTextResult | StreamTextFinishResult | StandardizedObjectResult<unknown> | StreamObjectFinishResult<unknown>;
7789
8073
 
7790
8074
  /**
7791
8075
  * MemoryManager - Unified manager for Memory and OpenTelemetry observability
@@ -7817,10 +8101,14 @@ declare class MemoryManager {
7817
8101
  * Background queue for memory operations
7818
8102
  */
7819
8103
  private backgroundQueue;
8104
+ /**
8105
+ * Optional title generator for new conversations
8106
+ */
8107
+ private titleGenerator?;
7820
8108
  /**
7821
8109
  * Creates a new MemoryManager V2 with same signature as original
7822
8110
  */
7823
- constructor(resourceId: string, memory?: Memory | false, options?: MemoryOptions, logger?: Logger);
8111
+ constructor(resourceId: string, memory?: Memory | false, options?: MemoryOptions, logger?: Logger, titleGenerator?: ConversationTitleGenerator);
7824
8112
  /**
7825
8113
  * Save a message to memory
7826
8114
  * PRESERVED FROM ORIGINAL WITH MEMORY V2 INTEGRATION
@@ -7877,6 +8165,10 @@ declare class MemoryManager {
7877
8165
  * Ensures conversation exists and then saves input without blocking.
7878
8166
  */
7879
8167
  queueSaveInput(context: OperationContext, input: string | UIMessage[], userId: string, conversationId: string): void;
8168
+ /**
8169
+ * Resolve conversation title using optional generator
8170
+ */
8171
+ private resolveConversationTitle;
7880
8172
  /**
7881
8173
  * Ensure conversation exists (background task)
7882
8174
  * PRESERVED FROM ORIGINAL
@@ -8031,6 +8323,7 @@ interface BaseGenerationOptions extends Partial<CallSettings> {
8031
8323
  parentAgentId?: string;
8032
8324
  parentOperationContext?: OperationContext;
8033
8325
  parentSpan?: Span;
8326
+ inheritParentSpan?: boolean;
8034
8327
  contextLimit?: number;
8035
8328
  semanticMemory?: {
8036
8329
  enabled?: boolean;
@@ -8048,6 +8341,10 @@ interface BaseGenerationOptions extends Partial<CallSettings> {
8048
8341
  */
8049
8342
  stopWhen?: StopWhen;
8050
8343
  tools?: (Tool<any, any> | Toolkit)[];
8344
+ /**
8345
+ * Optional per-call tool routing override.
8346
+ */
8347
+ toolRouting?: ToolRoutingConfig | false;
8051
8348
  hooks?: AgentHooks;
8052
8349
  inputGuardrails?: InputGuardrail[];
8053
8350
  outputGuardrails?: OutputGuardrail<any>[];
@@ -8095,6 +8392,7 @@ declare class Agent {
8095
8392
  readonly maxRetries: number;
8096
8393
  readonly stopWhen?: StopWhen;
8097
8394
  readonly markdown: boolean;
8395
+ readonly inheritParentSpan: boolean;
8098
8396
  readonly voice?: Voice;
8099
8397
  readonly retriever?: BaseRetriever;
8100
8398
  readonly supervisorConfig?: SupervisorConfig;
@@ -8106,6 +8404,7 @@ declare class Agent {
8106
8404
  private readonly summarization?;
8107
8405
  private defaultObservability?;
8108
8406
  private readonly toolManager;
8407
+ private readonly toolPoolManager;
8109
8408
  private readonly subAgentManager;
8110
8409
  private readonly voltOpsClient?;
8111
8410
  private readonly prompts?;
@@ -8117,6 +8416,10 @@ declare class Agent {
8117
8416
  private readonly outputMiddlewares;
8118
8417
  private readonly maxMiddlewareRetries;
8119
8418
  private readonly observabilityAuthWarningState;
8419
+ private toolRouting?;
8420
+ private toolRoutingConfigured;
8421
+ private toolRoutingExposedNames;
8422
+ private toolRoutingPoolExplicit;
8120
8423
  constructor(options: AgentOptions);
8121
8424
  /**
8122
8425
  * Generate text response
@@ -8194,6 +8497,7 @@ declare class Agent {
8194
8497
  * Extract user query from input for semantic search
8195
8498
  */
8196
8499
  private extractUserQuery;
8500
+ private createConversationTitleGenerator;
8197
8501
  /**
8198
8502
  * Prepare messages with system prompt and memory
8199
8503
  */
@@ -8244,6 +8548,20 @@ declare class Agent {
8244
8548
  */
8245
8549
  private validateToolOutput;
8246
8550
  private createToolExecutionFactory;
8551
+ /**
8552
+ * Internal: execute a tool router with access to the agent runtime.
8553
+ */
8554
+ __executeToolRouter(params: {
8555
+ router: ToolRouter;
8556
+ input: ToolRouterInput;
8557
+ options?: ToolExecuteOptions;
8558
+ }): Promise<ToolRouterResult>;
8559
+ private buildToolRouterCandidates;
8560
+ private resolveRoutedToolArgs;
8561
+ private resolveProviderToolArgs;
8562
+ private executeProviderToolViaRouter;
8563
+ private ensureToolApproval;
8564
+ private runInternalGenerateText;
8247
8565
  /**
8248
8566
  * Create step handler for memory and hooks
8249
8567
  */
@@ -8343,6 +8661,14 @@ declare class Agent {
8343
8661
  * Internal: apply a default Memory instance when none was configured explicitly.
8344
8662
  */
8345
8663
  __setDefaultMemory(memory: Memory): void;
8664
+ /**
8665
+ * Internal: apply a default tool routing config when none was configured explicitly.
8666
+ */
8667
+ __setDefaultToolRouting(toolRouting?: ToolRoutingConfig): void;
8668
+ private applyToolRoutingConfig;
8669
+ private resolveToolRoutingRouters;
8670
+ private resolveToolRouting;
8671
+ private getToolRoutingExposedNames;
8346
8672
  /**
8347
8673
  * Convert this agent into a tool that can be used by other agents.
8348
8674
  * This enables supervisor/coordinator patterns where one agent can delegate
@@ -8414,6 +8740,8 @@ type WorkflowState<INPUT, RESULT> = {
8414
8740
  input: InternalExtractWorkflowInputData<INPUT>;
8415
8741
  /** current data being processed */
8416
8742
  data: DangerouslyAllowAny;
8743
+ /** shared workflow state across steps */
8744
+ workflowState: WorkflowStateStore;
8417
8745
  /** the result of workflow execution, null until execution is complete */
8418
8746
  result: RESULT | null;
8419
8747
  error: Error | null;
@@ -8442,6 +8770,8 @@ interface WorkflowSuspensionMetadata<SUSPEND_DATA = DangerouslyAllowAny> {
8442
8770
  stepExecutionState?: DangerouslyAllowAny;
8443
8771
  /** Results from completed steps that need to be preserved */
8444
8772
  completedStepsData?: DangerouslyAllowAny[];
8773
+ /** Shared workflow state snapshot */
8774
+ workflowState?: WorkflowStateStore;
8445
8775
  };
8446
8776
  }
8447
8777
  interface WorkflowCancellationMetadata {
@@ -8596,6 +8926,8 @@ interface WorkflowRetryConfig {
8596
8926
  */
8597
8927
  delayMs?: number;
8598
8928
  }
8929
+ type WorkflowStateStore = Record<string, unknown>;
8930
+ type WorkflowStateUpdater = WorkflowStateStore | ((previous: WorkflowStateStore) => WorkflowStateStore);
8599
8931
  interface WorkflowRunOptions {
8600
8932
  /**
8601
8933
  * The active step, this can be used to track the current step in a workflow
@@ -8619,6 +8951,10 @@ interface WorkflowRunOptions {
8619
8951
  * The user context, this can be used to track the current user context in a workflow
8620
8952
  */
8621
8953
  context?: UserContext;
8954
+ /**
8955
+ * Shared workflow state available to all steps
8956
+ */
8957
+ workflowState?: WorkflowStateStore;
8622
8958
  /**
8623
8959
  * Override Memory V2 for this specific execution
8624
8960
  * Takes priority over workflow config memory and global memory
@@ -8672,6 +9008,7 @@ interface WorkflowResumeOptions {
8672
9008
  checkpoint?: {
8673
9009
  stepExecutionState?: DangerouslyAllowAny;
8674
9010
  completedStepsData?: DangerouslyAllowAny[];
9011
+ workflowState?: WorkflowStateStore;
8675
9012
  };
8676
9013
  /**
8677
9014
  * The step index to resume from
@@ -8977,11 +9314,12 @@ interface WorkflowStats {
8977
9314
  /**
8978
9315
  * Event emitted during workflow streaming
8979
9316
  */
9317
+ type WorkflowStreamEventType = "workflow-start" | "workflow-suspended" | "workflow-complete" | "workflow-cancelled" | "workflow-error" | "step-start" | "step-complete" | (string & {});
8980
9318
  interface WorkflowStreamEvent {
8981
9319
  /**
8982
9320
  * Type of the event (e.g., "step-start", "step-complete", "custom", "agent-stream")
8983
9321
  */
8984
- type: "workflow-start" | "workflow-suspended" | "workflow-complete" | "workflow-cancelled" | "workflow-error" | "step-start" | "step-complete";
9322
+ type: WorkflowStreamEventType;
8985
9323
  /**
8986
9324
  * Unique execution ID for this workflow run
8987
9325
  */
@@ -9034,8 +9372,8 @@ interface WorkflowStreamWriter {
9034
9372
  /**
9035
9373
  * Write a custom event to the stream
9036
9374
  */
9037
- write(event: Partial<WorkflowStreamEvent> & {
9038
- type: string;
9375
+ write(event: Omit<Partial<WorkflowStreamEvent>, "type"> & {
9376
+ type: WorkflowStreamEventType;
9039
9377
  }): void;
9040
9378
  /**
9041
9379
  * Pipe events from an agent's fullStream to the workflow stream
@@ -9203,6 +9541,10 @@ interface WorkflowExecutionContext {
9203
9541
  * User-defined context passed around during execution
9204
9542
  */
9205
9543
  context: Map<string | symbol, unknown>;
9544
+ /**
9545
+ * Shared workflow state available to all steps
9546
+ */
9547
+ workflowState: WorkflowStateStore;
9206
9548
  /**
9207
9549
  * Whether the workflow is still actively running
9208
9550
  */
@@ -9304,6 +9646,8 @@ interface WorkflowExecuteContext<INPUT, DATA, SUSPEND_DATA, RESUME_DATA> {
9304
9646
  suspend: (reason?: string, suspendData?: SUSPEND_DATA) => Promise<never>;
9305
9647
  resumeData?: RESUME_DATA;
9306
9648
  retryCount?: number;
9649
+ workflowState: WorkflowStateStore;
9650
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
9307
9651
  /**
9308
9652
  * Logger instance for this workflow execution.
9309
9653
  * Provides execution-scoped logging with full context (userId, conversationId, executionId).
@@ -9521,14 +9865,20 @@ interface WorkflowStepSleepUntil<INPUT, DATA> extends InternalBaseWorkflowStep<I
9521
9865
  type: "sleep-until";
9522
9866
  date: Date | InternalWorkflowFunc<INPUT, DATA, Date, any, any>;
9523
9867
  }
9524
- type WorkflowStepForEachConfig<INPUT, ITEM, RESULT> = InternalWorkflowStepConfig<{
9525
- step: InternalAnyWorkflowStep<INPUT, ITEM, RESULT>;
9868
+ type WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM> = InternalWorkflowFunc<INPUT, DATA, ITEM[], any, any>;
9869
+ type WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA> = (context: WorkflowExecuteContext<INPUT, DATA, any, any>, item: ITEM, index: number) => Promise<MAP_DATA> | MAP_DATA;
9870
+ type WorkflowStepForEachConfig<INPUT, DATA, ITEM, RESULT, MAP_DATA = ITEM> = InternalWorkflowStepConfig<{
9871
+ step: InternalAnyWorkflowStep<INPUT, MAP_DATA, RESULT>;
9526
9872
  concurrency?: number;
9873
+ items?: WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM>;
9874
+ map?: WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA>;
9527
9875
  }>;
9528
- interface WorkflowStepForEach<INPUT, ITEM, RESULT> extends InternalBaseWorkflowStep<INPUT, ITEM[], RESULT[], any, any> {
9876
+ interface WorkflowStepForEach<INPUT, DATA, ITEM, RESULT, MAP_DATA = ITEM> extends InternalBaseWorkflowStep<INPUT, DATA, RESULT[], any, any> {
9529
9877
  type: "foreach";
9530
- step: InternalAnyWorkflowStep<INPUT, ITEM, RESULT>;
9878
+ step: InternalAnyWorkflowStep<INPUT, MAP_DATA, RESULT>;
9531
9879
  concurrency?: number;
9880
+ items?: WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM>;
9881
+ map?: WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA>;
9532
9882
  }
9533
9883
  type WorkflowStepLoopConfig<INPUT, DATA, RESULT> = InternalWorkflowStepConfig<{
9534
9884
  step: InternalAnyWorkflowStep<INPUT, DATA, RESULT>;
@@ -9595,7 +9945,7 @@ interface WorkflowStepMap<INPUT, DATA, MAP extends Record<string, WorkflowStepMa
9595
9945
  }
9596
9946
  type WorkflowStepParallelDynamicStepsFunc<INPUT, DATA, RESULT> = (context: WorkflowExecuteContext<INPUT, DATA, any, any>) => Promise<WorkflowStepParallelSteps<INPUT, DATA, RESULT>>;
9597
9947
  type WorkflowStepParallelSteps<INPUT, DATA, RESULT> = ReadonlyArray<InternalAnyWorkflowStep<INPUT, DATA, RESULT>>;
9598
- 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>>>;
9948
+ 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>>>;
9599
9949
  /**
9600
9950
  * Internal type to allow overriding the run method for the workflow
9601
9951
  */
@@ -9874,12 +10224,15 @@ declare function andSleepUntil<INPUT, DATA>({ date, ...config }: WorkflowStepSle
9874
10224
 
9875
10225
  /**
9876
10226
  * Creates a foreach step that runs a step for each item in an array.
10227
+ * Use items to select the array and map to shape each item before execution.
9877
10228
  */
9878
- declare function andForEach<INPUT, ITEM, RESULT>({ step, concurrency, ...config }: WorkflowStepForEachConfig<INPUT, ITEM, RESULT>): {
10229
+ declare function andForEach<INPUT, DATA, ITEM, RESULT, MAP_DATA = ITEM>({ step, concurrency, items, map, ...config }: WorkflowStepForEachConfig<INPUT, DATA, ITEM, RESULT, MAP_DATA>): {
9879
10230
  type: "foreach";
9880
- step: InternalAnyWorkflowStep<INPUT, ITEM, RESULT>;
10231
+ step: InternalAnyWorkflowStep<INPUT, MAP_DATA, RESULT>;
9881
10232
  concurrency: number;
9882
- execute: (context: WorkflowExecuteContext<INPUT, ITEM[], any, any>) => Promise<RESULT[]>;
10233
+ items: WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM> | undefined;
10234
+ map: WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA> | undefined;
10235
+ execute: (context: WorkflowExecuteContext<INPUT, DATA, any, any>) => Promise<RESULT[]>;
9883
10236
  id: string;
9884
10237
  name: string;
9885
10238
  purpose: string;
@@ -10175,6 +10528,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10175
10528
  execute: (context: {
10176
10529
  data: z.infer<IS>;
10177
10530
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10531
+ workflowState: WorkflowStateStore;
10532
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10178
10533
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10179
10534
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10180
10535
  resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
@@ -10200,6 +10555,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10200
10555
  execute: (context: {
10201
10556
  data: z.infer<IS>;
10202
10557
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10558
+ workflowState: WorkflowStateStore;
10559
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10203
10560
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10204
10561
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10205
10562
  resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
@@ -10225,6 +10582,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10225
10582
  execute: (context: {
10226
10583
  data: CURRENT_DATA;
10227
10584
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10585
+ workflowState: WorkflowStateStore;
10586
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10228
10587
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10229
10588
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10230
10589
  resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
@@ -10250,6 +10609,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10250
10609
  execute: (context: {
10251
10610
  data: CURRENT_DATA;
10252
10611
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10612
+ workflowState: WorkflowStateStore;
10613
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10253
10614
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10254
10615
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10255
10616
  resumeData?: z.infer<RS>;
@@ -10291,6 +10652,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10291
10652
  execute: (context: {
10292
10653
  data: CURRENT_DATA;
10293
10654
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10655
+ workflowState: WorkflowStateStore;
10656
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10294
10657
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10295
10658
  suspend: (reason?: string, suspendData?: z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10296
10659
  resumeData?: z.infer<RESUME_SCHEMA>;
@@ -10320,6 +10683,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10320
10683
  condition: (context: {
10321
10684
  data: z.infer<IS>;
10322
10685
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10686
+ workflowState: WorkflowStateStore;
10687
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10323
10688
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10324
10689
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10325
10690
  resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
@@ -10378,6 +10743,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10378
10743
  execute: (context: {
10379
10744
  data: z.infer<IS>;
10380
10745
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10746
+ workflowState: WorkflowStateStore;
10747
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10381
10748
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10382
10749
  suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10383
10750
  resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
@@ -10418,6 +10785,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10418
10785
  execute: (context: {
10419
10786
  data: CURRENT_DATA;
10420
10787
  state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
10788
+ workflowState: WorkflowStateStore;
10789
+ setWorkflowState: (update: WorkflowStateUpdater) => void;
10421
10790
  getStepData: (stepId: string) => WorkflowStepData | undefined;
10422
10791
  suspend: (reason?: string, suspendData?: z.infer<SUSPEND_SCHEMA>) => Promise<never>;
10423
10792
  resumeData?: z.infer<RESUME_SCHEMA>;
@@ -10452,7 +10821,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
10452
10821
  /**
10453
10822
  * Add a foreach step that runs a step for each item in an array
10454
10823
  */
10455
- andForEach<ITEM, NEW_DATA>(config: WorkflowStepForEachConfig<WorkflowInput<INPUT_SCHEMA>, ITEM, NEW_DATA>): WorkflowChain<INPUT_SCHEMA, RESULT_SCHEMA, NEW_DATA[], SUSPEND_SCHEMA, RESUME_SCHEMA>;
10824
+ 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>;
10456
10825
  /**
10457
10826
  * Add a do-while loop step
10458
10827
  */
@@ -10911,6 +11280,7 @@ type PlanAgentOptions = Omit<AgentOptions, "instructions" | "tools" | "toolkits"
10911
11280
  systemPrompt?: InstructionsDynamicValue;
10912
11281
  tools?: (Tool<any, any> | Toolkit | Tool$1)[];
10913
11282
  toolkits?: Toolkit[];
11283
+ toolRouting?: ToolRoutingConfig | false;
10914
11284
  subagents?: PlanAgentSubagentDefinition[];
10915
11285
  generalPurposeAgent?: boolean;
10916
11286
  planning?: PlanningToolkitOptions | false;
@@ -12704,6 +13074,10 @@ type VoltAgentOptions = {
12704
13074
  * Falls back to `memory` when not provided.
12705
13075
  */
12706
13076
  workflowMemory?: Memory;
13077
+ /**
13078
+ * Global tool routing defaults (applied to agents without explicit toolRouting config).
13079
+ */
13080
+ toolRouting?: ToolRoutingConfig;
12707
13081
  /** Optional VoltOps trigger handlers */
12708
13082
  triggers?: VoltAgentTriggersConfig;
12709
13083
  /**
@@ -13569,22 +13943,22 @@ declare class InMemoryStorageAdapter implements StorageAdapter {
13569
13943
  * Lightweight in-memory vector database adapter
13570
13944
  * Suitable for development, testing, and small datasets (< 10k vectors)
13571
13945
  */
13572
- declare class InMemoryVectorAdapter implements VectorAdapter {
13946
+ declare class InMemoryVectorAdapter implements VectorAdapter$1 {
13573
13947
  private vectors;
13574
13948
  private dimensions;
13575
13949
  constructor();
13576
13950
  store(id: string, vector: number[], metadata?: Record<string, unknown>): Promise<void>;
13577
- storeBatch(items: VectorItem[]): Promise<void>;
13951
+ storeBatch(items: VectorItem$1[]): Promise<void>;
13578
13952
  search(queryVector: number[], options?: {
13579
13953
  limit?: number;
13580
13954
  filter?: Record<string, unknown>;
13581
13955
  threshold?: number;
13582
- }): Promise<SearchResult[]>;
13956
+ }): Promise<SearchResult$1[]>;
13583
13957
  delete(id: string): Promise<void>;
13584
13958
  deleteBatch(ids: string[]): Promise<void>;
13585
13959
  clear(): Promise<void>;
13586
13960
  count(): Promise<number>;
13587
- get(id: string): Promise<VectorItem | null>;
13961
+ get(id: string): Promise<VectorItem$1 | null>;
13588
13962
  /**
13589
13963
  * Check if metadata matches the filter criteria
13590
13964
  */
@@ -13599,56 +13973,18 @@ declare class InMemoryVectorAdapter implements VectorAdapter {
13599
13973
  }>;
13600
13974
  }
13601
13975
 
13602
- /**
13603
- * Embedding adapter interface for converting text to vectors
13604
- */
13605
- interface EmbeddingAdapter {
13606
- /**
13607
- * Embed a single text string into a vector
13608
- */
13609
- embed(text: string): Promise<number[]>;
13610
- /**
13611
- * Embed multiple texts in a batch for efficiency
13612
- */
13613
- embedBatch(texts: string[]): Promise<number[][]>;
13614
- /**
13615
- * Get the dimensionality of the embeddings
13616
- * Returns undefined if dimensions are not yet known
13617
- */
13618
- getDimensions(): number | undefined;
13619
- /**
13620
- * Get the model name for debugging/logging
13621
- */
13622
- getModelName(): string;
13623
- }
13624
- /**
13625
- * Options for embedding adapter initialization
13626
- */
13627
- interface EmbeddingOptions {
13628
- /**
13629
- * Maximum number of texts to process in a single batch
13630
- */
13631
- maxBatchSize?: number;
13632
- /**
13633
- * Timeout for embedding operations in milliseconds
13634
- */
13635
- timeout?: number;
13636
- /**
13637
- * Whether to normalize embeddings to unit vectors
13638
- */
13639
- normalize?: boolean;
13640
- }
13641
-
13642
13976
  /**
13643
13977
  * AI SDK Embedding Adapter
13644
13978
  * Wraps Vercel AI SDK embedding models for use with Memory V2
13645
13979
  */
13646
- declare class AiSdkEmbeddingAdapter implements EmbeddingAdapter {
13980
+ declare class AiSdkEmbeddingAdapter implements EmbeddingAdapter$1 {
13647
13981
  private model;
13648
13982
  private dimensions;
13649
13983
  private modelName;
13650
13984
  private options;
13651
- constructor(model: EmbeddingModel, options?: EmbeddingOptions);
13985
+ private modelResolvePromise?;
13986
+ constructor(model: EmbeddingModelReference, options?: EmbeddingOptions);
13987
+ private resolveModel;
13652
13988
  embed(text: string): Promise<number[]>;
13653
13989
  embedBatch(texts: string[]): Promise<number[][]>;
13654
13990
  getDimensions(): number;
@@ -13660,8 +13996,14 @@ declare class AiSdkEmbeddingAdapter implements EmbeddingAdapter {
13660
13996
  }
13661
13997
 
13662
13998
  type LanguageModelFactory = (modelId: string) => LanguageModel;
13999
+ type EmbeddingModelInstance = Exclude<EmbeddingModel, string>;
14000
+ type EmbeddingModelFactory = (modelId: string) => EmbeddingModelInstance;
13663
14001
  type ModelProvider = {
13664
14002
  languageModel: LanguageModelFactory;
14003
+ embeddingModel?: EmbeddingModelFactory;
14004
+ embedding?: EmbeddingModelFactory;
14005
+ textEmbeddingModel?: EmbeddingModelFactory;
14006
+ textEmbedding?: EmbeddingModelFactory;
13665
14007
  };
13666
14008
  type ModelProviderEntry = ModelProvider | LanguageModelFactory;
13667
14009
  type ModelProviderLoader = () => Promise<ModelProviderEntry>;
@@ -13670,8 +14012,9 @@ declare global {
13670
14012
  }
13671
14013
  declare class ModelProviderRegistry {
13672
14014
  private providers;
14015
+ private providerEntries;
13673
14016
  private loaders;
13674
- private loading;
14017
+ private entryLoading;
13675
14018
  private dynamicRegistry;
13676
14019
  private refreshInterval;
13677
14020
  private lastRefreshTime;
@@ -13695,7 +14038,9 @@ declare class ModelProviderRegistry {
13695
14038
  unregisterProvider(providerId: string): void;
13696
14039
  listProviders(): string[];
13697
14040
  resolveLanguageModel(modelId: string): Promise<LanguageModel>;
14041
+ resolveEmbeddingModel(modelId: string): Promise<EmbeddingModelInstance>;
13698
14042
  private getProvider;
14043
+ private getProviderEntry;
13699
14044
  private normalizeProvider;
13700
14045
  }
13701
14046
 
@@ -14286,6 +14631,7 @@ declare class AgentRegistry {
14286
14631
  private globalMemory?;
14287
14632
  private globalAgentMemory?;
14288
14633
  private globalWorkflowMemory?;
14634
+ private globalToolRouting?;
14289
14635
  /**
14290
14636
  * Track parent-child relationships between agents (child -> parents)
14291
14637
  */
@@ -14396,6 +14742,14 @@ declare class AgentRegistry {
14396
14742
  * Get the global default Memory instance for workflows.
14397
14743
  */
14398
14744
  getGlobalWorkflowMemory(): Memory | undefined;
14745
+ /**
14746
+ * Set the global default tool routing configuration.
14747
+ */
14748
+ setGlobalToolRouting(toolRouting: ToolRoutingConfig | undefined): void;
14749
+ /**
14750
+ * Get the global default tool routing configuration.
14751
+ */
14752
+ getGlobalToolRouting(): ToolRoutingConfig | undefined;
14399
14753
  }
14400
14754
 
14401
14755
  type UpdateOptions = {
@@ -14567,4 +14921,4 @@ declare class VoltAgent {
14567
14921
  */
14568
14922
  declare function convertUsage(usage: LanguageModelUsage | undefined): UsageInfo | undefined;
14569
14923
 
14570
- 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 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 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 };
14924
+ 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 };