@iqai/adk 0.1.22 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -32,6 +32,115 @@ declare class Logger {
32
32
  debugArray(title: string, items: Array<Record<string, any>>): void;
33
33
  }
34
34
 
35
+ type McpConfig = {
36
+ name: string;
37
+ description: string;
38
+ transport: McpTransportType;
39
+ timeout?: number;
40
+ retryOptions?: {
41
+ maxRetries?: number;
42
+ initialDelay?: number;
43
+ maxDelay?: number;
44
+ };
45
+ headers?: Record<string, string>;
46
+ cacheConfig?: {
47
+ enabled?: boolean;
48
+ maxAge?: number;
49
+ maxSize?: number;
50
+ };
51
+ debug?: boolean;
52
+ /**
53
+ * Sampling handler for processing MCP sampling requests.
54
+ * This allows MCP servers to request LLM completions through your ADK agent.
55
+ */
56
+ samplingHandler?: SamplingHandler;
57
+ };
58
+ type McpTransportType = {
59
+ mode: "stdio";
60
+ command: string;
61
+ args: string[];
62
+ env?: Record<string, string>;
63
+ } | {
64
+ mode: "sse";
65
+ serverUrl: string;
66
+ headers?: HeadersInit;
67
+ };
68
+ /**
69
+ * Error types specific to the MCP client
70
+ */
71
+ declare enum McpErrorType {
72
+ CONNECTION_ERROR = "connection_error",
73
+ TOOL_EXECUTION_ERROR = "tool_execution_error",
74
+ RESOURCE_CLOSED_ERROR = "resource_closed_error",
75
+ TIMEOUT_ERROR = "timeout_error",
76
+ INVALID_SCHEMA_ERROR = "invalid_schema_error",
77
+ SAMPLING_ERROR = "SAMPLING_ERROR",
78
+ INVALID_REQUEST_ERROR = "INVALID_REQUEST_ERROR"
79
+ }
80
+ /**
81
+ * Custom error class for MCP-related errors
82
+ */
83
+ declare class McpError extends Error {
84
+ type: McpErrorType;
85
+ originalError?: Error;
86
+ constructor(message: string, type: McpErrorType, originalError?: Error);
87
+ }
88
+ type McpSamplingRequest = z.infer<typeof CreateMessageRequestSchema>;
89
+ type McpSamplingResponse = z.infer<typeof CreateMessageResultSchema>;
90
+ type SamplingHandler = (request: LlmRequest) => Promise<string | LlmResponse>;
91
+
92
+ declare class McpClientService {
93
+ private config;
94
+ private client;
95
+ private transport;
96
+ private isClosing;
97
+ private mcpSamplingHandler;
98
+ protected logger: Logger;
99
+ constructor(config: McpConfig);
100
+ /**
101
+ * Initializes and returns an MCP client based on configuration.
102
+ * Will create a new client if one doesn't exist yet.
103
+ */
104
+ initialize(): Promise<Client>;
105
+ /**
106
+ * Creates a transport based on the configuration.
107
+ */
108
+ private createTransport;
109
+ /**
110
+ * Re-initializes the MCP client when a session is closed.
111
+ * Used by the retry mechanism.
112
+ */
113
+ reinitialize(): Promise<void>;
114
+ /**
115
+ * Cleans up resources associated with this client service.
116
+ * Similar to Python's AsyncExitStack.aclose() functionality.
117
+ */
118
+ private cleanupResources;
119
+ /**
120
+ * Call an MCP tool with retry capability if the session is closed.
121
+ */
122
+ callTool(name: string, args: Record<string, any>): Promise<any>;
123
+ /**
124
+ * Closes and cleans up all resources.
125
+ * Should be called when the service is no longer needed.
126
+ * Similar to Python's close() method.
127
+ */
128
+ close(): Promise<void>;
129
+ /**
130
+ * Checks if the client is currently connected
131
+ */
132
+ isConnected(): boolean;
133
+ private setupSamplingHandler;
134
+ /**
135
+ * Set a new ADK sampling handler
136
+ */
137
+ setSamplingHandler(handler: SamplingHandler): void;
138
+ /**
139
+ * Remove the sampling handler
140
+ */
141
+ removeSamplingHandler(): void;
142
+ }
143
+
35
144
  /**
36
145
  * Represents the actions attached to an event.
37
146
  */
@@ -1058,106 +1167,38 @@ declare abstract class BaseCodeExecutor {
1058
1167
  get executionResultDelimiters(): [string, string];
1059
1168
  }
1060
1169
 
1061
- /**
1062
- * Candidate response from the model.
1063
- */
1064
1170
  interface Candidate {
1065
1171
  content?: Content;
1066
1172
  groundingMetadata?: GroundingMetadata;
1067
1173
  finishReason?: string;
1068
1174
  finishMessage?: string;
1069
1175
  }
1070
- /**
1071
- * Prompt feedback in case of blocked or failed prompt.
1072
- */
1073
1176
  interface PromptFeedback {
1074
1177
  blockReason?: string;
1075
1178
  blockReasonMessage?: string;
1076
1179
  }
1077
- /**
1078
- * The response from the model generation API.
1079
- */
1080
1180
  interface GenerateContentResponse {
1081
1181
  candidates?: Candidate[];
1082
1182
  usageMetadata?: GenerateContentResponseUsageMetadata;
1083
1183
  promptFeedback?: PromptFeedback;
1084
1184
  }
