@voltagent/core 2.1.6 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2151 -1805
- package/dist/index.d.ts +2151 -1805
- package/dist/index.js +9393 -8161
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9395 -8165
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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,
|
|
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
|
-
*
|
|
781
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
796
|
-
|
|
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
|
-
*
|
|
1079
|
+
* Get the global logger instance from registry or create a default one
|
|
806
1080
|
*/
|
|
807
|
-
|
|
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
|
-
*
|
|
1083
|
+
* Get the global log buffer
|
|
816
1084
|
*/
|
|
817
|
-
|
|
818
|
-
|
|
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
|
|
1088
|
+
* Options for configuring the Retriever
|
|
827
1089
|
*/
|
|
828
|
-
type
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
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
|
-
*
|
|
863
|
-
*
|
|
1114
|
+
* Options passed to retrieve method.
|
|
1115
|
+
* Includes all operation context fields for user-specific and context-aware retrieval.
|
|
864
1116
|
*/
|
|
865
|
-
interface
|
|
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
|
-
*
|
|
892
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
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
|
|
944
|
-
/**
|
|
945
|
-
|
|
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
|
-
*
|
|
949
|
-
*
|
|
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
|
-
|
|
968
|
-
/**
|
|
969
|
-
* Storage adapter for conversations and messages
|
|
970
|
-
*/
|
|
971
|
-
storage: StorageAdapter;
|
|
1179
|
+
declare abstract class BaseRetriever {
|
|
972
1180
|
/**
|
|
973
|
-
*
|
|
1181
|
+
* Options that configure the retriever's behavior
|
|
974
1182
|
*/
|
|
975
|
-
|
|
1183
|
+
protected options: RetrieverOptions;
|
|
976
1184
|
/**
|
|
977
|
-
*
|
|
1185
|
+
* Logger instance for the retriever
|
|
978
1186
|
*/
|
|
979
|
-
|
|
1187
|
+
protected logger: Logger;
|
|
980
1188
|
/**
|
|
981
|
-
*
|
|
982
|
-
*
|
|
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
|
-
|
|
1206
|
+
readonly tool: AgentTool;
|
|
985
1207
|
/**
|
|
986
|
-
*
|
|
987
|
-
* @
|
|
1208
|
+
* Constructor for the BaseRetriever class.
|
|
1209
|
+
* @param options - Configuration options for the retriever.
|
|
988
1210
|
*/
|
|
989
|
-
|
|
1211
|
+
constructor(options?: RetrieverOptions);
|
|
990
1212
|
/**
|
|
991
|
-
*
|
|
992
|
-
*
|
|
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
|
-
|
|
1220
|
+
abstract retrieve(input: string | BaseMessage[], options: RetrieveOptions): Promise<string>;
|
|
995
1221
|
/**
|
|
996
|
-
*
|
|
997
|
-
*
|
|
1222
|
+
* Optional observability attributes for retriever spans.
|
|
1223
|
+
* Override in subclasses to add context (e.g. knowledge base metadata).
|
|
998
1224
|
*/
|
|
999
|
-
|
|
1225
|
+
getObservabilityAttributes(): Record<string, unknown>;
|
|
1000
1226
|
}
|
|
1227
|
+
|
|
1001
1228
|
/**
|
|
1002
|
-
*
|
|
1229
|
+
* ReadableStream type for voice responses
|
|
1003
1230
|
*/
|
|
1004
|
-
|
|
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
|
-
*
|
|
1233
|
+
* Voice provider options
|
|
1029
1234
|
*/
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
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
|
-
*
|
|
1258
|
+
* Voice event types
|
|
1037
1259
|
*/
|
|
1038
|
-
|
|
1039
|
-
limit?: number;
|
|
1040
|
-
threshold?: number;
|
|
1041
|
-
filter?: Record<string, unknown>;
|
|
1042
|
-
}
|
|
1260
|
+
type VoiceEventType = "speaking" | "listening" | "error" | "connected" | "disconnected";
|
|
1043
1261
|
/**
|
|
1044
|
-
*
|
|
1262
|
+
* Voice event data types
|
|
1045
1263
|
*/
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
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
|
-
*
|
|
1281
|
+
* Voice metadata
|
|
1054
1282
|
*/
|
|
1055
|
-
|
|
1283
|
+
type VoiceMetadata = {
|
|
1056
1284
|
id: string;
|
|
1057
|
-
|
|
1285
|
+
name: string;
|
|
1286
|
+
language: string;
|
|
1287
|
+
gender?: "male" | "female" | "neutral";
|
|
1058
1288
|
metadata?: Record<string, unknown>;
|
|
1059
|
-
}
|
|
1289
|
+
};
|
|
1060
1290
|
/**
|
|
1061
|
-
*
|
|
1062
|
-
* Handles persistence of conversations and messages
|
|
1291
|
+
* Base interface for voice providers
|
|
1063
1292
|
*/
|
|
1064
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
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
|
-
*
|
|
1303
|
+
* Convert speech to text
|
|
1084
1304
|
*/
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
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
|
-
*
|
|
1311
|
+
* Connect to real-time voice service
|
|
1119
1312
|
*/
|
|
1120
|
-
|
|
1313
|
+
connect(options?: Record<string, unknown>): Promise<void>;
|
|
1121
1314
|
/**
|
|
1122
|
-
*
|
|
1315
|
+
* Disconnect from real-time voice service
|
|
1123
1316
|
*/
|
|
1124
|
-
|
|
1317
|
+
disconnect(): void;
|
|
1125
1318
|
/**
|
|
1126
|
-
*
|
|
1319
|
+
* Send audio data to real-time service
|
|
1127
1320
|
*/
|
|
1128
|
-
|
|
1321
|
+
send(audioData: NodeJS.ReadableStream | Int16Array): Promise<void>;
|
|
1129
1322
|
/**
|
|
1130
|
-
*
|
|
1323
|
+
* Register event listener
|
|
1131
1324
|
*/
|
|
1132
|
-
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
1395
|
+
* Options for vector search
|
|
1174
1396
|
*/
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
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
|
-
*
|
|
1412
|
+
* Search result with similarity score
|
|
1182
1413
|
*/
|
|
1183
|
-
|
|
1184
|
-
|
|
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
|
-
*
|
|
1426
|
+
* Memory V2 Type Definitions
|
|
1427
|
+
* Clean separation between conversation memory and telemetry
|
|
1188
1428
|
*/
|
|
1189
|
-
|
|
1190
|
-
constructor(message: string, details?: Record<string, unknown>);
|
|
1191
|
-
}
|
|
1429
|
+
|
|
1192
1430
|
/**
|
|
1193
|
-
*
|
|
1431
|
+
* Extended UIMessage type with storage metadata
|
|
1194
1432
|
*/
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1433
|
+
type StoredUIMessage = UIMessage & {
|
|
1434
|
+
createdAt: Date;
|
|
1435
|
+
userId: string;
|
|
1436
|
+
conversationId: string;
|
|
1437
|
+
};
|
|
1198
1438
|
/**
|
|
1199
|
-
*
|
|
1439
|
+
* Conversation type
|
|
1200
1440
|
*/
|
|
1201
|
-
|
|
1202
|
-
|
|
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
|
-
*
|
|
1451
|
+
* Input type for creating a conversation
|
|
1206
1452
|
*/
|
|
1207
|
-
|
|
1208
|
-
|
|
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
|
-
*
|
|
1461
|
+
* Query builder options for conversations
|
|
1212
1462
|
*/
|
|
1213
|
-
|
|
1214
|
-
|
|
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
|
-
*
|
|
1504
|
+
* Memory options for MemoryManager
|
|
1218
1505
|
*/
|
|
1219
|
-
|
|
1220
|
-
|
|
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
|
-
*
|
|
1594
|
+
* Working memory scope - conversation or user level
|
|
1225
1595
|
*/
|
|
1226
|
-
|
|
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
|
-
*
|
|
1630
|
+
* Storage adapter for conversations and messages
|
|
1229
1631
|
*/
|
|
1230
|
-
|
|
1632
|
+
storage: StorageAdapter;
|
|
1231
1633
|
/**
|
|
1232
|
-
*
|
|
1634
|
+
* Optional embedding adapter or model reference for semantic operations
|
|
1233
1635
|
*/
|
|
1234
|
-
|
|
1636
|
+
embedding?: EmbeddingAdapterInput;
|
|
1235
1637
|
/**
|
|
1236
|
-
*
|
|
1638
|
+
* Optional vector adapter for similarity search
|
|
1237
1639
|
*/
|
|
1238
|
-
|
|
1640
|
+
vector?: VectorAdapter;
|
|
1239
1641
|
/**
|
|
1240
|
-
*
|
|
1642
|
+
* Enable caching for embeddings
|
|
1643
|
+
* @default false
|
|
1241
1644
|
*/
|
|
1242
|
-
|
|
1645
|
+
enableCache?: boolean;
|
|
1243
1646
|
/**
|
|
1244
|
-
*
|
|
1647
|
+
* Maximum number of embeddings to cache
|
|
1648
|
+
* @default 1000
|
|
1245
1649
|
*/
|
|
1246
|
-
|
|
1650
|
+
cacheSize?: number;
|
|
1247
1651
|
/**
|
|
1248
|
-
*
|
|
1652
|
+
* Cache TTL in milliseconds
|
|
1653
|
+
* @default 3600000 (1 hour)
|
|
1249
1654
|
*/
|
|
1250
|
-
|
|
1655
|
+
cacheTTL?: number;
|
|
1251
1656
|
/**
|
|
1252
|
-
*
|
|
1657
|
+
* Working memory configuration
|
|
1658
|
+
* Enables agents to maintain important context
|
|
1253
1659
|
*/
|
|
1254
|
-
|
|
1660
|
+
workingMemory?: WorkingMemoryConfig;
|
|
1255
1661
|
/**
|
|
1256
|
-
*
|
|
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
|
-
|
|
1666
|
+
generateTitle?: boolean | ConversationTitleConfig;
|
|
1259
1667
|
}
|
|
1260
1668
|
/**
|
|
1261
|
-
*
|
|
1669
|
+
* Embedding adapter config for Memory
|
|
1262
1670
|
*/
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
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
|
-
*
|
|
1675
|
+
* Embedding input options for Memory
|
|
1283
1676
|
*/
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
/**
|
|
1290
|
-
|
|
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
|
-
*
|
|
1686
|
+
* Summary of working memory configuration exposed to the UI
|
|
1300
1687
|
*/
|
|
1301
|
-
interface
|
|
1302
|
-
/**
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
/**
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
1321
|
-
|
|
1715
|
+
interface SearchOptions {
|
|
1716
|
+
limit?: number;
|
|
1717
|
+
threshold?: number;
|
|
1718
|
+
filter?: Record<string, unknown>;
|
|
1719
|
+
}
|
|
1322
1720
|
/**
|
|
1323
|
-
*
|
|
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
|
-
*
|
|
1328
|
-
* Handles conversation memory with optional vector search capabilities
|
|
1730
|
+
* Vector item for batch operations
|
|
1329
1731
|
*/
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
1462
|
-
|
|
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
|
-
*
|
|
1795
|
+
* Embed a single text
|
|
1466
1796
|
*/
|
|
1467
|
-
|
|
1797
|
+
embed(text: string): Promise<number[]>;
|
|
1468
1798
|
/**
|
|
1469
|
-
*
|
|
1799
|
+
* Embed multiple texts in batch
|
|
1470
1800
|
*/
|
|
1471
|
-
|
|
1801
|
+
embedBatch(texts: string[]): Promise<number[][]>;
|
|
1472
1802
|
/**
|
|
1473
|
-
*
|
|
1803
|
+
* Get embedding dimensions
|
|
1474
1804
|
*/
|
|
1475
|
-
|
|
1476
|
-
conversationId?: string;
|
|
1477
|
-
userId?: string;
|
|
1478
|
-
}): Promise<void>;
|
|
1805
|
+
getDimensions(): number;
|
|
1479
1806
|
/**
|
|
1480
|
-
* Get
|
|
1807
|
+
* Get model name
|
|
1481
1808
|
*/
|
|
1482
|
-
|
|
1809
|
+
getModelName(): string;
|
|
1810
|
+
}
|
|
1811
|
+
/**
|
|
1812
|
+
* Vector Adapter Interface
|
|
1813
|
+
* Handles vector storage and similarity search
|
|
1814
|
+
*/
|
|
1815
|
+
interface VectorAdapter {
|
|
1483
1816
|
/**
|
|
1484
|
-
*
|
|
1817
|
+
* Store a single vector
|
|
1485
1818
|
*/
|
|
1486
|
-
|
|
1819
|
+
store(id: string, vector: number[], metadata?: Record<string, unknown>): Promise<void>;
|
|
1487
1820
|
/**
|
|
1488
|
-
*
|
|
1821
|
+
* Store multiple vectors in batch
|
|
1489
1822
|
*/
|
|
1490
|
-
|
|
1823
|
+
storeBatch(items: VectorItem[]): Promise<void>;
|
|
1491
1824
|
/**
|
|
1492
|
-
*
|
|
1825
|
+
* Search for similar vectors
|
|
1493
1826
|
*/
|
|
1494
|
-
|
|
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
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
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
|
-
*
|
|
1833
|
+
* Delete a vector by ID
|
|
1572
1834
|
*/
|
|
1573
|
-
|
|
1835
|
+
delete(id: string): Promise<void>;
|
|
1574
1836
|
/**
|
|
1575
|
-
*
|
|
1837
|
+
* Delete multiple vectors by IDs
|
|
1576
1838
|
*/
|
|
1577
|
-
|
|
1839
|
+
deleteBatch(ids: string[]): Promise<void>;
|
|
1578
1840
|
/**
|
|
1579
|
-
*
|
|
1841
|
+
* Clear all vectors
|
|
1580
1842
|
*/
|
|
1581
|
-
|
|
1843
|
+
clear(): Promise<void>;
|
|
1582
1844
|
}
|
|
1583
1845
|
|
|
1584
1846
|
/**
|
|
1585
|
-
*
|
|
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
|
-
*
|
|
1849
|
+
* All types related to VoltOps client functionality including
|
|
1850
|
+
* prompt management, telemetry, and API interactions.
|
|
1590
1851
|
*/
|
|
1591
|
-
|
|
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
|
-
*
|
|
1855
|
+
* Reference to a prompt in the VoltOps system
|
|
1648
1856
|
*/
|
|
1649
|
-
|
|
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
|
-
*
|
|
1874
|
+
* Helper interface for prompt operations in agent instructions
|
|
1653
1875
|
*/
|
|
1654
|
-
|
|
1876
|
+
type PromptHelper = {
|
|
1877
|
+
/** Get prompt content by reference */
|
|
1878
|
+
getPrompt: (reference: PromptReference) => Promise<PromptContent>;
|
|
1879
|
+
};
|
|
1655
1880
|
/**
|
|
1656
|
-
*
|
|
1881
|
+
* Enhanced dynamic value options with prompts support
|
|
1657
1882
|
*/
|
|
1658
|
-
|
|
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
|
-
*
|
|
1890
|
+
* Dynamic value type for agent configuration
|
|
1662
1891
|
*/
|
|
1663
|
-
type
|
|
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
|
-
*
|
|
1688
|
-
* Includes all operation context fields for user-specific and context-aware retrieval.
|
|
1894
|
+
* VoltOps client configuration options
|
|
1689
1895
|
*/
|
|
1690
|
-
|
|
1896
|
+
type VoltOpsClientOptions = {
|
|
1897
|
+
/** Base URL of the VoltOps API (default: https://api.voltagent.dev) */
|
|
1898
|
+
baseUrl?: string;
|
|
1691
1899
|
/**
|
|
1692
|
-
*
|
|
1693
|
-
* Can be used to store metadata, results, or any custom data
|
|
1900
|
+
* Public API key for VoltOps authentication
|
|
1694
1901
|
*
|
|
1695
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
1915
|
+
publicKey?: string;
|
|
1713
1916
|
/**
|
|
1714
|
-
*
|
|
1715
|
-
* Can be used to retrieve conversation-specific context or history.
|
|
1917
|
+
* Secret API key for VoltOps authentication
|
|
1716
1918
|
*
|
|
1717
|
-
*
|
|
1718
|
-
|
|
1719
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
1790
|
-
* @
|
|
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
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
/**
|
|
1910
|
-
|
|
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
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
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> |
|
|
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,1149 @@ 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
|
+
parentAgentId?: string;
|
|
6933
|
+
input?: string | UIMessage[] | BaseMessage[];
|
|
6934
|
+
}
|
|
6935
|
+
declare class AgentTraceContext {
|
|
6936
|
+
private rootSpan;
|
|
6937
|
+
private tracer;
|
|
6938
|
+
private commonAttributes;
|
|
6939
|
+
private activeContext;
|
|
6940
|
+
constructor(observability: VoltAgentObservability, operationName: string, options: TraceContextOptions);
|
|
6941
|
+
/**
|
|
6942
|
+
* Create a child span with automatic parent context and attribute inheritance
|
|
6943
|
+
*/
|
|
6944
|
+
createChildSpan(name: string, type: "tool" | "memory" | "retriever" | "embedding" | "vector" | "agent" | "guardrail" | "middleware" | "llm" | "summary", options?: {
|
|
6945
|
+
label?: string;
|
|
6946
|
+
attributes?: Record<string, any>;
|
|
6947
|
+
kind?: SpanKind$1;
|
|
6948
|
+
}): Span;
|
|
6949
|
+
/**
|
|
6950
|
+
* Create a child span with a specific parent span
|
|
6951
|
+
*/
|
|
6952
|
+
createChildSpanWithParent(parentSpan: Span, name: string, type: "tool" | "memory" | "retriever" | "embedding" | "vector" | "agent" | "guardrail" | "middleware" | "llm" | "summary", options?: {
|
|
6953
|
+
label?: string;
|
|
6954
|
+
attributes?: Record<string, any>;
|
|
6955
|
+
kind?: SpanKind$1;
|
|
6956
|
+
}): Span;
|
|
6957
|
+
/**
|
|
6958
|
+
* Execute a function within a span's context
|
|
6959
|
+
*/
|
|
6960
|
+
withSpan<T>(span: Span, fn: () => T | Promise<T>): Promise<T>;
|
|
6961
|
+
/**
|
|
6962
|
+
* Get the root span
|
|
6963
|
+
*/
|
|
6964
|
+
getRootSpan(): Span;
|
|
6965
|
+
/**
|
|
6966
|
+
* Set input on the root span
|
|
6967
|
+
*/
|
|
6968
|
+
setInput(input: any): void;
|
|
6969
|
+
/**
|
|
6970
|
+
* Set output on the root span
|
|
6971
|
+
*/
|
|
6972
|
+
setOutput(output: any): void;
|
|
6973
|
+
/**
|
|
6974
|
+
* Set instructions (system prompt) on the root span
|
|
6975
|
+
*/
|
|
6976
|
+
setInstructions(instructions: any): void;
|
|
6977
|
+
/**
|
|
6978
|
+
* Set model attributes on the root span
|
|
6979
|
+
*/
|
|
6980
|
+
setModelAttributes(modelName: string, temperature?: number, maxTokens?: number, topP?: number, frequencyPenalty?: number, presencePenalty?: number, maxSteps?: number): void;
|
|
6981
|
+
/**
|
|
6982
|
+
* Set usage information on the root span
|
|
6983
|
+
*/
|
|
6984
|
+
setUsage(usage: {
|
|
6985
|
+
promptTokens?: number;
|
|
6986
|
+
completionTokens?: number;
|
|
6987
|
+
totalTokens?: number;
|
|
6988
|
+
cachedTokens?: number;
|
|
6989
|
+
reasoningTokens?: number;
|
|
6990
|
+
}): void;
|
|
6991
|
+
/**
|
|
6992
|
+
* Set finish reason on the root span
|
|
6993
|
+
*/
|
|
6994
|
+
setFinishReason(finishReason: string | null | undefined): void;
|
|
6995
|
+
/**
|
|
6996
|
+
* Set stop condition metadata when maxSteps is reached
|
|
6997
|
+
*/
|
|
6998
|
+
setStopConditionMet(stepCount: number, maxSteps: number): void;
|
|
6999
|
+
/**
|
|
7000
|
+
* End the root span with a status
|
|
7001
|
+
*/
|
|
7002
|
+
end(status: "completed" | "error", error?: Error | any): void;
|
|
7003
|
+
/**
|
|
7004
|
+
* End a child span with proper status
|
|
7005
|
+
*/
|
|
7006
|
+
endChildSpan(span: Span, status: "completed" | "error", options?: {
|
|
7007
|
+
output?: any;
|
|
7008
|
+
error?: Error | any;
|
|
7009
|
+
attributes?: Record<string, any>;
|
|
7010
|
+
}): void;
|
|
7011
|
+
private resolveParentSpan;
|
|
7012
|
+
/**
|
|
7013
|
+
* Get the active context for manual context propagation
|
|
7014
|
+
*/
|
|
7015
|
+
getActiveContext(): Context;
|
|
7016
|
+
/**
|
|
7017
|
+
* Update active context with a new span
|
|
7018
|
+
*/
|
|
7019
|
+
updateActiveContext(span: Span): void;
|
|
7020
|
+
}
|
|
7021
|
+
|
|
7022
|
+
/**
|
|
7023
|
+
* Tool representation for API responses
|
|
7024
|
+
*/
|
|
7025
|
+
interface ApiToolInfo {
|
|
7026
|
+
name: string;
|
|
7027
|
+
description: string;
|
|
7028
|
+
parameters?: any;
|
|
7029
|
+
}
|
|
7030
|
+
interface AgentToolRoutingState {
|
|
7031
|
+
routers?: ApiToolInfo[];
|
|
7032
|
+
expose?: ApiToolInfo[];
|
|
7033
|
+
pool?: ApiToolInfo[];
|
|
7034
|
+
}
|
|
7035
|
+
type AgentFeedbackOptions = {
|
|
7036
|
+
key?: string;
|
|
7037
|
+
feedbackConfig?: VoltOpsFeedbackConfig | null;
|
|
7038
|
+
expiresAt?: Date | string;
|
|
7039
|
+
expiresIn?: VoltOpsFeedbackExpiresIn;
|
|
7040
|
+
};
|
|
7041
|
+
type AgentFeedbackMetadata = {
|
|
7042
|
+
traceId: string;
|
|
7043
|
+
key: string;
|
|
7044
|
+
url: string;
|
|
7045
|
+
tokenId?: string;
|
|
7046
|
+
expiresAt?: string;
|
|
7047
|
+
feedbackConfig?: VoltOpsFeedbackConfig | null;
|
|
7048
|
+
};
|
|
7049
|
+
/**
|
|
7050
|
+
* Tool with node_id for agent state
|
|
7051
|
+
*/
|
|
7052
|
+
type ToolWithNodeId = (BaseTool | ProviderTool) & {
|
|
7053
|
+
node_id: string;
|
|
7054
|
+
};
|
|
7055
|
+
interface AgentScorerState {
|
|
7056
|
+
key: string;
|
|
7057
|
+
id: string;
|
|
7058
|
+
name: string;
|
|
7059
|
+
node_id: string;
|
|
7060
|
+
sampling?: SamplingPolicy;
|
|
7061
|
+
metadata?: Record<string, unknown> | null;
|
|
7062
|
+
params?: Record<string, unknown> | null;
|
|
7063
|
+
}
|
|
7064
|
+
/**
|
|
7065
|
+
* SubAgent data structure for agent state
|
|
7066
|
+
*/
|
|
7067
|
+
interface SubAgentStateData {
|
|
7068
|
+
id: string;
|
|
7069
|
+
name: string;
|
|
7070
|
+
instructions?: string;
|
|
7071
|
+
status: string;
|
|
7072
|
+
model: string;
|
|
7073
|
+
tools: ApiToolInfo[];
|
|
7074
|
+
memory?: AgentMemoryState;
|
|
7075
|
+
node_id: string;
|
|
7076
|
+
subAgents?: SubAgentStateData[];
|
|
7077
|
+
scorers?: AgentScorerState[];
|
|
7078
|
+
guardrails?: AgentGuardrailStateGroup;
|
|
7079
|
+
methodConfig?: {
|
|
7080
|
+
method: string;
|
|
7081
|
+
schema?: string;
|
|
7082
|
+
options?: string[];
|
|
7083
|
+
};
|
|
7084
|
+
[key: string]: unknown;
|
|
7085
|
+
}
|
|
7086
|
+
/**
|
|
7087
|
+
* Memory block representation shared across agent and sub-agent state
|
|
7088
|
+
*/
|
|
7089
|
+
interface AgentMemoryState extends Record<string, unknown> {
|
|
7090
|
+
node_id: string;
|
|
7091
|
+
type?: string;
|
|
7092
|
+
resourceId?: string;
|
|
7093
|
+
options?: MemoryOptions;
|
|
7094
|
+
available?: boolean;
|
|
7095
|
+
status?: string;
|
|
7096
|
+
storage?: MemoryStorageMetadata;
|
|
7097
|
+
workingMemory?: WorkingMemorySummary | null;
|
|
7098
|
+
vectorDB?: {
|
|
7099
|
+
enabled: boolean;
|
|
7100
|
+
adapter?: string;
|
|
7101
|
+
dimension?: number;
|
|
7102
|
+
status?: string;
|
|
7103
|
+
node_id?: string;
|
|
7104
|
+
} | null;
|
|
7105
|
+
embeddingModel?: {
|
|
7106
|
+
enabled: boolean;
|
|
7107
|
+
model?: string;
|
|
7108
|
+
dimension?: number;
|
|
7109
|
+
status?: string;
|
|
7110
|
+
node_id?: string;
|
|
7111
|
+
} | null;
|
|
7112
|
+
}
|
|
7113
|
+
/**
|
|
7114
|
+
* Full state of an agent including all properties
|
|
7115
|
+
*/
|
|
7116
|
+
interface AgentFullState {
|
|
7117
|
+
id: string;
|
|
7118
|
+
name: string;
|
|
7119
|
+
instructions?: string;
|
|
7120
|
+
status: string;
|
|
7121
|
+
model: string;
|
|
7122
|
+
node_id: string;
|
|
7123
|
+
tools: ToolWithNodeId[];
|
|
7124
|
+
toolRouting?: AgentToolRoutingState;
|
|
7125
|
+
subAgents: SubAgentStateData[];
|
|
7126
|
+
memory: AgentMemoryState;
|
|
7127
|
+
scorers?: AgentScorerState[];
|
|
7128
|
+
retriever?: {
|
|
7129
|
+
name: string;
|
|
7130
|
+
description?: string;
|
|
7131
|
+
status?: string;
|
|
7132
|
+
node_id: string;
|
|
7133
|
+
} | null;
|
|
7134
|
+
guardrails?: AgentGuardrailStateGroup;
|
|
7135
|
+
}
|
|
7136
|
+
/**
|
|
7137
|
+
* Enhanced dynamic value for instructions that supports prompt management
|
|
7138
|
+
*/
|
|
7139
|
+
type InstructionsDynamicValue = string | DynamicValue<string | PromptContent>;
|
|
7140
|
+
/**
|
|
7141
|
+
* Enhanced dynamic value for models that supports static or dynamic values
|
|
7142
|
+
*/
|
|
7143
|
+
type ModelDynamicValue<T> = T | DynamicValue<T>;
|
|
7144
|
+
/**
|
|
7145
|
+
* Supported model references for agents (AI SDK models or provider/model strings)
|
|
7146
|
+
*/
|
|
7147
|
+
type AgentModelReference = LanguageModel | ModelRouterModelId;
|
|
7148
|
+
/**
|
|
7149
|
+
* Model fallback configuration for agents.
|
|
7150
|
+
*/
|
|
7151
|
+
type AgentModelConfig = {
|
|
7152
|
+
/**
|
|
7153
|
+
* Optional stable identifier for the model entry (useful for logging).
|
|
7154
|
+
*/
|
|
7155
|
+
id?: string;
|
|
7156
|
+
/**
|
|
7157
|
+
* Model reference (static or dynamic).
|
|
7158
|
+
*/
|
|
7159
|
+
model: ModelDynamicValue<AgentModelReference>;
|
|
7160
|
+
/**
|
|
7161
|
+
* Maximum number of retries for this model before falling back.
|
|
7162
|
+
* Defaults to the agent's maxRetries.
|
|
7163
|
+
*/
|
|
7164
|
+
maxRetries?: number;
|
|
7165
|
+
/**
|
|
7166
|
+
* Whether this model is enabled for fallback selection.
|
|
7167
|
+
* @default true
|
|
7168
|
+
*/
|
|
7169
|
+
enabled?: boolean;
|
|
7170
|
+
};
|
|
7171
|
+
/**
|
|
7172
|
+
* Agent model value that can be static, dynamic, or a fallback list.
|
|
7173
|
+
*/
|
|
7174
|
+
type AgentModelValue = ModelDynamicValue<AgentModelReference> | AgentModelConfig[];
|
|
7175
|
+
/**
|
|
7176
|
+
* Provider options type for LLM configurations
|
|
7177
|
+
*/
|
|
7178
|
+
type ProviderOptions = {
|
|
7179
|
+
temperature?: number;
|
|
7180
|
+
maxTokens?: number;
|
|
7181
|
+
topP?: number;
|
|
7182
|
+
frequencyPenalty?: number;
|
|
7183
|
+
presencePenalty?: number;
|
|
7184
|
+
seed?: number;
|
|
7185
|
+
stopSequences?: string[];
|
|
7186
|
+
extraOptions?: Record<string, unknown>;
|
|
7187
|
+
onStepFinish?: (step: StepWithContent) => Promise<void>;
|
|
7188
|
+
onFinish?: (result: unknown) => Promise<void>;
|
|
7189
|
+
onError?: (error: unknown) => Promise<void>;
|
|
7190
|
+
[key: string]: unknown;
|
|
7191
|
+
};
|
|
7192
|
+
/**
|
|
7193
|
+
* Configuration for supervisor agents that have subagents
|
|
7194
|
+
*/
|
|
7195
|
+
/**
|
|
7196
|
+
* StreamEventType derived from AI SDK's TextStreamPart
|
|
7197
|
+
* Includes all event types from AI SDK
|
|
7198
|
+
*/
|
|
7199
|
+
type StreamEventType = TextStreamPart<any>["type"];
|
|
7200
|
+
/**
|
|
7201
|
+
* Configuration for forwarding events from subagents to the parent agent's stream
|
|
7202
|
+
*/
|
|
7203
|
+
type FullStreamEventForwardingConfig = {
|
|
7204
|
+
/**
|
|
7205
|
+
* Array of event types to forward from subagents
|
|
7206
|
+
* Uses AI SDK's TextStreamPart types:
|
|
7207
|
+
* - Text: 'text-start', 'text-end', 'text-delta'
|
|
7208
|
+
* - Reasoning: 'reasoning-start', 'reasoning-end', 'reasoning-delta'
|
|
7209
|
+
* - Tool: 'tool-input-start', 'tool-input-end', 'tool-input-delta',
|
|
7210
|
+
* 'tool-call', 'tool-result', 'tool-error'
|
|
7211
|
+
* - Other: 'source', 'file', 'start-step', 'finish-step',
|
|
7212
|
+
* 'start', 'finish', 'abort', 'error', 'raw'
|
|
7213
|
+
* @default ['tool-call', 'tool-result']
|
|
7214
|
+
* @example ['tool-call', 'tool-result', 'text-delta']
|
|
7215
|
+
*/
|
|
7216
|
+
types?: StreamEventType[];
|
|
7217
|
+
};
|
|
7218
|
+
type SupervisorConfig = {
|
|
7219
|
+
/**
|
|
7220
|
+
* Complete custom system message for the supervisor agent
|
|
7221
|
+
* If provided, this completely replaces the default template
|
|
7222
|
+
* Only agents memory section will be appended if includeAgentsMemory is true
|
|
7223
|
+
*/
|
|
7224
|
+
systemMessage?: string;
|
|
7225
|
+
/**
|
|
7226
|
+
* Whether to include agents memory in the supervisor system message
|
|
7227
|
+
* @default true
|
|
7228
|
+
*/
|
|
7229
|
+
includeAgentsMemory?: boolean;
|
|
7230
|
+
/**
|
|
7231
|
+
* Additional custom guidelines for the supervisor agent
|
|
7232
|
+
*/
|
|
7233
|
+
customGuidelines?: string[];
|
|
7234
|
+
/**
|
|
7235
|
+
* Configuration for forwarding events from subagents to the parent agent's full stream
|
|
7236
|
+
* Controls which event types are forwarded
|
|
7237
|
+
* @default { types: ['tool-call', 'tool-result'] }
|
|
7238
|
+
*/
|
|
7239
|
+
fullStreamEventForwarding?: FullStreamEventForwardingConfig;
|
|
7240
|
+
/**
|
|
7241
|
+
* Whether to throw an exception when a subagent stream encounters an error
|
|
7242
|
+
* If true, stream errors will cause the handoff to throw an exception
|
|
7243
|
+
* If false, errors will be captured and returned in the result
|
|
7244
|
+
* @default false
|
|
7245
|
+
*/
|
|
7246
|
+
throwOnStreamError?: boolean;
|
|
7247
|
+
/**
|
|
7248
|
+
* Whether to include error message in the result when no text content was produced
|
|
7249
|
+
* Only applies when throwOnStreamError is false
|
|
7250
|
+
* If true, the error message will be included in the result field
|
|
7251
|
+
* If false, the result will be empty but status will still be 'error'
|
|
7252
|
+
* @default true
|
|
7253
|
+
*/
|
|
7254
|
+
includeErrorInEmptyResponse?: boolean;
|
|
7255
|
+
};
|
|
7256
|
+
type GuardrailSeverity = "info" | "warning" | "critical";
|
|
7257
|
+
type GuardrailAction = "allow" | "modify" | "block";
|
|
7258
|
+
interface GuardrailBaseResult {
|
|
7259
|
+
pass: boolean;
|
|
7260
|
+
action?: GuardrailAction;
|
|
7261
|
+
message?: string;
|
|
7262
|
+
metadata?: Record<string, unknown>;
|
|
7263
|
+
}
|
|
7264
|
+
interface OutputGuardrailStreamArgs extends GuardrailContext {
|
|
7265
|
+
part: VoltAgentTextStreamPart;
|
|
7266
|
+
streamParts: VoltAgentTextStreamPart[];
|
|
7267
|
+
state: Record<string, any>;
|
|
7268
|
+
abort: (reason?: string) => never;
|
|
7269
|
+
}
|
|
7270
|
+
type OutputGuardrailStreamResult = VoltAgentTextStreamPart | null | undefined | Promise<VoltAgentTextStreamPart | null | undefined>;
|
|
7271
|
+
type OutputGuardrailStreamHandler = (args: OutputGuardrailStreamArgs) => OutputGuardrailStreamResult;
|
|
7272
|
+
type GuardrailFunctionMetadata = {
|
|
7273
|
+
guardrailId?: string;
|
|
7274
|
+
guardrailName?: string;
|
|
7275
|
+
guardrailDescription?: string;
|
|
7276
|
+
guardrailTags?: string[];
|
|
7277
|
+
guardrailSeverity?: GuardrailSeverity;
|
|
7278
|
+
};
|
|
7279
|
+
type GuardrailFunction<TArgs, TResult> = ((args: TArgs) => TResult | Promise<TResult>) & GuardrailFunctionMetadata;
|
|
7280
|
+
interface GuardrailDefinition<TArgs, TResult> {
|
|
7281
|
+
id?: string;
|
|
7282
|
+
name?: string;
|
|
7283
|
+
description?: string;
|
|
7284
|
+
tags?: string[];
|
|
7285
|
+
severity?: GuardrailSeverity;
|
|
7286
|
+
metadata?: Record<string, unknown>;
|
|
7287
|
+
handler: GuardrailFunction<TArgs, TResult>;
|
|
7288
|
+
}
|
|
7289
|
+
type GuardrailConfig<TArgs, TResult> = GuardrailFunction<TArgs, TResult> | GuardrailDefinition<TArgs, TResult>;
|
|
7290
|
+
interface AgentGuardrailState {
|
|
7291
|
+
id?: string;
|
|
7292
|
+
name: string;
|
|
7293
|
+
direction: "input" | "output";
|
|
7294
|
+
description?: string;
|
|
7295
|
+
severity?: GuardrailSeverity;
|
|
7296
|
+
tags?: string[];
|
|
7297
|
+
metadata?: Record<string, unknown> | null;
|
|
7298
|
+
node_id: string;
|
|
7299
|
+
}
|
|
7300
|
+
interface AgentGuardrailStateGroup {
|
|
7301
|
+
input: AgentGuardrailState[];
|
|
7302
|
+
output: AgentGuardrailState[];
|
|
7303
|
+
}
|
|
7304
|
+
interface GuardrailContext {
|
|
7305
|
+
agent: Agent;
|
|
7306
|
+
context: OperationContext;
|
|
7307
|
+
operation: AgentEvalOperationType;
|
|
7308
|
+
}
|
|
7309
|
+
interface InputGuardrailArgs extends GuardrailContext {
|
|
7310
|
+
/**
|
|
7311
|
+
* The latest value after any previous guardrail modifications.
|
|
7312
|
+
*/
|
|
7313
|
+
input: string | UIMessage[] | BaseMessage[];
|
|
7314
|
+
/**
|
|
7315
|
+
* Plain text representation of the latest input value.
|
|
7316
|
+
*/
|
|
7317
|
+
inputText: string;
|
|
7318
|
+
/**
|
|
7319
|
+
* The original user provided value before any guardrail modifications.
|
|
7320
|
+
*/
|
|
7321
|
+
originalInput: string | UIMessage[] | BaseMessage[];
|
|
7322
|
+
/**
|
|
7323
|
+
* Plain text representation of the original input value.
|
|
7324
|
+
*/
|
|
7325
|
+
originalInputText: string;
|
|
7326
|
+
}
|
|
7327
|
+
interface InputGuardrailResult extends GuardrailBaseResult {
|
|
7328
|
+
modifiedInput?: string | UIMessage[] | BaseMessage[];
|
|
7329
|
+
}
|
|
7330
|
+
interface OutputGuardrailArgs<TOutput = unknown> extends GuardrailContext {
|
|
7331
|
+
/**
|
|
7332
|
+
* The latest value after any previous guardrail modifications.
|
|
7333
|
+
*/
|
|
7334
|
+
output: TOutput;
|
|
7335
|
+
/**
|
|
7336
|
+
* Optional plain text representation of the latest output value.
|
|
7337
|
+
*/
|
|
7338
|
+
outputText?: string;
|
|
7339
|
+
/**
|
|
7340
|
+
* The original value produced by the model before guardrail modifications.
|
|
7341
|
+
*/
|
|
7342
|
+
originalOutput: TOutput;
|
|
7343
|
+
/**
|
|
7344
|
+
* Optional plain text representation of the original output value.
|
|
7345
|
+
*/
|
|
7346
|
+
originalOutputText?: string;
|
|
7347
|
+
/**
|
|
7348
|
+
* Optional usage metrics for the generation.
|
|
7349
|
+
*/
|
|
7350
|
+
usage?: UsageInfo;
|
|
7351
|
+
/**
|
|
7352
|
+
* Optional finish reason from the model/provider.
|
|
7353
|
+
*/
|
|
7354
|
+
finishReason?: string | null;
|
|
7355
|
+
/**
|
|
7356
|
+
* Optional warnings or diagnostics returned by the provider.
|
|
7357
|
+
*/
|
|
7358
|
+
warnings?: unknown[] | null;
|
|
7359
|
+
}
|
|
7360
|
+
interface OutputGuardrailResult<TOutput = unknown> extends GuardrailBaseResult {
|
|
7361
|
+
modifiedOutput?: TOutput;
|
|
7362
|
+
}
|
|
7363
|
+
type InputGuardrail = GuardrailConfig<InputGuardrailArgs, InputGuardrailResult>;
|
|
7364
|
+
type OutputGuardrailFunction<TOutput = unknown> = GuardrailFunction<OutputGuardrailArgs<TOutput>, OutputGuardrailResult<TOutput>> & {
|
|
7365
|
+
guardrailStreamHandler?: OutputGuardrailStreamHandler;
|
|
7366
|
+
};
|
|
7367
|
+
interface OutputGuardrailDefinition<TOutput = unknown> extends GuardrailDefinition<OutputGuardrailArgs<TOutput>, OutputGuardrailResult<TOutput>> {
|
|
7368
|
+
streamHandler?: OutputGuardrailStreamHandler;
|
|
7369
|
+
}
|
|
7370
|
+
type OutputGuardrail<TOutput = unknown> = OutputGuardrailFunction<TOutput> | OutputGuardrailDefinition<TOutput>;
|
|
7371
|
+
type MiddlewareDirection = "input" | "output";
|
|
7372
|
+
type MiddlewareFunctionMetadata = {
|
|
7373
|
+
middlewareId?: string;
|
|
7374
|
+
middlewareName?: string;
|
|
7375
|
+
middlewareDescription?: string;
|
|
7376
|
+
middlewareTags?: string[];
|
|
7377
|
+
};
|
|
7378
|
+
type MiddlewareFunction<TArgs, TResult> = ((args: TArgs) => TResult | Promise<TResult>) & MiddlewareFunctionMetadata;
|
|
7379
|
+
interface MiddlewareDefinition<TArgs, TResult> {
|
|
7380
|
+
id?: string;
|
|
7381
|
+
name?: string;
|
|
7382
|
+
description?: string;
|
|
7383
|
+
tags?: string[];
|
|
7384
|
+
metadata?: Record<string, unknown>;
|
|
7385
|
+
handler: MiddlewareFunction<TArgs, TResult>;
|
|
7386
|
+
}
|
|
7387
|
+
interface MiddlewareContext {
|
|
7388
|
+
agent: Agent;
|
|
7389
|
+
context: OperationContext;
|
|
7390
|
+
operation: AgentEvalOperationType;
|
|
7391
|
+
retryCount: number;
|
|
7392
|
+
}
|
|
7393
|
+
interface InputMiddlewareArgs extends MiddlewareContext {
|
|
7394
|
+
input: string | UIMessage[] | BaseMessage[];
|
|
7395
|
+
originalInput: string | UIMessage[] | BaseMessage[];
|
|
7396
|
+
abort: <TMetadata = unknown>(reason?: string, options?: MiddlewareAbortOptions<TMetadata>) => never;
|
|
7397
|
+
}
|
|
7398
|
+
type InputMiddlewareResult = string | UIMessage[] | BaseMessage[] | undefined;
|
|
7399
|
+
interface OutputMiddlewareArgs<TOutput = unknown> extends MiddlewareContext {
|
|
7400
|
+
output: TOutput;
|
|
7401
|
+
originalOutput: TOutput;
|
|
7402
|
+
usage?: UsageInfo;
|
|
7403
|
+
finishReason?: string | null;
|
|
7404
|
+
warnings?: unknown[] | null;
|
|
7405
|
+
abort: <TMetadata = unknown>(reason?: string, options?: MiddlewareAbortOptions<TMetadata>) => never;
|
|
7406
|
+
}
|
|
7407
|
+
type OutputMiddlewareResult<TOutput = unknown> = TOutput | undefined;
|
|
7408
|
+
type InputMiddleware = MiddlewareDefinition<InputMiddlewareArgs, InputMiddlewareResult> | MiddlewareFunction<InputMiddlewareArgs, InputMiddlewareResult>;
|
|
7409
|
+
type OutputMiddleware<TOutput = unknown> = MiddlewareDefinition<OutputMiddlewareArgs<TOutput>, OutputMiddlewareResult<TOutput>> | MiddlewareFunction<OutputMiddlewareArgs<TOutput>, OutputMiddlewareResult<TOutput>>;
|
|
7410
|
+
type AgentSummarizationOptions = {
|
|
7411
|
+
enabled?: boolean;
|
|
7412
|
+
triggerTokens?: number;
|
|
7413
|
+
keepMessages?: number;
|
|
7414
|
+
maxOutputTokens?: number;
|
|
7415
|
+
systemPrompt?: string | null;
|
|
7416
|
+
model?: AgentModelValue;
|
|
7417
|
+
};
|
|
7418
|
+
/**
|
|
7419
|
+
* Agent configuration options
|
|
7420
|
+
*/
|
|
7421
|
+
type AgentOptions = {
|
|
7422
|
+
id?: string;
|
|
7423
|
+
name: string;
|
|
7424
|
+
purpose?: string;
|
|
7425
|
+
model: AgentModelValue;
|
|
7426
|
+
instructions: InstructionsDynamicValue;
|
|
7427
|
+
tools?: (Tool<any, any> | Toolkit | Tool$1)[] | DynamicValue<(Tool<any, any> | Toolkit)[]>;
|
|
7428
|
+
toolkits?: Toolkit[];
|
|
7429
|
+
toolRouting?: ToolRoutingConfig | false;
|
|
7430
|
+
memory?: Memory | false;
|
|
7431
|
+
summarization?: AgentSummarizationOptions | false;
|
|
7432
|
+
retriever?: BaseRetriever;
|
|
7433
|
+
subAgents?: SubAgentConfig[];
|
|
7434
|
+
supervisorConfig?: SupervisorConfig;
|
|
7435
|
+
maxHistoryEntries?: number;
|
|
7436
|
+
hooks?: AgentHooks;
|
|
7437
|
+
inputGuardrails?: InputGuardrail[];
|
|
7438
|
+
outputGuardrails?: OutputGuardrail<any>[];
|
|
7439
|
+
inputMiddlewares?: InputMiddleware[];
|
|
7440
|
+
outputMiddlewares?: OutputMiddleware<any>[];
|
|
7441
|
+
/**
|
|
7442
|
+
* Default retry count for middleware-triggered retries.
|
|
7443
|
+
* Per-call maxMiddlewareRetries overrides this value.
|
|
7444
|
+
*/
|
|
7445
|
+
maxMiddlewareRetries?: number;
|
|
7446
|
+
temperature?: number;
|
|
7447
|
+
maxOutputTokens?: number;
|
|
7448
|
+
maxSteps?: number;
|
|
7449
|
+
/**
|
|
7450
|
+
* Default retry count for model calls before falling back.
|
|
7451
|
+
* Overridden by per-model maxRetries or per-call maxRetries.
|
|
7452
|
+
*/
|
|
7453
|
+
maxRetries?: number;
|
|
7454
|
+
feedback?: AgentFeedbackOptions | boolean;
|
|
7455
|
+
/**
|
|
7456
|
+
* Default stop condition for step execution (ai-sdk `stopWhen`).
|
|
7457
|
+
* Per-call `stopWhen` in method options overrides this.
|
|
7458
|
+
*/
|
|
7459
|
+
stopWhen?: StopWhen;
|
|
7460
|
+
markdown?: boolean;
|
|
7461
|
+
voice?: Voice;
|
|
7462
|
+
logger?: Logger;
|
|
7463
|
+
voltOpsClient?: VoltOpsClient;
|
|
7464
|
+
observability?: VoltAgentObservability;
|
|
7465
|
+
context?: ContextInput;
|
|
7466
|
+
eval?: AgentEvalConfig;
|
|
7467
|
+
};
|
|
7468
|
+
type AgentEvalOperationType = "generateText" | "generateTitle" | "streamText" | "generateObject" | "streamObject" | "workflow";
|
|
7469
|
+
interface AgentEvalPayload {
|
|
7470
|
+
operationId: string;
|
|
7471
|
+
operationType: AgentEvalOperationType;
|
|
7472
|
+
input?: string | null;
|
|
7473
|
+
output?: string | null;
|
|
7474
|
+
rawInput?: string | UIMessage[] | BaseMessage[];
|
|
7475
|
+
rawOutput?: unknown;
|
|
7476
|
+
userId?: string;
|
|
7477
|
+
conversationId?: string;
|
|
7478
|
+
traceId: string;
|
|
7479
|
+
spanId: string;
|
|
7480
|
+
metadata?: Record<string, unknown>;
|
|
7481
|
+
}
|
|
7482
|
+
type AgentEvalContext = AgentEvalPayload & Record<string, unknown> & {
|
|
7483
|
+
agentId: string;
|
|
7484
|
+
agentName: string;
|
|
7485
|
+
timestamp: string;
|
|
7486
|
+
rawPayload: AgentEvalPayload;
|
|
7487
|
+
};
|
|
7488
|
+
type AgentEvalParams = Record<string, unknown>;
|
|
7489
|
+
type AgentEvalSamplingPolicy = SamplingPolicy;
|
|
7490
|
+
type AgentEvalScorerFactory = () => LocalScorerDefinition<AgentEvalContext, Record<string, unknown>> | Promise<LocalScorerDefinition<AgentEvalContext, Record<string, unknown>>>;
|
|
7491
|
+
type AgentEvalScorerReference = LocalScorerDefinition<AgentEvalContext, Record<string, unknown>> | AgentEvalScorerFactory;
|
|
7492
|
+
interface AgentEvalResult {
|
|
7493
|
+
scorerId: string;
|
|
7494
|
+
scorerName?: string;
|
|
7495
|
+
status: "success" | "error" | "skipped";
|
|
7496
|
+
score?: number | null;
|
|
7497
|
+
metadata?: Record<string, unknown> | null;
|
|
7498
|
+
error?: unknown;
|
|
7499
|
+
durationMs?: number;
|
|
7500
|
+
payload: AgentEvalPayload;
|
|
7501
|
+
rawPayload: AgentEvalPayload;
|
|
7502
|
+
}
|
|
7503
|
+
type AgentEvalFeedbackSaveInput = Omit<VoltOpsFeedbackCreateInput, "traceId"> & {
|
|
7504
|
+
traceId?: string;
|
|
7505
|
+
};
|
|
7506
|
+
type AgentEvalFeedbackHelper = {
|
|
7507
|
+
save: (input: AgentEvalFeedbackSaveInput) => Promise<VoltOpsFeedback | null>;
|
|
7508
|
+
};
|
|
7509
|
+
type AgentEvalResultCallbackArgs = AgentEvalResult & {
|
|
7510
|
+
result: AgentEvalResult;
|
|
7511
|
+
feedback: AgentEvalFeedbackHelper;
|
|
7512
|
+
};
|
|
7513
|
+
interface AgentEvalScorerConfig {
|
|
7514
|
+
scorer: AgentEvalScorerReference;
|
|
7515
|
+
params?: AgentEvalParams | ((context: AgentEvalContext) => AgentEvalParams | undefined | Promise<AgentEvalParams | undefined>);
|
|
7516
|
+
sampling?: AgentEvalSamplingPolicy;
|
|
7517
|
+
id?: string;
|
|
7518
|
+
onResult?: (result: AgentEvalResultCallbackArgs) => void | Promise<void>;
|
|
7519
|
+
buildPayload?: (context: AgentEvalContext) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
7520
|
+
buildParams?: (context: AgentEvalContext) => AgentEvalParams | undefined | Promise<AgentEvalParams | undefined>;
|
|
7521
|
+
}
|
|
7522
|
+
interface AgentEvalConfig {
|
|
7523
|
+
scorers: Record<string, AgentEvalScorerConfig>;
|
|
7524
|
+
triggerSource?: string;
|
|
7525
|
+
environment?: string;
|
|
7526
|
+
sampling?: AgentEvalSamplingPolicy;
|
|
7527
|
+
redact?: (payload: AgentEvalPayload) => AgentEvalPayload;
|
|
7528
|
+
}
|
|
7529
|
+
/**
|
|
7530
|
+
* Agent status information
|
|
7531
|
+
*/
|
|
7532
|
+
type AgentStatus = "idle" | "working" | "error" | "completed" | "cancelled";
|
|
7533
|
+
/**
|
|
7534
|
+
* Tool call definition
|
|
7535
|
+
*/
|
|
7536
|
+
type ToolCall$1 = {
|
|
7537
|
+
id: string;
|
|
7538
|
+
type: "function";
|
|
7539
|
+
function: {
|
|
7540
|
+
name: string;
|
|
7541
|
+
arguments: string;
|
|
7542
|
+
};
|
|
7543
|
+
};
|
|
7544
|
+
/**
|
|
7545
|
+
* Model tool call format
|
|
7546
|
+
*/
|
|
7547
|
+
type ModelToolCall = {
|
|
7548
|
+
type: "tool-call";
|
|
7549
|
+
toolCallId: string;
|
|
7550
|
+
toolName: string;
|
|
7551
|
+
args: Record<string, unknown>;
|
|
7552
|
+
};
|
|
7553
|
+
/**
|
|
7554
|
+
* Represents the payload used when sending a tool's result back to the chat runtime
|
|
7555
|
+
* via useChat().addToolResult in the Vercel AI SDK.
|
|
7556
|
+
*/
|
|
7557
|
+
type ClientSideToolResult = {
|
|
7558
|
+
tool: string;
|
|
7559
|
+
toolCallId: string;
|
|
7560
|
+
output: unknown;
|
|
7561
|
+
} | {
|
|
7562
|
+
tool: string;
|
|
7563
|
+
toolCallId: string;
|
|
7564
|
+
state: "output-error";
|
|
7565
|
+
errorText: string;
|
|
7566
|
+
};
|
|
7567
|
+
/**
|
|
7568
|
+
* Agent response format
|
|
7569
|
+
*/
|
|
7570
|
+
type AgentResponse = {
|
|
7571
|
+
/**
|
|
7572
|
+
* Response content
|
|
7573
|
+
*/
|
|
7574
|
+
content: string;
|
|
7575
|
+
/**
|
|
7576
|
+
* Tool calls made by the model (if any)
|
|
7577
|
+
*/
|
|
7578
|
+
toolCalls?: ToolCall$1[];
|
|
7579
|
+
/**
|
|
7580
|
+
* Additional metadata
|
|
7581
|
+
*/
|
|
7582
|
+
metadata: {
|
|
7583
|
+
agentId: string;
|
|
7584
|
+
agentName: string;
|
|
7585
|
+
[key: string]: unknown;
|
|
7586
|
+
};
|
|
7587
|
+
};
|
|
7588
|
+
/**
|
|
7589
|
+
* Context for a specific agent operation (e.g., one generateText call)
|
|
7590
|
+
*/
|
|
7591
|
+
type OperationContext = {
|
|
7592
|
+
/** Unique identifier for the operation */
|
|
7593
|
+
readonly operationId: string;
|
|
7594
|
+
/** Optional user identifier associated with this operation */
|
|
7595
|
+
userId?: string;
|
|
7596
|
+
/** Optional conversation identifier associated with this operation */
|
|
7597
|
+
conversationId?: string;
|
|
7598
|
+
/** User-managed context map for this operation */
|
|
7599
|
+
readonly context: Map<string | symbol, unknown>;
|
|
7600
|
+
/** System-managed context map for internal operation tracking */
|
|
7601
|
+
readonly systemContext: Map<string | symbol, unknown>;
|
|
7602
|
+
/** Whether this operation is still active */
|
|
7603
|
+
isActive: boolean;
|
|
7604
|
+
/** Parent agent ID if part of a delegation chain */
|
|
7605
|
+
parentAgentId?: string;
|
|
7606
|
+
/** Optional elicitation bridge for requesting user input */
|
|
7607
|
+
elicitation?: (request: unknown) => Promise<unknown>;
|
|
7608
|
+
/** Trace context for managing span hierarchy and common attributes */
|
|
7609
|
+
traceContext: AgentTraceContext;
|
|
7610
|
+
/** Execution-scoped logger with full context (userId, conversationId, executionId) */
|
|
7611
|
+
logger: Logger;
|
|
7612
|
+
/** Conversation steps for building full message history including tool calls/results */
|
|
7613
|
+
conversationSteps?: StepWithContent[];
|
|
7614
|
+
/** AbortController for cancelling the operation and accessing the signal */
|
|
7615
|
+
abortController: AbortController;
|
|
7616
|
+
/** Start time of the operation (Date object) */
|
|
7617
|
+
startTime: Date;
|
|
7618
|
+
/** Cancellation error to be thrown when operation is aborted */
|
|
7619
|
+
cancellationError?: CancellationError;
|
|
7620
|
+
/** Input provided to the agent operation (string, UIMessages, or BaseMessages) */
|
|
7621
|
+
input?: string | UIMessage[] | BaseMessage[];
|
|
7622
|
+
/** Output generated by the agent operation (text or object) */
|
|
7623
|
+
output?: string | object;
|
|
7624
|
+
};
|
|
7625
|
+
/**
|
|
7626
|
+
* Specific information related to a tool execution error.
|
|
7627
|
+
*/
|
|
7628
|
+
interface ToolErrorInfo {
|
|
7629
|
+
/** The unique identifier of the tool call. */
|
|
7630
|
+
toolCallId: string;
|
|
7631
|
+
/** The name of the tool that was executed. */
|
|
7632
|
+
toolName: string;
|
|
7633
|
+
/** The original error thrown directly by the tool during execution (if available). */
|
|
7634
|
+
toolExecutionError?: unknown;
|
|
7635
|
+
/** The arguments passed to the tool when the error occurred (for debugging). */
|
|
7636
|
+
toolArguments?: unknown;
|
|
7637
|
+
}
|
|
7638
|
+
/**
|
|
7639
|
+
* Type for onError callbacks in streaming operations.
|
|
7640
|
+
* Providers must pass an error conforming to the VoltAgentError structure.
|
|
7641
|
+
*/
|
|
7642
|
+
type StreamOnErrorCallback = (error: VoltAgentError) => Promise<void> | void;
|
|
7643
|
+
type UserContext = Map<string | symbol, unknown>;
|
|
7644
|
+
/**
|
|
7645
|
+
* Standardized object structure passed to the onFinish callback
|
|
7646
|
+
* when streamText completes successfully.
|
|
7647
|
+
*/
|
|
7648
|
+
interface StreamTextFinishResult {
|
|
7649
|
+
/** The final, consolidated text output from the stream. */
|
|
7650
|
+
text: string;
|
|
7651
|
+
/** Token usage information (if available). */
|
|
7652
|
+
usage?: UsageInfo;
|
|
7653
|
+
/** Feedback metadata for the trace, if enabled. */
|
|
7654
|
+
feedback?: AgentFeedbackMetadata | null;
|
|
7655
|
+
/** The reason the stream finished (if available, e.g., 'stop', 'length', 'tool-calls'). */
|
|
7656
|
+
finishReason?: string;
|
|
7657
|
+
/** The original completion response object from the provider (if available). */
|
|
7658
|
+
providerResponse?: unknown;
|
|
7659
|
+
/** Any warnings generated during the completion (if available). */
|
|
7660
|
+
warnings?: unknown[];
|
|
7661
|
+
/** User context containing any custom metadata from the operation. */
|
|
7662
|
+
context?: UserContext;
|
|
7663
|
+
}
|
|
7664
|
+
/**
|
|
7665
|
+
* Type for the onFinish callback function for streamText.
|
|
7666
|
+
*/
|
|
7667
|
+
type StreamTextOnFinishCallback = (result: StreamTextFinishResult) => Promise<void> | void;
|
|
7668
|
+
/**
|
|
7669
|
+
* Standardized object structure passed to the onFinish callback
|
|
7670
|
+
* when streamObject completes successfully.
|
|
7671
|
+
* @template TObject The expected type of the fully formed object.
|
|
7672
|
+
*/
|
|
7673
|
+
interface StreamObjectFinishResult<TObject> {
|
|
7674
|
+
/** The final, fully formed object from the stream. */
|
|
7675
|
+
object: TObject;
|
|
7676
|
+
/** Token usage information (if available). */
|
|
7677
|
+
usage?: UsageInfo;
|
|
7678
|
+
/** The original completion response object from the provider (if available). */
|
|
7679
|
+
providerResponse?: unknown;
|
|
7680
|
+
/** Any warnings generated during the completion (if available). */
|
|
7681
|
+
warnings?: unknown[];
|
|
7682
|
+
/** The reason the stream finished (if available). Although less common for object streams. */
|
|
7683
|
+
finishReason?: string;
|
|
7684
|
+
/** User context containing any custom metadata from the operation. */
|
|
7685
|
+
context?: UserContext;
|
|
7686
|
+
}
|
|
7687
|
+
/**
|
|
7688
|
+
* Type for the onFinish callback function for streamObject.
|
|
7689
|
+
* @template TObject The expected type of the fully formed object.
|
|
7690
|
+
*/
|
|
7691
|
+
type StreamObjectOnFinishCallback<TObject> = (result: StreamObjectFinishResult<TObject>) => Promise<void> | void;
|
|
7692
|
+
/**
|
|
7693
|
+
* Standardized success result structure for generateText.
|
|
7694
|
+
*/
|
|
7695
|
+
interface StandardizedTextResult {
|
|
7696
|
+
/** The generated text. */
|
|
7697
|
+
text: string;
|
|
7698
|
+
/** Token usage information (if available). */
|
|
7699
|
+
usage?: UsageInfo;
|
|
7700
|
+
/** Feedback metadata for the trace, if enabled. */
|
|
7701
|
+
feedback?: AgentFeedbackMetadata | null;
|
|
7702
|
+
/** Original provider response (if needed). */
|
|
7703
|
+
providerResponse?: unknown;
|
|
7704
|
+
/** Finish reason (if available from provider). */
|
|
7705
|
+
finishReason?: string;
|
|
7706
|
+
/** Warnings (if available from provider). */
|
|
7707
|
+
warnings?: unknown[];
|
|
7708
|
+
/** User context containing any custom metadata from the operation. */
|
|
7709
|
+
context?: UserContext;
|
|
7710
|
+
}
|
|
7711
|
+
/**
|
|
7712
|
+
* Standardized success result structure for generateObject.
|
|
7713
|
+
* @template TObject The expected type of the generated object.
|
|
7714
|
+
*/
|
|
7715
|
+
interface StandardizedObjectResult<TObject> {
|
|
7716
|
+
/** The generated object. */
|
|
7717
|
+
object: TObject;
|
|
7718
|
+
/** Token usage information (if available). */
|
|
7719
|
+
usage?: UsageInfo;
|
|
7720
|
+
/** Original provider response (if needed). */
|
|
7721
|
+
providerResponse?: unknown;
|
|
7722
|
+
/** Finish reason (if available from provider). */
|
|
7723
|
+
finishReason?: string;
|
|
7724
|
+
/** Warnings (if available from provider). */
|
|
7725
|
+
warnings?: unknown[];
|
|
7726
|
+
/** User context containing any custom metadata from the operation. */
|
|
7727
|
+
context?: UserContext;
|
|
7728
|
+
}
|
|
7729
|
+
/**
|
|
7730
|
+
* Unified output type for the onEnd hook, representing the successful result
|
|
7731
|
+
* of any core agent operation. Use 'type guarding' or check specific fields
|
|
7732
|
+
* within the hook implementation to determine the concrete type.
|
|
7733
|
+
* Object types are generalized to 'unknown' here for the union.
|
|
7734
|
+
*/
|
|
7735
|
+
type AgentOperationOutput = StandardizedTextResult | StreamTextFinishResult | StandardizedObjectResult<unknown> | StreamObjectFinishResult<unknown>;
|
|
7736
|
+
|
|
7737
|
+
/**
|
|
7738
|
+
* Custom error classes for Memory V2
|
|
7739
|
+
*/
|
|
7740
|
+
/**
|
|
7741
|
+
* Base error class for Memory V2
|
|
7742
|
+
*/
|
|
7743
|
+
declare class MemoryV2Error extends Error {
|
|
7744
|
+
readonly code: string;
|
|
7745
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
7746
|
+
constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
|
|
6994
7747
|
}
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
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;
|
|
7748
|
+
/**
|
|
7749
|
+
* Error thrown when a storage operation fails
|
|
7750
|
+
*/
|
|
7751
|
+
declare class StorageError extends MemoryV2Error {
|
|
7752
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
7080
7753
|
}
|
|
7081
|
-
|
|
7082
7754
|
/**
|
|
7083
|
-
*
|
|
7755
|
+
* Error thrown when an embedding operation fails
|
|
7084
7756
|
*/
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
description: string;
|
|
7088
|
-
parameters?: any;
|
|
7757
|
+
declare class EmbeddingError extends MemoryV2Error {
|
|
7758
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
7089
7759
|
}
|
|
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
7760
|
/**
|
|
7105
|
-
*
|
|
7761
|
+
* Error thrown when a vector operation fails
|
|
7106
7762
|
*/
|
|
7107
|
-
|
|
7108
|
-
|
|
7763
|
+
declare class VectorError extends MemoryV2Error {
|
|
7764
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
7109
7765
|
}
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
sampling?: SamplingPolicy;
|
|
7116
|
-
metadata?: Record<string, unknown> | null;
|
|
7117
|
-
params?: Record<string, unknown> | null;
|
|
7766
|
+
/**
|
|
7767
|
+
* Error thrown when a conversation is not found
|
|
7768
|
+
*/
|
|
7769
|
+
declare class ConversationNotFoundError extends MemoryV2Error {
|
|
7770
|
+
constructor(conversationId: string);
|
|
7118
7771
|
}
|
|
7119
7772
|
/**
|
|
7120
|
-
*
|
|
7773
|
+
* Error thrown when trying to create a conversation that already exists
|
|
7121
7774
|
*/
|
|
7122
|
-
|
|
7123
|
-
|
|
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;
|
|
7775
|
+
declare class ConversationAlreadyExistsError extends MemoryV2Error {
|
|
7776
|
+
constructor(conversationId: string);
|
|
7140
7777
|
}
|
|
7141
7778
|
/**
|
|
7142
|
-
*
|
|
7779
|
+
* Error thrown when vector adapter is required but not configured
|
|
7143
7780
|
*/
|
|
7144
|
-
|
|
7145
|
-
|
|
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;
|
|
7781
|
+
declare class VectorAdapterNotConfiguredError extends MemoryV2Error {
|
|
7782
|
+
constructor(operation: string);
|
|
7167
7783
|
}
|
|
7168
7784
|
/**
|
|
7169
|
-
*
|
|
7785
|
+
* Error thrown when embedding adapter is required but not configured
|
|
7170
7786
|
*/
|
|
7171
|
-
|
|
7172
|
-
|
|
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;
|
|
7787
|
+
declare class EmbeddingAdapterNotConfiguredError extends MemoryV2Error {
|
|
7788
|
+
constructor(operation: string);
|
|
7189
7789
|
}
|
|
7790
|
+
|
|
7190
7791
|
/**
|
|
7191
|
-
*
|
|
7792
|
+
* Vector math utilities for similarity calculations
|
|
7192
7793
|
*/
|
|
7193
|
-
type InstructionsDynamicValue = string | DynamicValue<string | PromptContent>;
|
|
7194
7794
|
/**
|
|
7195
|
-
*
|
|
7795
|
+
* Calculate cosine similarity between two vectors
|
|
7796
|
+
* Returns a value between -1 and 1, where 1 means identical direction,
|
|
7797
|
+
* 0 means perpendicular, and -1 means opposite direction
|
|
7196
7798
|
*/
|
|
7197
|
-
|
|
7799
|
+
declare function cosineSimilarity(a: number[], b: number[]): number;
|
|
7800
|
+
|
|
7198
7801
|
/**
|
|
7199
|
-
*
|
|
7802
|
+
* Memory - Clean architecture for conversation memory and state management
|
|
7200
7803
|
*/
|
|
7201
|
-
|
|
7804
|
+
|
|
7202
7805
|
/**
|
|
7203
|
-
*
|
|
7806
|
+
* Memory Class
|
|
7807
|
+
* Handles conversation memory with optional vector search capabilities
|
|
7204
7808
|
*/
|
|
7205
|
-
|
|
7809
|
+
declare class Memory {
|
|
7810
|
+
private readonly storage;
|
|
7811
|
+
private readonly embedding?;
|
|
7812
|
+
private readonly vector?;
|
|
7813
|
+
private embeddingCache?;
|
|
7814
|
+
private readonly workingMemoryConfig?;
|
|
7815
|
+
private readonly titleGenerationConfig?;
|
|
7816
|
+
private resourceId?;
|
|
7817
|
+
private logger?;
|
|
7818
|
+
constructor(options: MemoryConfig);
|
|
7819
|
+
/**
|
|
7820
|
+
* Get messages from a conversation
|
|
7821
|
+
*/
|
|
7822
|
+
getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise<UIMessage<{
|
|
7823
|
+
createdAt: Date;
|
|
7824
|
+
}>[]>;
|
|
7825
|
+
/**
|
|
7826
|
+
* Save a single message
|
|
7827
|
+
*/
|
|
7828
|
+
saveMessage(message: UIMessage, userId: string, conversationId: string): Promise<void>;
|
|
7829
|
+
saveConversationSteps(steps: ConversationStepRecord[]): Promise<void>;
|
|
7206
7830
|
/**
|
|
7207
|
-
*
|
|
7831
|
+
* Add a single message (alias for consistency with existing API)
|
|
7208
7832
|
*/
|
|
7209
|
-
|
|
7833
|
+
addMessage(message: UIMessage, userId: string, conversationId: string, context?: OperationContext): Promise<void>;
|
|
7210
7834
|
/**
|
|
7211
|
-
*
|
|
7835
|
+
* Add multiple messages in batch
|
|
7212
7836
|
*/
|
|
7213
|
-
|
|
7837
|
+
addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
|
|
7214
7838
|
/**
|
|
7215
|
-
*
|
|
7216
|
-
* Defaults to the agent's maxRetries.
|
|
7839
|
+
* Clear messages for a user
|
|
7217
7840
|
*/
|
|
7218
|
-
|
|
7841
|
+
clearMessages(userId: string, conversationId?: string, context?: OperationContext): Promise<void>;
|
|
7219
7842
|
/**
|
|
7220
|
-
*
|
|
7221
|
-
*
|
|
7843
|
+
* Delete specific messages by ID for a conversation
|
|
7844
|
+
* Adapters should delete atomically when possible; otherwise a best-effort delete may be used.
|
|
7222
7845
|
*/
|
|
7223
|
-
|
|
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 = {
|
|
7846
|
+
deleteMessages(messageIds: string[], userId: string, conversationId: string, context?: OperationContext): Promise<void>;
|
|
7847
|
+
getConversationSteps(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise<ConversationStepRecord[]>;
|
|
7258
7848
|
/**
|
|
7259
|
-
*
|
|
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']
|
|
7849
|
+
* Get a conversation by ID
|
|
7269
7850
|
*/
|
|
7270
|
-
|
|
7271
|
-
};
|
|
7272
|
-
type SupervisorConfig = {
|
|
7851
|
+
getConversation(id: string): Promise<Conversation | null>;
|
|
7273
7852
|
/**
|
|
7274
|
-
*
|
|
7275
|
-
* If provided, this completely replaces the default template
|
|
7276
|
-
* Only agents memory section will be appended if includeAgentsMemory is true
|
|
7853
|
+
* Get conversations for a resource
|
|
7277
7854
|
*/
|
|
7278
|
-
|
|
7855
|
+
getConversations(resourceId: string): Promise<Conversation[]>;
|
|
7279
7856
|
/**
|
|
7280
|
-
*
|
|
7281
|
-
* @default true
|
|
7857
|
+
* Get conversations by user ID with query options
|
|
7282
7858
|
*/
|
|
7283
|
-
|
|
7859
|
+
getConversationsByUserId(userId: string, options?: Omit<ConversationQueryOptions, "userId">): Promise<Conversation[]>;
|
|
7284
7860
|
/**
|
|
7285
|
-
*
|
|
7861
|
+
* Query conversations with advanced options
|
|
7286
7862
|
*/
|
|
7287
|
-
|
|
7863
|
+
queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
|
|
7288
7864
|
/**
|
|
7289
|
-
*
|
|
7290
|
-
* Controls which event types are forwarded
|
|
7291
|
-
* @default { types: ['tool-call', 'tool-result'] }
|
|
7865
|
+
* Count conversations with the same filtering as queryConversations (ignores limit/offset)
|
|
7292
7866
|
*/
|
|
7293
|
-
|
|
7867
|
+
countConversations(options: ConversationQueryOptions): Promise<number>;
|
|
7294
7868
|
/**
|
|
7295
|
-
*
|
|
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
|
|
7869
|
+
* Create a new conversation
|
|
7299
7870
|
*/
|
|
7300
|
-
|
|
7871
|
+
createConversation(input: CreateConversationInput): Promise<Conversation>;
|
|
7301
7872
|
/**
|
|
7302
|
-
*
|
|
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
|
|
7873
|
+
* Update a conversation
|
|
7307
7874
|
*/
|
|
7308
|
-
|
|
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 {
|
|
7875
|
+
updateConversation(id: string, updates: Partial<Omit<Conversation, "id" | "createdAt" | "updatedAt">>): Promise<Conversation>;
|
|
7364
7876
|
/**
|
|
7365
|
-
*
|
|
7877
|
+
* Delete a conversation
|
|
7366
7878
|
*/
|
|
7367
|
-
|
|
7879
|
+
deleteConversation(id: string): Promise<void>;
|
|
7368
7880
|
/**
|
|
7369
|
-
*
|
|
7881
|
+
* Get messages with semantic search
|
|
7882
|
+
* Combines recent messages with semantically similar messages
|
|
7370
7883
|
*/
|
|
7371
|
-
|
|
7884
|
+
getMessagesWithSemanticSearch(userId: string, conversationId: string, currentQuery?: string, options?: {
|
|
7885
|
+
limit?: number;
|
|
7886
|
+
semanticLimit?: number;
|
|
7887
|
+
semanticThreshold?: number;
|
|
7888
|
+
mergeStrategy?: "prepend" | "append" | "interleave";
|
|
7889
|
+
}): Promise<UIMessage<{
|
|
7890
|
+
createdAt: Date;
|
|
7891
|
+
}>[]>;
|
|
7372
7892
|
/**
|
|
7373
|
-
*
|
|
7893
|
+
* Get messages by their IDs
|
|
7374
7894
|
*/
|
|
7375
|
-
|
|
7895
|
+
private getMessagesByIds;
|
|
7376
7896
|
/**
|
|
7377
|
-
*
|
|
7897
|
+
* Merge two arrays of messages, removing duplicates
|
|
7378
7898
|
*/
|
|
7379
|
-
|
|
7380
|
-
}
|
|
7381
|
-
interface InputGuardrailResult extends GuardrailBaseResult {
|
|
7382
|
-
modifiedInput?: string | UIMessage[] | BaseMessage[];
|
|
7383
|
-
}
|
|
7384
|
-
interface OutputGuardrailArgs<TOutput = unknown> extends GuardrailContext {
|
|
7899
|
+
private mergeMessages;
|
|
7385
7900
|
/**
|
|
7386
|
-
*
|
|
7901
|
+
* Check if vector support is configured
|
|
7387
7902
|
*/
|
|
7388
|
-
|
|
7903
|
+
hasVectorSupport(): boolean;
|
|
7389
7904
|
/**
|
|
7390
|
-
*
|
|
7905
|
+
* Search for similar content
|
|
7391
7906
|
*/
|
|
7392
|
-
|
|
7907
|
+
searchSimilar(query: string, options?: SearchOptions): Promise<SearchResult[]>;
|
|
7393
7908
|
/**
|
|
7394
|
-
*
|
|
7909
|
+
* Add a document for RAG
|
|
7395
7910
|
*/
|
|
7396
|
-
|
|
7911
|
+
addDocument(document: Document): Promise<void>;
|
|
7912
|
+
/**
|
|
7913
|
+
* Remove a document
|
|
7914
|
+
*/
|
|
7915
|
+
removeDocument(id: string): Promise<void>;
|
|
7916
|
+
/**
|
|
7917
|
+
* Get embedding with caching
|
|
7918
|
+
*/
|
|
7919
|
+
private getEmbedding;
|
|
7920
|
+
/**
|
|
7921
|
+
* Embed and store a message
|
|
7922
|
+
*/
|
|
7923
|
+
private embedAndStoreMessage;
|
|
7924
|
+
/**
|
|
7925
|
+
* Embed and store multiple messages
|
|
7926
|
+
*/
|
|
7927
|
+
private embedAndStoreMessages;
|
|
7928
|
+
/**
|
|
7929
|
+
* Get working memory for a conversation or user
|
|
7930
|
+
*/
|
|
7931
|
+
getWorkingMemory(params: {
|
|
7932
|
+
conversationId?: string;
|
|
7933
|
+
userId?: string;
|
|
7934
|
+
}): Promise<string | null>;
|
|
7935
|
+
/**
|
|
7936
|
+
* Update working memory (simplified)
|
|
7937
|
+
*/
|
|
7938
|
+
updateWorkingMemory(params: {
|
|
7939
|
+
conversationId?: string;
|
|
7940
|
+
userId?: string;
|
|
7941
|
+
content: string | Record<string, unknown>;
|
|
7942
|
+
options?: WorkingMemoryUpdateOptions;
|
|
7943
|
+
}): Promise<void>;
|
|
7944
|
+
/**
|
|
7945
|
+
* Process content to string format
|
|
7946
|
+
*/
|
|
7947
|
+
private processContent;
|
|
7948
|
+
/**
|
|
7949
|
+
* Simple deep merge for JSON objects
|
|
7950
|
+
*/
|
|
7951
|
+
private simpleDeepMerge;
|
|
7952
|
+
/**
|
|
7953
|
+
* Clear working memory
|
|
7954
|
+
*/
|
|
7955
|
+
clearWorkingMemory(params: {
|
|
7956
|
+
conversationId?: string;
|
|
7957
|
+
userId?: string;
|
|
7958
|
+
}): Promise<void>;
|
|
7959
|
+
/**
|
|
7960
|
+
* Get working memory template
|
|
7961
|
+
*/
|
|
7962
|
+
getWorkingMemoryTemplate(): string | null;
|
|
7963
|
+
/**
|
|
7964
|
+
* Get working memory schema
|
|
7965
|
+
*/
|
|
7966
|
+
getWorkingMemorySchema(): z.ZodObject<any> | null;
|
|
7397
7967
|
/**
|
|
7398
|
-
*
|
|
7968
|
+
* Get working memory format
|
|
7399
7969
|
*/
|
|
7400
|
-
|
|
7970
|
+
getWorkingMemoryFormat(): "markdown" | "json" | null;
|
|
7401
7971
|
/**
|
|
7402
|
-
*
|
|
7972
|
+
* Check if working memory is supported
|
|
7403
7973
|
*/
|
|
7404
|
-
|
|
7974
|
+
hasWorkingMemorySupport(): boolean;
|
|
7405
7975
|
/**
|
|
7406
|
-
*
|
|
7976
|
+
* Generate system instructions for working memory usage
|
|
7407
7977
|
*/
|
|
7408
|
-
|
|
7978
|
+
getWorkingMemoryInstructions(params: {
|
|
7979
|
+
conversationId?: string;
|
|
7980
|
+
userId?: string;
|
|
7981
|
+
}): Promise<string | null>;
|
|
7409
7982
|
/**
|
|
7410
|
-
*
|
|
7983
|
+
* Get configured adapters info
|
|
7411
7984
|
*/
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
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>[];
|
|
7985
|
+
getAdaptersInfo(): {
|
|
7986
|
+
storage: boolean;
|
|
7987
|
+
embedding: {
|
|
7988
|
+
configured: boolean;
|
|
7989
|
+
model?: string;
|
|
7990
|
+
dimensions?: number;
|
|
7991
|
+
};
|
|
7992
|
+
vector: boolean;
|
|
7993
|
+
cache: boolean;
|
|
7994
|
+
};
|
|
7494
7995
|
/**
|
|
7495
|
-
*
|
|
7496
|
-
*
|
|
7996
|
+
* Save a message to memory
|
|
7997
|
+
* Simple version without event publishing (handled by MemoryManagerV2)
|
|
7497
7998
|
*/
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
maxSteps?: number;
|
|
7999
|
+
saveMessageWithContext(message: UIMessage, userId: string, conversationId: string, context?: {
|
|
8000
|
+
logger?: Logger;
|
|
8001
|
+
}, operationContext?: OperationContext): Promise<void>;
|
|
7502
8002
|
/**
|
|
7503
|
-
*
|
|
7504
|
-
*
|
|
8003
|
+
* Get messages with semantic search support
|
|
8004
|
+
* Simple version without event publishing (handled by MemoryManagerV2)
|
|
7505
8005
|
*/
|
|
7506
|
-
|
|
7507
|
-
|
|
8006
|
+
getMessagesWithContext(userId: string, conversationId: string, options?: {
|
|
8007
|
+
limit?: number;
|
|
8008
|
+
useSemanticSearch?: boolean;
|
|
8009
|
+
currentQuery?: string;
|
|
8010
|
+
traceId?: string;
|
|
8011
|
+
logger?: Logger;
|
|
8012
|
+
semanticLimit?: number;
|
|
8013
|
+
semanticThreshold?: number;
|
|
8014
|
+
mergeStrategy?: "prepend" | "append" | "interleave";
|
|
8015
|
+
}, operationContext?: OperationContext): Promise<UIMessage<{
|
|
8016
|
+
createdAt: Date;
|
|
8017
|
+
}>[]>;
|
|
7508
8018
|
/**
|
|
7509
|
-
*
|
|
7510
|
-
* Per-call `stopWhen` in method options overrides this.
|
|
8019
|
+
* Internal: Set resource ID (agent ID)
|
|
7511
8020
|
*/
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
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 = {
|
|
8021
|
+
_setResourceId(id: string): void;
|
|
8022
|
+
/**
|
|
8023
|
+
* Internal: Set logger
|
|
8024
|
+
*/
|
|
8025
|
+
_setLogger(logger: Logger): void;
|
|
7624
8026
|
/**
|
|
7625
|
-
*
|
|
8027
|
+
* Get vector adapter if configured
|
|
7626
8028
|
*/
|
|
7627
|
-
|
|
8029
|
+
getVectorAdapter(): VectorAdapter | undefined;
|
|
7628
8030
|
/**
|
|
7629
|
-
*
|
|
8031
|
+
* Get embedding adapter if configured
|
|
7630
8032
|
*/
|
|
7631
|
-
|
|
8033
|
+
getEmbeddingAdapter(): EmbeddingAdapter | undefined;
|
|
7632
8034
|
/**
|
|
7633
|
-
*
|
|
8035
|
+
* Get metadata about the configured storage adapter
|
|
7634
8036
|
*/
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
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;
|
|
8037
|
+
getStorageMetadata(): MemoryStorageMetadata;
|
|
8038
|
+
/**
|
|
8039
|
+
* Get conversation title generation configuration
|
|
8040
|
+
*/
|
|
8041
|
+
getTitleGenerationConfig(): MemoryConfig["generateTitle"] | undefined;
|
|
8042
|
+
/**
|
|
8043
|
+
* Get a UI-friendly summary of working memory configuration
|
|
8044
|
+
*/
|
|
8045
|
+
getWorkingMemorySummary(): WorkingMemorySummary | null;
|
|
8046
|
+
/**
|
|
8047
|
+
* Get workflow state by execution ID
|
|
8048
|
+
*/
|
|
8049
|
+
getWorkflowState(executionId: string): Promise<WorkflowStateEntry | null>;
|
|
8050
|
+
/**
|
|
8051
|
+
* Query workflow states with filters
|
|
8052
|
+
*/
|
|
8053
|
+
queryWorkflowRuns(query: WorkflowRunQuery): Promise<WorkflowStateEntry[]>;
|
|
8054
|
+
/**
|
|
8055
|
+
* Set workflow state
|
|
8056
|
+
*/
|
|
8057
|
+
setWorkflowState(executionId: string, state: WorkflowStateEntry): Promise<void>;
|
|
8058
|
+
/**
|
|
8059
|
+
* Update workflow state
|
|
8060
|
+
*/
|
|
8061
|
+
updateWorkflowState(executionId: string, updates: Partial<WorkflowStateEntry>): Promise<void>;
|
|
8062
|
+
/**
|
|
8063
|
+
* Get suspended workflow states for a workflow
|
|
8064
|
+
*/
|
|
8065
|
+
getSuspendedWorkflowStates(workflowId: string): Promise<WorkflowStateEntry[]>;
|
|
7781
8066
|
}
|
|
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
8067
|
|
|
7790
8068
|
/**
|
|
7791
8069
|
* MemoryManager - Unified manager for Memory and OpenTelemetry observability
|
|
@@ -7817,10 +8095,14 @@ declare class MemoryManager {
|
|
|
7817
8095
|
* Background queue for memory operations
|
|
7818
8096
|
*/
|
|
7819
8097
|
private backgroundQueue;
|
|
8098
|
+
/**
|
|
8099
|
+
* Optional title generator for new conversations
|
|
8100
|
+
*/
|
|
8101
|
+
private titleGenerator?;
|
|
7820
8102
|
/**
|
|
7821
8103
|
* Creates a new MemoryManager V2 with same signature as original
|
|
7822
8104
|
*/
|
|
7823
|
-
constructor(resourceId: string, memory?: Memory | false, options?: MemoryOptions, logger?: Logger);
|
|
8105
|
+
constructor(resourceId: string, memory?: Memory | false, options?: MemoryOptions, logger?: Logger, titleGenerator?: ConversationTitleGenerator);
|
|
7824
8106
|
/**
|
|
7825
8107
|
* Save a message to memory
|
|
7826
8108
|
* PRESERVED FROM ORIGINAL WITH MEMORY V2 INTEGRATION
|
|
@@ -7877,6 +8159,10 @@ declare class MemoryManager {
|
|
|
7877
8159
|
* Ensures conversation exists and then saves input without blocking.
|
|
7878
8160
|
*/
|
|
7879
8161
|
queueSaveInput(context: OperationContext, input: string | UIMessage[], userId: string, conversationId: string): void;
|
|
8162
|
+
/**
|
|
8163
|
+
* Resolve conversation title using optional generator
|
|
8164
|
+
*/
|
|
8165
|
+
private resolveConversationTitle;
|
|
7880
8166
|
/**
|
|
7881
8167
|
* Ensure conversation exists (background task)
|
|
7882
8168
|
* PRESERVED FROM ORIGINAL
|
|
@@ -8048,6 +8334,10 @@ interface BaseGenerationOptions extends Partial<CallSettings> {
|
|
|
8048
8334
|
*/
|
|
8049
8335
|
stopWhen?: StopWhen;
|
|
8050
8336
|
tools?: (Tool<any, any> | Toolkit)[];
|
|
8337
|
+
/**
|
|
8338
|
+
* Optional per-call tool routing override.
|
|
8339
|
+
*/
|
|
8340
|
+
toolRouting?: ToolRoutingConfig | false;
|
|
8051
8341
|
hooks?: AgentHooks;
|
|
8052
8342
|
inputGuardrails?: InputGuardrail[];
|
|
8053
8343
|
outputGuardrails?: OutputGuardrail<any>[];
|
|
@@ -8106,6 +8396,7 @@ declare class Agent {
|
|
|
8106
8396
|
private readonly summarization?;
|
|
8107
8397
|
private defaultObservability?;
|
|
8108
8398
|
private readonly toolManager;
|
|
8399
|
+
private readonly toolPoolManager;
|
|
8109
8400
|
private readonly subAgentManager;
|
|
8110
8401
|
private readonly voltOpsClient?;
|
|
8111
8402
|
private readonly prompts?;
|
|
@@ -8117,6 +8408,10 @@ declare class Agent {
|
|
|
8117
8408
|
private readonly outputMiddlewares;
|
|
8118
8409
|
private readonly maxMiddlewareRetries;
|
|
8119
8410
|
private readonly observabilityAuthWarningState;
|
|
8411
|
+
private toolRouting?;
|
|
8412
|
+
private toolRoutingConfigured;
|
|
8413
|
+
private toolRoutingExposedNames;
|
|
8414
|
+
private toolRoutingPoolExplicit;
|
|
8120
8415
|
constructor(options: AgentOptions);
|
|
8121
8416
|
/**
|
|
8122
8417
|
* Generate text response
|
|
@@ -8194,6 +8489,7 @@ declare class Agent {
|
|
|
8194
8489
|
* Extract user query from input for semantic search
|
|
8195
8490
|
*/
|
|
8196
8491
|
private extractUserQuery;
|
|
8492
|
+
private createConversationTitleGenerator;
|
|
8197
8493
|
/**
|
|
8198
8494
|
* Prepare messages with system prompt and memory
|
|
8199
8495
|
*/
|
|
@@ -8244,6 +8540,20 @@ declare class Agent {
|
|
|
8244
8540
|
*/
|
|
8245
8541
|
private validateToolOutput;
|
|
8246
8542
|
private createToolExecutionFactory;
|
|
8543
|
+
/**
|
|
8544
|
+
* Internal: execute a tool router with access to the agent runtime.
|
|
8545
|
+
*/
|
|
8546
|
+
__executeToolRouter(params: {
|
|
8547
|
+
router: ToolRouter;
|
|
8548
|
+
input: ToolRouterInput;
|
|
8549
|
+
options?: ToolExecuteOptions;
|
|
8550
|
+
}): Promise<ToolRouterResult>;
|
|
8551
|
+
private buildToolRouterCandidates;
|
|
8552
|
+
private resolveRoutedToolArgs;
|
|
8553
|
+
private resolveProviderToolArgs;
|
|
8554
|
+
private executeProviderToolViaRouter;
|
|
8555
|
+
private ensureToolApproval;
|
|
8556
|
+
private runInternalGenerateText;
|
|
8247
8557
|
/**
|
|
8248
8558
|
* Create step handler for memory and hooks
|
|
8249
8559
|
*/
|
|
@@ -8343,6 +8653,14 @@ declare class Agent {
|
|
|
8343
8653
|
* Internal: apply a default Memory instance when none was configured explicitly.
|
|
8344
8654
|
*/
|
|
8345
8655
|
__setDefaultMemory(memory: Memory): void;
|
|
8656
|
+
/**
|
|
8657
|
+
* Internal: apply a default tool routing config when none was configured explicitly.
|
|
8658
|
+
*/
|
|
8659
|
+
__setDefaultToolRouting(toolRouting?: ToolRoutingConfig): void;
|
|
8660
|
+
private applyToolRoutingConfig;
|
|
8661
|
+
private resolveToolRoutingRouters;
|
|
8662
|
+
private resolveToolRouting;
|
|
8663
|
+
private getToolRoutingExposedNames;
|
|
8346
8664
|
/**
|
|
8347
8665
|
* Convert this agent into a tool that can be used by other agents.
|
|
8348
8666
|
* This enables supervisor/coordinator patterns where one agent can delegate
|
|
@@ -8414,6 +8732,8 @@ type WorkflowState<INPUT, RESULT> = {
|
|
|
8414
8732
|
input: InternalExtractWorkflowInputData<INPUT>;
|
|
8415
8733
|
/** current data being processed */
|
|
8416
8734
|
data: DangerouslyAllowAny;
|
|
8735
|
+
/** shared workflow state across steps */
|
|
8736
|
+
workflowState: WorkflowStateStore;
|
|
8417
8737
|
/** the result of workflow execution, null until execution is complete */
|
|
8418
8738
|
result: RESULT | null;
|
|
8419
8739
|
error: Error | null;
|
|
@@ -8442,6 +8762,8 @@ interface WorkflowSuspensionMetadata<SUSPEND_DATA = DangerouslyAllowAny> {
|
|
|
8442
8762
|
stepExecutionState?: DangerouslyAllowAny;
|
|
8443
8763
|
/** Results from completed steps that need to be preserved */
|
|
8444
8764
|
completedStepsData?: DangerouslyAllowAny[];
|
|
8765
|
+
/** Shared workflow state snapshot */
|
|
8766
|
+
workflowState?: WorkflowStateStore;
|
|
8445
8767
|
};
|
|
8446
8768
|
}
|
|
8447
8769
|
interface WorkflowCancellationMetadata {
|
|
@@ -8596,6 +8918,8 @@ interface WorkflowRetryConfig {
|
|
|
8596
8918
|
*/
|
|
8597
8919
|
delayMs?: number;
|
|
8598
8920
|
}
|
|
8921
|
+
type WorkflowStateStore = Record<string, unknown>;
|
|
8922
|
+
type WorkflowStateUpdater = WorkflowStateStore | ((previous: WorkflowStateStore) => WorkflowStateStore);
|
|
8599
8923
|
interface WorkflowRunOptions {
|
|
8600
8924
|
/**
|
|
8601
8925
|
* The active step, this can be used to track the current step in a workflow
|
|
@@ -8619,6 +8943,10 @@ interface WorkflowRunOptions {
|
|
|
8619
8943
|
* The user context, this can be used to track the current user context in a workflow
|
|
8620
8944
|
*/
|
|
8621
8945
|
context?: UserContext;
|
|
8946
|
+
/**
|
|
8947
|
+
* Shared workflow state available to all steps
|
|
8948
|
+
*/
|
|
8949
|
+
workflowState?: WorkflowStateStore;
|
|
8622
8950
|
/**
|
|
8623
8951
|
* Override Memory V2 for this specific execution
|
|
8624
8952
|
* Takes priority over workflow config memory and global memory
|
|
@@ -8672,6 +9000,7 @@ interface WorkflowResumeOptions {
|
|
|
8672
9000
|
checkpoint?: {
|
|
8673
9001
|
stepExecutionState?: DangerouslyAllowAny;
|
|
8674
9002
|
completedStepsData?: DangerouslyAllowAny[];
|
|
9003
|
+
workflowState?: WorkflowStateStore;
|
|
8675
9004
|
};
|
|
8676
9005
|
/**
|
|
8677
9006
|
* The step index to resume from
|
|
@@ -8977,11 +9306,12 @@ interface WorkflowStats {
|
|
|
8977
9306
|
/**
|
|
8978
9307
|
* Event emitted during workflow streaming
|
|
8979
9308
|
*/
|
|
9309
|
+
type WorkflowStreamEventType = "workflow-start" | "workflow-suspended" | "workflow-complete" | "workflow-cancelled" | "workflow-error" | "step-start" | "step-complete" | (string & {});
|
|
8980
9310
|
interface WorkflowStreamEvent {
|
|
8981
9311
|
/**
|
|
8982
9312
|
* Type of the event (e.g., "step-start", "step-complete", "custom", "agent-stream")
|
|
8983
9313
|
*/
|
|
8984
|
-
type:
|
|
9314
|
+
type: WorkflowStreamEventType;
|
|
8985
9315
|
/**
|
|
8986
9316
|
* Unique execution ID for this workflow run
|
|
8987
9317
|
*/
|
|
@@ -9034,8 +9364,8 @@ interface WorkflowStreamWriter {
|
|
|
9034
9364
|
/**
|
|
9035
9365
|
* Write a custom event to the stream
|
|
9036
9366
|
*/
|
|
9037
|
-
write(event: Partial<WorkflowStreamEvent> & {
|
|
9038
|
-
type:
|
|
9367
|
+
write(event: Omit<Partial<WorkflowStreamEvent>, "type"> & {
|
|
9368
|
+
type: WorkflowStreamEventType;
|
|
9039
9369
|
}): void;
|
|
9040
9370
|
/**
|
|
9041
9371
|
* Pipe events from an agent's fullStream to the workflow stream
|
|
@@ -9203,6 +9533,10 @@ interface WorkflowExecutionContext {
|
|
|
9203
9533
|
* User-defined context passed around during execution
|
|
9204
9534
|
*/
|
|
9205
9535
|
context: Map<string | symbol, unknown>;
|
|
9536
|
+
/**
|
|
9537
|
+
* Shared workflow state available to all steps
|
|
9538
|
+
*/
|
|
9539
|
+
workflowState: WorkflowStateStore;
|
|
9206
9540
|
/**
|
|
9207
9541
|
* Whether the workflow is still actively running
|
|
9208
9542
|
*/
|
|
@@ -9304,6 +9638,8 @@ interface WorkflowExecuteContext<INPUT, DATA, SUSPEND_DATA, RESUME_DATA> {
|
|
|
9304
9638
|
suspend: (reason?: string, suspendData?: SUSPEND_DATA) => Promise<never>;
|
|
9305
9639
|
resumeData?: RESUME_DATA;
|
|
9306
9640
|
retryCount?: number;
|
|
9641
|
+
workflowState: WorkflowStateStore;
|
|
9642
|
+
setWorkflowState: (update: WorkflowStateUpdater) => void;
|
|
9307
9643
|
/**
|
|
9308
9644
|
* Logger instance for this workflow execution.
|
|
9309
9645
|
* Provides execution-scoped logging with full context (userId, conversationId, executionId).
|
|
@@ -9521,14 +9857,20 @@ interface WorkflowStepSleepUntil<INPUT, DATA> extends InternalBaseWorkflowStep<I
|
|
|
9521
9857
|
type: "sleep-until";
|
|
9522
9858
|
date: Date | InternalWorkflowFunc<INPUT, DATA, Date, any, any>;
|
|
9523
9859
|
}
|
|
9524
|
-
type
|
|
9525
|
-
|
|
9860
|
+
type WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM> = InternalWorkflowFunc<INPUT, DATA, ITEM[], any, any>;
|
|
9861
|
+
type WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA> = (context: WorkflowExecuteContext<INPUT, DATA, any, any>, item: ITEM, index: number) => Promise<MAP_DATA> | MAP_DATA;
|
|
9862
|
+
type WorkflowStepForEachConfig<INPUT, DATA, ITEM, RESULT, MAP_DATA = ITEM> = InternalWorkflowStepConfig<{
|
|
9863
|
+
step: InternalAnyWorkflowStep<INPUT, MAP_DATA, RESULT>;
|
|
9526
9864
|
concurrency?: number;
|
|
9865
|
+
items?: WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM>;
|
|
9866
|
+
map?: WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA>;
|
|
9527
9867
|
}>;
|
|
9528
|
-
interface WorkflowStepForEach<INPUT, ITEM, RESULT> extends InternalBaseWorkflowStep<INPUT,
|
|
9868
|
+
interface WorkflowStepForEach<INPUT, DATA, ITEM, RESULT, MAP_DATA = ITEM> extends InternalBaseWorkflowStep<INPUT, DATA, RESULT[], any, any> {
|
|
9529
9869
|
type: "foreach";
|
|
9530
|
-
step: InternalAnyWorkflowStep<INPUT,
|
|
9870
|
+
step: InternalAnyWorkflowStep<INPUT, MAP_DATA, RESULT>;
|
|
9531
9871
|
concurrency?: number;
|
|
9872
|
+
items?: WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM>;
|
|
9873
|
+
map?: WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA>;
|
|
9532
9874
|
}
|
|
9533
9875
|
type WorkflowStepLoopConfig<INPUT, DATA, RESULT> = InternalWorkflowStepConfig<{
|
|
9534
9876
|
step: InternalAnyWorkflowStep<INPUT, DATA, RESULT>;
|
|
@@ -9595,7 +9937,7 @@ interface WorkflowStepMap<INPUT, DATA, MAP extends Record<string, WorkflowStepMa
|
|
|
9595
9937
|
}
|
|
9596
9938
|
type WorkflowStepParallelDynamicStepsFunc<INPUT, DATA, RESULT> = (context: WorkflowExecuteContext<INPUT, DATA, any, any>) => Promise<WorkflowStepParallelSteps<INPUT, DATA, RESULT>>;
|
|
9597
9939
|
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>>>;
|
|
9940
|
+
type WorkflowStep<INPUT, DATA, RESULT, SUSPEND_DATA = any> = WorkflowStepAgent<INPUT, DATA, RESULT> | WorkflowStepFunc<INPUT, DATA, RESULT, SUSPEND_DATA> | WorkflowStepConditionalWhen<INPUT, DATA, RESULT> | WorkflowStepGuardrail<INPUT, DATA> | WorkflowStepParallelAll<INPUT, DATA, RESULT> | WorkflowStepTap<INPUT, DATA, RESULT, SUSPEND_DATA> | WorkflowStepParallelRace<INPUT, DATA, RESULT> | WorkflowStepWorkflow<INPUT, DATA, RESULT, SUSPEND_DATA> | WorkflowStepSleep<INPUT, DATA> | WorkflowStepSleepUntil<INPUT, DATA> | WorkflowStepForEach<INPUT, any, any, any> | WorkflowStepLoop<INPUT, DATA, RESULT> | WorkflowStepBranch<INPUT, DATA, RESULT> | WorkflowStepMap<INPUT, DATA, Record<string, WorkflowStepMapEntry<INPUT, DATA>>>;
|
|
9599
9941
|
/**
|
|
9600
9942
|
* Internal type to allow overriding the run method for the workflow
|
|
9601
9943
|
*/
|
|
@@ -9874,12 +10216,15 @@ declare function andSleepUntil<INPUT, DATA>({ date, ...config }: WorkflowStepSle
|
|
|
9874
10216
|
|
|
9875
10217
|
/**
|
|
9876
10218
|
* Creates a foreach step that runs a step for each item in an array.
|
|
10219
|
+
* Use items to select the array and map to shape each item before execution.
|
|
9877
10220
|
*/
|
|
9878
|
-
declare function andForEach<INPUT, ITEM, RESULT>({ step, concurrency, ...config }: WorkflowStepForEachConfig<INPUT, ITEM, RESULT>): {
|
|
10221
|
+
declare function andForEach<INPUT, DATA, ITEM, RESULT, MAP_DATA = ITEM>({ step, concurrency, items, map, ...config }: WorkflowStepForEachConfig<INPUT, DATA, ITEM, RESULT, MAP_DATA>): {
|
|
9879
10222
|
type: "foreach";
|
|
9880
|
-
step: InternalAnyWorkflowStep<INPUT,
|
|
10223
|
+
step: InternalAnyWorkflowStep<INPUT, MAP_DATA, RESULT>;
|
|
9881
10224
|
concurrency: number;
|
|
9882
|
-
|
|
10225
|
+
items: WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM> | undefined;
|
|
10226
|
+
map: WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA> | undefined;
|
|
10227
|
+
execute: (context: WorkflowExecuteContext<INPUT, DATA, any, any>) => Promise<RESULT[]>;
|
|
9883
10228
|
id: string;
|
|
9884
10229
|
name: string;
|
|
9885
10230
|
purpose: string;
|
|
@@ -10175,6 +10520,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
10175
10520
|
execute: (context: {
|
|
10176
10521
|
data: z.infer<IS>;
|
|
10177
10522
|
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
10523
|
+
workflowState: WorkflowStateStore;
|
|
10524
|
+
setWorkflowState: (update: WorkflowStateUpdater) => void;
|
|
10178
10525
|
getStepData: (stepId: string) => WorkflowStepData | undefined;
|
|
10179
10526
|
suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
|
|
10180
10527
|
resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
|
|
@@ -10200,6 +10547,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
10200
10547
|
execute: (context: {
|
|
10201
10548
|
data: z.infer<IS>;
|
|
10202
10549
|
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
10550
|
+
workflowState: WorkflowStateStore;
|
|
10551
|
+
setWorkflowState: (update: WorkflowStateUpdater) => void;
|
|
10203
10552
|
getStepData: (stepId: string) => WorkflowStepData | undefined;
|
|
10204
10553
|
suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
|
|
10205
10554
|
resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
|
|
@@ -10225,6 +10574,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
10225
10574
|
execute: (context: {
|
|
10226
10575
|
data: CURRENT_DATA;
|
|
10227
10576
|
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
10577
|
+
workflowState: WorkflowStateStore;
|
|
10578
|
+
setWorkflowState: (update: WorkflowStateUpdater) => void;
|
|
10228
10579
|
getStepData: (stepId: string) => WorkflowStepData | undefined;
|
|
10229
10580
|
suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
|
|
10230
10581
|
resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
|
|
@@ -10250,6 +10601,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
10250
10601
|
execute: (context: {
|
|
10251
10602
|
data: CURRENT_DATA;
|
|
10252
10603
|
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
10604
|
+
workflowState: WorkflowStateStore;
|
|
10605
|
+
setWorkflowState: (update: WorkflowStateUpdater) => void;
|
|
10253
10606
|
getStepData: (stepId: string) => WorkflowStepData | undefined;
|
|
10254
10607
|
suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
|
|
10255
10608
|
resumeData?: z.infer<RS>;
|
|
@@ -10291,6 +10644,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
10291
10644
|
execute: (context: {
|
|
10292
10645
|
data: CURRENT_DATA;
|
|
10293
10646
|
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
10647
|
+
workflowState: WorkflowStateStore;
|
|
10648
|
+
setWorkflowState: (update: WorkflowStateUpdater) => void;
|
|
10294
10649
|
getStepData: (stepId: string) => WorkflowStepData | undefined;
|
|
10295
10650
|
suspend: (reason?: string, suspendData?: z.infer<SUSPEND_SCHEMA>) => Promise<never>;
|
|
10296
10651
|
resumeData?: z.infer<RESUME_SCHEMA>;
|
|
@@ -10320,6 +10675,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
10320
10675
|
condition: (context: {
|
|
10321
10676
|
data: z.infer<IS>;
|
|
10322
10677
|
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
10678
|
+
workflowState: WorkflowStateStore;
|
|
10679
|
+
setWorkflowState: (update: WorkflowStateUpdater) => void;
|
|
10323
10680
|
getStepData: (stepId: string) => WorkflowStepData | undefined;
|
|
10324
10681
|
suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
|
|
10325
10682
|
resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
|
|
@@ -10378,6 +10735,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
10378
10735
|
execute: (context: {
|
|
10379
10736
|
data: z.infer<IS>;
|
|
10380
10737
|
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
10738
|
+
workflowState: WorkflowStateStore;
|
|
10739
|
+
setWorkflowState: (update: WorkflowStateUpdater) => void;
|
|
10381
10740
|
getStepData: (stepId: string) => WorkflowStepData | undefined;
|
|
10382
10741
|
suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer<SS> : z.infer<SUSPEND_SCHEMA>) => Promise<never>;
|
|
10383
10742
|
resumeData?: RS extends z.ZodTypeAny ? z.infer<RS> : z.infer<RESUME_SCHEMA>;
|
|
@@ -10418,6 +10777,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
10418
10777
|
execute: (context: {
|
|
10419
10778
|
data: CURRENT_DATA;
|
|
10420
10779
|
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
10780
|
+
workflowState: WorkflowStateStore;
|
|
10781
|
+
setWorkflowState: (update: WorkflowStateUpdater) => void;
|
|
10421
10782
|
getStepData: (stepId: string) => WorkflowStepData | undefined;
|
|
10422
10783
|
suspend: (reason?: string, suspendData?: z.infer<SUSPEND_SCHEMA>) => Promise<never>;
|
|
10423
10784
|
resumeData?: z.infer<RESUME_SCHEMA>;
|
|
@@ -10452,7 +10813,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
10452
10813
|
/**
|
|
10453
10814
|
* Add a foreach step that runs a step for each item in an array
|
|
10454
10815
|
*/
|
|
10455
|
-
andForEach<ITEM, NEW_DATA>(config: WorkflowStepForEachConfig<WorkflowInput<INPUT_SCHEMA>, ITEM, NEW_DATA>): WorkflowChain<INPUT_SCHEMA, RESULT_SCHEMA, NEW_DATA[], SUSPEND_SCHEMA, RESUME_SCHEMA>;
|
|
10816
|
+
andForEach<ITEM, NEW_DATA, MAP_DATA = ITEM>(config: WorkflowStepForEachConfig<WorkflowInput<INPUT_SCHEMA>, CURRENT_DATA, ITEM, NEW_DATA, MAP_DATA>): WorkflowChain<INPUT_SCHEMA, RESULT_SCHEMA, NEW_DATA[], SUSPEND_SCHEMA, RESUME_SCHEMA>;
|
|
10456
10817
|
/**
|
|
10457
10818
|
* Add a do-while loop step
|
|
10458
10819
|
*/
|
|
@@ -10911,6 +11272,7 @@ type PlanAgentOptions = Omit<AgentOptions, "instructions" | "tools" | "toolkits"
|
|
|
10911
11272
|
systemPrompt?: InstructionsDynamicValue;
|
|
10912
11273
|
tools?: (Tool<any, any> | Toolkit | Tool$1)[];
|
|
10913
11274
|
toolkits?: Toolkit[];
|
|
11275
|
+
toolRouting?: ToolRoutingConfig | false;
|
|
10914
11276
|
subagents?: PlanAgentSubagentDefinition[];
|
|
10915
11277
|
generalPurposeAgent?: boolean;
|
|
10916
11278
|
planning?: PlanningToolkitOptions | false;
|
|
@@ -12704,6 +13066,10 @@ type VoltAgentOptions = {
|
|
|
12704
13066
|
* Falls back to `memory` when not provided.
|
|
12705
13067
|
*/
|
|
12706
13068
|
workflowMemory?: Memory;
|
|
13069
|
+
/**
|
|
13070
|
+
* Global tool routing defaults (applied to agents without explicit toolRouting config).
|
|
13071
|
+
*/
|
|
13072
|
+
toolRouting?: ToolRoutingConfig;
|
|
12707
13073
|
/** Optional VoltOps trigger handlers */
|
|
12708
13074
|
triggers?: VoltAgentTriggersConfig;
|
|
12709
13075
|
/**
|
|
@@ -13569,22 +13935,22 @@ declare class InMemoryStorageAdapter implements StorageAdapter {
|
|
|
13569
13935
|
* Lightweight in-memory vector database adapter
|
|
13570
13936
|
* Suitable for development, testing, and small datasets (< 10k vectors)
|
|
13571
13937
|
*/
|
|
13572
|
-
declare class InMemoryVectorAdapter implements VectorAdapter {
|
|
13938
|
+
declare class InMemoryVectorAdapter implements VectorAdapter$1 {
|
|
13573
13939
|
private vectors;
|
|
13574
13940
|
private dimensions;
|
|
13575
13941
|
constructor();
|
|
13576
13942
|
store(id: string, vector: number[], metadata?: Record<string, unknown>): Promise<void>;
|
|
13577
|
-
storeBatch(items: VectorItem[]): Promise<void>;
|
|
13943
|
+
storeBatch(items: VectorItem$1[]): Promise<void>;
|
|
13578
13944
|
search(queryVector: number[], options?: {
|
|
13579
13945
|
limit?: number;
|
|
13580
13946
|
filter?: Record<string, unknown>;
|
|
13581
13947
|
threshold?: number;
|
|
13582
|
-
}): Promise<SearchResult[]>;
|
|
13948
|
+
}): Promise<SearchResult$1[]>;
|
|
13583
13949
|
delete(id: string): Promise<void>;
|
|
13584
13950
|
deleteBatch(ids: string[]): Promise<void>;
|
|
13585
13951
|
clear(): Promise<void>;
|
|
13586
13952
|
count(): Promise<number>;
|
|
13587
|
-
get(id: string): Promise<VectorItem | null>;
|
|
13953
|
+
get(id: string): Promise<VectorItem$1 | null>;
|
|
13588
13954
|
/**
|
|
13589
13955
|
* Check if metadata matches the filter criteria
|
|
13590
13956
|
*/
|
|
@@ -13599,56 +13965,18 @@ declare class InMemoryVectorAdapter implements VectorAdapter {
|
|
|
13599
13965
|
}>;
|
|
13600
13966
|
}
|
|
13601
13967
|
|
|
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
13968
|
/**
|
|
13643
13969
|
* AI SDK Embedding Adapter
|
|
13644
13970
|
* Wraps Vercel AI SDK embedding models for use with Memory V2
|
|
13645
13971
|
*/
|
|
13646
|
-
declare class AiSdkEmbeddingAdapter implements EmbeddingAdapter {
|
|
13972
|
+
declare class AiSdkEmbeddingAdapter implements EmbeddingAdapter$1 {
|
|
13647
13973
|
private model;
|
|
13648
13974
|
private dimensions;
|
|
13649
13975
|
private modelName;
|
|
13650
13976
|
private options;
|
|
13651
|
-
|
|
13977
|
+
private modelResolvePromise?;
|
|
13978
|
+
constructor(model: EmbeddingModelReference, options?: EmbeddingOptions);
|
|
13979
|
+
private resolveModel;
|
|
13652
13980
|
embed(text: string): Promise<number[]>;
|
|
13653
13981
|
embedBatch(texts: string[]): Promise<number[][]>;
|
|
13654
13982
|
getDimensions(): number;
|
|
@@ -13660,8 +13988,14 @@ declare class AiSdkEmbeddingAdapter implements EmbeddingAdapter {
|
|
|
13660
13988
|
}
|
|
13661
13989
|
|
|
13662
13990
|
type LanguageModelFactory = (modelId: string) => LanguageModel;
|
|
13991
|
+
type EmbeddingModelInstance = Exclude<EmbeddingModel, string>;
|
|
13992
|
+
type EmbeddingModelFactory = (modelId: string) => EmbeddingModelInstance;
|
|
13663
13993
|
type ModelProvider = {
|
|
13664
13994
|
languageModel: LanguageModelFactory;
|
|
13995
|
+
embeddingModel?: EmbeddingModelFactory;
|
|
13996
|
+
embedding?: EmbeddingModelFactory;
|
|
13997
|
+
textEmbeddingModel?: EmbeddingModelFactory;
|
|
13998
|
+
textEmbedding?: EmbeddingModelFactory;
|
|
13665
13999
|
};
|
|
13666
14000
|
type ModelProviderEntry = ModelProvider | LanguageModelFactory;
|
|
13667
14001
|
type ModelProviderLoader = () => Promise<ModelProviderEntry>;
|
|
@@ -13670,8 +14004,9 @@ declare global {
|
|
|
13670
14004
|
}
|
|
13671
14005
|
declare class ModelProviderRegistry {
|
|
13672
14006
|
private providers;
|
|
14007
|
+
private providerEntries;
|
|
13673
14008
|
private loaders;
|
|
13674
|
-
private
|
|
14009
|
+
private entryLoading;
|
|
13675
14010
|
private dynamicRegistry;
|
|
13676
14011
|
private refreshInterval;
|
|
13677
14012
|
private lastRefreshTime;
|
|
@@ -13695,7 +14030,9 @@ declare class ModelProviderRegistry {
|
|
|
13695
14030
|
unregisterProvider(providerId: string): void;
|
|
13696
14031
|
listProviders(): string[];
|
|
13697
14032
|
resolveLanguageModel(modelId: string): Promise<LanguageModel>;
|
|
14033
|
+
resolveEmbeddingModel(modelId: string): Promise<EmbeddingModelInstance>;
|
|
13698
14034
|
private getProvider;
|
|
14035
|
+
private getProviderEntry;
|
|
13699
14036
|
private normalizeProvider;
|
|
13700
14037
|
}
|
|
13701
14038
|
|
|
@@ -14286,6 +14623,7 @@ declare class AgentRegistry {
|
|
|
14286
14623
|
private globalMemory?;
|
|
14287
14624
|
private globalAgentMemory?;
|
|
14288
14625
|
private globalWorkflowMemory?;
|
|
14626
|
+
private globalToolRouting?;
|
|
14289
14627
|
/**
|
|
14290
14628
|
* Track parent-child relationships between agents (child -> parents)
|
|
14291
14629
|
*/
|
|
@@ -14396,6 +14734,14 @@ declare class AgentRegistry {
|
|
|
14396
14734
|
* Get the global default Memory instance for workflows.
|
|
14397
14735
|
*/
|
|
14398
14736
|
getGlobalWorkflowMemory(): Memory | undefined;
|
|
14737
|
+
/**
|
|
14738
|
+
* Set the global default tool routing configuration.
|
|
14739
|
+
*/
|
|
14740
|
+
setGlobalToolRouting(toolRouting: ToolRoutingConfig | undefined): void;
|
|
14741
|
+
/**
|
|
14742
|
+
* Get the global default tool routing configuration.
|
|
14743
|
+
*/
|
|
14744
|
+
getGlobalToolRouting(): ToolRoutingConfig | undefined;
|
|
14399
14745
|
}
|
|
14400
14746
|
|
|
14401
14747
|
type UpdateOptions = {
|
|
@@ -14567,4 +14913,4 @@ declare class VoltAgent {
|
|
|
14567
14913
|
*/
|
|
14568
14914
|
declare function convertUsage(usage: LanguageModelUsage | undefined): UsageInfo | undefined;
|
|
14569
14915
|
|
|
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 };
|
|
14916
|
+
export { A2AServerRegistry, AbortError, Agent, type AgentEvalConfig, type AgentEvalContext, type AgentEvalFeedbackHelper, type AgentEvalFeedbackSaveInput, type AgentEvalOperationType, type AgentEvalPayload, type AgentEvalResult, type AgentEvalResultCallbackArgs, type AgentEvalSamplingPolicy, type AgentEvalScorerConfig, type AgentEvalScorerFactory, type AgentEvalScorerReference, type AgentFeedbackMetadata, type AgentFeedbackOptions, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnFallback, type AgentHookOnHandoff, type AgentHookOnHandoffComplete, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnRetry, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentModelConfig, type AgentModelReference, type AgentModelValue, type AgentOptions, AgentRegistry, type AgentResponse, type AgentScorerState, type AgentStatus, type AgentSummarizationOptions, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type BuildScorerOptions, type BuildScorerRunArgs, type BuildScorerRunResult, type BuilderAnalyzeContext, type BuilderPrepareContext, type BuilderReasonContext, type BuilderScoreContext, type CachedPrompt, type ChatMessage, ClientHTTPError, type ClientSideToolResult, type CloudflareFetchHandler, CompositeFilesystemBackend, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type ConversationStepRecord, type ConversationStepType, type ConversationTitleConfig, type ConversationTitleGenerator, ConversationTodoBackend, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateInputGuardrailOptions, type CreateInputMiddlewareOptions, type CreateOutputGuardrailOptions, type CreateOutputMiddlewareOptions, type CreateReasoningToolsOptions, type CreateScorerOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, EDIT_FILE_TOOL_DESCRIPTION, type EditResult, type EmbeddingAdapter, type EmbeddingAdapterConfig, type EmbeddingAdapterInput, EmbeddingAdapterNotConfiguredError, EmbeddingError, type EmbeddingModelFactory, type EmbeddingModelReference, type EmbeddingRouterModelId, type ExtractVariableNames, FEW_SHOT_EXAMPLES, FILESYSTEM_SYSTEM_PROMPT, type FallbackStage, type FileData, type FileInfo, type FilesystemBackend, type FilesystemBackendContext, type FilesystemBackendFactory, type FilesystemToolkitOptions, GLOB_TOOL_DESCRIPTION, GREP_TOOL_DESCRIPTION, type GenerateObjectOptions, type GenerateObjectResultWithContext, type GenerateObjectSubAgentConfig, type GenerateReasonResult, type GenerateScoreResult, type GenerateScoreStep, type GenerateTextOptions, type GenerateTextResultWithContext, type GenerateTextSubAgentConfig, type GetConversationStepsOptions, type GetMessagesOptions, type GrepMatch, type GuardrailAction, type GuardrailContext, type GuardrailDefinition, type GuardrailFunction, type GuardrailSeverity, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryFilesystemBackend, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type InputGuardrail, type InputGuardrailArgs, type InputGuardrailResult, type InputMiddleware, type InputMiddlewareArgs, type InputMiddlewareResult, type KnowledgeBaseTagFilter, type LLMProvider, LS_TOOL_DESCRIPTION, type LanguageModelFactory, LazyRemoteExportProcessor, type LocalScorerDefinition, type LocalScorerExecutionResult, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, type MCPAuthorizationAction, type MCPAuthorizationConfig, type MCPAuthorizationContext, MCPAuthorizationError, type MCPCanFunction, type MCPCanParams, type MCPCanResult, MCPClient, type MCPClientCallOptions, type MCPClientConfig, MCPConfiguration, type MCPConfigurationOptions, type MCPElicitationAdapter, type MCPElicitationHandler, type MCPLoggingAdapter, type MCPPromptsAdapter, type MCPResourcesAdapter, MCPServerRegistry, type ManagedMemoryAddMessageInput, type ManagedMemoryAddMessagesInput, type ManagedMemoryClearMessagesInput, type ManagedMemoryConnectionInfo, type ManagedMemoryConversationsClient, type ManagedMemoryCredentialCreateResult, type ManagedMemoryCredentialListResult, type ManagedMemoryCredentialSummary, type ManagedMemoryDatabaseSummary, type ManagedMemoryDeleteMessagesInput, type ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, type ManagedMemoryQueryWorkflowRunsInput, type ManagedMemorySetWorkingMemoryInput, type ManagedMemoryStatus, type ManagedMemoryUpdateConversationInput, type ManagedMemoryVoltOpsClient, type ManagedMemoryWorkflowStateUpdateInput, type ManagedMemoryWorkflowStatesClient, type ManagedMemoryWorkingMemoryClient, type ManagedMemoryWorkingMemoryInput, Memory, type MemoryConfig, type MemoryOptions, type MemoryStorageMetadata, type MemoryUpdateMode, Memory as MemoryV2, MemoryV2Error, type MessageContent, MessageContentBuilder, type MessageRole, MiddlewareAbortError, type MiddlewareAbortOptions, type MiddlewareContext, type MiddlewareDefinition, type MiddlewareDirection, type MiddlewareFunction, type ModelForProvider, type ModelProvider, type ModelProviderEntry, type ModelProviderLoader, ModelProviderRegistry, type ModelRouterModelId, type ModelToolCall, NextAction, NodeFilesystemBackend, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnFallbackHookArgs, type OnHandoffCompleteHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnRetryHookArgs, type OnRetryHookArgsBase, type OnRetryLLMHookArgs, type OnRetryMiddlewareHookArgs, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolEndHookResult, type OnToolStartHookArgs, type OperationContext, type OutputGuardrail, type OutputGuardrailArgs, type OutputGuardrailResult, type OutputMiddleware, type OutputMiddlewareArgs, type OutputMiddlewareResult, type OutputSpec$1 as OutputSpec, type PackageUpdateInfo, PlanAgent, type PlanAgentExtension, type PlanAgentExtensionContext, type PlanAgentExtensionResult, type PlanAgentFileData, type PlanAgentOptions, type PlanAgentState, type PlanAgentSubagentDefinition, type PlanAgentTodoItem, type PlanAgentTodoStatus, type PlanningToolkitOptions, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderId, type ProviderModelsMap, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ProviderTool, READ_FILE_TOOL_DESCRIPTION, type RagKnowledgeBaseSummary, type RagSearchKnowledgeBaseChildChunk, type RagSearchKnowledgeBaseRequest, type RagSearchKnowledgeBaseResponse, type RagSearchKnowledgeBaseResult, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredTrigger, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type ResumableStreamAdapter, type ResumableStreamContext, type RetrieveOptions, type Retriever, type RetrieverOptions, type RetrySource, type RunLocalScorersArgs, type RunLocalScorersResult, SERVERLESS_ENV_CONTEXT_KEY, type SamplingMetadata, type SamplingPolicy, type ScorerBuilder, type ScorerContext, type ScorerLifecycleScope, type ScorerPipelineContext, type ScorerReasonContext, type ScorerResult, type SearchOptions, type SearchResult$1 as SearchResult, type ServerAgentResponse, type ServerApiResponse, type ServerProviderDeps, type ServerProviderFactory, type ServerWorkflowResponse, type ServerlessProviderFactory, type ServerlessRemoteEndpointConfig, type ServerlessRemoteExportConfig, type ServerlessRequestHandler, ServerlessVoltAgentObservability, type SpanAttributes, type SpanEvent, type SpanFilterConfig, SpanFilterProcessor, SpanKind, type SpanLink, type SpanStatus, SpanStatusCode, type SpanTreeNode, type StepChunkCallback, type StepFinishCallback, type StepWithContent, type StopWhen, type StorageAdapter, StorageError, StorageLogProcessor, type StoredUIMessage, type StreamObjectFinishResult, type StreamObjectOnFinishCallback, type StreamObjectOptions, type StreamObjectResultWithContext, type StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextResultWithContext, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, TRIGGER_CONTEXT_KEY, type TaskToolOptions, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, type TodoBackend, type TodoBackendFactory, Tool, type ToolArgumentResolver, type ToolCall, type ToolContext, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, type ToolExecutionResult, type ToolHookOnEnd, type ToolHookOnEndArgs, type ToolHookOnEndResult, type ToolHookOnStart, type ToolHookOnStartArgs, type ToolHooks, ToolManager, type ToolOptions, type ToolResultOutput, type ToolRouter, type ToolRouterCandidate, type ToolRouterContext, type ToolRouterInput, type ToolRouterMode, type ToolRouterResult, type ToolRouterResultItem, type ToolRouterSelection, type ToolRouterStrategy, type ToolRoutingConfig, type ToolRoutingEmbeddingConfig, type ToolRoutingEmbeddingInput, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type TriggerHandler, type TriggerHandlerBody, type TriggerHandlerContext, type TriggerHandlerResponse, type TriggerHandlerResult, type TriggerHandlerReturn, type TriggerHttpMethod, TriggerRegistry, type Usage, type UsageInfo, UserInputBridge, type UserInputHandler, type VectorAdapter$1 as VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem$1 as VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, VoltAgentRagRetriever, type VoltAgentRagRetrieverOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, type VoltAgentTriggerConfig, type VoltAgentTriggersConfig, type VoltOpsActionExecutionResult, type VoltOpsActionsApi, VoltOpsActionsClient, type VoltOpsActionsTransport, type VoltOpsAirtableCreateRecordParams, type VoltOpsAirtableCredential, type VoltOpsAirtableDeleteRecordParams, type VoltOpsAirtableGetRecordParams, type VoltOpsAirtableListRecordsParams, type VoltOpsAirtableUpdateRecordParams, type VoltOpsAppendEvalRunResultPayload, type VoltOpsAppendEvalRunResultsRequest, VoltOpsClient, type VoltOpsClientOptions, type VoltOpsCompleteEvalRunRequest, type VoltOpsCreateEvalRunRequest, type VoltOpsCreateScorerRequest, type VoltOpsDiscordChannelMessageParams, type VoltOpsDiscordChannelType, type VoltOpsDiscordConfig, type VoltOpsDiscordCreateChannelParams, type VoltOpsDiscordCredential, type VoltOpsDiscordDeleteChannelParams, type VoltOpsDiscordGetChannelParams, type VoltOpsDiscordListChannelsParams, type VoltOpsDiscordListMembersParams, type VoltOpsDiscordListMessagesParams, type VoltOpsDiscordMemberRoleParams, type VoltOpsDiscordReactionParams, type VoltOpsDiscordSendMessageParams, type VoltOpsDiscordSendWebhookMessageParams, type VoltOpsDiscordUpdateChannelParams, type VoltOpsEvalResultStatus, type VoltOpsEvalRunCompletionSummaryPayload, type VoltOpsEvalRunErrorPayload, type VoltOpsEvalRunResultLiveMetadata, type VoltOpsEvalRunResultScorePayload, type VoltOpsEvalRunStatus, type VoltOpsEvalRunSummary, type VoltOpsFeedback, type VoltOpsFeedbackConfig, type VoltOpsFeedbackCreateInput, type VoltOpsFeedbackExpiresIn, type VoltOpsFeedbackToken, type VoltOpsFeedbackTokenCreateInput, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, type VoltOpsScorerSummary, type VoltOpsSlackCredential, type VoltOpsSlackDeleteMessageParams, type VoltOpsSlackPostMessageParams, type VoltOpsSlackSearchMessagesParams, type VoltOpsTerminalEvalRunStatus, type VoltOpsTriggerDefinition, VoltOpsTriggerDefinitions, type VoltOpsTriggerEnvelope, type VoltOpsTriggerGroupMap, type VoltOpsTriggerName, VoltOpsTriggerNames, WRITE_FILE_TOOL_DESCRIPTION, WRITE_TODOS_TOOL_DESCRIPTION, WRITE_TODOS_TOOL_NAME, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type WeightedBlendComponent, type WeightedBlendOptions, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, type WorkflowHookContext, type WorkflowHookStatus, type WorkflowHooks, WorkflowRegistry, type WorkflowRunQuery, type WorkflowStateEntry, type WorkflowStateStore, type WorkflowStateUpdater, type WorkflowStats, type WorkflowStepContext, type WorkflowStepData, type WorkflowStepStatus, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, type WriteResult, addTimestampToMessage, andAgent, andAll, andBranch, andDoUntil, andDoWhile, andForEach, andGuardrail, andMap, andRace, andSleep, andSleepUntil, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSamplingMetadata, buildScorer, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createDefaultInputSafetyGuardrails, createDefaultPIIGuardrails, createDefaultSafetyGuardrails, createEmailRedactorGuardrail, createEmbeddingToolRouterStrategy, createFilesystemToolkit, createHTMLSanitizerInputGuardrail, createHooks, createInputGuardrail, createInputLengthGuardrail, createInputMiddleware, createMaxLengthGuardrail, createNodeId, createOutputGuardrail, createOutputMiddleware, createPIIInputGuardrail, createPhoneNumberGuardrail, createPlanningToolkit, createProfanityGuardrail, createProfanityInputGuardrail, createPrompt, createPromptInjectionGuardrail, createReasoningTools, createRetrieverTool, createScorer, createSensitiveNumberGuardrail, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolResultEvictor, createToolRouter, createToolkit, createTriggers, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, defineVoltOpsTrigger, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getGlobalVoltOpsClient, getNodeTypeFromNodeId, getVoltOpsTriggerDefinition, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isMiddlewareAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isToolRouter, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeScorerResult, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, runLocalScorers, safeJsonParse, serializeValueForDebug, setWaitUntil, shouldSample, tool, transformTextContent, updateAllPackages, updateSinglePackage, weightedBlend, zodSchemaToJsonUI };
|