@iqai/adk 0.4.1 → 0.5.2
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/CHANGELOG.md +26 -0
- package/dist/index.d.mts +202 -11
- package/dist/index.d.ts +202 -11
- package/dist/index.js +505 -125
- package/dist/index.mjs +403 -23
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Content, Part, Blob, SpeechConfig, AudioTranscriptionConfig, RealtimeInputConfig, ProactivityConfig, FunctionDeclaration, GroundingMetadata, GenerateContentResponseUsageMetadata, GenerateContentConfig, Schema, LiveConnectConfig, GoogleGenAI, FunctionCall } from '@google/genai';
|
|
2
2
|
export { Blob, Content, FunctionDeclaration, Schema as JSONSchema } from '@google/genai';
|
|
3
3
|
import { LanguageModel } from 'ai';
|
|
4
4
|
import * as z from 'zod';
|
|
@@ -57,6 +57,15 @@ declare class Logger {
|
|
|
57
57
|
private arrayToLines;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Event compaction data structure containing the summarized content
|
|
62
|
+
* and the timestamp range it covers.
|
|
63
|
+
*/
|
|
64
|
+
interface EventCompaction {
|
|
65
|
+
startTimestamp: number;
|
|
66
|
+
endTimestamp: number;
|
|
67
|
+
compactedContent: Content;
|
|
68
|
+
}
|
|
60
69
|
/**
|
|
61
70
|
* Represents the actions attached to an event.
|
|
62
71
|
*/
|
|
@@ -87,6 +96,11 @@ declare class EventActions {
|
|
|
87
96
|
* Requested authentication configurations.
|
|
88
97
|
*/
|
|
89
98
|
requestedAuthConfigs?: Record<string, any>;
|
|
99
|
+
/**
|
|
100
|
+
* Event compaction information. When set, this event represents
|
|
101
|
+
* a compaction of events within the specified timestamp range.
|
|
102
|
+
*/
|
|
103
|
+
compaction?: EventCompaction;
|
|
90
104
|
/**
|
|
91
105
|
* Constructor for EventActions
|
|
92
106
|
*/
|
|
@@ -97,6 +111,7 @@ declare class EventActions {
|
|
|
97
111
|
transferToAgent?: string;
|
|
98
112
|
escalate?: boolean;
|
|
99
113
|
requestedAuthConfigs?: Record<string, any>;
|
|
114
|
+
compaction?: EventCompaction;
|
|
100
115
|
});
|
|
101
116
|
}
|
|
102
117
|
|
|
@@ -674,6 +689,18 @@ declare class ReadonlyContext {
|
|
|
674
689
|
* The name of the agent that is currently running.
|
|
675
690
|
*/
|
|
676
691
|
get agentName(): string;
|
|
692
|
+
/**
|
|
693
|
+
* The application name for this invocation. READONLY field.
|
|
694
|
+
*/
|
|
695
|
+
get appName(): string;
|
|
696
|
+
/**
|
|
697
|
+
* The user ID for this invocation. READONLY field.
|
|
698
|
+
*/
|
|
699
|
+
get userId(): string;
|
|
700
|
+
/**
|
|
701
|
+
* The session ID for this invocation. READONLY field.
|
|
702
|
+
*/
|
|
703
|
+
get sessionId(): string;
|
|
677
704
|
/**
|
|
678
705
|
* The state of the current session. READONLY field.
|
|
679
706
|
*/
|
|
@@ -1255,7 +1282,7 @@ type ToolUnion = BaseTool | ((...args: any[]) => any);
|
|
|
1255
1282
|
type SingleBeforeModelCallback = (args: {
|
|
1256
1283
|
callbackContext: CallbackContext;
|
|
1257
1284
|
llmRequest: LlmRequest;
|
|
1258
|
-
}) => LlmResponse | null | Promise<LlmResponse | null>;
|
|
1285
|
+
}) => LlmResponse | null | undefined | Promise<LlmResponse | null | undefined>;
|
|
1259
1286
|
/**
|
|
1260
1287
|
* Before model callback type (single or array)
|
|
1261
1288
|
*/
|
|
@@ -1266,7 +1293,7 @@ type BeforeModelCallback = SingleBeforeModelCallback | SingleBeforeModelCallback
|
|
|
1266
1293
|
type SingleAfterModelCallback = (args: {
|
|
1267
1294
|
callbackContext: CallbackContext;
|
|
1268
1295
|
llmResponse: LlmResponse;
|
|
1269
|
-
}) => LlmResponse | null | Promise<LlmResponse | null>;
|
|
1296
|
+
}) => LlmResponse | null | undefined | Promise<LlmResponse | null | undefined>;
|
|
1270
1297
|
/**
|
|
1271
1298
|
* After model callback type (single or array)
|
|
1272
1299
|
*/
|
|
@@ -1274,7 +1301,7 @@ type AfterModelCallback = SingleAfterModelCallback | SingleAfterModelCallback[];
|
|
|
1274
1301
|
/**
|
|
1275
1302
|
* Single before tool callback type
|
|
1276
1303
|
*/
|
|
1277
|
-
type SingleBeforeToolCallback = (tool: BaseTool, args: Record<string, any>, toolContext: ToolContext) => Record<string, any> | null | Promise<Record<string, any> | null>;
|
|
1304
|
+
type SingleBeforeToolCallback = (tool: BaseTool, args: Record<string, any>, toolContext: ToolContext) => Record<string, any> | null | undefined | Promise<Record<string, any> | null | undefined>;
|
|
1278
1305
|
/**
|
|
1279
1306
|
* Before tool callback type (single or array)
|
|
1280
1307
|
*/
|
|
@@ -1282,7 +1309,7 @@ type BeforeToolCallback = SingleBeforeToolCallback | SingleBeforeToolCallback[];
|
|
|
1282
1309
|
/**
|
|
1283
1310
|
* Single after tool callback type
|
|
1284
1311
|
*/
|
|
1285
|
-
type SingleAfterToolCallback = (tool: BaseTool, args: Record<string, any>, toolContext: ToolContext, toolResponse: Record<string, any>) => Record<string, any> | null | Promise<Record<string, any> | null>;
|
|
1312
|
+
type SingleAfterToolCallback = (tool: BaseTool, args: Record<string, any>, toolContext: ToolContext, toolResponse: Record<string, any>) => Record<string, any> | null | undefined | Promise<Record<string, any> | null | undefined>;
|
|
1286
1313
|
/**
|
|
1287
1314
|
* After tool callback type (single or array)
|
|
1288
1315
|
*/
|
|
@@ -2275,6 +2302,24 @@ declare function createSamplingHandler(handler: SamplingHandler): SamplingHandle
|
|
|
2275
2302
|
*
|
|
2276
2303
|
* @example
|
|
2277
2304
|
* ```typescript
|
|
2305
|
+
* // Using remote MCP endpoints (CoinGecko):
|
|
2306
|
+
* const coinGeckoTools = await McpCoinGecko().getTools();
|
|
2307
|
+
*
|
|
2308
|
+
* const coinGeckoProTools = await McpCoinGeckoPro({
|
|
2309
|
+
* env: {
|
|
2310
|
+
* COINGECKO_PRO_API_KEY: env.COINGECKO_PRO_API_KEY
|
|
2311
|
+
* }
|
|
2312
|
+
* }).getTools();
|
|
2313
|
+
*
|
|
2314
|
+
* const cryptoAgent = new LlmAgent({
|
|
2315
|
+
* name: "crypto_assistant",
|
|
2316
|
+
* model: "gemini-2.5-flash",
|
|
2317
|
+
* tools: [...coinGeckoTools, ...coinGeckoProTools],
|
|
2318
|
+
* });
|
|
2319
|
+
* ```
|
|
2320
|
+
*
|
|
2321
|
+
* @example
|
|
2322
|
+
* ```typescript
|
|
2278
2323
|
* // Using MCP servers with sampling handlers:
|
|
2279
2324
|
* import { createSamplingHandler, LlmResponse } from "@iqai/adk";
|
|
2280
2325
|
*
|
|
@@ -2388,11 +2433,18 @@ declare function McpTelegram(config?: McpServerConfig): McpToolset;
|
|
|
2388
2433
|
*/
|
|
2389
2434
|
declare function McpDiscord(config?: McpServerConfig): McpToolset;
|
|
2390
2435
|
/**
|
|
2391
|
-
* MCP CoinGecko - Access cryptocurrency market data and analytics
|
|
2436
|
+
* MCP CoinGecko - Access cryptocurrency market data and analytics via remote endpoint
|
|
2392
2437
|
*
|
|
2393
|
-
*
|
|
2438
|
+
* Uses the public CoinGecko MCP API endpoint. No API key required for basic functionality.
|
|
2394
2439
|
*/
|
|
2395
2440
|
declare function McpCoinGecko(config?: McpServerConfig): McpToolset;
|
|
2441
|
+
/**
|
|
2442
|
+
* MCP CoinGecko Pro - Access premium cryptocurrency market data and analytics via remote endpoint
|
|
2443
|
+
*
|
|
2444
|
+
* Uses the professional CoinGecko MCP API endpoint with enhanced features and higher rate limits.
|
|
2445
|
+
* Requires a CoinGecko Pro API subscription.
|
|
2446
|
+
*/
|
|
2447
|
+
declare function McpCoinGeckoPro(config?: McpServerConfig): McpToolset;
|
|
2396
2448
|
/**
|
|
2397
2449
|
* MCP Upbit - Interact with the Upbit cryptocurrency exchange
|
|
2398
2450
|
*
|
|
@@ -2528,6 +2580,7 @@ declare const index$7_McpAbi: typeof McpAbi;
|
|
|
2528
2580
|
declare const index$7_McpAtp: typeof McpAtp;
|
|
2529
2581
|
declare const index$7_McpBamm: typeof McpBamm;
|
|
2530
2582
|
declare const index$7_McpCoinGecko: typeof McpCoinGecko;
|
|
2583
|
+
declare const index$7_McpCoinGeckoPro: typeof McpCoinGeckoPro;
|
|
2531
2584
|
type index$7_McpConfig = McpConfig;
|
|
2532
2585
|
declare const index$7_McpDiscord: typeof McpDiscord;
|
|
2533
2586
|
type index$7_McpError = McpError;
|
|
@@ -2571,7 +2624,7 @@ declare const index$7_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
|
|
|
2571
2624
|
declare const index$7_mcpSchemaToParameters: typeof mcpSchemaToParameters;
|
|
2572
2625
|
declare const index$7_normalizeJsonSchema: typeof normalizeJsonSchema;
|
|
2573
2626
|
declare namespace index$7 {
|
|
2574
|
-
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_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_convertMcpToolToBaseTool as convertMcpToolToBaseTool, 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 };
|
|
2627
|
+
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_McpCoinGecko as McpCoinGecko, index$7_McpCoinGeckoPro as McpCoinGeckoPro, 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_convertMcpToolToBaseTool as convertMcpToolToBaseTool, 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 };
|
|
2575
2628
|
}
|
|
2576
2629
|
|
|
2577
2630
|
/**
|
|
@@ -3983,6 +4036,45 @@ declare class LangGraphAgent extends BaseAgent {
|
|
|
3983
4036
|
setMaxSteps(maxSteps: number): void;
|
|
3984
4037
|
}
|
|
3985
4038
|
|
|
4039
|
+
/**
|
|
4040
|
+
* Base interface for event summarizers.
|
|
4041
|
+
* Implementations convert a list of events into a single compaction event.
|
|
4042
|
+
*/
|
|
4043
|
+
interface EventsSummarizer {
|
|
4044
|
+
/**
|
|
4045
|
+
* Attempts to summarize a list of events into a single compaction event.
|
|
4046
|
+
* @param events - The events to summarize
|
|
4047
|
+
* @returns A compaction carrier event with actions.compaction set, or undefined if no summarization is needed
|
|
4048
|
+
*/
|
|
4049
|
+
maybeSummarizeEvents(events: Event[]): Promise<Event | undefined>;
|
|
4050
|
+
}
|
|
4051
|
+
|
|
4052
|
+
/**
|
|
4053
|
+
* Configuration for event compaction feature.
|
|
4054
|
+
* Controls how and when session histories are compacted via summarization.
|
|
4055
|
+
*/
|
|
4056
|
+
interface EventsCompactionConfig {
|
|
4057
|
+
/**
|
|
4058
|
+
* The summarizer to use for compacting events.
|
|
4059
|
+
* If not provided, a default LLM-based summarizer will be used.
|
|
4060
|
+
*/
|
|
4061
|
+
summarizer?: EventsSummarizer;
|
|
4062
|
+
/**
|
|
4063
|
+
* Number of new invocations required to trigger compaction.
|
|
4064
|
+
* When this many new invocations have been completed since the last
|
|
4065
|
+
* compaction, a new compaction will be triggered.
|
|
4066
|
+
* Default: 10
|
|
4067
|
+
*/
|
|
4068
|
+
compactionInterval: number;
|
|
4069
|
+
/**
|
|
4070
|
+
* Number of prior invocations to include from the previous compacted
|
|
4071
|
+
* range for continuity when creating a new compaction.
|
|
4072
|
+
* This ensures some overlap between successive summaries.
|
|
4073
|
+
* Default: 2
|
|
4074
|
+
*/
|
|
4075
|
+
overlapSize: number;
|
|
4076
|
+
}
|
|
4077
|
+
|
|
3986
4078
|
/**
|
|
3987
4079
|
* Configuration options for the AgentBuilder
|
|
3988
4080
|
*/
|
|
@@ -3997,6 +4089,10 @@ interface AgentBuilderConfig {
|
|
|
3997
4089
|
subAgents?: BaseAgent[];
|
|
3998
4090
|
beforeAgentCallback?: BeforeAgentCallback;
|
|
3999
4091
|
afterAgentCallback?: AfterAgentCallback;
|
|
4092
|
+
beforeModelCallback?: BeforeModelCallback;
|
|
4093
|
+
afterModelCallback?: AfterModelCallback;
|
|
4094
|
+
beforeToolCallback?: BeforeToolCallback;
|
|
4095
|
+
afterToolCallback?: AfterToolCallback;
|
|
4000
4096
|
maxIterations?: number;
|
|
4001
4097
|
nodes?: LangGraphNode[];
|
|
4002
4098
|
rootNode?: string;
|
|
@@ -4119,6 +4215,7 @@ declare class AgentBuilder<TOut = string, TMulti extends boolean = false> {
|
|
|
4119
4215
|
private sessionOptions?;
|
|
4120
4216
|
private memoryService?;
|
|
4121
4217
|
private artifactService?;
|
|
4218
|
+
private eventsCompactionConfig?;
|
|
4122
4219
|
private agentType;
|
|
4123
4220
|
private existingSession?;
|
|
4124
4221
|
private existingAgent?;
|
|
@@ -4207,6 +4304,36 @@ declare class AgentBuilder<TOut = string, TMulti extends boolean = false> {
|
|
|
4207
4304
|
* @returns This builder instance for chaining
|
|
4208
4305
|
*/
|
|
4209
4306
|
withAfterAgentCallback(callback: AfterAgentCallback): this;
|
|
4307
|
+
/**
|
|
4308
|
+
* Set the before model callback for LLM interaction
|
|
4309
|
+
* @param callback Callback to invoke before calling the LLM
|
|
4310
|
+
* @returns This builder instance for chaining
|
|
4311
|
+
*/
|
|
4312
|
+
withBeforeModelCallback(callback: BeforeModelCallback): this;
|
|
4313
|
+
/**
|
|
4314
|
+
* Set the after model callback for LLM interaction
|
|
4315
|
+
* @param callback Callback to invoke after receiving LLM response
|
|
4316
|
+
* @returns This builder instance for chaining
|
|
4317
|
+
*/
|
|
4318
|
+
withAfterModelCallback(callback: AfterModelCallback): this;
|
|
4319
|
+
/**
|
|
4320
|
+
* Set the before tool callback for tool execution
|
|
4321
|
+
* @param callback Callback to invoke before running a tool
|
|
4322
|
+
* @returns This builder instance for chaining
|
|
4323
|
+
*/
|
|
4324
|
+
withBeforeToolCallback(callback: BeforeToolCallback): this;
|
|
4325
|
+
/**
|
|
4326
|
+
* Set the after tool callback for tool execution
|
|
4327
|
+
* @param callback Callback to invoke after running a tool
|
|
4328
|
+
* @returns This builder instance for chaining
|
|
4329
|
+
*/
|
|
4330
|
+
withAfterToolCallback(callback: AfterToolCallback): this;
|
|
4331
|
+
/**
|
|
4332
|
+
* Convenience method to start building with an existing agent
|
|
4333
|
+
* @param agent The agent instance to wrap
|
|
4334
|
+
* @returns New AgentBuilder instance with agent set
|
|
4335
|
+
*/
|
|
4336
|
+
static withAgent(agent: BaseAgent): AgentBuilder<string, false>;
|
|
4210
4337
|
/**
|
|
4211
4338
|
* Provide an already constructed agent instance. Further definition-mutating calls
|
|
4212
4339
|
* (model/tools/instruction/etc.) will be ignored with a dev warning.
|
|
@@ -4268,6 +4395,23 @@ declare class AgentBuilder<TOut = string, TMulti extends boolean = false> {
|
|
|
4268
4395
|
* Configure runtime behavior for runs
|
|
4269
4396
|
*/
|
|
4270
4397
|
withRunConfig(config: RunConfig | Partial<RunConfig>): this;
|
|
4398
|
+
/**
|
|
4399
|
+
* Configure event compaction for automatic history management
|
|
4400
|
+
* @param config Event compaction configuration
|
|
4401
|
+
* @returns This builder instance for chaining
|
|
4402
|
+
* @example
|
|
4403
|
+
* ```typescript
|
|
4404
|
+
* const { runner } = await AgentBuilder
|
|
4405
|
+
* .create("assistant")
|
|
4406
|
+
* .withModel("gemini-2.5-flash")
|
|
4407
|
+
* .withEventsCompaction({
|
|
4408
|
+
* compactionInterval: 10, // Compact every 10 invocations
|
|
4409
|
+
* overlapSize: 2, // Include 2 prior invocations
|
|
4410
|
+
* })
|
|
4411
|
+
* .build();
|
|
4412
|
+
* ```
|
|
4413
|
+
*/
|
|
4414
|
+
withEventsCompaction(config: EventsCompactionConfig): this;
|
|
4271
4415
|
/**
|
|
4272
4416
|
* Configure with an in-memory session with custom IDs
|
|
4273
4417
|
* Note: In-memory sessions are created automatically by default, use this only if you need custom appName/userId
|
|
@@ -4768,12 +4912,46 @@ declare class InMemoryArtifactService implements BaseArtifactService {
|
|
|
4768
4912
|
}): Promise<number[]>;
|
|
4769
4913
|
}
|
|
4770
4914
|
|
|
4915
|
+
/**
|
|
4916
|
+
* LLM-based event summarizer that uses a language model to generate summaries.
|
|
4917
|
+
*/
|
|
4918
|
+
declare class LlmEventSummarizer implements EventsSummarizer {
|
|
4919
|
+
private model;
|
|
4920
|
+
private prompt;
|
|
4921
|
+
/**
|
|
4922
|
+
* Creates a new LLM event summarizer.
|
|
4923
|
+
* @param model - The LLM model to use for summarization
|
|
4924
|
+
* @param prompt - Optional custom prompt template. Use {events} as placeholder for event content.
|
|
4925
|
+
*/
|
|
4926
|
+
constructor(model: BaseLlm, prompt?: string);
|
|
4927
|
+
/**
|
|
4928
|
+
* Summarizes events using the configured LLM.
|
|
4929
|
+
*/
|
|
4930
|
+
maybeSummarizeEvents(events: Event[]): Promise<Event | undefined>;
|
|
4931
|
+
/**
|
|
4932
|
+
* Formats events into a readable text format for summarization.
|
|
4933
|
+
*/
|
|
4934
|
+
private formatEventsForSummarization;
|
|
4935
|
+
}
|
|
4936
|
+
|
|
4937
|
+
/**
|
|
4938
|
+
* Runs compaction for a sliding window of invocations.
|
|
4939
|
+
* This function implements the core sliding window logic from ADK Python.
|
|
4940
|
+
*/
|
|
4941
|
+
declare function runCompactionForSlidingWindow(config: EventsCompactionConfig, session: Session, sessionService: BaseSessionService, summarizer: EventsSummarizer): Promise<void>;
|
|
4942
|
+
|
|
4771
4943
|
type index$2_Event = Event;
|
|
4772
4944
|
declare const index$2_Event: typeof Event;
|
|
4773
4945
|
type index$2_EventActions = EventActions;
|
|
4774
4946
|
declare const index$2_EventActions: typeof EventActions;
|
|
4947
|
+
type index$2_EventCompaction = EventCompaction;
|
|
4948
|
+
type index$2_EventsCompactionConfig = EventsCompactionConfig;
|
|
4949
|
+
type index$2_EventsSummarizer = EventsSummarizer;
|
|
4950
|
+
type index$2_LlmEventSummarizer = LlmEventSummarizer;
|
|
4951
|
+
declare const index$2_LlmEventSummarizer: typeof LlmEventSummarizer;
|
|
4952
|
+
declare const index$2_runCompactionForSlidingWindow: typeof runCompactionForSlidingWindow;
|
|
4775
4953
|
declare namespace index$2 {
|
|
4776
|
-
export { index$2_Event as Event, index$2_EventActions as EventActions };
|
|
4954
|
+
export { index$2_Event as Event, index$2_EventActions as EventActions, type index$2_EventCompaction as EventCompaction, type index$2_EventsCompactionConfig as EventsCompactionConfig, type index$2_EventsSummarizer as EventsSummarizer, index$2_LlmEventSummarizer as LlmEventSummarizer, index$2_runCompactionForSlidingWindow as runCompactionForSlidingWindow };
|
|
4777
4955
|
}
|
|
4778
4956
|
|
|
4779
4957
|
declare abstract class BaseLlmFlow {
|
|
@@ -5471,16 +5649,21 @@ declare class Runner<T extends BaseAgent = BaseAgent> {
|
|
|
5471
5649
|
* The memory service for the runner.
|
|
5472
5650
|
*/
|
|
5473
5651
|
memoryService?: BaseMemoryService;
|
|
5652
|
+
/**
|
|
5653
|
+
* Configuration for event compaction.
|
|
5654
|
+
*/
|
|
5655
|
+
eventsCompactionConfig?: EventsCompactionConfig;
|
|
5474
5656
|
protected logger: Logger;
|
|
5475
5657
|
/**
|
|
5476
5658
|
* Initializes the Runner.
|
|
5477
5659
|
*/
|
|
5478
|
-
constructor({ appName, agent, artifactService, sessionService, memoryService, }: {
|
|
5660
|
+
constructor({ appName, agent, artifactService, sessionService, memoryService, eventsCompactionConfig, }: {
|
|
5479
5661
|
appName: string;
|
|
5480
5662
|
agent: T;
|
|
5481
5663
|
artifactService?: BaseArtifactService;
|
|
5482
5664
|
sessionService: BaseSessionService;
|
|
5483
5665
|
memoryService?: BaseMemoryService;
|
|
5666
|
+
eventsCompactionConfig?: EventsCompactionConfig;
|
|
5484
5667
|
});
|
|
5485
5668
|
/**
|
|
5486
5669
|
* Runs the agent synchronously.
|
|
@@ -5518,6 +5701,14 @@ declare class Runner<T extends BaseAgent = BaseAgent> {
|
|
|
5518
5701
|
* Creates a new invocation context.
|
|
5519
5702
|
*/
|
|
5520
5703
|
private _newInvocationContext;
|
|
5704
|
+
/**
|
|
5705
|
+
* Runs compaction if configured.
|
|
5706
|
+
*/
|
|
5707
|
+
private _runCompaction;
|
|
5708
|
+
/**
|
|
5709
|
+
* Gets the configured summarizer or creates a default LLM-based one.
|
|
5710
|
+
*/
|
|
5711
|
+
private _getOrCreateSummarizer;
|
|
5521
5712
|
}
|
|
5522
5713
|
/**
|
|
5523
5714
|
* An in-memory Runner for testing and development.
|
|
@@ -5607,4 +5798,4 @@ declare const traceLlmCall: (invocationContext: InvocationContext, eventId: stri
|
|
|
5607
5798
|
|
|
5608
5799
|
declare const VERSION = "0.1.0";
|
|
5609
5800
|
|
|
5610
|
-
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, 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, type MultiAgentResponse, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, type PerInvocationResult, PlanReActPlanner, PrebuiltMetrics, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RougeEvaluator, RunConfig, Runner, type RunnerAskReturn, 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, VertexAiRagMemoryService, VertexAiSessionService, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, convertMcpToolToBaseTool, 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 };
|
|
5801
|
+
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, type EventCompaction, index$2 as Events, type EventsCompactionConfig, type EventsSummarizer, 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, LlmEventSummarizer, type LlmModel, type LlmModelConfig, LlmRequest, LlmResponse, LoadArtifactsTool, LoadMemoryTool, LocalEvalService, LoopAgent, type LoopAgentConfig, McpAbi, McpAtp, McpBamm, McpCoinGecko, McpCoinGeckoPro, 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, type MultiAgentResponse, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, type PerInvocationResult, PlanReActPlanner, PrebuiltMetrics, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, RougeEvaluator, RunConfig, Runner, type RunnerAskReturn, 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, VertexAiRagMemoryService, VertexAiSessionService, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, convertMcpToolToBaseTool, 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, runCompactionForSlidingWindow, shutdownTelemetry, telemetryService, traceLlmCall, traceToolCall, tracer };
|