1085
- /**
1086
- * Response from a language model.
1087
- */
1088
1185
  declare class LlmResponse {
1089
- /**
1090
- * Unique identifier for the response.
1091
- */
1092
1186
  id?: string;
1093
- /**
1094
- * The content generated by the model.
1095
- */
1187
+ text?: string;
1096
1188
  content?: Content;
1097
- /**
1098
- * The grounding metadata of the response.
1099
- */
1100
1189
  groundingMetadata?: GroundingMetadata;
1101
- /**
1102
- * Indicates whether the text content is part of an unfinished text stream.
1103
- */
1104
1190
  partial?: boolean;
1105
- /**
1106
- * Indicates whether the response from the model is complete.
1107
- */
1108
1191
  turnComplete?: boolean;
1109
- /**
1110
- * Error code if the response is an error.
1111
- */
1112
1192
  errorCode?: string;
1113
- /**
1114
- * Error message if the response is an error.
1115
- */
1116
1193
  errorMessage?: string;
1117
- /**
1118
- * Flag indicating that LLM was interrupted when generating the content.
1119
- */
1120
1194
  interrupted?: boolean;
1121
- /**
1122
- * The custom metadata of the LlmResponse.
1123
- */
1124
1195
  customMetadata?: Record<string, any>;
1125
- /**
1126
- * The usage metadata of the LlmResponse.
1127
- */
1128
1196
  usageMetadata?: GenerateContentResponseUsageMetadata;
1129
- /**
1130
- * Index of the candidate response.
1131
- */
1132
1197
  candidateIndex?: number;
1133
- /**
1134
- * Reason why the model finished generating.
1135
- */
1136
1198
  finishReason?: string;
1137
- /**
1138
- * Error object if the response is an error.
1139
- */
1140
1199
  error?: Error;
1141
- /**
1142
- * Creates a new LlmResponse.
1143
- */
1144
1200
  constructor(data?: Partial<LlmResponse>);
1145
- /**
1146
- * Creates an LlmResponse from a GenerateContentResponse.
1147
- *
1148
- * @param generateContentResponse The GenerateContentResponse to create the LlmResponse from.
1149
- * @returns The LlmResponse.
1150
- */
1151
1201
  static create(generateContentResponse: GenerateContentResponse): LlmResponse;
1152
- /**
1153
- * Creates an LlmResponse from an error.
1154
- *
1155
- * @param error The error object or message.
1156
- * @param options Additional options for the error response.
1157
- * @param options.errorCode A specific error code for the response.
1158
- * @param options.model The model that was being used when the error occurred.
1159
- * @returns The LlmResponse.
1160
- */
1161
1202
  static fromError(error: unknown, options?: {
1162
1203
  errorCode?: string;
1163
1204
  model?: string;
@@ -2038,115 +2079,6 @@ declare class LoadArtifactsTool extends BaseTool {
2038
2079
  private extractFunctionResponse;
2039
2080
  }
2040
2081
 
2041
- type McpConfig = {
2042
- name: string;
2043
- description: string;
2044
- transport: McpTransportType;
2045
- timeout?: number;
2046
- retryOptions?: {
2047
- maxRetries?: number;
2048
- initialDelay?: number;
2049
- maxDelay?: number;
2050
- };
2051
- headers?: Record<string, string>;
2052
- cacheConfig?: {
2053
- enabled?: boolean;
2054
- maxAge?: number;
2055
- maxSize?: number;
2056
- };
2057
- debug?: boolean;
2058
- /**
2059
- * Sampling handler for processing MCP sampling requests.
2060
- * This allows MCP servers to request LLM completions through your ADK agent.
2061
- */
2062
- samplingHandler?: SamplingHandler;
2063
- };
2064
- type McpTransportType = {
2065
- mode: "stdio";
2066
- command: string;
2067
- args: string[];
2068
- env?: Record<string, string>;
2069
- } | {
2070
- mode: "sse";
2071
- serverUrl: string;
2072
- headers?: HeadersInit;
2073
- };
2074
- /**
2075
- * Error types specific to the MCP client
2076
- */
2077
- declare enum McpErrorType {
2078
- CONNECTION_ERROR = "connection_error",
2079
- TOOL_EXECUTION_ERROR = "tool_execution_error",
2080
- RESOURCE_CLOSED_ERROR = "resource_closed_error",
2081
- TIMEOUT_ERROR = "timeout_error",
2082
- INVALID_SCHEMA_ERROR = "invalid_schema_error",
2083
- SAMPLING_ERROR = "SAMPLING_ERROR",
2084
- INVALID_REQUEST_ERROR = "INVALID_REQUEST_ERROR"
2085
- }
2086
- /**
2087
- * Custom error class for MCP-related errors
2088
- */
2089
- declare class McpError extends Error {
2090
- type: McpErrorType;
2091
- originalError?: Error;
2092
- constructor(message: string, type: McpErrorType, originalError?: Error);
2093
- }
2094
- type McpSamplingRequest = z.infer<typeof CreateMessageRequestSchema>;
2095
- type McpSamplingResponse = z.infer<typeof CreateMessageResultSchema>;
2096
- type SamplingHandler = (request: LlmRequest) => Promise<string | LlmResponse>;
2097
-
2098
- declare class McpClientService {
2099
- private config;
2100
- private client;
2101
- private transport;
2102
- private isClosing;
2103
- private mcpSamplingHandler;
2104
- protected logger: Logger;
2105
- constructor(config: McpConfig);
2106
- /**
2107
- * Initializes and returns an MCP client based on configuration.
2108
- * Will create a new client if one doesn't exist yet.
2109
- */
2110
- initialize(): Promise<Client>;
2111
- /**
2112
- * Creates a transport based on the configuration.
2113
- */
2114
- private createTransport;
2115
- /**
2116
- * Re-initializes the MCP client when a session is closed.
2117
- * Used by the retry mechanism.
2118
- */
2119
- reinitialize(): Promise<void>;
2120
- /**
2121
- * Cleans up resources associated with this client service.
2122
- * Similar to Python's AsyncExitStack.aclose() functionality.
2123
- */
2124
- private cleanupResources;
2125
- /**
2126
- * Call an MCP tool with retry capability if the session is closed.
2127
- */
2128
- callTool(name: string, args: Record<string, any>): Promise<any>;
2129
- /**
2130
- * Closes and cleans up all resources.
2131
- * Should be called when the service is no longer needed.
2132
- * Similar to Python's close() method.
2133
- */
2134
- close(): Promise<void>;
2135
- /**
2136
- * Checks if the client is currently connected
2137
- */
2138
- isConnected(): boolean;
2139
- private setupSamplingHandler;
2140
- /**
2141
- * Set a new ADK sampling handler
2142
- */
2143
- setSamplingHandler(handler: SamplingHandler): void;
2144
- /**
2145
- * Remove the sampling handler
2146
- */
2147
- removeSamplingHandler(): void;
2148
- }
2149
-
2150
2082
  /**
2151
2083
  * Converts an ADK-style BaseTool to an MCP tool format
2152
2084
  * Similar to Python's adk_to_mcp_tool_type function
@@ -2423,6 +2355,16 @@ declare function McpDiscord(config?: McpServerConfig): McpToolset;
2423
2355
  * Optional env vars: COINGECKO_PRO_API_KEY, COINGECKO_DEMO_API_KEY, COINGECKO_ENVIRONMENT
2424
2356
  */
2425
2357
  declare function McpCoinGecko(config?: McpServerConfig): McpToolset;
2358
+ /**
2359
+ * MCP Upbit - Interact with the Upbit cryptocurrency exchange
2360
+ *
2361
+ * Public tools require no auth.
2362
+ * Private trading tools require:
2363
+ * - UPBIT_ACCESS_KEY
2364
+ * - UPBIT_SECRET_KEY
2365
+ * - UPBIT_ENABLE_TRADING=true
2366
+ */
2367
+ declare function McpUpbit(config?: McpServerConfig): McpToolset;
2426
2368
  /**
2427
2369
  * Popular third-party MCP servers
2428
2370
  * These can be added as we expand support for community MCP servers
@@ -2518,78 +2460,81 @@ declare function getMcpTools(config: McpConfig, toolFilter?: string[] | ((tool:
2518
2460
  * Tools module exports
2519
2461
  */
2520
2462
 
2521
- type index$6_AgentTool = AgentTool;
2522
- declare const index$6_AgentTool: typeof AgentTool;
2523
- type index$6_AgentToolConfig = AgentToolConfig;
2524
- type index$6_BaseAgentType = BaseAgentType;
2525
- type index$6_BaseTool = BaseTool;
2526
- declare const index$6_BaseTool: typeof BaseTool;
2527
- type index$6_BuildFunctionDeclarationOptions = BuildFunctionDeclarationOptions;
2528
- type index$6_CreateToolConfig<T extends Record<string, any> = Record<string, never>> = CreateToolConfig<T>;
2529
- type index$6_CreateToolConfigWithSchema<T extends Record<string, any>> = CreateToolConfigWithSchema<T>;
2530
- type index$6_CreateToolConfigWithoutSchema = CreateToolConfigWithoutSchema;
2531
- type index$6_ExitLoopTool = ExitLoopTool;
2532
- declare const index$6_ExitLoopTool: typeof ExitLoopTool;
2533
- type index$6_FileOperationsTool = FileOperationsTool;
2534
- declare const index$6_FileOperationsTool: typeof FileOperationsTool;
2535
- type index$6_FunctionTool<T extends Record<string, any>> = FunctionTool<T>;
2536
- declare const index$6_FunctionTool: typeof FunctionTool;
2537
- type index$6_GetUserChoiceTool = GetUserChoiceTool;
2538
- declare const index$6_GetUserChoiceTool: typeof GetUserChoiceTool;
2539
- type index$6_GoogleSearch = GoogleSearch;
2540
- declare const index$6_GoogleSearch: typeof GoogleSearch;
2541
- type index$6_HttpRequestTool = HttpRequestTool;
2542
- declare const index$6_HttpRequestTool: typeof HttpRequestTool;
2543
- type index$6_LoadArtifactsTool = LoadArtifactsTool;
2544
- declare const index$6_LoadArtifactsTool: typeof LoadArtifactsTool;
2545
- type index$6_LoadMemoryTool = LoadMemoryTool;
2546
- declare const index$6_LoadMemoryTool: typeof LoadMemoryTool;
2547
- declare const index$6_McpAbi: typeof McpAbi;
2548
- declare const index$6_McpAtp: typeof McpAtp;
2549
- declare const index$6_McpBamm: typeof McpBamm;
2550
- declare const index$6_McpCoinGecko: typeof McpCoinGecko;
2551
- type index$6_McpConfig = McpConfig;
2552
- declare const index$6_McpDiscord: typeof McpDiscord;
2553
- type index$6_McpError = McpError;
2554
- declare const index$6_McpError: typeof McpError;
2555
- type index$6_McpErrorType = McpErrorType;
2556
- declare const index$6_McpErrorType: typeof McpErrorType;
2557
- declare const index$6_McpFilesystem: typeof McpFilesystem;
2558
- declare const index$6_McpFraxlend: typeof McpFraxlend;
2559
- declare const index$6_McpGeneric: typeof McpGeneric;
2560
- declare const index$6_McpIqWiki: typeof McpIqWiki;
2561
- declare const index$6_McpMemory: typeof McpMemory;
2562
- declare const index$6_McpNearAgent: typeof McpNearAgent;
2563
- declare const index$6_McpNearIntents: typeof McpNearIntents;
2564
- declare const index$6_McpOdos: typeof McpOdos;
2565
- type index$6_McpSamplingHandler = McpSamplingHandler;
2566
- declare const index$6_McpSamplingHandler: typeof McpSamplingHandler;
2567
- type index$6_McpSamplingRequest = McpSamplingRequest;
2568
- type index$6_McpSamplingResponse = McpSamplingResponse;
2569
- type index$6_McpServerConfig = McpServerConfig;
2570
- declare const index$6_McpTelegram: typeof McpTelegram;
2571
- type index$6_McpToolset = McpToolset;
2572
- declare const index$6_McpToolset: typeof McpToolset;
2573
- type index$6_McpTransportType = McpTransportType;
2574
- type index$6_SamplingHandler = SamplingHandler;
2575
- type index$6_ToolConfig = ToolConfig;
2576
- type index$6_ToolContext = ToolContext;
2577
- declare const index$6_ToolContext: typeof ToolContext;
2578
- type index$6_TransferToAgentTool = TransferToAgentTool;
2579
- declare const index$6_TransferToAgentTool: typeof TransferToAgentTool;
2580
- type index$6_UserInteractionTool = UserInteractionTool;
2581
- declare const index$6_UserInteractionTool: typeof UserInteractionTool;
2582
- declare const index$6_adkToMcpToolType: typeof adkToMcpToolType;
2583
- declare const index$6_buildFunctionDeclaration: typeof buildFunctionDeclaration;
2584
- declare const index$6_createFunctionTool: typeof createFunctionTool;
2585
- declare const index$6_createSamplingHandler: typeof createSamplingHandler;
2586
- declare const index$6_createTool: typeof createTool;
2587
- declare const index$6_getMcpTools: typeof getMcpTools;
2588
- declare const index$6_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
2589
- declare const index$6_mcpSchemaToParameters: typeof mcpSchemaToParameters;
2590
- declare const index$6_normalizeJsonSchema: typeof normalizeJsonSchema;
2591
- declare namespace index$6 {
2592
- export { index$6_AgentTool as AgentTool, type index$6_AgentToolConfig as AgentToolConfig, type index$6_BaseAgentType as BaseAgentType, index$6_BaseTool as BaseTool, type index$6_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, type index$6_CreateToolConfig as CreateToolConfig, type index$6_CreateToolConfigWithSchema as CreateToolConfigWithSchema, type index$6_CreateToolConfigWithoutSchema as CreateToolConfigWithoutSchema, index$6_ExitLoopTool as ExitLoopTool, index$6_FileOperationsTool as FileOperationsTool, index$6_FunctionTool as FunctionTool, index$6_GetUserChoiceTool as GetUserChoiceTool, index$6_GoogleSearch as GoogleSearch, index$6_HttpRequestTool as HttpRequestTool, index$6_LoadArtifactsTool as LoadArtifactsTool, index$6_LoadMemoryTool as LoadMemoryTool, index$6_McpAbi as McpAbi, index$6_McpAtp as McpAtp, index$6_McpBamm as McpBamm, index$6_McpCoinGecko as McpCoinGecko, type index$6_McpConfig as McpConfig, index$6_McpDiscord as McpDiscord, index$6_McpError as McpError, index$6_McpErrorType as McpErrorType, index$6_McpFilesystem as McpFilesystem, index$6_McpFraxlend as McpFraxlend, index$6_McpGeneric as McpGeneric, index$6_McpIqWiki as McpIqWiki, index$6_McpMemory as McpMemory, index$6_McpNearAgent as McpNearAgent, index$6_McpNearIntents as McpNearIntents, index$6_McpOdos as McpOdos, index$6_McpSamplingHandler as McpSamplingHandler, type index$6_McpSamplingRequest as McpSamplingRequest, type index$6_McpSamplingResponse as McpSamplingResponse, type index$6_McpServerConfig as McpServerConfig, index$6_McpTelegram as McpTelegram, index$6_McpToolset as McpToolset, type index$6_McpTransportType as McpTransportType, type index$6_SamplingHandler as SamplingHandler, type index$6_ToolConfig as ToolConfig, index$6_ToolContext as ToolContext, index$6_TransferToAgentTool as TransferToAgentTool, index$6_UserInteractionTool as UserInteractionTool, index$6_adkToMcpToolType as adkToMcpToolType, index$6_buildFunctionDeclaration as buildFunctionDeclaration, index$6_createFunctionTool as createFunctionTool, index$6_createSamplingHandler as createSamplingHandler, index$6_createTool as createTool, index$6_getMcpTools as getMcpTools, index$6_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$6_mcpSchemaToParameters as mcpSchemaToParameters, index$6_normalizeJsonSchema as normalizeJsonSchema };
2463
+ type index$7_AgentTool = AgentTool;
2464
+ declare const index$7_AgentTool: typeof AgentTool;
2465
+ type index$7_AgentToolConfig = AgentToolConfig;
2466
+ type index$7_BaseAgentType = BaseAgentType;
2467
+ type index$7_BaseTool = BaseTool;
2468
+ declare const index$7_BaseTool: typeof BaseTool;
2469
+ type index$7_BuildFunctionDeclarationOptions = BuildFunctionDeclarationOptions;
2470
+ type index$7_CreateToolConfig<T extends Record<string, any> = Record<string, never>> = CreateToolConfig<T>;
2471
+ type index$7_CreateToolConfigWithSchema<T extends Record<string, any>> = CreateToolConfigWithSchema<T>;
2472
+ type index$7_CreateToolConfigWithoutSchema = CreateToolConfigWithoutSchema;
2473
+ type index$7_ExitLoopTool = ExitLoopTool;
2474
+ declare const index$7_ExitLoopTool: typeof ExitLoopTool;
2475
+ type index$7_FileOperationsTool = FileOperationsTool;
2476
+ declare const index$7_FileOperationsTool: typeof FileOperationsTool;
2477
+ type index$7_FunctionTool<T extends Record<string, any>> = FunctionTool<T>;
2478
+ declare const index$7_FunctionTool: typeof FunctionTool;
2479
+ type index$7_GetUserChoiceTool = GetUserChoiceTool;
2480
+ declare const index$7_GetUserChoiceTool: typeof GetUserChoiceTool;
2481
+ type index$7_GoogleSearch = GoogleSearch;
2482
+ declare const index$7_GoogleSearch: typeof GoogleSearch;
2483
+ type index$7_HttpRequestTool = HttpRequestTool;
2484
+ declare const index$7_HttpRequestTool: typeof HttpRequestTool;
2485
+ type index$7_LoadArtifactsTool = LoadArtifactsTool;
2486
+ declare const index$7_LoadArtifactsTool: typeof LoadArtifactsTool;
2487
+ type index$7_LoadMemoryTool = LoadMemoryTool;
2488
+ declare const index$7_LoadMemoryTool: typeof LoadMemoryTool;
2489
+ declare const index$7_McpAbi: typeof McpAbi;
2490
+ declare const index$7_McpAtp: typeof McpAtp;
2491
+ declare const index$7_McpBamm: typeof McpBamm;
2492
+ type index$7_McpClientService = McpClientService;
2493
+ declare const index$7_McpClientService: typeof McpClientService;
2494
+ declare const index$7_McpCoinGecko: typeof McpCoinGecko;
2495
+ type index$7_McpConfig = McpConfig;
2496
+ declare const index$7_McpDiscord: typeof McpDiscord;
2497
+ type index$7_McpError = McpError;
2498
+ declare const index$7_McpError: typeof McpError;
2499
+ type index$7_McpErrorType = McpErrorType;
2500
+ declare const index$7_McpErrorType: typeof McpErrorType;
2501
+ declare const index$7_McpFilesystem: typeof McpFilesystem;
2502
+ declare const index$7_McpFraxlend: typeof McpFraxlend;
2503
+ declare const index$7_McpGeneric: typeof McpGeneric;
2504
+ declare const index$7_McpIqWiki: typeof McpIqWiki;
2505
+ declare const index$7_McpMemory: typeof McpMemory;
2506
+ declare const index$7_McpNearAgent: typeof McpNearAgent;
2507
+ declare const index$7_McpNearIntents: typeof McpNearIntents;
2508
+ declare const index$7_McpOdos: typeof McpOdos;
2509
+ type index$7_McpSamplingHandler = McpSamplingHandler;
2510
+ declare const index$7_McpSamplingHandler: typeof McpSamplingHandler;
2511
+ type index$7_McpSamplingRequest = McpSamplingRequest;
2512
+ type index$7_McpSamplingResponse = McpSamplingResponse;
2513
+ type index$7_McpServerConfig = McpServerConfig;
2514
+ declare const index$7_McpTelegram: typeof McpTelegram;
2515
+ type index$7_McpToolset = McpToolset;
2516
+ declare const index$7_McpToolset: typeof McpToolset;
2517
+ type index$7_McpTransportType = McpTransportType;
2518
+ declare const index$7_McpUpbit: typeof McpUpbit;
2519
+ type index$7_SamplingHandler = SamplingHandler;
2520
+ type index$7_ToolConfig = ToolConfig;
2521
+ type index$7_ToolContext = ToolContext;
2522
+ declare const index$7_ToolContext: typeof ToolContext;
2523
+ type index$7_TransferToAgentTool = TransferToAgentTool;
2524
+ declare const index$7_TransferToAgentTool: typeof TransferToAgentTool;
2525
+ type index$7_UserInteractionTool = UserInteractionTool;
2526
+ declare const index$7_UserInteractionTool: typeof UserInteractionTool;
2527
+ declare const index$7_adkToMcpToolType: typeof adkToMcpToolType;
2528
+ declare const index$7_buildFunctionDeclaration: typeof buildFunctionDeclaration;
2529
+ declare const index$7_createFunctionTool: typeof createFunctionTool;
2530
+ declare const index$7_createSamplingHandler: typeof createSamplingHandler;
2531
+ declare const index$7_createTool: typeof createTool;
2532
+ declare const index$7_getMcpTools: typeof getMcpTools;
2533
+ declare const index$7_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
2534
+ declare const index$7_mcpSchemaToParameters: typeof mcpSchemaToParameters;
2535
+ declare const index$7_normalizeJsonSchema: typeof normalizeJsonSchema;
2536
+ declare namespace index$7 {
2537
+ export { index$7_AgentTool as AgentTool, type index$7_AgentToolConfig as AgentToolConfig, type index$7_BaseAgentType as BaseAgentType, index$7_BaseTool as BaseTool, type index$7_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, type index$7_CreateToolConfig as CreateToolConfig, type index$7_CreateToolConfigWithSchema as CreateToolConfigWithSchema, type index$7_CreateToolConfigWithoutSchema as CreateToolConfigWithoutSchema, index$7_ExitLoopTool as ExitLoopTool, index$7_FileOperationsTool as FileOperationsTool, index$7_FunctionTool as FunctionTool, index$7_GetUserChoiceTool as GetUserChoiceTool, index$7_GoogleSearch as GoogleSearch, index$7_HttpRequestTool as HttpRequestTool, index$7_LoadArtifactsTool as LoadArtifactsTool, index$7_LoadMemoryTool as LoadMemoryTool, index$7_McpAbi as McpAbi, index$7_McpAtp as McpAtp, index$7_McpBamm as McpBamm, index$7_McpClientService as McpClientService, index$7_McpCoinGecko as McpCoinGecko, type index$7_McpConfig as McpConfig, index$7_McpDiscord as McpDiscord, index$7_McpError as McpError, index$7_McpErrorType as McpErrorType, index$7_McpFilesystem as McpFilesystem, index$7_McpFraxlend as McpFraxlend, index$7_McpGeneric as McpGeneric, index$7_McpIqWiki as McpIqWiki, index$7_McpMemory as McpMemory, index$7_McpNearAgent as McpNearAgent, index$7_McpNearIntents as McpNearIntents, index$7_McpOdos as McpOdos, index$7_McpSamplingHandler as McpSamplingHandler, type index$7_McpSamplingRequest as McpSamplingRequest, type index$7_McpSamplingResponse as McpSamplingResponse, type index$7_McpServerConfig as McpServerConfig, index$7_McpTelegram as McpTelegram, index$7_McpToolset as McpToolset, type index$7_McpTransportType as McpTransportType, index$7_McpUpbit as McpUpbit, type index$7_SamplingHandler as SamplingHandler, type index$7_ToolConfig as ToolConfig, index$7_ToolContext as ToolContext, index$7_TransferToAgentTool as TransferToAgentTool, index$7_UserInteractionTool as UserInteractionTool, index$7_adkToMcpToolType as adkToMcpToolType, index$7_buildFunctionDeclaration as buildFunctionDeclaration, index$7_createFunctionTool as createFunctionTool, index$7_createSamplingHandler as createSamplingHandler, index$7_createTool as createTool, index$7_getMcpTools as getMcpTools, index$7_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$7_mcpSchemaToParameters as mcpSchemaToParameters, index$7_normalizeJsonSchema as normalizeJsonSchema };
2593
2538
  }
2594
2539
 
2595
2540
  /**
@@ -2914,52 +2859,37 @@ declare class OpenAiLlm extends BaseLlm {
2914
2859
  private get client();
2915
2860
  }
2916
2861
 
2917
- /**
2918
- * Type for LLM constructor with static methods
2919
- */
2920
2862
  interface LLMClass {
2921
2863
  new (model: string): BaseLlm;
2922
2864
  supportedModels(): string[];
2923
2865
  }
2924
- /**
2925
- * Registry for LLMs
2926
- */
2866
+ interface LlmModelConfig {
2867
+ temperature?: number;
2868
+ maxOutputTokens?: number;
2869
+ topP?: number;
2870
+ topK?: number;
2871
+ }
2872
+ interface LlmModel {
2873
+ generateContent(options: {
2874
+ prompt: string;
2875
+ } & LlmModelConfig): Promise<LlmResponse>;
2876
+ }
2927
2877
  declare class LLMRegistry {
2928
- /**
2929
- * Map of model name regex to LLM class
2930
- */
2931
2878
  private static llmRegistry;
2879
+ private static modelInstances;
2932
2880
  private static logger;
2933
- /**
2934
- * Creates a new LLM instance
2935
- *
2936
- * @param model The model name
2937
- * @returns The LLM instance
2938
- */
2939
2881
  static newLLM(model: string): BaseLlm;
2940
- /**
2941
- * Resolves the LLM class from the model name
2942
- *
2943
- * @param model The model name
2944
- * @returns The LLM class
2945
- */
2946
2882
  static resolve(model: string): LLMClass | null;
2947
- /**
2948
- * Registers a new LLM class
2949
- *
2950
- * @param modelNameRegex The regex to match model names
2951
- * @param llmClass The LLM class
2952
- */
2953
2883
  static register(modelNameRegex: string, llmClass: LLMClass): void;
2954
- /**
2955
- * Registers all model patterns from an LLM class
2956
- *
2957
- * @param llmClass The LLM class
2958
- */
2959
2884
  static registerLLM(llmClass: LLMClass): void;
2960
- /**
2961
- * Logs all registered models for debugging
2962
- */
2885
+ static registerModel(name: string, model: LlmModel): void;
2886
+ static getModel(name: string): LlmModel;
2887
+ static hasModel(name: string): boolean;
2888
+ static unregisterModel(name: string): void;
2889
+ static getModelOrCreate(name: string): LlmModel | BaseLlm;
2890
+ static clear(): void;
2891
+ static clearModels(): void;
2892
+ static clearClasses(): void;
2963
2893
  static logRegisteredModels(): void;
2964
2894
  }
2965
2895
 
@@ -3462,66 +3392,68 @@ declare class OAuth2Credential extends AuthCredential {
3462
3392
  * Models module exports - consolidated to match Python structure
3463
3393
  */
3464
3394
 
3465
- type index$5_AiSdkLlm = AiSdkLlm;
3466
- declare const index$5_AiSdkLlm: typeof AiSdkLlm;
3467
- type index$5_AnthropicLlm = AnthropicLlm;
3468
- declare const index$5_AnthropicLlm: typeof AnthropicLlm;
3469
- type index$5_ApiKeyCredential = ApiKeyCredential;
3470
- declare const index$5_ApiKeyCredential: typeof ApiKeyCredential;
3471
- type index$5_ApiKeyScheme = ApiKeyScheme;
3472
- declare const index$5_ApiKeyScheme: typeof ApiKeyScheme;
3473
- type index$5_AuthConfig = AuthConfig;
3474
- declare const index$5_AuthConfig: typeof AuthConfig;
3475
- type index$5_AuthCredential = AuthCredential;
3476
- declare const index$5_AuthCredential: typeof AuthCredential;
3477
- type index$5_AuthCredentialType = AuthCredentialType;
3478
- declare const index$5_AuthCredentialType: typeof AuthCredentialType;
3479
- type index$5_AuthHandler = AuthHandler;
3480
- declare const index$5_AuthHandler: typeof AuthHandler;
3481
- type index$5_AuthScheme = AuthScheme;
3482
- declare const index$5_AuthScheme: typeof AuthScheme;
3483
- type index$5_AuthSchemeType = AuthSchemeType;
3484
- declare const index$5_AuthSchemeType: typeof AuthSchemeType;
3485
- type index$5_BaseLLMConnection = BaseLLMConnection;
3486
- declare const index$5_BaseLLMConnection: typeof BaseLLMConnection;
3487
- type index$5_BaseLlm = BaseLlm;
3488
- declare const index$5_BaseLlm: typeof BaseLlm;
3489
- type index$5_BaseMemoryService = BaseMemoryService;
3490
- type index$5_BasicAuthCredential = BasicAuthCredential;
3491
- declare const index$5_BasicAuthCredential: typeof BasicAuthCredential;
3492
- type index$5_BearerTokenCredential = BearerTokenCredential;
3493
- declare const index$5_BearerTokenCredential: typeof BearerTokenCredential;
3494
- declare const index$5_Blob: typeof Blob;
3495
- declare const index$5_Content: typeof Content;
3496
- declare const index$5_FunctionDeclaration: typeof FunctionDeclaration;
3497
- type index$5_GoogleLlm = GoogleLlm;
3498
- declare const index$5_GoogleLlm: typeof GoogleLlm;
3499
- type index$5_HttpScheme = HttpScheme;
3500
- declare const index$5_HttpScheme: typeof HttpScheme;
3501
- type index$5_LLMRegistry = LLMRegistry;
3502
- declare const index$5_LLMRegistry: typeof LLMRegistry;
3503
- type index$5_LlmRequest = LlmRequest;
3504
- declare const index$5_LlmRequest: typeof LlmRequest;
3505
- type index$5_LlmResponse = LlmResponse;
3506
- declare const index$5_LlmResponse: typeof LlmResponse;
3507
- type index$5_OAuth2Credential = OAuth2Credential;
3508
- declare const index$5_OAuth2Credential: typeof OAuth2Credential;
3509
- type index$5_OAuth2Scheme = OAuth2Scheme;
3510
- declare const index$5_OAuth2Scheme: typeof OAuth2Scheme;
3511
- type index$5_OAuthFlow = OAuthFlow;
3512
- type index$5_OAuthFlows = OAuthFlows;
3513
- type index$5_OpenAiLlm = OpenAiLlm;
3514
- declare const index$5_OpenAiLlm: typeof OpenAiLlm;
3515
- type index$5_OpenIdConnectScheme = OpenIdConnectScheme;
3516
- declare const index$5_OpenIdConnectScheme: typeof OpenIdConnectScheme;
3517
- type index$5_SearchMemoryResponse = SearchMemoryResponse;
3518
- type index$5_Session = Session;
3519
- type index$5_State = State;
3520
- declare const index$5_State: typeof State;
3521
- type index$5_ThinkingConfig = ThinkingConfig;
3522
- declare const index$5_registerProviders: typeof registerProviders;
3523
- declare namespace index$5 {
3524
- export { index$5_AiSdkLlm as AiSdkLlm, index$5_AnthropicLlm as AnthropicLlm, index$5_ApiKeyCredential as ApiKeyCredential, index$5_ApiKeyScheme as ApiKeyScheme, index$5_AuthConfig as AuthConfig, index$5_AuthCredential as AuthCredential, index$5_AuthCredentialType as AuthCredentialType, index$5_AuthHandler as AuthHandler, index$5_AuthScheme as AuthScheme, index$5_AuthSchemeType as AuthSchemeType, index$5_BaseLLMConnection as BaseLLMConnection, index$5_BaseLlm as BaseLlm, type index$5_BaseMemoryService as BaseMemoryService, index$5_BasicAuthCredential as BasicAuthCredential, index$5_BearerTokenCredential as BearerTokenCredential, index$5_Blob as Blob, index$5_Content as Content, index$5_FunctionDeclaration as FunctionDeclaration, index$5_GoogleLlm as GoogleLlm, index$5_HttpScheme as HttpScheme, Schema as JSONSchema, index$5_LLMRegistry as LLMRegistry, index$5_LlmRequest as LlmRequest, index$5_LlmResponse as LlmResponse, index$5_OAuth2Credential as OAuth2Credential, index$5_OAuth2Scheme as OAuth2Scheme, type index$5_OAuthFlow as OAuthFlow, type index$5_OAuthFlows as OAuthFlows, index$5_OpenAiLlm as OpenAiLlm, index$5_OpenIdConnectScheme as OpenIdConnectScheme, type index$5_SearchMemoryResponse as SearchMemoryResponse, type index$5_Session as Session, index$5_State as State, type index$5_ThinkingConfig as ThinkingConfig, index$5_registerProviders as registerProviders };
3395
+ type index$6_AiSdkLlm = AiSdkLlm;
3396
+ declare const index$6_AiSdkLlm: typeof AiSdkLlm;
3397
+ type index$6_AnthropicLlm = AnthropicLlm;
3398
+ declare const index$6_AnthropicLlm: typeof AnthropicLlm;
3399
+ type index$6_ApiKeyCredential = ApiKeyCredential;
3400
+ declare const index$6_ApiKeyCredential: typeof ApiKeyCredential;
3401
+ type index$6_ApiKeyScheme = ApiKeyScheme;
3402
+ declare const index$6_ApiKeyScheme: typeof ApiKeyScheme;
3403
+ type index$6_AuthConfig = AuthConfig;
3404
+ declare const index$6_AuthConfig: typeof AuthConfig;
3405
+ type index$6_AuthCredential = AuthCredential;
3406
+ declare const index$6_AuthCredential: typeof AuthCredential;
3407
+ type index$6_AuthCredentialType = AuthCredentialType;
3408
+ declare const index$6_AuthCredentialType: typeof AuthCredentialType;
3409
+ type index$6_AuthHandler = AuthHandler;
3410
+ declare const index$6_AuthHandler: typeof AuthHandler;
3411
+ type index$6_AuthScheme = AuthScheme;
3412
+ declare const index$6_AuthScheme: typeof AuthScheme;
3413
+ type index$6_AuthSchemeType = AuthSchemeType;
3414
+ declare const index$6_AuthSchemeType: typeof AuthSchemeType;
3415
+ type index$6_BaseLLMConnection = BaseLLMConnection;
3416
+ declare const index$6_BaseLLMConnection: typeof BaseLLMConnection;
3417
+ type index$6_BaseLlm = BaseLlm;
3418
+ declare const index$6_BaseLlm: typeof BaseLlm;
3419
+ type index$6_BaseMemoryService = BaseMemoryService;
3420
+ type index$6_BasicAuthCredential = BasicAuthCredential;
3421
+ declare const index$6_BasicAuthCredential: typeof BasicAuthCredential;
3422
+ type index$6_BearerTokenCredential = BearerTokenCredential;
3423
+ declare const index$6_BearerTokenCredential: typeof BearerTokenCredential;
3424
+ declare const index$6_Blob: typeof Blob;
3425
+ declare const index$6_Content: typeof Content;
3426
+ declare const index$6_FunctionDeclaration: typeof FunctionDeclaration;
3427
+ type index$6_GoogleLlm = GoogleLlm;
3428
+ declare const index$6_GoogleLlm: typeof GoogleLlm;
3429
+ type index$6_HttpScheme = HttpScheme;
3430
+ declare const index$6_HttpScheme: typeof HttpScheme;
3431
+ type index$6_LLMRegistry = LLMRegistry;
3432
+ declare const index$6_LLMRegistry: typeof LLMRegistry;
3433
+ type index$6_LlmModel = LlmModel;
3434
+ type index$6_LlmModelConfig = LlmModelConfig;
3435
+ type index$6_LlmRequest = LlmRequest;
3436
+ declare const index$6_LlmRequest: typeof LlmRequest;
3437
+ type index$6_LlmResponse = LlmResponse;
3438
+ declare const index$6_LlmResponse: typeof LlmResponse;
3439
+ type index$6_OAuth2Credential = OAuth2Credential;
3440
+ declare const index$6_OAuth2Credential: typeof OAuth2Credential;
3441
+ type index$6_OAuth2Scheme = OAuth2Scheme;
3442
+ declare const index$6_OAuth2Scheme: typeof OAuth2Scheme;
3443
+ type index$6_OAuthFlow = OAuthFlow;
3444
+ type index$6_OAuthFlows = OAuthFlows;
3445
+ type index$6_OpenAiLlm = OpenAiLlm;
3446
+ declare const index$6_OpenAiLlm: typeof OpenAiLlm;
3447
+ type index$6_OpenIdConnectScheme = OpenIdConnectScheme;
3448
+ declare const index$6_OpenIdConnectScheme: typeof OpenIdConnectScheme;
3449
+ type index$6_SearchMemoryResponse = SearchMemoryResponse;
3450
+ type index$6_Session = Session;
3451
+ type index$6_State = State;
3452
+ declare const index$6_State: typeof State;
3453
+ type index$6_ThinkingConfig = ThinkingConfig;
3454
+ declare const index$6_registerProviders: typeof registerProviders;
3455
+ declare namespace index$6 {
3456
+ export { index$6_AiSdkLlm as AiSdkLlm, index$6_AnthropicLlm as AnthropicLlm, index$6_ApiKeyCredential as ApiKeyCredential, index$6_ApiKeyScheme as ApiKeyScheme, index$6_AuthConfig as AuthConfig, index$6_AuthCredential as AuthCredential, index$6_AuthCredentialType as AuthCredentialType, index$6_AuthHandler as AuthHandler, index$6_AuthScheme as AuthScheme, index$6_AuthSchemeType as AuthSchemeType, index$6_BaseLLMConnection as BaseLLMConnection, index$6_BaseLlm as BaseLlm, type index$6_BaseMemoryService as BaseMemoryService, index$6_BasicAuthCredential as BasicAuthCredential, index$6_BearerTokenCredential as BearerTokenCredential, index$6_Blob as Blob, index$6_Content as Content, index$6_FunctionDeclaration as FunctionDeclaration, index$6_GoogleLlm as GoogleLlm, index$6_HttpScheme as HttpScheme, Schema as JSONSchema, index$6_LLMRegistry as LLMRegistry, type index$6_LlmModel as LlmModel, type index$6_LlmModelConfig as LlmModelConfig, index$6_LlmRequest as LlmRequest, index$6_LlmResponse as LlmResponse, index$6_OAuth2Credential as OAuth2Credential, index$6_OAuth2Scheme as OAuth2Scheme, type index$6_OAuthFlow as OAuthFlow, type index$6_OAuthFlows as OAuthFlows, index$6_OpenAiLlm as OpenAiLlm, index$6_OpenIdConnectScheme as OpenIdConnectScheme, type index$6_SearchMemoryResponse as SearchMemoryResponse, type index$6_Session as Session, index$6_State as State, type index$6_ThinkingConfig as ThinkingConfig, index$6_registerProviders as registerProviders };
3525
3457
  }
3526
3458
 
3527
3459
  /**
@@ -4144,6 +4076,10 @@ declare class AgentBuilder {
4144
4076
  private artifactService?;
4145
4077
  private agentType;
4146
4078
  private existingSession?;
4079
+ private existingAgent?;
4080
+ private definitionLocked;
4081
+ private warnedMethods;
4082
+ private logger;
4147
4083
  /**
4148
4084
  * Private constructor - use static create() method
4149
4085
  */
@@ -4222,6 +4158,11 @@ declare class AgentBuilder {
4222
4158
  * @returns This builder instance for chaining
4223
4159
  */
4224
4160
  withAfterAgentCallback(callback: AfterAgentCallback): this;
4161
+ /**
4162
+ * Provide an already constructed agent instance. Further definition-mutating calls
4163
+ * (model/tools/instruction/etc.) will be ignored with a dev warning.
4164
+ */
4165
+ withAgent(agent: BaseAgent): this;
4225
4166
  /**
4226
4167
  * Configure as a sequential agent
4227
4168
  * @param subAgents Sub-agents to execute in sequence
@@ -4319,66 +4260,70 @@ declare class AgentBuilder {
4319
4260
  * @returns Enhanced runner with simplified API
4320
4261
  */
4321
4262
  private createEnhancedRunner;
4263
+ /**
4264
+ * Warn (once per method) if the definition has been locked by withAgent().
4265
+ */
4266
+ private warnIfLocked;
4322
4267
  }
4323
4268
 
4324
- type index$4_AfterAgentCallback = AfterAgentCallback;
4325
- type index$4_AfterModelCallback = AfterModelCallback;
4326
- type index$4_AfterToolCallback = AfterToolCallback;
4327
- type index$4_AgentBuilder = AgentBuilder;
4328
- declare const index$4_AgentBuilder: typeof AgentBuilder;
4329
- type index$4_AgentBuilderConfig = AgentBuilderConfig;
4330
- type index$4_AgentBuilderWithSchema<T> = AgentBuilderWithSchema<T>;
4331
- type index$4_AgentType = AgentType;
4332
- type index$4_BaseAgent = BaseAgent;
4333
- declare const index$4_BaseAgent: typeof BaseAgent;
4334
- type index$4_BeforeAgentCallback = BeforeAgentCallback;
4335
- type index$4_BeforeModelCallback = BeforeModelCallback;
4336
- type index$4_BeforeToolCallback = BeforeToolCallback;
4337
- type index$4_BuiltAgent<T = string> = BuiltAgent<T>;
4338
- type index$4_CallbackContext = CallbackContext;
4339
- declare const index$4_CallbackContext: typeof CallbackContext;
4340
- type index$4_EnhancedRunner<T = string> = EnhancedRunner<T>;
4341
- type index$4_FullMessage = FullMessage;
4342
- type index$4_InstructionProvider = InstructionProvider;
4343
- type index$4_InvocationContext = InvocationContext;
4344
- declare const index$4_InvocationContext: typeof InvocationContext;
4345
- type index$4_LangGraphAgent = LangGraphAgent;
4346
- declare const index$4_LangGraphAgent: typeof LangGraphAgent;
4347
- type index$4_LangGraphAgentConfig = LangGraphAgentConfig;
4348
- type index$4_LangGraphNode = LangGraphNode;
4349
- type index$4_LlmAgent<T extends BaseLlm = BaseLlm> = LlmAgent<T>;
4350
- declare const index$4_LlmAgent: typeof LlmAgent;
4351
- type index$4_LlmAgentConfig<T extends BaseLlm = BaseLlm> = LlmAgentConfig<T>;
4352
- type index$4_LlmCallsLimitExceededError = LlmCallsLimitExceededError;
4353
- declare const index$4_LlmCallsLimitExceededError: typeof LlmCallsLimitExceededError;
4354
- type index$4_LoopAgent = LoopAgent;
4355
- declare const index$4_LoopAgent: typeof LoopAgent;
4356
- type index$4_LoopAgentConfig = LoopAgentConfig;
4357
- type index$4_MessagePart = MessagePart;
4358
- type index$4_ParallelAgent = ParallelAgent;
4359
- declare const index$4_ParallelAgent: typeof ParallelAgent;
4360
- type index$4_ParallelAgentConfig = ParallelAgentConfig;
4361
- type index$4_ReadonlyContext = ReadonlyContext;
4362
- declare const index$4_ReadonlyContext: typeof ReadonlyContext;
4363
- type index$4_RunConfig = RunConfig;
4364
- declare const index$4_RunConfig: typeof RunConfig;
4365
- type index$4_SequentialAgent = SequentialAgent;
4366
- declare const index$4_SequentialAgent: typeof SequentialAgent;
4367
- type index$4_SequentialAgentConfig = SequentialAgentConfig;
4368
- type index$4_SessionOptions = SessionOptions;
4369
- type index$4_SingleAfterModelCallback = SingleAfterModelCallback;
4370
- type index$4_SingleAfterToolCallback = SingleAfterToolCallback;
4371
- type index$4_SingleAgentCallback = SingleAgentCallback;
4372
- type index$4_SingleBeforeModelCallback = SingleBeforeModelCallback;
4373
- type index$4_SingleBeforeToolCallback = SingleBeforeToolCallback;
4374
- type index$4_StreamingMode = StreamingMode;
4375
- declare const index$4_StreamingMode: typeof StreamingMode;
4376
- type index$4_ToolUnion = ToolUnion;
4377
- declare const index$4_createBranchContextForSubAgent: typeof createBranchContextForSubAgent;
4378
- declare const index$4_mergeAgentRun: typeof mergeAgentRun;
4379
- declare const index$4_newInvocationContextId: typeof newInvocationContextId;
4380
- declare namespace index$4 {
4381
- export { type index$4_AfterAgentCallback as AfterAgentCallback, type index$4_AfterModelCallback as AfterModelCallback, type index$4_AfterToolCallback as AfterToolCallback, LlmAgent as Agent, index$4_AgentBuilder as AgentBuilder, type index$4_AgentBuilderConfig as AgentBuilderConfig, type index$4_AgentBuilderWithSchema as AgentBuilderWithSchema, type index$4_AgentType as AgentType, index$4_BaseAgent as BaseAgent, type index$4_BeforeAgentCallback as BeforeAgentCallback, type index$4_BeforeModelCallback as BeforeModelCallback, type index$4_BeforeToolCallback as BeforeToolCallback, type index$4_BuiltAgent as BuiltAgent, index$4_CallbackContext as CallbackContext, type index$4_EnhancedRunner as EnhancedRunner, type index$4_FullMessage as FullMessage, type index$4_InstructionProvider as InstructionProvider, index$4_InvocationContext as InvocationContext, index$4_LangGraphAgent as LangGraphAgent, type index$4_LangGraphAgentConfig as LangGraphAgentConfig, type index$4_LangGraphNode as LangGraphNode, index$4_LlmAgent as LlmAgent, type index$4_LlmAgentConfig as LlmAgentConfig, index$4_LlmCallsLimitExceededError as LlmCallsLimitExceededError, index$4_LoopAgent as LoopAgent, type index$4_LoopAgentConfig as LoopAgentConfig, type index$4_MessagePart as MessagePart, index$4_ParallelAgent as ParallelAgent, type index$4_ParallelAgentConfig as ParallelAgentConfig, index$4_ReadonlyContext as ReadonlyContext, index$4_RunConfig as RunConfig, index$4_SequentialAgent as SequentialAgent, type index$4_SequentialAgentConfig as SequentialAgentConfig, type index$4_SessionOptions as SessionOptions, type index$4_SingleAfterModelCallback as SingleAfterModelCallback, type index$4_SingleAfterToolCallback as SingleAfterToolCallback, type index$4_SingleAgentCallback as SingleAgentCallback, type index$4_SingleBeforeModelCallback as SingleBeforeModelCallback, type index$4_SingleBeforeToolCallback as SingleBeforeToolCallback, index$4_StreamingMode as StreamingMode, type index$4_ToolUnion as ToolUnion, index$4_createBranchContextForSubAgent as createBranchContextForSubAgent, index$4_mergeAgentRun as mergeAgentRun, index$4_newInvocationContextId as newInvocationContextId };
4269
+ type index$5_AfterAgentCallback = AfterAgentCallback;
4270
+ type index$5_AfterModelCallback = AfterModelCallback;
4271
+ type index$5_AfterToolCallback = AfterToolCallback;
4272
+ type index$5_AgentBuilder = AgentBuilder;
4273
+ declare const index$5_AgentBuilder: typeof AgentBuilder;
4274
+ type index$5_AgentBuilderConfig = AgentBuilderConfig;
4275
+ type index$5_AgentBuilderWithSchema<T> = AgentBuilderWithSchema<T>;
4276
+ type index$5_AgentType = AgentType;
4277
+ type index$5_BaseAgent = BaseAgent;
4278
+ declare const index$5_BaseAgent: typeof BaseAgent;
4279
+ type index$5_BeforeAgentCallback = BeforeAgentCallback;
4280
+ type index$5_BeforeModelCallback = BeforeModelCallback;
4281
+ type index$5_BeforeToolCallback = BeforeToolCallback;
4282
+ type index$5_BuiltAgent<T = string> = BuiltAgent<T>;
4283
+ type index$5_CallbackContext = CallbackContext;
4284
+ declare const index$5_CallbackContext: typeof CallbackContext;
4285
+ type index$5_EnhancedRunner<T = string> = EnhancedRunner<T>;
4286
+ type index$5_FullMessage = FullMessage;
4287
+ type index$5_InstructionProvider = InstructionProvider;
4288
+ type index$5_InvocationContext = InvocationContext;
4289
+ declare const index$5_InvocationContext: typeof InvocationContext;
4290
+ type index$5_LangGraphAgent = LangGraphAgent;
4291
+ declare const index$5_LangGraphAgent: typeof LangGraphAgent;
4292
+ type index$5_LangGraphAgentConfig = LangGraphAgentConfig;
4293
+ type index$5_LangGraphNode = LangGraphNode;
4294
+ type index$5_LlmAgent<T extends BaseLlm = BaseLlm> = LlmAgent<T>;
4295
+ declare const index$5_LlmAgent: typeof LlmAgent;
4296
+ type index$5_LlmAgentConfig<T extends BaseLlm = BaseLlm> = LlmAgentConfig<T>;
4297
+ type index$5_LlmCallsLimitExceededError = LlmCallsLimitExceededError;
4298
+ declare const index$5_LlmCallsLimitExceededError: typeof LlmCallsLimitExceededError;
4299
+ type index$5_LoopAgent = LoopAgent;
4300
+ declare const index$5_LoopAgent: typeof LoopAgent;
4301
+ type index$5_LoopAgentConfig = LoopAgentConfig;
4302
+ type index$5_MessagePart = MessagePart;
4303
+ type index$5_ParallelAgent = ParallelAgent;
4304
+ declare const index$5_ParallelAgent: typeof ParallelAgent;
4305
+ type index$5_ParallelAgentConfig = ParallelAgentConfig;
4306
+ type index$5_ReadonlyContext = ReadonlyContext;
4307
+ declare const index$5_ReadonlyContext: typeof ReadonlyContext;
4308
+ type index$5_RunConfig = RunConfig;
4309
+ declare const index$5_RunConfig: typeof RunConfig;
4310
+ type index$5_SequentialAgent = SequentialAgent;
4311
+ declare const index$5_SequentialAgent: typeof SequentialAgent;
4312
+ type index$5_SequentialAgentConfig = SequentialAgentConfig;
4313
+ type index$5_SessionOptions = SessionOptions;
4314
+ type index$5_SingleAfterModelCallback = SingleAfterModelCallback;
4315
+ type index$5_SingleAfterToolCallback = SingleAfterToolCallback;
4316
+ type index$5_SingleAgentCallback = SingleAgentCallback;
4317
+ type index$5_SingleBeforeModelCallback = SingleBeforeModelCallback;
4318
+ type index$5_SingleBeforeToolCallback = SingleBeforeToolCallback;
4319
+ type index$5_StreamingMode = StreamingMode;
4320
+ declare const index$5_StreamingMode: typeof StreamingMode;
4321
+ type index$5_ToolUnion = ToolUnion;
4322
+ declare const index$5_createBranchContextForSubAgent: typeof createBranchContextForSubAgent;
4323
+ declare const index$5_mergeAgentRun: typeof mergeAgentRun;
4324
+ declare const index$5_newInvocationContextId: typeof newInvocationContextId;
4325
+ declare namespace index$5 {
4326
+ export { type index$5_AfterAgentCallback as AfterAgentCallback, type index$5_AfterModelCallback as AfterModelCallback, type index$5_AfterToolCallback as AfterToolCallback, LlmAgent as Agent, index$5_AgentBuilder as AgentBuilder, type index$5_AgentBuilderConfig as AgentBuilderConfig, type index$5_AgentBuilderWithSchema as AgentBuilderWithSchema, type index$5_AgentType as AgentType, index$5_BaseAgent as BaseAgent, type index$5_BeforeAgentCallback as BeforeAgentCallback, type index$5_BeforeModelCallback as BeforeModelCallback, type index$5_BeforeToolCallback as BeforeToolCallback, type index$5_BuiltAgent as BuiltAgent, index$5_CallbackContext as CallbackContext, type index$5_EnhancedRunner as EnhancedRunner, type index$5_FullMessage as FullMessage, type index$5_InstructionProvider as InstructionProvider, index$5_InvocationContext as InvocationContext, index$5_LangGraphAgent as LangGraphAgent, type index$5_LangGraphAgentConfig as LangGraphAgentConfig, type index$5_LangGraphNode as LangGraphNode, index$5_LlmAgent as LlmAgent, type index$5_LlmAgentConfig as LlmAgentConfig, index$5_LlmCallsLimitExceededError as LlmCallsLimitExceededError, index$5_LoopAgent as LoopAgent, type index$5_LoopAgentConfig as LoopAgentConfig, type index$5_MessagePart as MessagePart, index$5_ParallelAgent as ParallelAgent, type index$5_ParallelAgentConfig as ParallelAgentConfig, index$5_ReadonlyContext as ReadonlyContext, index$5_RunConfig as RunConfig, index$5_SequentialAgent as SequentialAgent, type index$5_SequentialAgentConfig as SequentialAgentConfig, type index$5_SessionOptions as SessionOptions, type index$5_SingleAfterModelCallback as SingleAfterModelCallback, type index$5_SingleAfterToolCallback as SingleAfterToolCallback, type index$5_SingleAgentCallback as SingleAgentCallback, type index$5_SingleBeforeModelCallback as SingleBeforeModelCallback, type index$5_SingleBeforeToolCallback as SingleBeforeToolCallback, index$5_StreamingMode as StreamingMode, type index$5_ToolUnion as ToolUnion, index$5_createBranchContextForSubAgent as createBranchContextForSubAgent, index$5_mergeAgentRun as mergeAgentRun, index$5_newInvocationContextId as newInvocationContextId };
4382
4327
  }
4383
4328
 
4384
4329
  /**
@@ -4430,10 +4375,10 @@ declare class InMemoryMemoryService implements BaseMemoryService {
4430
4375
  * Memory Services for the Agent Development Kit
4431
4376
  */
4432
4377
 
4433
- type index$3_InMemoryMemoryService = InMemoryMemoryService;
4434
- declare const index$3_InMemoryMemoryService: typeof InMemoryMemoryService;
4435
- declare namespace index$3 {
4436
- export { index$3_InMemoryMemoryService as InMemoryMemoryService };
4378
+ type index$4_InMemoryMemoryService = InMemoryMemoryService;
4379
+ declare const index$4_InMemoryMemoryService: typeof InMemoryMemoryService;
4380
+ declare namespace index$4 {
4381
+ export { index$4_InMemoryMemoryService as InMemoryMemoryService };
4437
4382
  }
4438
4383
 
4439
4384
  /**
@@ -4642,25 +4587,25 @@ declare function createDatabaseSessionService(databaseUrl: string, options?: any
4642
4587
  * Sessions module exports
4643
4588
  */
4644
4589
 
4645
- type index$2_BaseSessionService = BaseSessionService;
4646
- declare const index$2_BaseSessionService: typeof BaseSessionService;
4647
- type index$2_DatabaseSessionService = DatabaseSessionService;
4648
- declare const index$2_DatabaseSessionService: typeof DatabaseSessionService;
4649
- type index$2_GetSessionConfig = GetSessionConfig;
4650
- type index$2_InMemorySessionService = InMemorySessionService;
4651
- declare const index$2_InMemorySessionService: typeof InMemorySessionService;
4652
- type index$2_ListSessionsResponse = ListSessionsResponse;
4653
- type index$2_Session = Session;
4654
- type index$2_State = State;
4655
- declare const index$2_State: typeof State;
4656
- type index$2_VertexAiSessionService = VertexAiSessionService;
4657
- declare const index$2_VertexAiSessionService: typeof VertexAiSessionService;
4658
- declare const index$2_createDatabaseSessionService: typeof createDatabaseSessionService;
4659
- declare const index$2_createMysqlSessionService: typeof createMysqlSessionService;
4660
- declare const index$2_createPostgresSessionService: typeof createPostgresSessionService;
4661
- declare const index$2_createSqliteSessionService: typeof createSqliteSessionService;
4662
- declare namespace index$2 {
4663
- export { index$2_BaseSessionService as BaseSessionService, index$2_DatabaseSessionService as DatabaseSessionService, type index$2_GetSessionConfig as GetSessionConfig, index$2_InMemorySessionService as InMemorySessionService, type index$2_ListSessionsResponse as ListSessionsResponse, type index$2_Session as Session, index$2_State as State, index$2_VertexAiSessionService as VertexAiSessionService, index$2_createDatabaseSessionService as createDatabaseSessionService, index$2_createMysqlSessionService as createMysqlSessionService, index$2_createPostgresSessionService as createPostgresSessionService, index$2_createSqliteSessionService as createSqliteSessionService };
4590
+ type index$3_BaseSessionService = BaseSessionService;
4591
+ declare const index$3_BaseSessionService: typeof BaseSessionService;
4592
+ type index$3_DatabaseSessionService = DatabaseSessionService;
4593
+ declare const index$3_DatabaseSessionService: typeof DatabaseSessionService;
4594
+ type index$3_GetSessionConfig = GetSessionConfig;
4595
+ type index$3_InMemorySessionService = InMemorySessionService;
4596
+ declare const index$3_InMemorySessionService: typeof InMemorySessionService;
4597
+ type index$3_ListSessionsResponse = ListSessionsResponse;
4598
+ type index$3_Session = Session;
4599
+ type index$3_State = State;
4600
+ declare const index$3_State: typeof State;
4601
+ type index$3_VertexAiSessionService = VertexAiSessionService;
4602
+ declare const index$3_VertexAiSessionService: typeof VertexAiSessionService;
4603
+ declare const index$3_createDatabaseSessionService: typeof createDatabaseSessionService;
4604
+ declare const index$3_createMysqlSessionService: typeof createMysqlSessionService;
4605
+ declare const index$3_createPostgresSessionService: typeof createPostgresSessionService;
4606
+ declare const index$3_createSqliteSessionService: typeof createSqliteSessionService;
4607
+ declare namespace index$3 {
4608
+ export { index$3_BaseSessionService as BaseSessionService, index$3_DatabaseSessionService as DatabaseSessionService, type index$3_GetSessionConfig as GetSessionConfig, index$3_InMemorySessionService as InMemorySessionService, type index$3_ListSessionsResponse as ListSessionsResponse, type index$3_Session as Session, index$3_State as State, index$3_VertexAiSessionService as VertexAiSessionService, index$3_createDatabaseSessionService as createDatabaseSessionService, index$3_createMysqlSessionService as createMysqlSessionService, index$3_createPostgresSessionService as createPostgresSessionService, index$3_createSqliteSessionService as createSqliteSessionService };
4664
4609
  }
4665
4610
 
4666
4611
  declare class GcsArtifactService implements BaseArtifactService {
@@ -4740,12 +4685,12 @@ declare class InMemoryArtifactService implements BaseArtifactService {
4740
4685
  }): Promise<number[]>;
4741
4686
  }
4742
4687
 
4743
- type index$1_Event = Event;
4744
- declare const index$1_Event: typeof Event;
4745
- type index$1_EventActions = EventActions;
4746
- declare const index$1_EventActions: typeof EventActions;
4747
- declare namespace index$1 {
4748
- export { index$1_Event as Event, index$1_EventActions as EventActions };
4688
+ type index$2_Event = Event;
4689
+ declare const index$2_Event: typeof Event;
4690
+ type index$2_EventActions = EventActions;
4691
+ declare const index$2_EventActions: typeof EventActions;
4692
+ declare namespace index$2 {
4693
+ export { index$2_Event as Event, index$2_EventActions as EventActions };
4749
4694
  }
4750
4695
 
4751
4696
  declare abstract class BaseLlmFlow {
@@ -5017,28 +4962,28 @@ declare function handleFunctionCallsLive(invocationContext: InvocationContext, f
5017
4962
  */
5018
4963
  declare function mergeParallelFunctionResponseEvents(functionResponseEvents: Event[]): Event;
5019
4964
 
5020
- declare const index_AF_FUNCTION_CALL_ID_PREFIX: typeof AF_FUNCTION_CALL_ID_PREFIX;
5021
- type index_AutoFlow = AutoFlow;
5022
- declare const index_AutoFlow: typeof AutoFlow;
5023
- type index_BaseLlmFlow = BaseLlmFlow;
5024
- declare const index_BaseLlmFlow: typeof BaseLlmFlow;
5025
- type index_BaseLlmRequestProcessor = BaseLlmRequestProcessor;
5026
- declare const index_BaseLlmRequestProcessor: typeof BaseLlmRequestProcessor;
5027
- type index_BaseLlmResponseProcessor = BaseLlmResponseProcessor;
5028
- declare const index_BaseLlmResponseProcessor: typeof BaseLlmResponseProcessor;
5029
- declare const index_REQUEST_EUC_FUNCTION_CALL_NAME: typeof REQUEST_EUC_FUNCTION_CALL_NAME;
5030
- type index_SingleFlow = SingleFlow;
5031
- declare const index_SingleFlow: typeof SingleFlow;
5032
- declare const index_generateAuthEvent: typeof generateAuthEvent;
5033
- declare const index_generateClientFunctionCallId: typeof generateClientFunctionCallId;
5034
- declare const index_getLongRunningFunctionCalls: typeof getLongRunningFunctionCalls;
5035
- declare const index_handleFunctionCallsAsync: typeof handleFunctionCallsAsync;
5036
- declare const index_handleFunctionCallsLive: typeof handleFunctionCallsLive;
5037
- declare const index_mergeParallelFunctionResponseEvents: typeof mergeParallelFunctionResponseEvents;
5038
- declare const index_populateClientFunctionCallId: typeof populateClientFunctionCallId;
5039
- declare const index_removeClientFunctionCallId: typeof removeClientFunctionCallId;
5040
- declare namespace index {
5041
- export { index_AF_FUNCTION_CALL_ID_PREFIX as AF_FUNCTION_CALL_ID_PREFIX, index_AutoFlow as AutoFlow, index_BaseLlmFlow as BaseLlmFlow, index_BaseLlmRequestProcessor as BaseLlmRequestProcessor, index_BaseLlmResponseProcessor as BaseLlmResponseProcessor, index_REQUEST_EUC_FUNCTION_CALL_NAME as REQUEST_EUC_FUNCTION_CALL_NAME, index_SingleFlow as SingleFlow, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, index_generateAuthEvent as generateAuthEvent, index_generateClientFunctionCallId as generateClientFunctionCallId, index_getLongRunningFunctionCalls as getLongRunningFunctionCalls, index_handleFunctionCallsAsync as handleFunctionCallsAsync, index_handleFunctionCallsLive as handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, requestProcessor$4 as instructionsRequestProcessor, index_mergeParallelFunctionResponseEvents as mergeParallelFunctionResponseEvents, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, index_populateClientFunctionCallId as populateClientFunctionCallId, index_removeClientFunctionCallId as removeClientFunctionCallId };
4965
+ declare const index$1_AF_FUNCTION_CALL_ID_PREFIX: typeof AF_FUNCTION_CALL_ID_PREFIX;
4966
+ type index$1_AutoFlow = AutoFlow;
4967
+ declare const index$1_AutoFlow: typeof AutoFlow;
4968
+ type index$1_BaseLlmFlow = BaseLlmFlow;
4969
+ declare const index$1_BaseLlmFlow: typeof BaseLlmFlow;
4970
+ type index$1_BaseLlmRequestProcessor = BaseLlmRequestProcessor;
4971
+ declare const index$1_BaseLlmRequestProcessor: typeof BaseLlmRequestProcessor;
4972
+ type index$1_BaseLlmResponseProcessor = BaseLlmResponseProcessor;
4973
+ declare const index$1_BaseLlmResponseProcessor: typeof BaseLlmResponseProcessor;
4974
+ declare const index$1_REQUEST_EUC_FUNCTION_CALL_NAME: typeof REQUEST_EUC_FUNCTION_CALL_NAME;
4975
+ type index$1_SingleFlow = SingleFlow;
4976
+ declare const index$1_SingleFlow: typeof SingleFlow;
4977
+ declare const index$1_generateAuthEvent: typeof generateAuthEvent;
4978
+ declare const index$1_generateClientFunctionCallId: typeof generateClientFunctionCallId;
4979
+ declare const index$1_getLongRunningFunctionCalls: typeof getLongRunningFunctionCalls;
4980
+ declare const index$1_handleFunctionCallsAsync: typeof handleFunctionCallsAsync;
4981
+ declare const index$1_handleFunctionCallsLive: typeof handleFunctionCallsLive;
4982
+ declare const index$1_mergeParallelFunctionResponseEvents: typeof mergeParallelFunctionResponseEvents;
4983
+ declare const index$1_populateClientFunctionCallId: typeof populateClientFunctionCallId;
4984
+ declare const index$1_removeClientFunctionCallId: typeof removeClientFunctionCallId;
4985
+ declare namespace index$1 {
4986
+ export { index$1_AF_FUNCTION_CALL_ID_PREFIX as AF_FUNCTION_CALL_ID_PREFIX, index$1_AutoFlow as AutoFlow, index$1_BaseLlmFlow as BaseLlmFlow, index$1_BaseLlmRequestProcessor as BaseLlmRequestProcessor, index$1_BaseLlmResponseProcessor as BaseLlmResponseProcessor, index$1_REQUEST_EUC_FUNCTION_CALL_NAME as REQUEST_EUC_FUNCTION_CALL_NAME, index$1_SingleFlow as SingleFlow, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, index$1_generateAuthEvent as generateAuthEvent, index$1_generateClientFunctionCallId as generateClientFunctionCallId, index$1_getLongRunningFunctionCalls as getLongRunningFunctionCalls, index$1_handleFunctionCallsAsync as handleFunctionCallsAsync, index$1_handleFunctionCallsLive as handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, requestProcessor$4 as instructionsRequestProcessor, index$1_mergeParallelFunctionResponseEvents as mergeParallelFunctionResponseEvents, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, index$1_populateClientFunctionCallId as populateClientFunctionCallId, index$1_removeClientFunctionCallId as removeClientFunctionCallId };
5042
4987
  }
5043
4988
 
5044
4989
  /**
@@ -5153,6 +5098,265 @@ declare class PlanReActPlanner extends BasePlanner {
5153
5098
  private _buildNlPlannerInstruction;
5154
5099
  }
5155
5100
 
5101
+ interface IntermediateData {
5102
+ toolUses: FunctionCall[];
5103
+ intermediateResponses: Array<[string, Part[]]>;
5104
+ }
5105
+ interface Invocation {
5106
+ invocationId?: string;
5107
+ userContent: Content;
5108
+ finalResponse?: Content;
5109
+ intermediateData?: IntermediateData;
5110
+ creationTimestamp: number;
5111
+ }
5112
+ interface SessionInput {
5113
+ appName: string;
5114
+ userId: string;
5115
+ state: Record<string, any>;
5116
+ }
5117
+ interface EvalCase {
5118
+ evalId: string;
5119
+ conversation: Invocation[];
5120
+ sessionInput?: SessionInput;
5121
+ }
5122
+
5123
+ declare enum PrebuiltMetrics {
5124
+ TOOL_TRAJECTORY_AVG_SCORE = "tool_trajectory_avg_score",
5125
+ RESPONSE_EVALUATION_SCORE = "response_evaluation_score",
5126
+ RESPONSE_MATCH_SCORE = "response_match_score",
5127
+ SAFETY_V1 = "safety_v1",
5128
+ FINAL_RESPONSE_MATCH_V2 = "final_response_match_v2",
5129
+ TOOL_TRAJECTORY_SCORE = "tool_trajectory_score",
5130
+ SAFETY = "safety",
5131
+ RESPONSE_MATCH = "response_match"
5132
+ }
5133
+ interface JudgeModelOptions {
5134
+ judgeModel: string;
5135
+ judgeModelConfig?: GenerateContentConfig;
5136
+ numSamples?: number;
5137
+ }
5138
+ interface EvalMetric {
5139
+ metricName: string;
5140
+ threshold: number;
5141
+ judgeModelOptions?: JudgeModelOptions;
5142
+ }
5143
+ interface EvalMetricResult extends EvalMetric {
5144
+ score?: number;
5145
+ evalStatus: EvalStatus;
5146
+ }
5147
+ interface EvalMetricResultPerInvocation {
5148
+ actualInvocation: Invocation;
5149
+ expectedInvocation: Invocation;
5150
+ evalMetricResults: EvalMetricResult[];
5151
+ }
5152
+ interface Interval {
5153
+ minValue: number;
5154
+ openAtMin: boolean;
5155
+ maxValue: number;
5156
+ openAtMax: boolean;
5157
+ }
5158
+ interface MetricValueInfo {
5159
+ interval?: Interval;
5160
+ }
5161
+ interface MetricInfo {
5162
+ metricName?: string;
5163
+ description?: string;
5164
+ defaultThreshold?: number;
5165
+ experimental?: boolean;
5166
+ metricValueInfo?: MetricValueInfo;
5167
+ }
5168
+ interface EvaluateConfig {
5169
+ evalMetrics: EvalMetric[];
5170
+ parallelism?: number;
5171
+ }
5172
+
5173
+ declare enum EvalStatus {
5174
+ PASSED = 1,
5175
+ FAILED = 2,
5176
+ NOT_EVALUATED = 3
5177
+ }
5178
+ interface PerInvocationResult {
5179
+ actualInvocation: Invocation;
5180
+ expectedInvocation: Invocation;
5181
+ score?: number;
5182
+ evalStatus: EvalStatus;
5183
+ }
5184
+ interface EvaluationResult {
5185
+ overallScore?: number;
5186
+ overallEvalStatus: EvalStatus;
5187
+ perInvocationResults: PerInvocationResult[];
5188
+ }
5189
+ declare abstract class Evaluator {
5190
+ protected readonly metric: EvalMetric;
5191
+ constructor(metric: EvalMetric);
5192
+ abstract evaluateInvocations(actualInvocations: Invocation[], expectedInvocations: Invocation[]): Promise<EvaluationResult>;
5193
+ static getMetricInfo(metricName?: string): MetricInfo;
5194
+ }
5195
+
5196
+ interface EvalSet {
5197
+ evalSetId: string;
5198
+ name?: string;
5199
+ description?: string;
5200
+ evalCases: EvalCase[];
5201
+ creationTimestamp: number;
5202
+ }
5203
+
5204
+ interface EvalCaseResult {
5205
+ evalSetId: string;
5206
+ evalId: string;
5207
+ finalEvalStatus: EvalStatus;
5208
+ overallEvalMetricResults: EvalMetricResult[];
5209
+ evalMetricResultPerInvocation: EvalMetricResultPerInvocation[];
5210
+ sessionId: string;
5211
+ sessionDetails?: Session;
5212
+ userId?: string;
5213
+ }
5214
+ interface EvalSetResult {
5215
+ evalSetResultId: string;
5216
+ evalSetResultName?: string;
5217
+ evalSetId: string;
5218
+ evalCaseResults: EvalCaseResult[];
5219
+ creationTimestamp: number;
5220
+ }
5221
+ declare class EvalResult implements EvalSetResult {
5222
+ evalSetResultId: string;
5223
+ evalSetResultName?: string;
5224
+ evalSetId: string;
5225
+ evalCaseResults: EvalCaseResult[];
5226
+ creationTimestamp: number;
5227
+ constructor(init: Partial<EvalSetResult>);
5228
+ }
5229
+
5230
+ declare class AgentEvaluator {
5231
+ static findConfigForTestFile(testFile: string): Promise<Record<string, number>>;
5232
+ static evaluateEvalSet(agent: BaseAgent, evalSet: EvalSet, criteria: Record<string, number>, numRuns?: number, printDetailedResults?: boolean): Promise<void>;
5233
+ static evaluate(agent: BaseAgent, evalDatasetFilePathOrDir: string, numRuns?: number, initialSessionFile?: string): Promise<void>;
5234
+ static migrateEvalDataToNewSchema(oldEvalDataFile: string, newEvalDataFile: string, initialSessionFile?: string): Promise<void>;
5235
+ private static _findTestFilesRecursively;
5236
+ private static _loadEvalSetFromFile;
5237
+ private static _getEvalSetFromOldFormat;
5238
+ private static _getInitialSession;
5239
+ private static _loadDataset;
5240
+ private static _validateInput;
5241
+ private static _printDetails;
5242
+ private static _convertContentToText;
5243
+ private static _convertToolCallsToText;
5244
+ private static _getEvalResultsByEvalId;
5245
+ private static _getEvalMetricResultsWithInvocation;
5246
+ private static _processMetricsAndGetFailures;
5247
+ }
5248
+
5249
+ declare abstract class BaseEvalService {
5250
+ abstract performInference(request: {
5251
+ evalSetId: string;
5252
+ evalCases: EvalSet[];
5253
+ }): AsyncGenerator<Invocation[], void>;
5254
+ abstract evaluate(request: {
5255
+ inferenceResults: Invocation[][];
5256
+ evaluateConfig: EvaluateConfig;
5257
+ }): AsyncGenerator<EvalSetResult, void>;
5258
+ evaluateSession(session: {
5259
+ evalSetId: string;
5260
+ evalCases: EvalSet[];
5261
+ evaluateConfig: EvaluateConfig;
5262
+ }): AsyncGenerator<EvalSetResult, void>;
5263
+ }
5264
+
5265
+ declare class LocalEvalService extends BaseEvalService {
5266
+ private readonly agent;
5267
+ private readonly parallelism;
5268
+ private runner;
5269
+ constructor(agent: BaseAgent, parallelism?: number);
5270
+ private initializeRunner;
5271
+ performInference(request: {
5272
+ evalSetId: string;
5273
+ evalCases: EvalSet[];
5274
+ }): AsyncGenerator<Invocation[], void>;
5275
+ evaluate(request: {
5276
+ inferenceResults: Invocation[][];
5277
+ evaluateConfig: EvaluateConfig;
5278
+ }): AsyncGenerator<EvalResult, void>;
5279
+ private runInference;
5280
+ }
5281
+
5282
+ declare class TrajectoryEvaluator extends Evaluator {
5283
+ static getMetricInfo(): MetricInfo;
5284
+ evaluateInvocations(actualInvocations: Invocation[], expectedInvocations: Invocation[]): Promise<EvaluationResult>;
5285
+ private areToolCallsEqual;
5286
+ private isToolCallEqual;
5287
+ }
5288
+
5289
+ declare class RougeEvaluator extends Evaluator {
5290
+ private evalMetric;
5291
+ constructor(evalMetric: EvalMetric);
5292
+ static getMetricInfo(): MetricInfo;
5293
+ evaluateInvocations(actualInvocations: Invocation[], expectedInvocations: Invocation[]): Promise<EvaluationResult>;
5294
+ }
5295
+
5296
+ declare enum Label {
5297
+ VALID = "valid",
5298
+ INVALID = "invalid",
5299
+ NOT_FOUND = "not_found"
5300
+ }
5301
+
5302
+ type CritiqueParser = (response: string) => Label;
5303
+ declare class LlmAsJudge {
5304
+ sampleJudge(prompt: string, numSamples: number, critiqueParser: CritiqueParser, judgeModelOptions?: JudgeModelOptions): Promise<Label[]>;
5305
+ }
5306
+
5307
+ declare class FinalResponseMatchV2Evaluator extends Evaluator {
5308
+ private readonly llmAsJudge;
5309
+ constructor(evalMetric: EvalMetric, llmAsJudge?: LlmAsJudge);
5310
+ static getMetricInfo(): MetricInfo;
5311
+ evaluateInvocations(actualInvocations: Invocation[], expectedInvocations: Invocation[]): Promise<EvaluationResult>;
5312
+ }
5313
+
5314
+ declare class SafetyEvaluatorV1 extends Evaluator {
5315
+ static getMetricInfo(): MetricInfo;
5316
+ evaluateInvocations(actualInvocations: Invocation[], expectedInvocations: Invocation[]): Promise<EvaluationResult>;
5317
+ }
5318
+
5319
+ type index_AgentEvaluator = AgentEvaluator;
5320
+ declare const index_AgentEvaluator: typeof AgentEvaluator;
5321
+ type index_EvalCase = EvalCase;
5322
+ type index_EvalCaseResult = EvalCaseResult;
5323
+ type index_EvalMetric = EvalMetric;
5324
+ type index_EvalMetricResult = EvalMetricResult;
5325
+ type index_EvalMetricResultPerInvocation = EvalMetricResultPerInvocation;
5326
+ type index_EvalResult = EvalResult;
5327
+ declare const index_EvalResult: typeof EvalResult;
5328
+ type index_EvalSet = EvalSet;
5329
+ type index_EvalSetResult = EvalSetResult;
5330
+ type index_EvalStatus = EvalStatus;
5331
+ declare const index_EvalStatus: typeof EvalStatus;
5332
+ type index_EvaluateConfig = EvaluateConfig;
5333
+ type index_EvaluationResult = EvaluationResult;
5334
+ type index_Evaluator = Evaluator;
5335
+ declare const index_Evaluator: typeof Evaluator;
5336
+ type index_FinalResponseMatchV2Evaluator = FinalResponseMatchV2Evaluator;
5337
+ declare const index_FinalResponseMatchV2Evaluator: typeof FinalResponseMatchV2Evaluator;
5338
+ type index_IntermediateData = IntermediateData;
5339
+ type index_Interval = Interval;
5340
+ type index_Invocation = Invocation;
5341
+ type index_JudgeModelOptions = JudgeModelOptions;
5342
+ type index_LocalEvalService = LocalEvalService;
5343
+ declare const index_LocalEvalService: typeof LocalEvalService;
5344
+ type index_MetricInfo = MetricInfo;
5345
+ type index_MetricValueInfo = MetricValueInfo;
5346
+ type index_PerInvocationResult = PerInvocationResult;
5347
+ type index_PrebuiltMetrics = PrebuiltMetrics;
5348
+ declare const index_PrebuiltMetrics: typeof PrebuiltMetrics;
5349
+ type index_RougeEvaluator = RougeEvaluator;
5350
+ declare const index_RougeEvaluator: typeof RougeEvaluator;
5351
+ type index_SafetyEvaluatorV1 = SafetyEvaluatorV1;
5352
+ declare const index_SafetyEvaluatorV1: typeof SafetyEvaluatorV1;
5353
+ type index_SessionInput = SessionInput;
5354
+ type index_TrajectoryEvaluator = TrajectoryEvaluator;
5355
+ declare const index_TrajectoryEvaluator: typeof TrajectoryEvaluator;
5356
+ declare namespace index {
5357
+ export { index_AgentEvaluator as AgentEvaluator, type index_EvalCase as EvalCase, type index_EvalCaseResult as EvalCaseResult, type index_EvalMetric as EvalMetric, type index_EvalMetricResult as EvalMetricResult, type index_EvalMetricResultPerInvocation as EvalMetricResultPerInvocation, index_EvalResult as EvalResult, type index_EvalSet as EvalSet, type index_EvalSetResult as EvalSetResult, index_EvalStatus as EvalStatus, type index_EvaluateConfig as EvaluateConfig, type index_EvaluationResult as EvaluationResult, index_Evaluator as Evaluator, index_FinalResponseMatchV2Evaluator as FinalResponseMatchV2Evaluator, type index_IntermediateData as IntermediateData, type index_Interval as Interval, type index_Invocation as Invocation, type index_JudgeModelOptions as JudgeModelOptions, index_LocalEvalService as LocalEvalService, type index_MetricInfo as MetricInfo, type index_MetricValueInfo as MetricValueInfo, type index_PerInvocationResult as PerInvocationResult, index_PrebuiltMetrics as PrebuiltMetrics, index_RougeEvaluator as RougeEvaluator, index_SafetyEvaluatorV1 as SafetyEvaluatorV1, type index_SessionInput as SessionInput, index_TrajectoryEvaluator as TrajectoryEvaluator };
5358
+ }
5359
+
5156
5360
  /**
5157
5361
  * Find function call event if last event is function response.
5158
5362
  */
@@ -5320,4 +5524,4 @@ declare const traceLlmCall: (invocationContext: InvocationContext, eventId: stri
5320
5524
 
5321
5525
  declare const VERSION = "0.1.0";
5322
5526
 
5323
- export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, type AfterModelCallback, type AfterToolCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentBuilderWithSchema, AgentTool, type AgentToolConfig, type AgentType, index$4 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, type BaseAgentType, BaseCodeExecutor, type BaseCodeExecutorConfig, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BeforeModelCallback, type BeforeToolCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInCodeExecutor, BuiltInPlanner, CallbackContext, type CodeExecutionInput, type CodeExecutionResult, CodeExecutionUtils, CodeExecutorContext, type CreateToolConfig, type CreateToolConfigWithSchema, type CreateToolConfigWithoutSchema, DatabaseSessionService, EnhancedAuthConfig, type EnhancedRunner, Event, EventActions, index$1 as Events, ExitLoopTool, type File, FileOperationsTool, index as Flows, type FullMessage, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, InvocationContext, LLMRegistry, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, LlmRequest, LlmResponse, LoadArtifactsTool, LoadMemoryTool, LoopAgent, type LoopAgentConfig, McpAbi, McpAtp, McpBamm, McpCoinGecko, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntents, McpOdos, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, index$3 as Memory, type MessagePart, index$5 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PlanReActPlanner, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RunConfig, Runner, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionOptions, index$2 as Sessions, type SingleAfterModelCallback, type SingleAfterToolCallback, type SingleAgentCallback, type SingleBeforeModelCallback, type SingleBeforeToolCallback, SingleFlow, State, StreamingMode, type TelemetryConfig, TelemetryService, type ThinkingConfig, type ToolConfig, ToolContext, type ToolUnion, index$6 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, VertexAiSessionService, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, createAuthToolArguments, createBranchContextForSubAgent, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, createTool, generateAuthEvent, generateClientFunctionCallId, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$4 as instructionsRequestProcessor, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeAgentRun, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, normalizeJsonSchema, populateClientFunctionCallId, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, shutdownTelemetry, telemetryService, traceLlmCall, traceToolCall, tracer };
5527
+ export { AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, type AfterModelCallback, type AfterToolCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentBuilderWithSchema, AgentEvaluator, AgentTool, type AgentToolConfig, type AgentType, index$5 as Agents, AiSdkLlm, AnthropicLlm, ApiKeyCredential, ApiKeyScheme, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, AuthTool, type AuthToolArguments, AutoFlow, BaseAgent, type BaseAgentType, BaseCodeExecutor, type BaseCodeExecutorConfig, BaseLLMConnection, BaseLlm, BaseLlmFlow, BaseLlmRequestProcessor, BaseLlmResponseProcessor, type BaseMemoryService, BasePlanner, BaseSessionService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BeforeModelCallback, type BeforeToolCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInCodeExecutor, BuiltInPlanner, CallbackContext, type CodeExecutionInput, type CodeExecutionResult, CodeExecutionUtils, CodeExecutorContext, type CreateToolConfig, type CreateToolConfigWithSchema, type CreateToolConfigWithoutSchema, DatabaseSessionService, EnhancedAuthConfig, type EnhancedRunner, type EvalCase, type EvalCaseResult, type EvalMetric, type EvalMetricResult, type EvalMetricResultPerInvocation, EvalResult, type EvalSet, type EvalSetResult, EvalStatus, type EvaluateConfig, index as Evaluation, type EvaluationResult, Evaluator, Event, EventActions, index$2 as Events, ExitLoopTool, type File, FileOperationsTool, FinalResponseMatchV2Evaluator, index$1 as Flows, type FullMessage, FunctionTool, GcsArtifactService, type GetSessionConfig, GetUserChoiceTool, GoogleLlm, GoogleSearch, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, type IntermediateData, type Interval, type Invocation, InvocationContext, type JudgeModelOptions, LLMRegistry, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, type LlmModel, type LlmModelConfig, LlmRequest, LlmResponse, LoadArtifactsTool, LoadMemoryTool, LocalEvalService, LoopAgent, type LoopAgentConfig, McpAbi, McpAtp, McpBamm, McpClientService, McpCoinGecko, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntents, McpOdos, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, McpUpbit, index$4 as Memory, type MessagePart, type MetricInfo, type MetricValueInfo, index$6 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, type PerInvocationResult, PlanReActPlanner, PrebuiltMetrics, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RougeEvaluator, RunConfig, Runner, SafetyEvaluatorV1, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionInput, type SessionOptions, index$3 as Sessions, type SingleAfterModelCallback, type SingleAfterToolCallback, type SingleAgentCallback, type SingleBeforeModelCallback, type SingleBeforeToolCallback, SingleFlow, State, StreamingMode, type TelemetryConfig, TelemetryService, type ThinkingConfig, type ToolConfig, ToolContext, type ToolUnion, index$7 as Tools, TrajectoryEvaluator, TransferToAgentTool, UserInteractionTool, VERSION, VertexAiSessionService, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, createAuthToolArguments, createBranchContextForSubAgent, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, createTool, generateAuthEvent, generateClientFunctionCallId, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$4 as instructionsRequestProcessor, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeAgentRun, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, normalizeJsonSchema, populateClientFunctionCallId, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, shutdownTelemetry, telemetryService, traceLlmCall, traceToolCall, tracer };