@iqai/adk 0.6.1 → 0.6.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/dist/index.d.mts CHANGED
@@ -1,178 +1,194 @@
1
- import { Content, Part, GroundingMetadata, GenerateContentResponseUsageMetadata, Blob, SpeechConfig, AudioTranscriptionConfig, RealtimeInputConfig, ProactivityConfig, FunctionDeclaration, GenerateContentConfig, Schema, LiveConnectConfig, GoogleGenAI, FunctionCall } from '@google/genai';
1
+ import { Part, Content, GroundingMetadata, GenerateContentResponseUsageMetadata, Blob, FunctionDeclaration, GenerateContentConfig, Schema, LiveConnectConfig, SpeechConfig, AudioTranscriptionConfig, RealtimeInputConfig, ProactivityConfig, GoogleGenAI, FunctionCall } from '@google/genai';
2
2
  export { Blob, Content, FunctionDeclaration, Schema as JSONSchema } from '@google/genai';
3
- import { SpanContext, Tracer, Span } from '@opentelemetry/api';
3
+ import { LanguageModel } from 'ai';
4
4
  import * as z from 'zod';
5
5
  import { z as z$1, ZodSchema, ZodType } from 'zod';
6
- import { LanguageModel } from 'ai';
6
+ import { SpanContext, Tracer, Span } from '@opentelemetry/api';
7
7
  import { StorageOptions } from '@google-cloud/storage';
8
8
  import { Kysely, Generated } from 'kysely';
9
9
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
10
10
  import { CreateMessageRequest, CreateMessageResult, Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
11
11
 
12
- interface LoggerOpts {
13
- name: string;
12
+ /**
13
+ * Authentication scheme types
14
+ */
15
+ declare enum AuthSchemeType {
16
+ APIKEY = "apiKey",
17
+ HTTP = "http",
18
+ OAUTH2 = "oauth2",
19
+ OPENID_CONNECT = "openIdConnect"
14
20
  }
15
- declare class Logger {
16
- name: string;
17
- isDebugEnabled: boolean;
18
- constructor({ name }: LoggerOpts);
19
- debug(message: string, ...args: any[]): void;
20
- info(message: string, ...args: any[]): void;
21
- warn(message: string, ...args: any[]): void;
22
- error(message: string, ...args: any[]): void;
23
- private log;
24
- private extractMeta;
25
- private formatArgs;
26
- private parseStackFrames;
27
- private stringify;
28
- private capitalize;
29
- formatBox(params: {
30
- title: string;
31
- description: string;
32
- lines?: string[];
33
- width?: number;
34
- maxWidthPct?: number;
35
- color?: (txt: string) => string;
36
- pad?: number;
37
- borderChar?: string;
38
- wrap?: boolean;
39
- }): string;
21
+ /**
22
+ * Base class for authentication schemes
23
+ */
24
+ declare abstract class AuthScheme {
40
25
  /**
41
- * Structured warning with code, suggestion, context.
26
+ * The type of authentication scheme
42
27
  */
43
- warnStructured(warning: {
44
- code: string;
45
- message: string;
46
- suggestion?: string;
47
- context?: Record<string, any>;
48
- severity?: "warn" | "info" | "error";
49
- timestamp?: string;
50
- }, opts?: {
51
- format?: "pretty" | "json" | "text";
52
- verbose?: boolean;
53
- }): void;
54
- debugStructured(title: string, data: Record<string, any>): void;
55
- debugArray(title: string, items: Array<Record<string, any>>): void;
56
- private objectToLines;
57
- private arrayToLines;
28
+ type: AuthSchemeType;
29
+ constructor(type: AuthSchemeType);
58
30
  }
59
-
60
31
  /**
61
- * Event compaction data structure containing the summarized content
62
- * and the timestamp range it covers.
32
+ * API Key authentication scheme
63
33
  */
64
- interface EventCompaction {
65
- startTimestamp: number;
66
- endTimestamp: number;
67
- compactedContent: Content;
34
+ declare class ApiKeyScheme extends AuthScheme {
35
+ /**
36
+ * Where the API key is sent
37
+ */
38
+ in: "query" | "header" | "cookie";
39
+ /**
40
+ * Name of the parameter
41
+ */
42
+ name: string;
43
+ /**
44
+ * Description of the API key
45
+ */
46
+ description?: string;
47
+ /**
48
+ * Constructor for ApiKeyScheme
49
+ */
50
+ constructor(config: {
51
+ in: "query" | "header" | "cookie";
52
+ name: string;
53
+ description?: string;
54
+ });
68
55
  }
69
56
  /**
70
- * Represents the actions attached to an event.
57
+ * HTTP authentication scheme
71
58
  */
72
- declare class EventActions {
59
+ declare class HttpScheme extends AuthScheme {
73
60
  /**
74
- * If true, it won't call model to summarize function response.
75
- * Only used for function_response event.
61
+ * The HTTP authentication scheme
76
62
  */
77
- skipSummarization?: boolean;
63
+ scheme: "basic" | "bearer" | "digest" | "other";
78
64
  /**
79
- * Indicates that the event is updating the state with the given delta.
65
+ * Bearer format when scheme is 'bearer'
80
66
  */
81
- stateDelta: Record<string, any>;
67
+ bearerFormat?: string;
82
68
  /**
83
- * Indicates that the event is updating an artifact. key is the filename,
84
- * value is the version.
69
+ * Description of the scheme
85
70
  */
86
- artifactDelta: Record<string, number>;
71
+ description?: string;
87
72
  /**
88
- * If set, the event transfers to the specified agent.
73
+ * Constructor for HttpScheme
89
74
  */
90
- transferToAgent?: string;
75
+ constructor(config: {
76
+ scheme: "basic" | "bearer" | "digest" | "other";
77
+ bearerFormat?: string;
78
+ description?: string;
79
+ });
80
+ }
81
+ /**
82
+ * OAuth flow configuration
83
+ */
84
+ interface OAuthFlow {
85
+ authorizationUrl?: string;
86
+ tokenUrl?: string;
87
+ refreshUrl?: string;
88
+ scopes: Record<string, string>;
89
+ }
90
+ /**
91
+ * OAuth flows configuration
92
+ */
93
+ interface OAuthFlows {
94
+ implicit?: OAuthFlow;
95
+ password?: OAuthFlow;
96
+ clientCredentials?: OAuthFlow;
97
+ authorizationCode?: OAuthFlow;
98
+ }
99
+ /**
100
+ * OAuth2 authentication scheme
101
+ */
102
+ declare class OAuth2Scheme extends AuthScheme {
91
103
  /**
92
- * The agent is escalating to a higher level agent.
104
+ * OAuth flows
93
105
  */
94
- escalate?: boolean;
106
+ flows: OAuthFlows;
95
107
  /**
96
- * Requested authentication configurations.
108
+ * Description of the scheme
97
109
  */
98
- requestedAuthConfigs?: Record<string, any>;
110
+ description?: string;
99
111
  /**
100
- * Event compaction information. When set, this event represents
101
- * a compaction of events within the specified timestamp range.
112
+ * Constructor for OAuth2Scheme
102
113
  */
103
- compaction?: EventCompaction;
114
+ constructor(config: {
115
+ flows: OAuthFlows;
116
+ description?: string;
117
+ });
118
+ }
119
+ /**
120
+ * OpenID Connect authentication scheme
121
+ */
122
+ declare class OpenIdConnectScheme extends AuthScheme {
104
123
  /**
105
- * The invocation id to rewind to. This is only set for rewind event.
124
+ * OpenID Connect URL
106
125
  */
107
- rewindBeforeInvocationId?: string;
126
+ openIdConnectUrl: string;
108
127
  /**
109
- * Constructor for EventActions
128
+ * Description of the scheme
110
129
  */
111
- constructor(options?: {
112
- skipSummarization?: boolean;
113
- stateDelta?: Record<string, any>;
114
- artifactDelta?: Record<string, number>;
115
- transferToAgent?: string;
116
- escalate?: boolean;
117
- requestedAuthConfigs?: Record<string, any>;
118
- compaction?: EventCompaction;
119
- rewindBeforeInvocationId?: string;
130
+ description?: string;
131
+ /**
132
+ * Constructor for OpenIdConnectScheme
133
+ */
134
+ constructor(config: {
135
+ openIdConnectUrl: string;
136
+ description?: string;
120
137
  });
121
138
  }
122
139
 
123
140
  /**
124
- * A state dict that maintain the current value and the pending-commit delta.
141
+ * Authentication configuration for tools
125
142
  */
126
- declare class State {
127
- static readonly APP_PREFIX = "app:";
128
- static readonly USER_PREFIX = "user:";
129
- static readonly TEMP_PREFIX = "temp:";
130
- private readonly _value;
131
- private readonly _delta;
132
- /**
133
- * Constructor for State
134
- *
135
- * @param value - The current value of the state dict.
136
- * @param delta - The delta change to the current value that hasn't been committed.
137
- */
138
- constructor(value: Record<string, any>, delta: Record<string, any>);
143
+ declare class AuthConfig {
139
144
  /**
140
- * Returns the value of the state dict for the given key.
145
+ * The authentication scheme
141
146
  */
142
- get(key: string, defaultValue?: any): any;
147
+ authScheme: AuthScheme;
143
148
  /**
144
- * Sets the value of the state dict for the given key.
149
+ * Additional context properties
145
150
  */
146
- set(key: string, value: any): void;
151
+ context?: Record<string, any>;
147
152
  /**
148
- * Whether the state dict contains the given key.
153
+ * Constructor for AuthConfig
149
154
  */
150
- has(key: string): boolean;
155
+ constructor(config: {
156
+ authScheme: AuthScheme;
157
+ context?: Record<string, any>;
158
+ });
159
+ }
160
+
161
+ /**
162
+ * Handler for authentication in tools
163
+ */
164
+ declare class AuthHandler {
151
165
  /**
152
- * Whether the state has pending delta.
166
+ * The authentication configuration
153
167
  */
154
- hasDelta(): boolean;
168
+ authConfig: AuthConfig;
155
169
  /**
156
- * Updates the state dict with the given delta.
170
+ * The authentication credential
157
171
  */
158
- update(delta: Record<string, any>): void;
172
+ credential?: AuthCredential;
159
173
  /**
160
- * Returns the state dict.
174
+ * Constructor for AuthHandler
161
175
  */
162
- toDict(): Record<string, any>;
176
+ constructor(config: {
177
+ authConfig: AuthConfig;
178
+ credential?: AuthCredential;
179
+ });
163
180
  /**
164
- * Array-like access for getting values.
165
- * Returns the value of the state dict for the given key.
181
+ * Gets the authentication token
166
182
  */
167
- [key: string]: any;
183
+ getToken(): string | undefined;
168
184
  /**
169
- * Proxy handler for array-like access
185
+ * Gets headers for HTTP requests
170
186
  */
171
- private static createProxy;
187
+ getHeaders(): Record<string, string>;
172
188
  /**
173
- * Factory method to create a proxied State instance
189
+ * Refreshes the token if necessary
174
190
  */
175
- static create(value: Record<string, any>, delta: Record<string, any>): State;
191
+ refreshToken(): Promise<void>;
176
192
  }
177
193
 
178
194
  interface BaseArtifactService {
@@ -270,13 +286,76 @@ interface BaseMemoryService {
270
286
  }
271
287
 
272
288
  /**
273
- * Options for creating an Event.
289
+ * Event compaction data structure containing the summarized content
290
+ * and the timestamp range it covers.
274
291
  */
275
- interface EventOpts {
276
- invocationId?: string;
277
- author: string;
278
- actions?: EventActions;
279
- longRunningToolIds?: Set<string>;
292
+ interface EventCompaction {
293
+ startTimestamp: number;
294
+ endTimestamp: number;
295
+ compactedContent: Content;
296
+ }
297
+ /**
298
+ * Represents the actions attached to an event.
299
+ */
300
+ declare class EventActions {
301
+ /**
302
+ * If true, it won't call model to summarize function response.
303
+ * Only used for function_response event.
304
+ */
305
+ skipSummarization?: boolean;
306
+ /**
307
+ * Indicates that the event is updating the state with the given delta.
308
+ */
309
+ stateDelta: Record<string, any>;
310
+ /**
311
+ * Indicates that the event is updating an artifact. key is the filename,
312
+ * value is the version.
313
+ */
314
+ artifactDelta: Record<string, number>;
315
+ /**
316
+ * If set, the event transfers to the specified agent.
317
+ */
318
+ transferToAgent?: string;
319
+ /**
320
+ * The agent is escalating to a higher level agent.
321
+ */
322
+ escalate?: boolean;
323
+ /**
324
+ * Requested authentication configurations.
325
+ */
326
+ requestedAuthConfigs?: Record<string, any>;
327
+ /**
328
+ * Event compaction information. When set, this event represents
329
+ * a compaction of events within the specified timestamp range.
330
+ */
331
+ compaction?: EventCompaction;
332
+ /**
333
+ * The invocation id to rewind to. This is only set for rewind event.
334
+ */
335
+ rewindBeforeInvocationId?: string;
336
+ /**
337
+ * Constructor for EventActions
338
+ */
339
+ constructor(options?: {
340
+ skipSummarization?: boolean;
341
+ stateDelta?: Record<string, any>;
342
+ artifactDelta?: Record<string, number>;
343
+ transferToAgent?: string;
344
+ escalate?: boolean;
345
+ requestedAuthConfigs?: Record<string, any>;
346
+ compaction?: EventCompaction;
347
+ rewindBeforeInvocationId?: string;
348
+ });
349
+ }
350
+
351
+ /**
352
+ * Options for creating an Event.
353
+ */
354
+ interface EventOpts {
355
+ invocationId?: string;
356
+ author: string;
357
+ actions?: EventActions;
358
+ longRunningToolIds?: Set<string>;
280
359
  branch?: string;
281
360
  id?: string;
282
361
  timestamp?: number;
@@ -483,6 +562,75 @@ interface EventsCompactionConfig {
483
562
  */
484
563
  declare function runCompactionForSlidingWindow(config: EventsCompactionConfig, session: Session, sessionService: BaseSessionService, summarizer: EventsSummarizer): Promise<void>;
485
564
 
565
+ interface LoggerOpts {
566
+ name: string;
567
+ }
568
+ declare class Logger {
569
+ name: string;
570
+ isDebugEnabled: boolean;
571
+ constructor({ name }: LoggerOpts);
572
+ debug(message: string, ...args: any[]): void;
573
+ info(message: string, ...args: any[]): void;
574
+ warn(message: string, ...args: any[]): void;
575
+ error(message: string, ...args: any[]): void;
576
+ private log;
577
+ private extractMeta;
578
+ private formatArgs;
579
+ private parseStackFrames;
580
+ private stringify;
581
+ private capitalize;
582
+ formatBox(params: {
583
+ title: string;
584
+ description: string;
585
+ lines?: string[];
586
+ width?: number;
587
+ maxWidthPct?: number;
588
+ color?: (txt: string) => string;
589
+ pad?: number;
590
+ borderChar?: string;
591
+ wrap?: boolean;
592
+ }): string;
593
+ /**
594
+ * Structured warning with code, suggestion, context.
595
+ */
596
+ warnStructured(warning: {
597
+ code: string;
598
+ message: string;
599
+ suggestion?: string;
600
+ context?: Record<string, any>;
601
+ severity?: "warn" | "info" | "error";
602
+ timestamp?: string;
603
+ }, opts?: {
604
+ format?: "pretty" | "json" | "text";
605
+ verbose?: boolean;
606
+ }): void;
607
+ debugStructured(title: string, data: Record<string, any>): void;
608
+ debugArray(title: string, items: Array<Record<string, any>>): void;
609
+ private objectToLines;
610
+ private arrayToLines;
611
+ }
612
+
613
+ declare class CacheMetadata {
614
+ readonly cacheName?: string | null;
615
+ readonly expireTime?: number | null;
616
+ readonly fingerprint: string;
617
+ readonly invocationsUsed?: number | null;
618
+ readonly contentsCount: number;
619
+ readonly createdAt?: number | null;
620
+ constructor(params: CacheMetadataParams);
621
+ get expireSoon(): boolean;
622
+ copy(update?: Partial<CacheMetadataParams>): CacheMetadata;
623
+ toString(): string;
624
+ }
625
+ interface CacheMetadataParams {
626
+ cacheName?: string | null;
627
+ expireTime?: number | null;
628
+ fingerprint: string;
629
+ invocationsUsed?: number | null;
630
+ contentsCount: number;
631
+ createdAt?: number | null;
632
+ }
633
+
486
634
  interface Candidate {
487
635
  content?: Content;
488
636
  groundingMetadata?: GroundingMetadata;
@@ -509,6 +657,7 @@ declare class LlmResponse {
509
657
  errorMessage?: string;
510
658
  interrupted?: boolean;
511
659
  customMetadata?: Record<string, any>;
660
+ cacheMetadata?: CacheMetadata;
512
661
  usageMetadata?: GenerateContentResponseUsageMetadata;
513
662
  candidateIndex?: number;
514
663
  finishReason?: string;
@@ -567,767 +716,127 @@ declare abstract class BaseLLMConnection {
567
716
  }
568
717
 
569
718
  /**
570
- * The BaseLlm class.
719
+ * Configuration for context caching across all agents in an app.
720
+ *
721
+ * This configuration enables and controls context caching behavior for
722
+ * all LLM agents in an app. When this config is present on an app, context
723
+ * caching is enabled for all agents. When absent (null), context caching
724
+ * is disabled.
725
+ *
726
+ * Context caching can significantly reduce costs and improve response times
727
+ * by reusing previously processed context across multiple requests.
728
+ */
729
+ declare class ContextCacheConfig implements ContextCacheConfigProps {
730
+ /** Maximum number of invocations to reuse the same cache before refreshing it. */
731
+ cacheIntervals: number;
732
+ /** Time-to-live for cache in seconds. */
733
+ ttlSeconds: number;
734
+ /** Minimum estimated request tokens required to enable caching. */
735
+ minTokens: number;
736
+ constructor(params?: Partial<ContextCacheConfigProps>);
737
+ get ttlString(): string;
738
+ toJSON(): {
739
+ cacheIntervals: number;
740
+ ttlSeconds: number;
741
+ minTokens: number;
742
+ };
743
+ }
744
+ declare const contextCacheConfigSchema: z$1.ZodObject<{
745
+ cacheIntervals: z$1.ZodDefault<z$1.ZodNumber>;
746
+ ttlSeconds: z$1.ZodDefault<z$1.ZodNumber>;
747
+ minTokens: z$1.ZodDefault<z$1.ZodNumber>;
748
+ }, z$1.core.$strip>;
749
+ type ContextCacheConfigProps = z$1.infer<typeof contextCacheConfigSchema>;
750
+
751
+ /**
752
+ * A state dict that maintain the current value and the pending-commit delta.
571
753
  */
572
- declare abstract class BaseLlm {
754
+ declare class State {
755
+ static readonly APP_PREFIX = "app:";
756
+ static readonly USER_PREFIX = "user:";
757
+ static readonly TEMP_PREFIX = "temp:";
758
+ private readonly _value;
759
+ private readonly _delta;
573
760
  /**
574
- * The name of the LLM, e.g. gemini-2.5-flash or gemini-2.5-flash-001.
761
+ * Constructor for State
762
+ *
763
+ * @param value - The current value of the state dict.
764
+ * @param delta - The delta change to the current value that hasn't been committed.
575
765
  */
576
- model: string;
577
- protected logger: Logger;
766
+ constructor(value: Record<string, any>, delta: Record<string, any>);
578
767
  /**
579
- * Constructor for BaseLlm
768
+ * Returns the value of the state dict for the given key.
580
769
  */
581
- constructor(model: string);
770
+ get(key: string, defaultValue?: any): any;
582
771
  /**
583
- * Returns a list of supported models in regex for LLMRegistry
772
+ * Sets the value of the state dict for the given key.
584
773
  */
585
- static supportedModels(): string[];
774
+ set(key: string, value: any): void;
586
775
  /**
587
- * Generates one content from the given contents and tools.
588
- *
589
- * @param llmRequest LlmRequest, the request to send to the LLM.
590
- * @param stream bool = false, whether to do streaming call.
591
- * @returns a generator of LlmResponse.
592
- *
593
- * For non-streaming call, it will only yield one LlmResponse.
594
- *
595
- * For streaming call, it may yield more than one response, but all yielded
596
- * responses should be treated as one response by merging the
597
- * parts list.
776
+ * Whether the state dict contains the given key.
598
777
  */
599
- generateContentAsync(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
778
+ has(key: string): boolean;
600
779
  /**
601
- * Implementation method to be overridden by subclasses.
602
- * This replaces the abstract generateContentAsync method.
780
+ * Whether the state has pending delta.
603
781
  */
604
- protected abstract generateContentAsyncImpl(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
782
+ hasDelta(): boolean;
605
783
  /**
606
- * Appends a user content, so that model can continue to output.
607
- *
608
- * @param llmRequest LlmRequest, the request to send to the LLM.
784
+ * Updates the state dict with the given delta.
609
785
  */
610
- protected maybeAppendUserContent(llmRequest: LlmRequest): void;
786
+ update(delta: Record<string, any>): void;
611
787
  /**
612
- * Creates a live connection to the LLM.
613
- *
614
- * @param llmRequest LlmRequest, the request to send to the LLM.
615
- * @returns BaseLLMConnection, the connection to the LLM.
788
+ * Returns the state dict.
616
789
  */
617
- connect(_llmRequest: LlmRequest): BaseLLMConnection;
790
+ toDict(): Record<string, any>;
791
+ /**
792
+ * Array-like access for getting values.
793
+ * Returns the value of the state dict for the given key.
794
+ */
795
+ [key: string]: any;
796
+ /**
797
+ * Proxy handler for array-like access
798
+ */
799
+ private static createProxy;
800
+ /**
801
+ * Factory method to create a proxied State instance
802
+ */
803
+ static create(value: Record<string, any>, delta: Record<string, any>): State;
618
804
  }
619
805
 
620
806
  /**
621
- * LLM-based event summarizer that uses a language model to generate summaries.
807
+ * Base readonly context class.
622
808
  */
623
- declare class LlmEventSummarizer implements EventsSummarizer {
624
- private model;
625
- private prompt;
809
+ declare class ReadonlyContext {
810
+ protected readonly _invocationContext: InvocationContext;
811
+ constructor(invocationContext: InvocationContext);
626
812
  /**
627
- * Creates a new LLM event summarizer.
628
- * @param model - The LLM model to use for summarization
629
- * @param prompt - Optional custom prompt template. Use {events} as placeholder for event content.
813
+ * The user content that started this invocation. READONLY field.
630
814
  */
631
- constructor(model: BaseLlm, prompt?: string);
815
+ get userContent(): Content | undefined;
632
816
  /**
633
- * Summarizes events using the configured LLM.
817
+ * The current invocation id.
634
818
  */
635
- maybeSummarizeEvents(events: Event[]): Promise<Event | undefined>;
819
+ get invocationId(): string;
636
820
  /**
637
- * Formats events into a readable text format for summarization.
821
+ * The name of the agent that is currently running.
638
822
  */
639
- private formatEventsForSummarization;
640
- }
641
-
642
- type index$7_Event = Event;
643
- declare const index$7_Event: typeof Event;
644
- type index$7_EventActions = EventActions;
645
- declare const index$7_EventActions: typeof EventActions;
646
- type index$7_EventCompaction = EventCompaction;
647
- type index$7_EventsCompactionConfig = EventsCompactionConfig;
648
- type index$7_EventsSummarizer = EventsSummarizer;
649
- type index$7_LlmEventSummarizer = LlmEventSummarizer;
650
- declare const index$7_LlmEventSummarizer: typeof LlmEventSummarizer;
651
- declare const index$7_runCompactionForSlidingWindow: typeof runCompactionForSlidingWindow;
652
- declare namespace index$7 {
653
- export { index$7_Event as Event, index$7_EventActions as EventActions, type index$7_EventCompaction as EventCompaction, type index$7_EventsCompactionConfig as EventsCompactionConfig, type index$7_EventsSummarizer as EventsSummarizer, index$7_LlmEventSummarizer as LlmEventSummarizer, index$7_runCompactionForSlidingWindow as runCompactionForSlidingWindow };
654
- }
655
-
656
- declare abstract class BasePlugin {
657
- readonly name: string;
658
- constructor(name: string);
659
- onUserMessageCallback?(_params: {
660
- invocationContext: InvocationContext;
661
- userMessage: Content;
662
- }): Promise<Content | undefined>;
663
- beforeRunCallback?(_params: {
664
- invocationContext: InvocationContext;
665
- }): Promise<Event | undefined>;
666
- onEventCallback?(_params: {
667
- invocationContext: InvocationContext;
668
- event: Event;
669
- }): Promise<Event | undefined>;
670
- afterRunCallback?(_params: {
671
- invocationContext: InvocationContext;
672
- result?: any;
673
- }): Promise<void>;
674
- close?(): Promise<void>;
675
- beforeAgentCallback?(_params: {
676
- agent: BaseAgent;
677
- callbackContext: CallbackContext;
678
- }): Promise<Content | undefined>;
679
- afterAgentCallback?(_params: {
680
- agent: BaseAgent;
681
- callbackContext: CallbackContext;
682
- result?: any;
683
- }): Promise<Content | undefined>;
684
- beforeModelCallback?(_params: {
685
- callbackContext: CallbackContext;
686
- llmRequest: LlmRequest;
687
- }): Promise<LlmResponse | undefined>;
688
- afterModelCallback?(_params: {
689
- callbackContext: CallbackContext;
690
- llmResponse: LlmResponse;
691
- llmRequest?: LlmRequest;
692
- }): Promise<LlmResponse | undefined>;
693
- onModelErrorCallback?(_params: {
694
- callbackContext: CallbackContext;
695
- llmRequest: LlmRequest;
696
- error: unknown;
697
- }): Promise<LlmResponse | undefined>;
698
- beforeToolCallback?(_params: {
699
- tool: BaseTool;
700
- toolArgs: Record<string, any>;
701
- toolContext: ToolContext;
702
- }): Promise<Record<string, any> | undefined>;
703
- afterToolCallback?(_params: {
704
- tool: BaseTool;
705
- toolArgs: Record<string, any>;
706
- toolContext: ToolContext;
707
- result: Record<string, any>;
708
- }): Promise<Record<string, any> | undefined>;
709
- onToolErrorCallback?(_params: {
710
- tool: BaseTool;
711
- toolArgs: Record<string, any>;
712
- toolContext: ToolContext;
713
- error: unknown;
714
- }): Promise<Record<string, any> | undefined>;
715
- }
716
-
717
- declare const pluginCallbackNameSchema: z$1.ZodEnum<{
718
- onUserMessageCallback: "onUserMessageCallback";
719
- beforeRunCallback: "beforeRunCallback";
720
- afterRunCallback: "afterRunCallback";
721
- onEventCallback: "onEventCallback";
722
- beforeAgentCallback: "beforeAgentCallback";
723
- afterAgentCallback: "afterAgentCallback";
724
- beforeToolCallback: "beforeToolCallback";
725
- afterToolCallback: "afterToolCallback";
726
- beforeModelCallback: "beforeModelCallback";
727
- afterModelCallback: "afterModelCallback";
728
- onToolErrorCallback: "onToolErrorCallback";
729
- onModelErrorCallback: "onModelErrorCallback";
730
- }>;
731
- type PluginCallbackName = z$1.infer<typeof pluginCallbackNameSchema>;
732
- declare class PluginManager {
733
- readonly plugins: BasePlugin[];
734
- private readonly closeTimeout;
735
- constructor(opts?: {
736
- plugins?: BasePlugin[];
737
- closeTimeout?: number;
738
- });
739
- /** Register a plugin (unique names) */
740
- registerPlugin(plugin: BasePlugin): void;
741
- getPlugin(name: string): BasePlugin | undefined;
742
- getPlugins(): BasePlugin[];
743
- runOnUserMessageCallback(params: {
744
- userMessage: Content;
745
- invocationContext: InvocationContext;
746
- }): Promise<any>;
747
- runBeforeRunCallback(params: {
748
- invocationContext: InvocationContext;
749
- }): Promise<any>;
750
- runAfterRunCallback(params: {
751
- invocationContext: InvocationContext;
752
- }): Promise<any>;
753
- runOnEventCallback(params: {
754
- invocationContext: InvocationContext;
755
- event: Event;
756
- }): Promise<any>;
757
- runBeforeAgentCallback(params: {
758
- agent: BaseAgent;
759
- callbackContext: CallbackContext;
760
- }): Promise<any>;
761
- runAfterAgentCallback(params: {
762
- agent: BaseAgent;
763
- callbackContext: CallbackContext;
764
- }): Promise<any>;
765
- runBeforeToolCallback(params: {
766
- tool: BaseTool;
767
- toolArgs: Record<string, any>;
768
- toolContext: ToolContext;
769
- }): Promise<any>;
770
- runAfterToolCallback(params: {
771
- tool: BaseTool;
772
- toolArgs: Record<string, any>;
773
- toolContext: ToolContext;
774
- result: Record<string, any>;
775
- }): Promise<any>;
776
- runBeforeModelCallback(params: {
777
- callbackContext: CallbackContext;
778
- llmRequest: LlmRequest;
779
- }): Promise<any>;
780
- runAfterModelCallback(params: {
781
- callbackContext: CallbackContext;
782
- llmResponse: LlmResponse;
783
- }): Promise<any>;
784
- runOnToolErrorCallback(params: {
785
- tool: BaseTool;
786
- toolArgs: Record<string, any>;
787
- toolContext: ToolContext;
788
- error: Error;
789
- }): Promise<any>;
790
- runOnModelErrorCallback(params: {
791
- callbackContext: CallbackContext;
792
- llmRequest: LlmRequest;
793
- error: Error;
794
- }): Promise<any>;
795
- private runCallbacks;
796
- close(): Promise<void>;
797
- }
798
-
799
- /**
800
- * Request send to live agents.
801
- */
802
- declare class LiveRequest {
803
- /**
804
- * If set, send the content to the model in turn-by-turn mode.
805
- */
806
- content?: Content;
807
- /**
808
- * If set, send the blob to the model in realtime mode.
809
- */
810
- blob?: Blob;
811
- /**
812
- * If set, close the queue.
813
- */
814
- close: boolean;
815
- constructor(options?: {
816
- content?: Content;
817
- blob?: Blob;
818
- close?: boolean;
819
- });
820
- }
821
- /**
822
- * Queue used to send LiveRequest in a live(bidirectional streaming) way.
823
- */
824
- declare class LiveRequestQueue {
825
- private _queue;
826
- private _waiters;
827
- private _closed;
828
- /**
829
- * Close the queue.
830
- */
831
- close(): void;
832
- /**
833
- * Send content to the queue.
834
- */
835
- sendContent(content: Content): void;
836
- /**
837
- * Send realtime blob to the queue.
838
- */
839
- sendRealtime(blob: Blob): void;
840
- /**
841
- * Send a LiveRequest to the queue.
842
- */
843
- send(req: LiveRequest): void;
844
- /**
845
- * Get the next LiveRequest from the queue.
846
- */
847
- get(): Promise<LiveRequest>;
848
- }
849
-
850
- /**
851
- * Manages streaming tool related resources during invocation.
852
- */
853
- declare class ActiveStreamingTool {
854
- /**
855
- * The active task of this streaming tool.
856
- */
857
- task?: Promise<any>;
858
- /**
859
- * The active (input) streams of this streaming tool.
860
- */
861
- stream?: LiveRequestQueue;
862
- constructor(options?: {
863
- task?: Promise<any>;
864
- stream?: LiveRequestQueue;
865
- });
866
- }
867
-
868
- /**
869
- * Single agent callback type
870
- */
871
- type SingleAgentCallback = (callbackContext: CallbackContext) => Promise<Content | undefined> | Content | undefined;
872
- /**
873
- * Before agent callback type
874
- */
875
- type BeforeAgentCallback = SingleAgentCallback | SingleAgentCallback[];
876
- /**
877
- * After agent callback type
878
- */
879
- type AfterAgentCallback = SingleAgentCallback | SingleAgentCallback[];
880
- /**
881
- * Base class for all agents in Agent Development Kit.
882
- */
883
- declare abstract class BaseAgent {
884
- /**
885
- * The agent's name.
886
- * Agent name must be a valid identifier and unique within the agent tree.
887
- * Agent name cannot be "user", since it's reserved for end-user's input.
888
- */
889
- name: string;
890
- /**
891
- * Description about the agent's capability.
892
- * The model uses this to determine whether to delegate control to the agent.
893
- * One-line description is enough and preferred.
894
- */
895
- description: string;
896
- /**
897
- * The parent agent of this agent.
898
- * Note that an agent can ONLY be added as sub-agent once.
899
- * If you want to add one agent twice as sub-agent, consider to create two agent
900
- * instances with identical config, but with different name and add them to the
901
- * agent tree.
902
- */
903
- parentAgent?: BaseAgent;
904
- /**
905
- * The sub-agents of this agent.
906
- */
907
- subAgents: BaseAgent[];
908
- /**
909
- * Callback or list of callbacks to be invoked before the agent run.
910
- * When a list of callbacks is provided, the callbacks will be called in the
911
- * order they are listed until a callback does not return undefined.
912
- *
913
- * Args:
914
- * callbackContext: The callback context.
915
- *
916
- * Returns:
917
- * Content | undefined: The content to return to the user.
918
- * When the content is present, the agent run will be skipped and the
919
- * provided content will be returned to user.
920
- */
921
- beforeAgentCallback?: BeforeAgentCallback;
922
- /**
923
- * Callback or list of callbacks to be invoked after the agent run.
924
- * When a list of callbacks is provided, the callbacks will be called in the
925
- * order they are listed until a callback does not return undefined.
926
- *
927
- * Args:
928
- * callbackContext: The callback context.
929
- *
930
- * Returns:
931
- * Content | undefined: The content to return to the user.
932
- * When the content is present, the provided content will be used as agent
933
- * response and appended to event history as agent response.
934
- */
935
- afterAgentCallback?: AfterAgentCallback;
936
- /**
937
- * Constructor for BaseAgent
938
- */
939
- constructor(config: {
940
- name: string;
941
- description?: string;
942
- subAgents?: BaseAgent[];
943
- beforeAgentCallback?: BeforeAgentCallback;
944
- afterAgentCallback?: AfterAgentCallback;
945
- });
946
- /**
947
- * Entry method to run an agent via text-based conversation.
948
- */
949
- runAsync(parentContext: InvocationContext): AsyncGenerator<Event, void, unknown>;
950
- /**
951
- * Entry method to run an agent via video/audio-based conversation.
952
- */
953
- runLive(parentContext: InvocationContext): AsyncGenerator<Event, void, unknown>;
954
- /**
955
- * Internal implementation for runAsync
956
- */
957
- private runAsyncInternal;
958
- /**
959
- * Internal implementation for runLive
960
- */
961
- private runLiveInternal;
962
- /**
963
- * Core logic to run this agent via text-based conversation.
964
- *
965
- * @param ctx - The invocation context for this agent.
966
- * @yields Event - The events generated by the agent.
967
- */
968
- protected runAsyncImpl(_ctx: InvocationContext): AsyncGenerator<Event, void, unknown>;
969
- /**
970
- * Core logic to run this agent via video/audio-based conversation.
971
- *
972
- * @param ctx - The invocation context for this agent.
973
- * @yields Event - The events generated by the agent.
974
- */
975
- protected runLiveImpl(_ctx: InvocationContext): AsyncGenerator<Event, void, unknown>;
976
- /**
977
- * Gets the root agent of this agent.
978
- */
979
- get rootAgent(): BaseAgent;
980
- /**
981
- * Finds the agent with the given name in this agent and its descendants.
982
- *
983
- * @param name - The name of the agent to find.
984
- * @returns The agent with the matching name, or undefined if no such agent is found.
985
- */
986
- findAgent(name: string): BaseAgent | undefined;
987
- /**
988
- * Finds the agent with the given name in this agent's descendants.
989
- *
990
- * @param name - The name of the agent to find.
991
- * @returns The agent with the matching name, or undefined if no such agent is found.
992
- */
993
- findSubAgent(name: string): BaseAgent | undefined;
994
- /**
995
- * Creates a new invocation context for this agent.
996
- */
997
- private createInvocationContext;
998
- /**
999
- * The resolved beforeAgentCallback field as a list of SingleAgentCallback.
1000
- * This method is only for use by Agent Development Kit.
1001
- */
1002
- get canonicalBeforeAgentCallbacks(): SingleAgentCallback[];
1003
- /**
1004
- * The resolved afterAgentCallback field as a list of SingleAgentCallback.
1005
- * This method is only for use by Agent Development Kit.
1006
- */
1007
- get canonicalAfterAgentCallbacks(): SingleAgentCallback[];
1008
- /**
1009
- * Runs the beforeAgentCallback if it exists.
1010
- * First runs plugin callbacks, then runs canonical callbacks if no override provided.
1011
- *
1012
- * @returns An event if callback provides content or changed state.
1013
- */
1014
- private handleBeforeAgentCallback;
1015
- /**
1016
- * Runs the afterAgentCallback if it exists.
1017
- * First runs plugin callbacks, then runs canonical callbacks if no override provided.
1018
- *
1019
- * @returns An event if callback provides content or changed state.
1020
- */
1021
- private handleAfterAgentCallback;
1022
- /**
1023
- * Validates the agent name.
1024
- */
1025
- private validateName;
1026
- /**
1027
- * Sets parent agent for sub-agents.
1028
- */
1029
- private setParentAgentForSubAgents;
1030
- }
1031
-
1032
- /**
1033
- * Streaming mode options for agent execution
1034
- */
1035
- declare enum StreamingMode {
1036
- NONE = "NONE",
1037
- SSE = "sse",
1038
- BIDI = "bidi"
1039
- }
1040
- /**
1041
- * Configs for runtime behavior of agents
1042
- */
1043
- declare class RunConfig {
1044
- /**
1045
- * Speech configuration for the live agent
1046
- */
1047
- speechConfig?: SpeechConfig;
1048
- /**
1049
- * The output modalities. If not set, it's default to AUDIO.
1050
- */
1051
- responseModalities?: string[];
1052
- /**
1053
- * Whether or not to save the input blobs as artifacts.
1054
- */
1055
- saveInputBlobsAsArtifacts: boolean;
1056
- /**
1057
- * Whether to support CFC (Compositional Function Calling). Only applicable for
1058
- * StreamingMode.SSE. If it's true. the LIVE API will be invoked. Since only LIVE
1059
- * API supports CFC
1060
- *
1061
- * @warning This feature is **experimental** and its API or behavior may change
1062
- * in future releases.
1063
- */
1064
- supportCFC: boolean;
1065
- /**
1066
- * Streaming mode, None or StreamingMode.SSE or StreamingMode.BIDI.
1067
- */
1068
- streamingMode: StreamingMode;
1069
- /**
1070
- * Output transcription for live agents with audio response.
1071
- */
1072
- outputAudioTranscription?: AudioTranscriptionConfig;
1073
- /**
1074
- * Input transcription for live agents with audio input from user.
1075
- */
1076
- inputAudioTranscription?: AudioTranscriptionConfig;
1077
- /**
1078
- * Realtime input config for live agents with audio input from user.
1079
- */
1080
- realtimeInputConfig?: RealtimeInputConfig;
1081
- /**
1082
- * If enabled, the model will detect emotions and adapt its responses accordingly.
1083
- */
1084
- enableAffectiveDialog?: boolean;
1085
- /**
1086
- * Configures the proactivity of the model. This allows the model to respond
1087
- * proactively to the input and to ignore irrelevant input.
1088
- */
1089
- proactivity?: ProactivityConfig;
1090
- /**
1091
- * A limit on the total number of llm calls for a given run.
1092
- *
1093
- * Valid Values:
1094
- * - More than 0 and less than Number.MAX_SAFE_INTEGER: The bound on the number of llm
1095
- * calls is enforced, if the value is set in this range.
1096
- * - Less than or equal to 0: This allows for unbounded number of llm calls.
1097
- */
1098
- maxLlmCalls: number;
1099
- constructor(config?: Partial<RunConfig>);
1100
- /**
1101
- * Validates the maxLlmCalls value
1102
- */
1103
- private validateMaxLlmCalls;
1104
- }
1105
-
1106
- /**
1107
- * Store the data that can be used for transcription.
1108
- */
1109
- declare class TranscriptionEntry {
1110
- /**
1111
- * The role that created this data, typically "user" or "model". For function
1112
- * call, this is None.
1113
- */
1114
- role?: string;
1115
- /**
1116
- * The data that can be used for transcription
1117
- */
1118
- data: Blob | Content;
1119
- constructor(options: {
1120
- role?: string;
1121
- data: Blob | Content;
1122
- });
1123
- }
1124
-
1125
- /**
1126
- * Transfer context for multi-agent workflows
1127
- * Tracks the chain of agent transfers for telemetry
1128
- */
1129
- interface TransferContext {
1130
- /** Array of agent names in transfer order */
1131
- transferChain: string[];
1132
- /** Current depth in transfer chain (0 = root) */
1133
- transferDepth: number;
1134
- /** Name of the root agent that started the chain */
1135
- rootAgentName: string;
1136
- /** Span context of the root agent for linking */
1137
- rootSpanContext?: SpanContext;
1138
- /** Span context of the previous agent in the chain */
1139
- previousSpanContext?: SpanContext;
1140
- }
1141
- /**
1142
- * Error thrown when the number of LLM calls exceed the limit.
1143
- */
1144
- declare class LlmCallsLimitExceededError extends Error {
1145
- constructor(message: string);
1146
- }
1147
- /**
1148
- * Generates a new invocation context ID
1149
- */
1150
- declare function newInvocationContextId(): string;
1151
- /**
1152
- * An invocation context represents the data of a single invocation of an agent.
1153
- *
1154
- * An invocation:
1155
- * 1. Starts with a user message and ends with a final response.
1156
- * 2. Can contain one or multiple agent calls.
1157
- * 3. Is handled by runner.run_async().
1158
- *
1159
- * An invocation runs an agent until it does not request to transfer to another
1160
- * agent.
1161
- *
1162
- * An agent call:
1163
- * 1. Is handled by agent.run().
1164
- * 2. Ends when agent.run() ends.
1165
- *
1166
- * An LLM agent call is an agent with a BaseLLMFlow.
1167
- * An LLM agent call can contain one or multiple steps.
1168
- *
1169
- * An LLM agent runs steps in a loop until:
1170
- * 1. A final response is generated.
1171
- * 2. The agent transfers to another agent.
1172
- * 3. The end_invocation is set to true by any callbacks or tools.
1173
- *
1174
- * A step:
1175
- * 1. Calls the LLM only once and yields its response.
1176
- * 2. Calls the tools and yields their responses if requested.
1177
- *
1178
- * The summarization of the function response is considered another step, since
1179
- * it is another llm call.
1180
- *
1181
- * A step ends when it's done calling llm and tools, or if the end_invocation
1182
- * is set to true at any time.
1183
- *
1184
- *
1185
- * ┌─────────────────────── invocation ──────────────────────────┐
1186
- * ┌──────────── llm_agent_call_1 ────────────┐ ┌─ agent_call_2 ─┐
1187
- * ┌──── step_1 ────────┐ ┌───── step_2 ──────┐
1188
- * [call_llm] [call_tool] [call_llm] [transfer]
1189
- *
1190
- */
1191
- declare class InvocationContext {
1192
- readonly artifactService?: BaseArtifactService;
1193
- readonly sessionService: BaseSessionService;
1194
- readonly memoryService?: BaseMemoryService;
1195
- /**
1196
- * The plugin manager for this invocation context.
1197
- */
1198
- readonly pluginManager: PluginManager;
1199
- /**
1200
- * The id of this invocation context. Readonly.
1201
- */
1202
- readonly invocationId: string;
1203
- /**
1204
- * The branch of the invocation context.
1205
- *
1206
- * The format is like agent_1.agent_2.agent_3, where agent_1 is the parent of
1207
- * agent_2, and agent_2 is the parent of agent_3.
1208
- *
1209
- * Branch is used when multiple sub-agents shouldn't see their peer agents'
1210
- * conversation history.
1211
- */
1212
- readonly branch?: string;
1213
- /**
1214
- * The current agent of this invocation context. Readonly.
1215
- */
1216
- agent: BaseAgent;
1217
- /**
1218
- * The user content that started this invocation. Readonly.
1219
- */
1220
- readonly userContent?: Content;
1221
- /**
1222
- * The current session of this invocation context. Readonly.
1223
- */
1224
- readonly session: Session;
1225
- /**
1226
- * Whether to end this invocation.
1227
- *
1228
- * Set to True in callbacks or tools to terminate this invocation.
1229
- */
1230
- endInvocation: boolean;
1231
- /**
1232
- * The queue to receive live requests.
1233
- */
1234
- liveRequestQueue?: LiveRequestQueue;
1235
- /**
1236
- * The running streaming tools of this invocation.
1237
- */
1238
- activeStreamingTools?: Record<string, ActiveStreamingTool>;
1239
- /**
1240
- * Caches necessary, data audio or contents, that are needed by transcription.
1241
- */
1242
- transcriptionCache?: TranscriptionEntry[];
1243
- /**
1244
- * Configurations for live agents under this invocation.
1245
- */
1246
- runConfig?: RunConfig;
1247
- /**
1248
- * Transfer context for multi-agent workflows
1249
- * Tracks agent transfer chain for telemetry
1250
- */
1251
- transferContext?: TransferContext;
1252
- /**
1253
- * A container to keep track of different kinds of costs incurred as a part
1254
- * of this invocation.
1255
- */
1256
- private readonly _invocationCostManager;
1257
- /**
1258
- * Constructor for InvocationContext
1259
- */
1260
- constructor(options: {
1261
- artifactService?: BaseArtifactService;
1262
- sessionService: BaseSessionService;
1263
- memoryService?: BaseMemoryService;
1264
- pluginManager: PluginManager;
1265
- invocationId?: string;
1266
- branch?: string;
1267
- agent: BaseAgent;
1268
- userContent?: Content;
1269
- session: Session;
1270
- endInvocation?: boolean;
1271
- liveRequestQueue?: LiveRequestQueue;
1272
- activeStreamingTools?: Record<string, ActiveStreamingTool>;
1273
- transcriptionCache?: TranscriptionEntry[];
1274
- runConfig?: RunConfig;
1275
- transferContext?: TransferContext;
1276
- });
1277
- /**
1278
- * App name from the session
1279
- */
1280
- get appName(): string;
1281
- /**
1282
- * User ID from the session
1283
- */
1284
- get userId(): string;
1285
- /**
1286
- * Tracks number of llm calls made.
1287
- *
1288
- * @throws {LlmCallsLimitExceededError} If number of llm calls made exceed the set threshold.
1289
- */
1290
- incrementLlmCallCount(): void;
1291
- /**
1292
- * Creates a child invocation context for a sub-agent
1293
- */
1294
- createChildContext(agent: BaseAgent): InvocationContext;
1295
- }
1296
-
1297
- /**
1298
- * Base readonly context class.
1299
- */
1300
- declare class ReadonlyContext {
1301
- protected readonly _invocationContext: InvocationContext;
1302
- constructor(invocationContext: InvocationContext);
1303
- /**
1304
- * The user content that started this invocation. READONLY field.
1305
- */
1306
- get userContent(): Content | undefined;
1307
- /**
1308
- * The current invocation id.
1309
- */
1310
- get invocationId(): string;
1311
- /**
1312
- * The name of the agent that is currently running.
1313
- */
1314
- get agentName(): string;
1315
- /**
1316
- * The application name for this invocation. READONLY field.
1317
- */
1318
- get appName(): string;
1319
- /**
1320
- * The user ID for this invocation. READONLY field.
1321
- */
1322
- get userId(): string;
1323
- /**
1324
- * The session ID for this invocation. READONLY field.
1325
- */
1326
- get sessionId(): string;
1327
- /**
1328
- * The state of the current session. READONLY field.
1329
- */
1330
- get state(): Readonly<Record<string, any>>;
823
+ get agentName(): string;
824
+ /**
825
+ * The application name for this invocation. READONLY field.
826
+ */
827
+ get appName(): string;
828
+ /**
829
+ * The user ID for this invocation. READONLY field.
830
+ */
831
+ get userId(): string;
832
+ /**
833
+ * The session ID for this invocation. READONLY field.
834
+ */
835
+ get sessionId(): string;
836
+ /**
837
+ * The state of the current session. READONLY field.
838
+ */
839
+ get state(): Readonly<Record<string, any>>;
1331
840
  }
1332
841
 
1333
842
  /**
@@ -1665,97 +1174,322 @@ interface CodeExecutionResult {
1665
1174
  }
1666
1175
  declare class CodeExecutionUtils {
1667
1176
  /**
1668
- * Gets the file content as a base64-encoded string
1177
+ * Gets the file content as a base64-encoded string
1178
+ */
1179
+ static getEncodedFileContent(data: string | ArrayBuffer): string;
1180
+ private static isBase64Encoded;
1181
+ /**
1182
+ * Extracts the first code block from the content and truncates everything after it
1183
+ */
1184
+ static extractCodeAndTruncateContent(content: Content, codeBlockDelimiters: Array<[string, string]>): string | null;
1185
+ private static escapeRegex;
1186
+ /**
1187
+ * Builds an executable code part with code string
1188
+ */
1189
+ static buildExecutableCodePart(code: string): Part;
1190
+ /**
1191
+ * Builds the code execution result part from the code execution result
1192
+ */
1193
+ static buildCodeExecutionResultPart(codeExecutionResult: CodeExecutionResult): Part;
1194
+ /**
1195
+ * Converts the code execution parts to text parts in a Content
1196
+ */
1197
+ static convertCodeExecutionParts(content: Content, codeBlockDelimiter: [string, string], executionResultDelimiters: [string, string]): void;
1198
+ }
1199
+
1200
+ interface BaseCodeExecutorConfig {
1201
+ /**
1202
+ * If true, extract and process data files from the model request
1203
+ * and attach them to the code executor.
1204
+ * Supported data file MimeTypes are [text/csv].
1205
+ * Default to false.
1206
+ */
1207
+ optimizeDataFile?: boolean;
1208
+ /**
1209
+ * Whether the code executor is stateful. Default to false.
1210
+ */
1211
+ stateful?: boolean;
1212
+ /**
1213
+ * The number of attempts to retry on consecutive code execution errors.
1214
+ * Default to 2.
1215
+ */
1216
+ errorRetryAttempts?: number;
1217
+ /**
1218
+ * The list of the enclosing delimiters to identify the code blocks.
1219
+ * For example, the delimiter ['```python\n', '\n```'] can be
1220
+ * used to identify code blocks with the following format:
1221
+ *
1222
+ * ```python
1223
+ * print("hello")
1224
+ * ```
1225
+ */
1226
+ codeBlockDelimiters?: Array<[string, string]>;
1227
+ /**
1228
+ * The delimiters to format the code execution result.
1229
+ */
1230
+ executionResultDelimiters?: [string, string];
1231
+ }
1232
+ declare abstract class BaseCodeExecutor {
1233
+ protected readonly config: Required<BaseCodeExecutorConfig>;
1234
+ constructor(config?: BaseCodeExecutorConfig);
1235
+ /**
1236
+ * Executes code and returns the code execution result.
1237
+ */
1238
+ abstract executeCode(invocationContext: InvocationContext, codeExecutionInput: CodeExecutionInput): Promise<CodeExecutionResult>;
1239
+ get optimizeDataFile(): boolean;
1240
+ get stateful(): boolean;
1241
+ get errorRetryAttempts(): number;
1242
+ get codeBlockDelimiters(): Array<[string, string]>;
1243
+ get executionResultDelimiters(): [string, string];
1244
+ }
1245
+
1246
+ /**
1247
+ * Abstract base class for all planners.
1248
+ *
1249
+ * The planner allows the agent to generate plans for the queries to guide its action.
1250
+ */
1251
+ declare abstract class BasePlanner {
1252
+ /**
1253
+ * Builds the system instruction to be appended to the LLM request for planning.
1254
+ *
1255
+ * @param readonlyContext The readonly context of the invocation
1256
+ * @param llmRequest The LLM request. Readonly.
1257
+ * @returns The planning system instruction, or undefined if no instruction is needed
1258
+ */
1259
+ abstract buildPlanningInstruction(readonlyContext: ReadonlyContext, llmRequest: LlmRequest): string | undefined;
1260
+ /**
1261
+ * Processes the LLM response for planning.
1262
+ *
1263
+ * @param callbackContext The callback context of the invocation
1264
+ * @param responseParts The LLM response parts. Readonly.
1265
+ * @returns The processed response parts, or undefined if no processing is needed
1266
+ */
1267
+ abstract processPlanningResponse(callbackContext: CallbackContext, responseParts: Part[]): Part[] | undefined;
1268
+ }
1269
+
1270
+ declare abstract class BasePlugin {
1271
+ readonly name: string;
1272
+ constructor(name: string);
1273
+ onUserMessageCallback?(_params: {
1274
+ invocationContext: InvocationContext;
1275
+ userMessage: Content;
1276
+ }): Promise<Content | undefined>;
1277
+ beforeRunCallback?(_params: {
1278
+ invocationContext: InvocationContext;
1279
+ }): Promise<Event | undefined>;
1280
+ onEventCallback?(_params: {
1281
+ invocationContext: InvocationContext;
1282
+ event: Event;
1283
+ }): Promise<Event | undefined>;
1284
+ afterRunCallback?(_params: {
1285
+ invocationContext: InvocationContext;
1286
+ result?: any;
1287
+ }): Promise<void>;
1288
+ close?(): Promise<void>;
1289
+ beforeAgentCallback?(_params: {
1290
+ agent: BaseAgent;
1291
+ callbackContext: CallbackContext;
1292
+ }): Promise<Content | undefined>;
1293
+ afterAgentCallback?(_params: {
1294
+ agent: BaseAgent;
1295
+ callbackContext: CallbackContext;
1296
+ result?: any;
1297
+ }): Promise<Content | undefined>;
1298
+ beforeModelCallback?(_params: {
1299
+ callbackContext: CallbackContext;
1300
+ llmRequest: LlmRequest;
1301
+ }): Promise<LlmResponse | undefined>;
1302
+ afterModelCallback?(_params: {
1303
+ callbackContext: CallbackContext;
1304
+ llmResponse: LlmResponse;
1305
+ llmRequest?: LlmRequest;
1306
+ }): Promise<LlmResponse | undefined>;
1307
+ onModelErrorCallback?(_params: {
1308
+ callbackContext: CallbackContext;
1309
+ llmRequest: LlmRequest;
1310
+ error: unknown;
1311
+ }): Promise<LlmResponse | undefined>;
1312
+ beforeToolCallback?(_params: {
1313
+ tool: BaseTool;
1314
+ toolArgs: Record<string, any>;
1315
+ toolContext: ToolContext;
1316
+ }): Promise<Record<string, any> | undefined>;
1317
+ afterToolCallback?(_params: {
1318
+ tool: BaseTool;
1319
+ toolArgs: Record<string, any>;
1320
+ toolContext: ToolContext;
1321
+ result: Record<string, any>;
1322
+ }): Promise<Record<string, any> | undefined>;
1323
+ onToolErrorCallback?(_params: {
1324
+ tool: BaseTool;
1325
+ toolArgs: Record<string, any>;
1326
+ toolContext: ToolContext;
1327
+ error: unknown;
1328
+ }): Promise<Record<string, any> | undefined>;
1329
+ }
1330
+
1331
+ /**
1332
+ * Single agent callback type
1333
+ */
1334
+ type SingleAgentCallback = (callbackContext: CallbackContext) => Promise<Content | undefined> | Content | undefined;
1335
+ /**
1336
+ * Before agent callback type
1337
+ */
1338
+ type BeforeAgentCallback = SingleAgentCallback | SingleAgentCallback[];
1339
+ /**
1340
+ * After agent callback type
1341
+ */
1342
+ type AfterAgentCallback = SingleAgentCallback | SingleAgentCallback[];
1343
+ /**
1344
+ * Base class for all agents in Agent Development Kit.
1345
+ */
1346
+ declare abstract class BaseAgent {
1347
+ /**
1348
+ * The agent's name.
1349
+ * Agent name must be a valid identifier and unique within the agent tree.
1350
+ * Agent name cannot be "user", since it's reserved for end-user's input.
1351
+ */
1352
+ name: string;
1353
+ /**
1354
+ * Description about the agent's capability.
1355
+ * The model uses this to determine whether to delegate control to the agent.
1356
+ * One-line description is enough and preferred.
1357
+ */
1358
+ description: string;
1359
+ /**
1360
+ * The parent agent of this agent.
1361
+ * Note that an agent can ONLY be added as sub-agent once.
1362
+ * If you want to add one agent twice as sub-agent, consider to create two agent
1363
+ * instances with identical config, but with different name and add them to the
1364
+ * agent tree.
1365
+ */
1366
+ parentAgent?: BaseAgent;
1367
+ /**
1368
+ * The sub-agents of this agent.
1369
+ */
1370
+ subAgents: BaseAgent[];
1371
+ /**
1372
+ * Callback or list of callbacks to be invoked before the agent run.
1373
+ * When a list of callbacks is provided, the callbacks will be called in the
1374
+ * order they are listed until a callback does not return undefined.
1375
+ *
1376
+ * Args:
1377
+ * callbackContext: The callback context.
1378
+ *
1379
+ * Returns:
1380
+ * Content | undefined: The content to return to the user.
1381
+ * When the content is present, the agent run will be skipped and the
1382
+ * provided content will be returned to user.
1383
+ */
1384
+ beforeAgentCallback?: BeforeAgentCallback;
1385
+ /**
1386
+ * Callback or list of callbacks to be invoked after the agent run.
1387
+ * When a list of callbacks is provided, the callbacks will be called in the
1388
+ * order they are listed until a callback does not return undefined.
1389
+ *
1390
+ * Args:
1391
+ * callbackContext: The callback context.
1392
+ *
1393
+ * Returns:
1394
+ * Content | undefined: The content to return to the user.
1395
+ * When the content is present, the provided content will be used as agent
1396
+ * response and appended to event history as agent response.
1669
1397
  */
1670
- static getEncodedFileContent(data: string | ArrayBuffer): string;
1671
- private static isBase64Encoded;
1398
+ afterAgentCallback?: AfterAgentCallback;
1672
1399
  /**
1673
- * Extracts the first code block from the content and truncates everything after it
1400
+ * Constructor for BaseAgent
1674
1401
  */
1675
- static extractCodeAndTruncateContent(content: Content, codeBlockDelimiters: Array<[string, string]>): string | null;
1676
- private static escapeRegex;
1402
+ constructor(config: {
1403
+ name: string;
1404
+ description?: string;
1405
+ subAgents?: BaseAgent[];
1406
+ beforeAgentCallback?: BeforeAgentCallback;
1407
+ afterAgentCallback?: AfterAgentCallback;
1408
+ });
1677
1409
  /**
1678
- * Builds an executable code part with code string
1410
+ * Entry method to run an agent via text-based conversation.
1679
1411
  */
1680
- static buildExecutableCodePart(code: string): Part;
1412
+ runAsync(parentContext: InvocationContext): AsyncGenerator<Event, void, unknown>;
1681
1413
  /**
1682
- * Builds the code execution result part from the code execution result
1414
+ * Entry method to run an agent via video/audio-based conversation.
1683
1415
  */
1684
- static buildCodeExecutionResultPart(codeExecutionResult: CodeExecutionResult): Part;
1416
+ runLive(parentContext: InvocationContext): AsyncGenerator<Event, void, unknown>;
1685
1417
  /**
1686
- * Converts the code execution parts to text parts in a Content
1418
+ * Internal implementation for runAsync
1687
1419
  */
1688
- static convertCodeExecutionParts(content: Content, codeBlockDelimiter: [string, string], executionResultDelimiters: [string, string]): void;
1689
- }
1690
-
1691
- interface BaseCodeExecutorConfig {
1420
+ private runAsyncInternal;
1692
1421
  /**
1693
- * If true, extract and process data files from the model request
1694
- * and attach them to the code executor.
1695
- * Supported data file MimeTypes are [text/csv].
1696
- * Default to false.
1422
+ * Internal implementation for runLive
1697
1423
  */
1698
- optimizeDataFile?: boolean;
1424
+ private runLiveInternal;
1699
1425
  /**
1700
- * Whether the code executor is stateful. Default to false.
1426
+ * Core logic to run this agent via text-based conversation.
1427
+ *
1428
+ * @param ctx - The invocation context for this agent.
1429
+ * @yields Event - The events generated by the agent.
1701
1430
  */
1702
- stateful?: boolean;
1431
+ protected runAsyncImpl(_ctx: InvocationContext): AsyncGenerator<Event, void, unknown>;
1703
1432
  /**
1704
- * The number of attempts to retry on consecutive code execution errors.
1705
- * Default to 2.
1433
+ * Core logic to run this agent via video/audio-based conversation.
1434
+ *
1435
+ * @param ctx - The invocation context for this agent.
1436
+ * @yields Event - The events generated by the agent.
1706
1437
  */
1707
- errorRetryAttempts?: number;
1438
+ protected runLiveImpl(_ctx: InvocationContext): AsyncGenerator<Event, void, unknown>;
1708
1439
  /**
1709
- * The list of the enclosing delimiters to identify the code blocks.
1710
- * For example, the delimiter ['```python\n', '\n```'] can be
1711
- * used to identify code blocks with the following format:
1440
+ * Gets the root agent of this agent.
1441
+ */
1442
+ get rootAgent(): BaseAgent;
1443
+ /**
1444
+ * Finds the agent with the given name in this agent and its descendants.
1712
1445
  *
1713
- * ```python
1714
- * print("hello")
1715
- * ```
1446
+ * @param name - The name of the agent to find.
1447
+ * @returns The agent with the matching name, or undefined if no such agent is found.
1716
1448
  */
1717
- codeBlockDelimiters?: Array<[string, string]>;
1449
+ findAgent(name: string): BaseAgent | undefined;
1718
1450
  /**
1719
- * The delimiters to format the code execution result.
1451
+ * Finds the agent with the given name in this agent's descendants.
1452
+ *
1453
+ * @param name - The name of the agent to find.
1454
+ * @returns The agent with the matching name, or undefined if no such agent is found.
1720
1455
  */
1721
- executionResultDelimiters?: [string, string];
1722
- }
1723
- declare abstract class BaseCodeExecutor {
1724
- protected readonly config: Required<BaseCodeExecutorConfig>;
1725
- constructor(config?: BaseCodeExecutorConfig);
1456
+ findSubAgent(name: string): BaseAgent | undefined;
1726
1457
  /**
1727
- * Executes code and returns the code execution result.
1458
+ * Creates a new invocation context for this agent.
1728
1459
  */
1729
- abstract executeCode(invocationContext: InvocationContext, codeExecutionInput: CodeExecutionInput): Promise<CodeExecutionResult>;
1730
- get optimizeDataFile(): boolean;
1731
- get stateful(): boolean;
1732
- get errorRetryAttempts(): number;
1733
- get codeBlockDelimiters(): Array<[string, string]>;
1734
- get executionResultDelimiters(): [string, string];
1735
- }
1736
-
1737
- /**
1738
- * Abstract base class for all planners.
1739
- *
1740
- * The planner allows the agent to generate plans for the queries to guide its action.
1741
- */
1742
- declare abstract class BasePlanner {
1460
+ private createInvocationContext;
1743
1461
  /**
1744
- * Builds the system instruction to be appended to the LLM request for planning.
1462
+ * The resolved beforeAgentCallback field as a list of SingleAgentCallback.
1463
+ * This method is only for use by Agent Development Kit.
1464
+ */
1465
+ get canonicalBeforeAgentCallbacks(): SingleAgentCallback[];
1466
+ /**
1467
+ * The resolved afterAgentCallback field as a list of SingleAgentCallback.
1468
+ * This method is only for use by Agent Development Kit.
1469
+ */
1470
+ get canonicalAfterAgentCallbacks(): SingleAgentCallback[];
1471
+ /**
1472
+ * Runs the beforeAgentCallback if it exists.
1473
+ * First runs plugin callbacks, then runs canonical callbacks if no override provided.
1745
1474
  *
1746
- * @param readonlyContext The readonly context of the invocation
1747
- * @param llmRequest The LLM request. Readonly.
1748
- * @returns The planning system instruction, or undefined if no instruction is needed
1475
+ * @returns An event if callback provides content or changed state.
1749
1476
  */
1750
- abstract buildPlanningInstruction(readonlyContext: ReadonlyContext, llmRequest: LlmRequest): string | undefined;
1477
+ private handleBeforeAgentCallback;
1751
1478
  /**
1752
- * Processes the LLM response for planning.
1479
+ * Runs the afterAgentCallback if it exists.
1480
+ * First runs plugin callbacks, then runs canonical callbacks if no override provided.
1753
1481
  *
1754
- * @param callbackContext The callback context of the invocation
1755
- * @param responseParts The LLM response parts. Readonly.
1756
- * @returns The processed response parts, or undefined if no processing is needed
1482
+ * @returns An event if callback provides content or changed state.
1757
1483
  */
1758
- abstract processPlanningResponse(callbackContext: CallbackContext, responseParts: Part[]): Part[] | undefined;
1484
+ private handleAfterAgentCallback;
1485
+ /**
1486
+ * Validates the agent name.
1487
+ */
1488
+ private validateName;
1489
+ /**
1490
+ * Sets parent agent for sub-agents.
1491
+ */
1492
+ private setParentAgentForSubAgents;
1759
1493
  }
1760
1494
 
1761
1495
  /**
@@ -2171,7 +1905,7 @@ declare class AgentTool extends BaseTool {
2171
1905
  /**
2172
1906
  * Execute the tool by running the agent with the provided input
2173
1907
  */
2174
- runAsync(params: Record<string, any>, context: ToolContext): Promise<any>;
1908
+ runAsync(params: Record<string, any>, context: ToolContext): Promise<unknown>;
2175
1909
  }
2176
1910
 
2177
1911
  /**
@@ -2186,7 +1920,7 @@ declare class ExitLoopTool extends BaseTool {
2186
1920
  /**
2187
1921
  * Execute the exit loop action
2188
1922
  */
2189
- runAsync(_args: Record<string, any>, context: ToolContext): Promise<any>;
1923
+ runAsync(_args: Record<string, any>, context: ToolContext): Promise<void>;
2190
1924
  }
2191
1925
 
2192
1926
  interface FileOperationResult {
@@ -2274,31 +2008,24 @@ declare class GetUserChoiceTool extends BaseTool {
2274
2008
  runAsync(args: {
2275
2009
  options: string[];
2276
2010
  question?: string;
2277
- }, context: ToolContext): Promise<any>;
2011
+ }, context: ToolContext): Promise<string | null>;
2278
2012
  }
2279
2013
 
2280
- /**
2281
- * Simple GoogleSearch tool implementation
2282
- */
2283
- declare class GoogleSearch extends BaseTool {
2014
+ declare class GoogleSearchTool extends BaseTool {
2284
2015
  protected logger: Logger;
2285
- /**
2286
- * Constructor for GoogleSearch
2287
- */
2288
2016
  constructor();
2289
- /**
2290
- * Get the function declaration for the tool
2291
- */
2292
2017
  getDeclaration(): FunctionDeclaration;
2293
- /**
2294
- * Execute the search
2295
- * This is a simplified implementation that doesn't actually search, just returns mock results
2296
- */
2297
- runAsync(args: {
2298
- query: string;
2299
- num_results?: number;
2300
- }, _context: ToolContext): Promise<any>;
2018
+ runAsync(rawArgs: unknown, _context: ToolContext): Promise<{
2019
+ results?: GoogleSearchResult[];
2020
+ success: boolean;
2021
+ error?: string;
2022
+ }>;
2301
2023
  }
2024
+ type GoogleSearchResult = {
2025
+ title: string;
2026
+ link: string;
2027
+ snippet: string;
2028
+ };
2302
2029
 
2303
2030
  interface HttpRequestResult {
2304
2031
  statusCode: number;
@@ -2363,70 +2090,272 @@ declare class LoadArtifactsTool extends BaseTool {
2363
2090
  private extractFunctionResponse;
2364
2091
  }
2365
2092
 
2366
- /**
2367
- * Tool that allows an agent to load memories relevant to a query
2368
- */
2369
- declare class LoadMemoryTool extends BaseTool {
2370
- protected logger: Logger;
2371
- /**
2372
- * Constructor for LoadMemoryTool
2373
- */
2093
+ interface LoadMemoryResult {
2094
+ memories?: any[];
2095
+ count?: number;
2096
+ error?: string;
2097
+ message?: string;
2098
+ }
2099
+ /**
2100
+ * Tool that allows an agent to load memories relevant to a query
2101
+ */
2102
+ declare class LoadMemoryTool extends BaseTool {
2103
+ protected logger: Logger;
2104
+ /**
2105
+ * Constructor for LoadMemoryTool
2106
+ */
2107
+ constructor();
2108
+ /**
2109
+ * Get the function declaration for the tool
2110
+ */
2111
+ getDeclaration(): FunctionDeclaration;
2112
+ /**
2113
+ * Execute the memory loading action
2114
+ */
2115
+ runAsync(args: {
2116
+ query: string;
2117
+ }, context: ToolContext): Promise<LoadMemoryResult>;
2118
+ }
2119
+
2120
+ /**
2121
+ * Tool that allows an agent to transfer control to another agent
2122
+ */
2123
+ declare class TransferToAgentTool extends BaseTool {
2124
+ protected logger: Logger;
2125
+ /**
2126
+ * Constructor for TransferToAgentTool
2127
+ */
2128
+ constructor();
2129
+ /**
2130
+ * Get the function declaration for the tool
2131
+ */
2132
+ getDeclaration(): FunctionDeclaration;
2133
+ /**
2134
+ * Execute the transfer to agent action
2135
+ */
2136
+ runAsync(args: {
2137
+ agent_name: string;
2138
+ }, context: ToolContext): Promise<void>;
2139
+ }
2140
+
2141
+ interface UserInteractionResult {
2142
+ success: boolean;
2143
+ userInput?: string;
2144
+ error?: string;
2145
+ }
2146
+ /**
2147
+ * Tool for prompting the user for input
2148
+ */
2149
+ declare class UserInteractionTool extends BaseTool {
2150
+ constructor();
2151
+ /**
2152
+ * Get the function declaration for the tool
2153
+ */
2154
+ getDeclaration(): FunctionDeclaration;
2155
+ /**
2156
+ * Execute the user interaction
2157
+ */
2158
+ runAsync(args: {
2159
+ prompt: string;
2160
+ options?: string[];
2161
+ defaultValue?: string;
2162
+ }, context: ToolContext): Promise<UserInteractionResult>;
2163
+ }
2164
+
2165
+ interface BashToolResult {
2166
+ exit_code: number | null;
2167
+ stdout: string;
2168
+ stderr: string;
2169
+ blocked?: boolean;
2170
+ reason?: string;
2171
+ }
2172
+ interface BashToolConfig {
2173
+ enabled: boolean;
2174
+ mode: "disabled" | "whitelist" | "sandboxed" | "unrestricted";
2175
+ dockerImage?: string;
2176
+ allowedCommands?: string[];
2177
+ maxTimeout?: number;
2178
+ requireConfirmation?: boolean;
2179
+ enableLogging?: boolean;
2180
+ }
2181
+ declare class BashTool extends BaseTool {
2182
+ private config;
2183
+ private commandLog;
2184
+ private static readonly DEFAULT_WHITELIST;
2185
+ private static readonly DANGEROUS_PATTERNS;
2186
+ private static readonly DANGEROUS_CHARS;
2187
+ constructor(config?: Partial<BashToolConfig>);
2188
+ getDeclaration(): FunctionDeclaration;
2189
+ runAsync(args: {
2190
+ command: string;
2191
+ }, _context: ToolContext): Promise<BashToolResult>;
2192
+ private validateCommand;
2193
+ private validateWhitelist;
2194
+ private executeDirect;
2195
+ private executeSandboxed;
2196
+ private logCommand;
2197
+ getCommandHistory(): typeof this.commandLog;
2198
+ clearCommandHistory(): void;
2199
+ }
2200
+
2201
+ interface EditToolResult {
2202
+ success: boolean;
2203
+ data?: string;
2204
+ error?: string;
2205
+ }
2206
+ declare class EditTool extends BaseTool {
2207
+ constructor();
2208
+ getDeclaration(): FunctionDeclaration;
2209
+ runAsync(args: {
2210
+ path: string;
2211
+ old_str: string;
2212
+ new_str: string;
2213
+ }, _context: ToolContext): Promise<EditToolResult>;
2214
+ }
2215
+
2216
+ interface GlobToolResult {
2217
+ success: boolean;
2218
+ data?: string[];
2219
+ error?: string;
2220
+ }
2221
+ declare class GlobTool extends BaseTool {
2222
+ constructor();
2223
+ getDeclaration(): FunctionDeclaration;
2224
+ runAsync(args: {
2225
+ pattern: string;
2226
+ }, _context: ToolContext): Promise<GlobToolResult>;
2227
+ }
2228
+
2229
+ declare class GrepTool extends BaseTool {
2230
+ private readonly config;
2231
+ constructor(config?: Partial<GrepConfig>);
2232
+ getDeclaration(): FunctionDeclaration;
2233
+ runAsync(args: {
2234
+ pattern: string;
2235
+ files: string;
2236
+ caseInsensitive?: boolean;
2237
+ contextLines?: number;
2238
+ maxMatches?: number;
2239
+ wholeWord?: boolean;
2240
+ invertMatch?: boolean;
2241
+ exclude?: string;
2242
+ include?: string;
2243
+ }, _context: ToolContext): Promise<GrepResult>;
2244
+ private validateAndSanitizeArgs;
2245
+ private buildRegex;
2246
+ private resolveFiles;
2247
+ private walkDir;
2248
+ private searchFiles;
2249
+ private searchFile;
2250
+ }
2251
+ interface GrepConfig {
2252
+ maxMatches: number;
2253
+ maxFileSize: number;
2254
+ contextLines: number;
2255
+ excludePatterns: string[];
2256
+ includePatterns: string[];
2257
+ }
2258
+ interface GrepMatch {
2259
+ file: string;
2260
+ line: number;
2261
+ column: number;
2262
+ content: string;
2263
+ context?: {
2264
+ before: string[];
2265
+ after: string[];
2266
+ };
2267
+ }
2268
+ interface GrepResult {
2269
+ success: boolean;
2270
+ matches: GrepMatch[];
2271
+ stats: {
2272
+ filesSearched: number;
2273
+ filesMatched: number;
2274
+ totalMatches: number;
2275
+ limitReached: boolean;
2276
+ duration: number;
2277
+ };
2278
+ error?: string;
2279
+ warnings?: string[];
2280
+ }
2281
+
2282
+ interface ReadToolResult {
2283
+ success: boolean;
2284
+ data?: string;
2285
+ error?: string;
2286
+ }
2287
+ declare class ReadTool extends BaseTool {
2374
2288
  constructor();
2375
- /**
2376
- * Get the function declaration for the tool
2377
- */
2378
2289
  getDeclaration(): FunctionDeclaration;
2379
- /**
2380
- * Execute the memory loading action
2381
- */
2382
2290
  runAsync(args: {
2383
- query: string;
2384
- }, context: ToolContext): Promise<any>;
2291
+ path: string;
2292
+ }, _context: ToolContext): Promise<ReadToolResult>;
2385
2293
  }
2386
2294
 
2387
- /**
2388
- * Tool that allows an agent to transfer control to another agent
2389
- */
2390
- declare class TransferToAgentTool extends BaseTool {
2391
- protected logger: Logger;
2392
- /**
2393
- * Constructor for TransferToAgentTool
2394
- */
2295
+ interface WebFetchToolResult {
2296
+ success: boolean;
2297
+ data?: {
2298
+ title: string;
2299
+ content: string;
2300
+ metadata: {
2301
+ contentType: string;
2302
+ url: string;
2303
+ };
2304
+ };
2305
+ error?: string;
2306
+ }
2307
+ declare class WebFetchTool extends BaseTool {
2395
2308
  constructor();
2396
- /**
2397
- * Get the function declaration for the tool
2398
- */
2399
2309
  getDeclaration(): FunctionDeclaration;
2400
- /**
2401
- * Execute the transfer to agent action
2402
- */
2403
2310
  runAsync(args: {
2404
- agent_name: string;
2405
- }, context: ToolContext): Promise<any>;
2311
+ url: string;
2312
+ }, _context: ToolContext): Promise<WebFetchToolResult>;
2406
2313
  }
2407
2314
 
2408
- interface UserInteractionResult {
2315
+ interface WebSearchToolResult {
2409
2316
  success: boolean;
2410
- userInput?: string;
2317
+ data?: z$1.infer<typeof tavilySearchResponseSchema>;
2318
+ error?: string | z$1.ZodError;
2319
+ details?: any;
2320
+ }
2321
+ declare class WebSearchTool extends BaseTool {
2322
+ constructor();
2323
+ getDeclaration(): FunctionDeclaration;
2324
+ runAsync(_rawArgs: unknown, _context: ToolContext): Promise<WebSearchToolResult>;
2325
+ }
2326
+ declare const tavilySearchResponseSchema: z$1.ZodObject<{
2327
+ query: z$1.ZodString;
2328
+ results: z$1.ZodArray<z$1.ZodObject<{
2329
+ title: z$1.ZodString;
2330
+ url: z$1.ZodString;
2331
+ content: z$1.ZodString;
2332
+ raw_content: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
2333
+ favicon: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
2334
+ score: z$1.ZodOptional<z$1.ZodNumber>;
2335
+ }, z$1.core.$strip>>;
2336
+ answer: z$1.ZodOptional<z$1.ZodString>;
2337
+ images: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2338
+ url: z$1.ZodString;
2339
+ description: z$1.ZodOptional<z$1.ZodString>;
2340
+ }, z$1.core.$strip>>>;
2341
+ auto_parameters: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodAny, z$1.ZodString>>;
2342
+ response_time: z$1.ZodNumber;
2343
+ usage: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodAny, z$1.ZodString>>;
2344
+ request_id: z$1.ZodOptional<z$1.ZodString>;
2345
+ }, z$1.core.$strip>;
2346
+
2347
+ interface WriteToolResult {
2348
+ success: boolean;
2349
+ data?: string;
2411
2350
  error?: string;
2412
2351
  }
2413
- /**
2414
- * Tool for prompting the user for input
2415
- */
2416
- declare class UserInteractionTool extends BaseTool {
2352
+ declare class WriteTool extends BaseTool {
2417
2353
  constructor();
2418
- /**
2419
- * Get the function declaration for the tool
2420
- */
2421
2354
  getDeclaration(): FunctionDeclaration;
2422
- /**
2423
- * Execute the user interaction
2424
- */
2425
2355
  runAsync(args: {
2426
- prompt: string;
2427
- options?: string[];
2428
- defaultValue?: string;
2429
- }, context: ToolContext): Promise<UserInteractionResult>;
2356
+ path: string;
2357
+ content: string;
2358
+ }, _context: ToolContext): Promise<WriteToolResult>;
2430
2359
  }
2431
2360
 
2432
2361
  /**
@@ -3059,82 +2988,98 @@ declare function getMcpTools(config: McpConfig, toolFilter?: string[] | ((tool:
3059
2988
  * Tools module exports
3060
2989
  */
3061
2990
 
3062
- type index$6_AgentTool = AgentTool;
3063
- declare const index$6_AgentTool: typeof AgentTool;
3064
- type index$6_AgentToolConfig = AgentToolConfig;
3065
- type index$6_BaseAgentType = BaseAgentType;
3066
- type index$6_BaseTool = BaseTool;
3067
- declare const index$6_BaseTool: typeof BaseTool;
3068
- type index$6_BuildFunctionDeclarationOptions = BuildFunctionDeclarationOptions;
3069
- type index$6_CreateToolConfig<T extends Record<string, any> = Record<string, never>> = CreateToolConfig<T>;
3070
- type index$6_CreateToolConfigWithSchema<T extends Record<string, any>> = CreateToolConfigWithSchema<T>;
3071
- type index$6_CreateToolConfigWithoutSchema = CreateToolConfigWithoutSchema;
3072
- type index$6_ExitLoopTool = ExitLoopTool;
3073
- declare const index$6_ExitLoopTool: typeof ExitLoopTool;
3074
- type index$6_FileOperationsTool = FileOperationsTool;
3075
- declare const index$6_FileOperationsTool: typeof FileOperationsTool;
3076
- type index$6_FunctionTool<T extends Record<string, any>> = FunctionTool<T>;
3077
- declare const index$6_FunctionTool: typeof FunctionTool;
3078
- type index$6_GetUserChoiceTool = GetUserChoiceTool;
3079
- declare const index$6_GetUserChoiceTool: typeof GetUserChoiceTool;
3080
- type index$6_GoogleSearch = GoogleSearch;
3081
- declare const index$6_GoogleSearch: typeof GoogleSearch;
3082
- type index$6_HttpRequestTool = HttpRequestTool;
3083
- declare const index$6_HttpRequestTool: typeof HttpRequestTool;
3084
- type index$6_LoadArtifactsTool = LoadArtifactsTool;
3085
- declare const index$6_LoadArtifactsTool: typeof LoadArtifactsTool;
3086
- type index$6_LoadMemoryTool = LoadMemoryTool;
3087
- declare const index$6_LoadMemoryTool: typeof LoadMemoryTool;
3088
- declare const index$6_McpAbi: typeof McpAbi;
3089
- declare const index$6_McpAtp: typeof McpAtp;
3090
- declare const index$6_McpBamm: typeof McpBamm;
3091
- declare const index$6_McpCoinGecko: typeof McpCoinGecko;
3092
- declare const index$6_McpCoinGeckoPro: typeof McpCoinGeckoPro;
3093
- type index$6_McpConfig = McpConfig;
3094
- declare const index$6_McpDiscord: typeof McpDiscord;
3095
- type index$6_McpError = McpError;
3096
- declare const index$6_McpError: typeof McpError;
3097
- type index$6_McpErrorType = McpErrorType;
3098
- declare const index$6_McpErrorType: typeof McpErrorType;
3099
- declare const index$6_McpFilesystem: typeof McpFilesystem;
3100
- declare const index$6_McpFraxlend: typeof McpFraxlend;
3101
- declare const index$6_McpGeneric: typeof McpGeneric;
3102
- declare const index$6_McpIqWiki: typeof McpIqWiki;
3103
- declare const index$6_McpMemory: typeof McpMemory;
3104
- declare const index$6_McpNearAgent: typeof McpNearAgent;
3105
- declare const index$6_McpNearIntents: typeof McpNearIntents;
3106
- declare const index$6_McpOdos: typeof McpOdos;
3107
- declare const index$6_McpPolymarket: typeof McpPolymarket;
3108
- type index$6_McpSamplingHandler = McpSamplingHandler;
3109
- declare const index$6_McpSamplingHandler: typeof McpSamplingHandler;
3110
- type index$6_McpSamplingRequest = McpSamplingRequest;
3111
- type index$6_McpSamplingResponse = McpSamplingResponse;
3112
- type index$6_McpServerConfig = McpServerConfig;
3113
- declare const index$6_McpTelegram: typeof McpTelegram;
3114
- type index$6_McpToolset = McpToolset;
3115
- declare const index$6_McpToolset: typeof McpToolset;
3116
- type index$6_McpTransportType = McpTransportType;
3117
- declare const index$6_McpUpbit: typeof McpUpbit;
3118
- type index$6_SamplingHandler = SamplingHandler;
3119
- type index$6_ToolConfig = ToolConfig;
3120
- type index$6_ToolContext = ToolContext;
3121
- declare const index$6_ToolContext: typeof ToolContext;
3122
- type index$6_TransferToAgentTool = TransferToAgentTool;
3123
- declare const index$6_TransferToAgentTool: typeof TransferToAgentTool;
3124
- type index$6_UserInteractionTool = UserInteractionTool;
3125
- declare const index$6_UserInteractionTool: typeof UserInteractionTool;
3126
- declare const index$6_adkToMcpToolType: typeof adkToMcpToolType;
3127
- declare const index$6_buildFunctionDeclaration: typeof buildFunctionDeclaration;
3128
- declare const index$6_convertMcpToolToBaseTool: typeof convertMcpToolToBaseTool;
3129
- declare const index$6_createFunctionTool: typeof createFunctionTool;
3130
- declare const index$6_createSamplingHandler: typeof createSamplingHandler;
3131
- declare const index$6_createTool: typeof createTool;
3132
- declare const index$6_getMcpTools: typeof getMcpTools;
3133
- declare const index$6_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
3134
- declare const index$6_mcpSchemaToParameters: typeof mcpSchemaToParameters;
3135
- declare const index$6_normalizeJsonSchema: typeof normalizeJsonSchema;
3136
- declare namespace index$6 {
3137
- 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, index$6_McpCoinGeckoPro as McpCoinGeckoPro, 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_McpPolymarket as McpPolymarket, 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, index$6_McpUpbit as McpUpbit, 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_convertMcpToolToBaseTool as convertMcpToolToBaseTool, 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 };
2991
+ type index$8_AgentTool = AgentTool;
2992
+ declare const index$8_AgentTool: typeof AgentTool;
2993
+ type index$8_AgentToolConfig = AgentToolConfig;
2994
+ type index$8_BaseAgentType = BaseAgentType;
2995
+ type index$8_BaseTool = BaseTool;
2996
+ declare const index$8_BaseTool: typeof BaseTool;
2997
+ type index$8_BashTool = BashTool;
2998
+ declare const index$8_BashTool: typeof BashTool;
2999
+ type index$8_BuildFunctionDeclarationOptions = BuildFunctionDeclarationOptions;
3000
+ type index$8_CreateToolConfig<T extends Record<string, any> = Record<string, never>> = CreateToolConfig<T>;
3001
+ type index$8_CreateToolConfigWithSchema<T extends Record<string, any>> = CreateToolConfigWithSchema<T>;
3002
+ type index$8_CreateToolConfigWithoutSchema = CreateToolConfigWithoutSchema;
3003
+ type index$8_EditTool = EditTool;
3004
+ declare const index$8_EditTool: typeof EditTool;
3005
+ type index$8_ExitLoopTool = ExitLoopTool;
3006
+ declare const index$8_ExitLoopTool: typeof ExitLoopTool;
3007
+ type index$8_FileOperationsTool = FileOperationsTool;
3008
+ declare const index$8_FileOperationsTool: typeof FileOperationsTool;
3009
+ type index$8_FunctionTool<T extends Record<string, any>> = FunctionTool<T>;
3010
+ declare const index$8_FunctionTool: typeof FunctionTool;
3011
+ type index$8_GetUserChoiceTool = GetUserChoiceTool;
3012
+ declare const index$8_GetUserChoiceTool: typeof GetUserChoiceTool;
3013
+ type index$8_GlobTool = GlobTool;
3014
+ declare const index$8_GlobTool: typeof GlobTool;
3015
+ type index$8_GoogleSearchTool = GoogleSearchTool;
3016
+ declare const index$8_GoogleSearchTool: typeof GoogleSearchTool;
3017
+ type index$8_GrepTool = GrepTool;
3018
+ declare const index$8_GrepTool: typeof GrepTool;
3019
+ type index$8_HttpRequestTool = HttpRequestTool;
3020
+ declare const index$8_HttpRequestTool: typeof HttpRequestTool;
3021
+ type index$8_LoadArtifactsTool = LoadArtifactsTool;
3022
+ declare const index$8_LoadArtifactsTool: typeof LoadArtifactsTool;
3023
+ type index$8_LoadMemoryTool = LoadMemoryTool;
3024
+ declare const index$8_LoadMemoryTool: typeof LoadMemoryTool;
3025
+ declare const index$8_McpAbi: typeof McpAbi;
3026
+ declare const index$8_McpAtp: typeof McpAtp;
3027
+ declare const index$8_McpBamm: typeof McpBamm;
3028
+ declare const index$8_McpCoinGecko: typeof McpCoinGecko;
3029
+ declare const index$8_McpCoinGeckoPro: typeof McpCoinGeckoPro;
3030
+ type index$8_McpConfig = McpConfig;
3031
+ declare const index$8_McpDiscord: typeof McpDiscord;
3032
+ type index$8_McpError = McpError;
3033
+ declare const index$8_McpError: typeof McpError;
3034
+ type index$8_McpErrorType = McpErrorType;
3035
+ declare const index$8_McpErrorType: typeof McpErrorType;
3036
+ declare const index$8_McpFilesystem: typeof McpFilesystem;
3037
+ declare const index$8_McpFraxlend: typeof McpFraxlend;
3038
+ declare const index$8_McpGeneric: typeof McpGeneric;
3039
+ declare const index$8_McpIqWiki: typeof McpIqWiki;
3040
+ declare const index$8_McpMemory: typeof McpMemory;
3041
+ declare const index$8_McpNearAgent: typeof McpNearAgent;
3042
+ declare const index$8_McpNearIntents: typeof McpNearIntents;
3043
+ declare const index$8_McpOdos: typeof McpOdos;
3044
+ declare const index$8_McpPolymarket: typeof McpPolymarket;
3045
+ type index$8_McpSamplingHandler = McpSamplingHandler;
3046
+ declare const index$8_McpSamplingHandler: typeof McpSamplingHandler;
3047
+ type index$8_McpSamplingRequest = McpSamplingRequest;
3048
+ type index$8_McpSamplingResponse = McpSamplingResponse;
3049
+ type index$8_McpServerConfig = McpServerConfig;
3050
+ declare const index$8_McpTelegram: typeof McpTelegram;
3051
+ type index$8_McpToolset = McpToolset;
3052
+ declare const index$8_McpToolset: typeof McpToolset;
3053
+ type index$8_McpTransportType = McpTransportType;
3054
+ declare const index$8_McpUpbit: typeof McpUpbit;
3055
+ type index$8_ReadTool = ReadTool;
3056
+ declare const index$8_ReadTool: typeof ReadTool;
3057
+ type index$8_SamplingHandler = SamplingHandler;
3058
+ type index$8_ToolConfig = ToolConfig;
3059
+ type index$8_ToolContext = ToolContext;
3060
+ declare const index$8_ToolContext: typeof ToolContext;
3061
+ type index$8_TransferToAgentTool = TransferToAgentTool;
3062
+ declare const index$8_TransferToAgentTool: typeof TransferToAgentTool;
3063
+ type index$8_UserInteractionTool = UserInteractionTool;
3064
+ declare const index$8_UserInteractionTool: typeof UserInteractionTool;
3065
+ type index$8_WebFetchTool = WebFetchTool;
3066
+ declare const index$8_WebFetchTool: typeof WebFetchTool;
3067
+ type index$8_WebSearchTool = WebSearchTool;
3068
+ declare const index$8_WebSearchTool: typeof WebSearchTool;
3069
+ type index$8_WriteTool = WriteTool;
3070
+ declare const index$8_WriteTool: typeof WriteTool;
3071
+ declare const index$8_adkToMcpToolType: typeof adkToMcpToolType;
3072
+ declare const index$8_buildFunctionDeclaration: typeof buildFunctionDeclaration;
3073
+ declare const index$8_convertMcpToolToBaseTool: typeof convertMcpToolToBaseTool;
3074
+ declare const index$8_createFunctionTool: typeof createFunctionTool;
3075
+ declare const index$8_createSamplingHandler: typeof createSamplingHandler;
3076
+ declare const index$8_createTool: typeof createTool;
3077
+ declare const index$8_getMcpTools: typeof getMcpTools;
3078
+ declare const index$8_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
3079
+ declare const index$8_mcpSchemaToParameters: typeof mcpSchemaToParameters;
3080
+ declare const index$8_normalizeJsonSchema: typeof normalizeJsonSchema;
3081
+ declare namespace index$8 {
3082
+ export { index$8_AgentTool as AgentTool, type index$8_AgentToolConfig as AgentToolConfig, type index$8_BaseAgentType as BaseAgentType, index$8_BaseTool as BaseTool, index$8_BashTool as BashTool, type index$8_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, type index$8_CreateToolConfig as CreateToolConfig, type index$8_CreateToolConfigWithSchema as CreateToolConfigWithSchema, type index$8_CreateToolConfigWithoutSchema as CreateToolConfigWithoutSchema, index$8_EditTool as EditTool, index$8_ExitLoopTool as ExitLoopTool, index$8_FileOperationsTool as FileOperationsTool, index$8_FunctionTool as FunctionTool, index$8_GetUserChoiceTool as GetUserChoiceTool, index$8_GlobTool as GlobTool, index$8_GoogleSearchTool as GoogleSearchTool, index$8_GrepTool as GrepTool, index$8_HttpRequestTool as HttpRequestTool, index$8_LoadArtifactsTool as LoadArtifactsTool, index$8_LoadMemoryTool as LoadMemoryTool, index$8_McpAbi as McpAbi, index$8_McpAtp as McpAtp, index$8_McpBamm as McpBamm, index$8_McpCoinGecko as McpCoinGecko, index$8_McpCoinGeckoPro as McpCoinGeckoPro, type index$8_McpConfig as McpConfig, index$8_McpDiscord as McpDiscord, index$8_McpError as McpError, index$8_McpErrorType as McpErrorType, index$8_McpFilesystem as McpFilesystem, index$8_McpFraxlend as McpFraxlend, index$8_McpGeneric as McpGeneric, index$8_McpIqWiki as McpIqWiki, index$8_McpMemory as McpMemory, index$8_McpNearAgent as McpNearAgent, index$8_McpNearIntents as McpNearIntents, index$8_McpOdos as McpOdos, index$8_McpPolymarket as McpPolymarket, index$8_McpSamplingHandler as McpSamplingHandler, type index$8_McpSamplingRequest as McpSamplingRequest, type index$8_McpSamplingResponse as McpSamplingResponse, type index$8_McpServerConfig as McpServerConfig, index$8_McpTelegram as McpTelegram, index$8_McpToolset as McpToolset, type index$8_McpTransportType as McpTransportType, index$8_McpUpbit as McpUpbit, index$8_ReadTool as ReadTool, type index$8_SamplingHandler as SamplingHandler, type index$8_ToolConfig as ToolConfig, index$8_ToolContext as ToolContext, index$8_TransferToAgentTool as TransferToAgentTool, index$8_UserInteractionTool as UserInteractionTool, index$8_WebFetchTool as WebFetchTool, index$8_WebSearchTool as WebSearchTool, index$8_WriteTool as WriteTool, index$8_adkToMcpToolType as adkToMcpToolType, index$8_buildFunctionDeclaration as buildFunctionDeclaration, index$8_convertMcpToolToBaseTool as convertMcpToolToBaseTool, index$8_createFunctionTool as createFunctionTool, index$8_createSamplingHandler as createSamplingHandler, index$8_createTool as createTool, index$8_getMcpTools as getMcpTools, index$8_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$8_mcpSchemaToParameters as mcpSchemaToParameters, index$8_normalizeJsonSchema as normalizeJsonSchema };
3138
3083
  }
3139
3084
 
3140
3085
  /**
@@ -3161,6 +3106,18 @@ declare class LlmRequest {
3161
3106
  * Tools in generate_content_config should not be set.
3162
3107
  */
3163
3108
  config?: GenerateContentConfig;
3109
+ /**
3110
+ * Context cache config for the request.
3111
+ */
3112
+ cacheConfig?: ContextCacheConfig;
3113
+ /**
3114
+ * Cache metadata from previous requests, used for cache management.
3115
+ */
3116
+ cacheMetadata?: CacheMetadata;
3117
+ /**
3118
+ * Token count from previous request's prompt, used for cache size validation.
3119
+ */
3120
+ cacheableContentsTokenCount?: number;
3164
3121
  /**
3165
3122
  * Live connect config for the request.
3166
3123
  */
@@ -3175,6 +3132,9 @@ declare class LlmRequest {
3175
3132
  config?: GenerateContentConfig;
3176
3133
  liveConnectConfig?: LiveConnectConfig;
3177
3134
  toolsDict?: Record<string, BaseTool>;
3135
+ cacheConfig?: ContextCacheConfig;
3136
+ cacheMetadata?: CacheMetadata;
3137
+ cacheableContentsTokenCount?: number;
3178
3138
  });
3179
3139
  /**
3180
3140
  * Appends instructions to the system instruction.
@@ -3187,869 +3147,1260 @@ declare class LlmRequest {
3187
3147
  */
3188
3148
  appendTools(tools: BaseTool[]): void;
3189
3149
  /**
3190
- * Sets the output schema for the request.
3191
- * @param baseModel The base model to set as the output schema.
3150
+ * Sets the output schema for the request.
3151
+ * @param baseModel The base model to set as the output schema.
3152
+ */
3153
+ setOutputSchema(baseModel: any): void;
3154
+ /**
3155
+ * Extracts the system instruction as plain text from Content or string.
3156
+ * System instructions can be either string or Content type.
3157
+ * @returns The system instruction as a string, or undefined if not set.
3158
+ */
3159
+ getSystemInstructionText(): string | undefined;
3160
+ /**
3161
+ * Extracts text content from a Content object.
3162
+ * Used for extracting text from message contents.
3163
+ * @param content The Content object to extract text from.
3164
+ * @returns The extracted text as a string.
3165
+ */
3166
+ static extractTextFromContent(content: any): string;
3167
+ }
3168
+
3169
+ /**
3170
+ * The BaseLlm class.
3171
+ */
3172
+ declare abstract class BaseLlm {
3173
+ /**
3174
+ * The name of the LLM, e.g. gemini-2.5-flash or gemini-2.5-flash-001.
3175
+ */
3176
+ model: string;
3177
+ protected logger: Logger;
3178
+ /**
3179
+ * Constructor for BaseLlm
3180
+ */
3181
+ constructor(model: string);
3182
+ /**
3183
+ * Returns a list of supported models in regex for LLMRegistry
3184
+ */
3185
+ static supportedModels(): string[];
3186
+ /**
3187
+ * Generates one content from the given contents and tools.
3188
+ *
3189
+ * @param llmRequest LlmRequest, the request to send to the LLM.
3190
+ * @param stream bool = false, whether to do streaming call.
3191
+ * @returns a generator of LlmResponse.
3192
+ *
3193
+ * For non-streaming call, it will only yield one LlmResponse.
3194
+ *
3195
+ * For streaming call, it may yield more than one response, but all yielded
3196
+ * responses should be treated as one response by merging the
3197
+ * parts list.
3198
+ */
3199
+ generateContentAsync(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
3200
+ /**
3201
+ * Implementation method to be overridden by subclasses.
3202
+ * This replaces the abstract generateContentAsync method.
3203
+ */
3204
+ protected abstract generateContentAsyncImpl(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
3205
+ /**
3206
+ * Appends a user content, so that model can continue to output.
3207
+ *
3208
+ * @param llmRequest LlmRequest, the request to send to the LLM.
3209
+ */
3210
+ protected maybeAppendUserContent(llmRequest: LlmRequest): void;
3211
+ /**
3212
+ * Creates a live connection to the LLM.
3213
+ *
3214
+ * @param llmRequest LlmRequest, the request to send to the LLM.
3215
+ * @returns BaseLLMConnection, the connection to the LLM.
3216
+ */
3217
+ connect(_llmRequest: LlmRequest): BaseLLMConnection;
3218
+ }
3219
+
3220
+ /**
3221
+ * LLM-based event summarizer that uses a language model to generate summaries.
3222
+ */
3223
+ declare class LlmEventSummarizer implements EventsSummarizer {
3224
+ private model;
3225
+ private prompt;
3226
+ /**
3227
+ * Creates a new LLM event summarizer.
3228
+ * @param model - The LLM model to use for summarization
3229
+ * @param prompt - Optional custom prompt template. Use {events} as placeholder for event content.
3230
+ */
3231
+ constructor(model: BaseLlm, prompt?: string);
3232
+ /**
3233
+ * Summarizes events using the configured LLM.
3234
+ */
3235
+ maybeSummarizeEvents(events: Event[]): Promise<Event | undefined>;
3236
+ /**
3237
+ * Formats events into a readable text format for summarization.
3238
+ */
3239
+ private formatEventsForSummarization;
3240
+ }
3241
+
3242
+ type index$7_Event = Event;
3243
+ declare const index$7_Event: typeof Event;
3244
+ type index$7_EventActions = EventActions;
3245
+ declare const index$7_EventActions: typeof EventActions;
3246
+ type index$7_EventCompaction = EventCompaction;
3247
+ type index$7_EventsCompactionConfig = EventsCompactionConfig;
3248
+ type index$7_EventsSummarizer = EventsSummarizer;
3249
+ type index$7_LlmEventSummarizer = LlmEventSummarizer;
3250
+ declare const index$7_LlmEventSummarizer: typeof LlmEventSummarizer;
3251
+ declare const index$7_runCompactionForSlidingWindow: typeof runCompactionForSlidingWindow;
3252
+ declare namespace index$7 {
3253
+ export { index$7_Event as Event, index$7_EventActions as EventActions, type index$7_EventCompaction as EventCompaction, type index$7_EventsCompactionConfig as EventsCompactionConfig, type index$7_EventsSummarizer as EventsSummarizer, index$7_LlmEventSummarizer as LlmEventSummarizer, index$7_runCompactionForSlidingWindow as runCompactionForSlidingWindow };
3254
+ }
3255
+
3256
+ declare const pluginCallbackNameSchema: z$1.ZodEnum<{
3257
+ onUserMessageCallback: "onUserMessageCallback";
3258
+ beforeRunCallback: "beforeRunCallback";
3259
+ afterRunCallback: "afterRunCallback";
3260
+ onEventCallback: "onEventCallback";
3261
+ beforeAgentCallback: "beforeAgentCallback";
3262
+ afterAgentCallback: "afterAgentCallback";
3263
+ beforeToolCallback: "beforeToolCallback";
3264
+ afterToolCallback: "afterToolCallback";
3265
+ beforeModelCallback: "beforeModelCallback";
3266
+ afterModelCallback: "afterModelCallback";
3267
+ onToolErrorCallback: "onToolErrorCallback";
3268
+ onModelErrorCallback: "onModelErrorCallback";
3269
+ }>;
3270
+ type PluginCallbackName = z$1.infer<typeof pluginCallbackNameSchema>;
3271
+ declare class PluginManager {
3272
+ readonly plugins: BasePlugin[];
3273
+ private readonly closeTimeout;
3274
+ constructor(opts?: {
3275
+ plugins?: BasePlugin[];
3276
+ closeTimeout?: number;
3277
+ });
3278
+ /** Register a plugin (unique names) */
3279
+ registerPlugin(plugin: BasePlugin): void;
3280
+ getPlugin(name: string): BasePlugin | undefined;
3281
+ getPlugins(): BasePlugin[];
3282
+ runOnUserMessageCallback(params: {
3283
+ userMessage: Content;
3284
+ invocationContext: InvocationContext;
3285
+ }): Promise<any>;
3286
+ runBeforeRunCallback(params: {
3287
+ invocationContext: InvocationContext;
3288
+ }): Promise<any>;
3289
+ runAfterRunCallback(params: {
3290
+ invocationContext: InvocationContext;
3291
+ }): Promise<any>;
3292
+ runOnEventCallback(params: {
3293
+ invocationContext: InvocationContext;
3294
+ event: Event;
3295
+ }): Promise<any>;
3296
+ runBeforeAgentCallback(params: {
3297
+ agent: BaseAgent;
3298
+ callbackContext: CallbackContext;
3299
+ }): Promise<any>;
3300
+ runAfterAgentCallback(params: {
3301
+ agent: BaseAgent;
3302
+ callbackContext: CallbackContext;
3303
+ }): Promise<any>;
3304
+ runBeforeToolCallback(params: {
3305
+ tool: BaseTool;
3306
+ toolArgs: Record<string, any>;
3307
+ toolContext: ToolContext;
3308
+ }): Promise<any>;
3309
+ runAfterToolCallback(params: {
3310
+ tool: BaseTool;
3311
+ toolArgs: Record<string, any>;
3312
+ toolContext: ToolContext;
3313
+ result: Record<string, any>;
3314
+ }): Promise<any>;
3315
+ runBeforeModelCallback(params: {
3316
+ callbackContext: CallbackContext;
3317
+ llmRequest: LlmRequest;
3318
+ }): Promise<any>;
3319
+ runAfterModelCallback(params: {
3320
+ callbackContext: CallbackContext;
3321
+ llmResponse: LlmResponse;
3322
+ }): Promise<any>;
3323
+ runOnToolErrorCallback(params: {
3324
+ tool: BaseTool;
3325
+ toolArgs: Record<string, any>;
3326
+ toolContext: ToolContext;
3327
+ error: Error;
3328
+ }): Promise<any>;
3329
+ runOnModelErrorCallback(params: {
3330
+ callbackContext: CallbackContext;
3331
+ llmRequest: LlmRequest;
3332
+ error: Error;
3333
+ }): Promise<any>;
3334
+ private runCallbacks;
3335
+ close(): Promise<void>;
3336
+ }
3337
+
3338
+ /**
3339
+ * Request send to live agents.
3340
+ */
3341
+ declare class LiveRequest {
3342
+ /**
3343
+ * If set, send the content to the model in turn-by-turn mode.
3192
3344
  */
3193
- setOutputSchema(baseModel: any): void;
3345
+ content?: Content;
3194
3346
  /**
3195
- * Extracts the system instruction as plain text from Content or string.
3196
- * System instructions can be either string or Content type.
3197
- * @returns The system instruction as a string, or undefined if not set.
3347
+ * If set, send the blob to the model in realtime mode.
3198
3348
  */
3199
- getSystemInstructionText(): string | undefined;
3349
+ blob?: Blob;
3200
3350
  /**
3201
- * Extracts text content from a Content object.
3202
- * Used for extracting text from message contents.
3203
- * @param content The Content object to extract text from.
3204
- * @returns The extracted text as a string.
3351
+ * If set, close the queue.
3205
3352
  */
3206
- static extractTextFromContent(content: any): string;
3353
+ close: boolean;
3354
+ constructor(options?: {
3355
+ content?: Content;
3356
+ blob?: Blob;
3357
+ close?: boolean;
3358
+ });
3207
3359
  }
3208
-
3209
3360
  /**
3210
- * AI SDK integration that accepts a pre-configured LanguageModel.
3211
- * Enables ADK to work with any provider supported by Vercel's AI SDK.
3361
+ * Queue used to send LiveRequest in a live(bidirectional streaming) way.
3212
3362
  */
3213
- declare class AiSdkLlm extends BaseLlm {
3214
- private modelInstance;
3215
- protected logger: Logger;
3216
- /**
3217
- * Constructor accepts a pre-configured LanguageModel instance
3218
- * @param model - Pre-configured LanguageModel from provider(modelName)
3219
- */
3220
- constructor(modelInstance: LanguageModel);
3363
+ declare class LiveRequestQueue {
3364
+ private _queue;
3365
+ private _waiters;
3366
+ private _closed;
3221
3367
  /**
3222
- * Returns empty array - following Python ADK pattern
3368
+ * Close the queue.
3223
3369
  */
3224
- static supportedModels(): string[];
3225
- protected generateContentAsyncImpl(request: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
3370
+ close(): void;
3226
3371
  /**
3227
- * Convert ADK LlmRequest to AI SDK CoreMessage format
3372
+ * Send content to the queue.
3228
3373
  */
3229
- private convertToAiSdkMessages;
3374
+ sendContent(content: Content): void;
3230
3375
  /**
3231
- * Transform JSON schema to use lowercase types for AI SDK compatibility
3376
+ * Send realtime blob to the queue.
3232
3377
  */
3233
- private transformSchemaForAiSdk;
3378
+ sendRealtime(blob: Blob): void;
3234
3379
  /**
3235
- * Convert ADK tools to AI SDK tools format
3380
+ * Send a LiveRequest to the queue.
3236
3381
  */
3237
- private convertToAiSdkTools;
3382
+ send(req: LiveRequest): void;
3238
3383
  /**
3239
- * Convert ADK Content to AI SDK CoreMessage
3384
+ * Get the next LiveRequest from the queue.
3240
3385
  */
3241
- private contentToAiSdkMessage;
3386
+ get(): Promise<LiveRequest>;
3387
+ }
3388
+
3389
+ /**
3390
+ * Manages streaming tool related resources during invocation.
3391
+ */
3392
+ declare class ActiveStreamingTool {
3242
3393
  /**
3243
- * Map ADK role to AI SDK role
3394
+ * The active task of this streaming tool.
3244
3395
  */
3245
- private mapRole;
3396
+ task?: Promise<any>;
3246
3397
  /**
3247
- * Map AI SDK finish reason to ADK finish reason
3398
+ * The active (input) streams of this streaming tool.
3248
3399
  */
3249
- private mapFinishReason;
3400
+ stream?: LiveRequestQueue;
3401
+ constructor(options?: {
3402
+ task?: Promise<any>;
3403
+ stream?: LiveRequestQueue;
3404
+ });
3250
3405
  }
3251
3406
 
3252
3407
  /**
3253
- * Anthropic LLM implementation using Claude models
3408
+ * Streaming mode options for agent execution
3254
3409
  */
3255
- declare class AnthropicLlm extends BaseLlm {
3256
- private _client?;
3257
- protected logger: Logger;
3410
+ declare enum StreamingMode {
3411
+ NONE = "NONE",
3412
+ SSE = "sse",
3413
+ BIDI = "bidi"
3414
+ }
3415
+ /**
3416
+ * Configs for runtime behavior of agents
3417
+ */
3418
+ declare class RunConfig {
3258
3419
  /**
3259
- * Constructor for Anthropic LLM
3420
+ * Speech configuration for the live agent
3260
3421
  */
3261
- constructor(model?: string);
3422
+ speechConfig?: SpeechConfig;
3262
3423
  /**
3263
- * Provides the list of supported models
3424
+ * The output modalities. If not set, it's default to AUDIO.
3264
3425
  */
3265
- static supportedModels(): string[];
3426
+ responseModalities?: string[];
3266
3427
  /**
3267
- * Main content generation method - handles both streaming and non-streaming
3428
+ * Whether or not to save the input blobs as artifacts.
3268
3429
  */
3269
- protected generateContentAsyncImpl(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
3430
+ saveInputBlobsAsArtifacts: boolean;
3270
3431
  /**
3271
- * Live connection is not supported for Anthropic models
3432
+ * Whether to support CFC (Compositional Function Calling). Only applicable for
3433
+ * StreamingMode.SSE. If it's true. the LIVE API will be invoked. Since only LIVE
3434
+ * API supports CFC
3435
+ *
3436
+ * @warning This feature is **experimental** and its API or behavior may change
3437
+ * in future releases.
3272
3438
  */
3273
- connect(_llmRequest: LlmRequest): BaseLLMConnection;
3439
+ supportCFC: boolean;
3274
3440
  /**
3275
- * Convert Anthropic Message to ADK LlmResponse
3441
+ * Streaming mode, None or StreamingMode.SSE or StreamingMode.BIDI.
3276
3442
  */
3277
- private anthropicMessageToLlmResponse;
3443
+ streamingMode: StreamingMode;
3278
3444
  /**
3279
- * Convert ADK Content to Anthropic MessageParam
3445
+ * Output transcription for live agents with audio response.
3280
3446
  */
3281
- private contentToAnthropicMessage;
3447
+ outputAudioTranscription?: AudioTranscriptionConfig;
3282
3448
  /**
3283
- * Convert ADK Part to Anthropic content block
3449
+ * Input transcription for live agents with audio input from user.
3284
3450
  */
3285
- private partToAnthropicBlock;
3451
+ inputAudioTranscription?: AudioTranscriptionConfig;
3286
3452
  /**
3287
- * Convert Anthropic content block to ADK Part
3453
+ * Realtime input config for live agents with audio input from user.
3288
3454
  */
3289
- private anthropicBlockToPart;
3455
+ realtimeInputConfig?: RealtimeInputConfig;
3290
3456
  /**
3291
- * Convert ADK function declaration to Anthropic tool param
3457
+ * If enabled, the model will detect emotions and adapt its responses accordingly.
3292
3458
  */
3293
- private functionDeclarationToAnthropicTool;
3459
+ enableAffectiveDialog?: boolean;
3294
3460
  /**
3295
- * Convert ADK role to Anthropic role format
3461
+ * Configures the proactivity of the model. This allows the model to respond
3462
+ * proactively to the input and to ignore irrelevant input.
3296
3463
  */
3297
- private toAnthropicRole;
3464
+ proactivity?: ProactivityConfig;
3298
3465
  /**
3299
- * Convert Anthropic stop reason to ADK finish reason
3466
+ * A limit on the total number of llm calls for a given run.
3467
+ *
3468
+ * Valid Values:
3469
+ * - More than 0 and less than Number.MAX_SAFE_INTEGER: The bound on the number of llm
3470
+ * calls is enforced, if the value is set in this range.
3471
+ * - Less than or equal to 0: This allows for unbounded number of llm calls.
3300
3472
  */
3301
- private toAdkFinishReason;
3473
+ maxLlmCalls: number;
3474
+ constructor(config?: Partial<RunConfig>);
3302
3475
  /**
3303
- * Update type strings in schema to lowercase for Anthropic compatibility
3476
+ * Validates the maxLlmCalls value
3304
3477
  */
3305
- private updateTypeString;
3478
+ private validateMaxLlmCalls;
3479
+ }
3480
+
3481
+ /**
3482
+ * Store the data that can be used for transcription.
3483
+ */
3484
+ declare class TranscriptionEntry {
3306
3485
  /**
3307
- * Gets the Anthropic client
3486
+ * The role that created this data, typically "user" or "model". For function
3487
+ * call, this is None.
3308
3488
  */
3309
- private get client();
3489
+ role?: string;
3490
+ /**
3491
+ * The data that can be used for transcription
3492
+ */
3493
+ data: Blob | Content;
3494
+ constructor(options: {
3495
+ role?: string;
3496
+ data: Blob | Content;
3497
+ });
3310
3498
  }
3311
3499
 
3312
3500
  /**
3313
- * Google LLM Variant enum
3501
+ * Transfer context for multi-agent workflows
3502
+ * Tracks the chain of agent transfers for telemetry
3314
3503
  */
3315
- declare enum GoogleLLMVariant {
3316
- VERTEX_AI = "VERTEX_AI",
3317
- GEMINI_API = "GEMINI_API"
3504
+ interface TransferContext {
3505
+ /** Array of agent names in transfer order */
3506
+ transferChain: string[];
3507
+ /** Current depth in transfer chain (0 = root) */
3508
+ transferDepth: number;
3509
+ /** Name of the root agent that started the chain */
3510
+ rootAgentName: string;
3511
+ /** Span context of the root agent for linking */
3512
+ rootSpanContext?: SpanContext;
3513
+ /** Span context of the previous agent in the chain */
3514
+ previousSpanContext?: SpanContext;
3318
3515
  }
3319
3516
  /**
3320
- * Integration for Gemini models.
3517
+ * Error thrown when the number of LLM calls exceed the limit.
3321
3518
  */
3322
- declare class GoogleLlm extends BaseLlm {
3323
- private _apiClient?;
3324
- private _liveApiClient?;
3325
- private _apiBackend?;
3326
- private _trackingHeaders?;
3519
+ declare class LlmCallsLimitExceededError extends Error {
3520
+ constructor(message: string);
3521
+ }
3522
+ /**
3523
+ * Generates a new invocation context ID
3524
+ */
3525
+ declare function newInvocationContextId(): string;
3526
+ /**
3527
+ * An invocation context represents the data of a single invocation of an agent.
3528
+ *
3529
+ * An invocation:
3530
+ * 1. Starts with a user message and ends with a final response.
3531
+ * 2. Can contain one or multiple agent calls.
3532
+ * 3. Is handled by runner.run_async().
3533
+ *
3534
+ * An invocation runs an agent until it does not request to transfer to another
3535
+ * agent.
3536
+ *
3537
+ * An agent call:
3538
+ * 1. Is handled by agent.run().
3539
+ * 2. Ends when agent.run() ends.
3540
+ *
3541
+ * An LLM agent call is an agent with a BaseLLMFlow.
3542
+ * An LLM agent call can contain one or multiple steps.
3543
+ *
3544
+ * An LLM agent runs steps in a loop until:
3545
+ * 1. A final response is generated.
3546
+ * 2. The agent transfers to another agent.
3547
+ * 3. The end_invocation is set to true by any callbacks or tools.
3548
+ *
3549
+ * A step:
3550
+ * 1. Calls the LLM only once and yields its response.
3551
+ * 2. Calls the tools and yields their responses if requested.
3552
+ *
3553
+ * The summarization of the function response is considered another step, since
3554
+ * it is another llm call.
3555
+ *
3556
+ * A step ends when it's done calling llm and tools, or if the end_invocation
3557
+ * is set to true at any time.
3558
+ *
3559
+ *
3560
+ * ┌─────────────────────── invocation ──────────────────────────┐
3561
+ * ┌──────────── llm_agent_call_1 ────────────┐ ┌─ agent_call_2 ─┐
3562
+ * ┌──── step_1 ────────┐ ┌───── step_2 ──────┐
3563
+ * [call_llm] [call_tool] [call_llm] [transfer]
3564
+ *
3565
+ */
3566
+ declare class InvocationContext {
3567
+ readonly artifactService?: BaseArtifactService;
3568
+ readonly sessionService: BaseSessionService;
3569
+ readonly memoryService?: BaseMemoryService;
3327
3570
  /**
3328
- * Constructor for Gemini
3571
+ * The plugin manager for this invocation context.
3572
+ */
3573
+ readonly pluginManager: PluginManager;
3574
+ /**
3575
+ * Optional configuration controlling context caching behavior for this invocation.
3576
+ *
3577
+ * When present, enables reuse of cached LLM context across agent calls and
3578
+ * sub-agents within the same invocation (and potentially across invocations,
3579
+ * depending on cache policy). When undefined, context caching is disabled.
3580
+ *
3581
+ * This config is typically inherited from the app-level configuration and
3582
+ * propagated to all child invocation contexts.
3329
3583
  */
3330
- constructor(model?: string);
3584
+ readonly contextCacheConfig?: ContextCacheConfig;
3331
3585
  /**
3332
- * Provides the list of supported models.
3586
+ * The id of this invocation context. Readonly.
3333
3587
  */
3334
- static supportedModels(): string[];
3588
+ readonly invocationId: string;
3335
3589
  /**
3336
- * Main content generation method - handles both streaming and non-streaming
3590
+ * The branch of the invocation context.
3591
+ *
3592
+ * The format is like agent_1.agent_2.agent_3, where agent_1 is the parent of
3593
+ * agent_2, and agent_2 is the parent of agent_3.
3594
+ *
3595
+ * Branch is used when multiple sub-agents shouldn't see their peer agents'
3596
+ * conversation history.
3337
3597
  */
3338
- protected generateContentAsyncImpl(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
3598
+ readonly branch?: string;
3339
3599
  /**
3340
- * Connects to the Gemini model and returns an llm connection.
3600
+ * The current agent of this invocation context. Readonly.
3341
3601
  */
3342
- connect(_llmRequest: LlmRequest): BaseLLMConnection;
3602
+ agent: BaseAgent;
3343
3603
  /**
3344
- * Check if response has inline data
3604
+ * The user content that started this invocation. Readonly.
3345
3605
  */
3346
- private hasInlineData;
3606
+ readonly userContent?: Content;
3347
3607
  /**
3348
- * Convert LlmRequest contents to GoogleGenAI format
3608
+ * The current session of this invocation context. Readonly.
3349
3609
  */
3350
- private convertContents;
3610
+ readonly session: Session;
3351
3611
  /**
3352
- * Preprocesses the request based on the API backend.
3612
+ * Whether to end this invocation.
3613
+ *
3614
+ * Set to True in callbacks or tools to terminate this invocation.
3353
3615
  */
3354
- private preprocessRequest;
3616
+ endInvocation: boolean;
3355
3617
  /**
3356
- * Sets display_name to null for the Gemini API (non-Vertex) backend.
3618
+ * The queue to receive live requests.
3357
3619
  */
3358
- private removeDisplayNameIfPresent;
3620
+ liveRequestQueue?: LiveRequestQueue;
3359
3621
  /**
3360
- * Provides the api client.
3622
+ * The running streaming tools of this invocation.
3361
3623
  */
3362
- get apiClient(): GoogleGenAI;
3624
+ activeStreamingTools?: Record<string, ActiveStreamingTool>;
3363
3625
  /**
3364
- * Gets the API backend type.
3626
+ * Caches necessary, data audio or contents, that are needed by transcription.
3365
3627
  */
3366
- get apiBackend(): GoogleLLMVariant;
3628
+ transcriptionCache?: TranscriptionEntry[];
3367
3629
  /**
3368
- * Gets the tracking headers.
3630
+ * Configurations for live agents under this invocation.
3369
3631
  */
3370
- get trackingHeaders(): Record<string, string>;
3632
+ runConfig?: RunConfig;
3371
3633
  /**
3372
- * Gets the live API version.
3634
+ * Transfer context for multi-agent workflows
3635
+ * Tracks agent transfer chain for telemetry
3373
3636
  */
3374
- get liveApiVersion(): string;
3637
+ transferContext?: TransferContext;
3375
3638
  /**
3376
- * Gets the live API client.
3639
+ * A container to keep track of different kinds of costs incurred as a part
3640
+ * of this invocation.
3377
3641
  */
3378
- get liveApiClient(): GoogleGenAI;
3379
- }
3380
-
3381
- /**
3382
- * OpenAI LLM implementation using GPT models
3383
- * Enhanced with comprehensive debug logging similar to Google LLM
3384
- */
3385
- declare class OpenAiLlm extends BaseLlm {
3386
- private _client?;
3642
+ private readonly _invocationCostManager;
3387
3643
  /**
3388
- * Constructor for OpenAI LLM
3644
+ * Constructor for InvocationContext
3389
3645
  */
3390
- constructor(model?: string);
3646
+ constructor(options: {
3647
+ artifactService?: BaseArtifactService;
3648
+ sessionService: BaseSessionService;
3649
+ memoryService?: BaseMemoryService;
3650
+ pluginManager: PluginManager;
3651
+ invocationId?: string;
3652
+ branch?: string;
3653
+ agent: BaseAgent;
3654
+ userContent?: Content;
3655
+ session: Session;
3656
+ endInvocation?: boolean;
3657
+ liveRequestQueue?: LiveRequestQueue;
3658
+ activeStreamingTools?: Record<string, ActiveStreamingTool>;
3659
+ transcriptionCache?: TranscriptionEntry[];
3660
+ runConfig?: RunConfig;
3661
+ contextCacheConfig?: ContextCacheConfig;
3662
+ transferContext?: TransferContext;
3663
+ });
3391
3664
  /**
3392
- * Provides the list of supported models
3665
+ * App name from the session
3393
3666
  */
3394
- static supportedModels(): string[];
3667
+ get appName(): string;
3395
3668
  /**
3396
- * Main content generation method - handles both streaming and non-streaming
3669
+ * User ID from the session
3397
3670
  */
3398
- protected generateContentAsyncImpl(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
3671
+ get userId(): string;
3399
3672
  /**
3400
- * Live connection is not supported for OpenAI models
3673
+ * Tracks number of llm calls made.
3674
+ *
3675
+ * @throws {LlmCallsLimitExceededError} If number of llm calls made exceed the set threshold.
3401
3676
  */
3402
- connect(_llmRequest: LlmRequest): BaseLLMConnection;
3677
+ incrementLlmCallCount(): void;
3403
3678
  /**
3404
- * Create LlmResponse from streaming chunk - similar to Google's LlmResponse.create
3679
+ * Creates a child invocation context for a sub-agent
3405
3680
  */
3406
- private createChunkResponse;
3681
+ createChildContext(agent: BaseAgent): InvocationContext;
3682
+ }
3683
+
3684
+ /**
3685
+ * Base class for LLM request processors.
3686
+ */
3687
+ declare abstract class BaseLlmRequestProcessor {
3407
3688
  /**
3408
- * Convert OpenAI message to ADK LlmResponse
3689
+ * Runs the processor on the given invocation context and LLM request.
3690
+ * @param invocationContext The invocation context
3691
+ * @param llmRequest The LLM request to process
3692
+ * @returns An async generator yielding events
3409
3693
  */
3410
- private openAiMessageToLlmResponse;
3694
+ abstract runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, unknown>;
3695
+ }
3696
+ /**
3697
+ * Base class for LLM response processors.
3698
+ */
3699
+ declare abstract class BaseLlmResponseProcessor {
3411
3700
  /**
3412
- * Convert ADK Content to OpenAI ChatCompletionMessage
3701
+ * Processes the LLM response.
3702
+ * @param invocationContext The invocation context
3703
+ * @param llmResponse The LLM response to process
3704
+ * @returns An async generator yielding events
3413
3705
  */
3414
- private contentToOpenAiMessage;
3706
+ abstract runAsync(invocationContext: InvocationContext, llmResponse: LlmResponse): AsyncGenerator<Event, void, unknown>;
3707
+ }
3708
+
3709
+ /**
3710
+ * Auth LLM request processor that handles authentication information
3711
+ * to build the LLM request with credential processing
3712
+ */
3713
+ declare class AuthLlmRequestProcessor extends BaseLlmRequestProcessor {
3415
3714
  /**
3416
- * Convert ADK Part to OpenAI message content
3715
+ * Processes authentication information from session events
3716
+ * and resumes function calls that required authentication
3417
3717
  */
3418
- private partToOpenAiContent;
3718
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event>;
3419
3719
  /**
3420
- * Transform JSON schema to use lowercase types for OpenAI compatibility
3720
+ * Parses and stores authentication response in session state
3421
3721
  */
3422
- private transformSchemaForOpenAi;
3722
+ private parseAndStoreAuthResponse;
3723
+ }
3724
+ /**
3725
+ * Exported request processor instance for use in flow configurations
3726
+ */
3727
+ declare const requestProcessor$7: AuthLlmRequestProcessor;
3728
+
3729
+ /**
3730
+ * Enhanced auth configuration with credential handling
3731
+ * This extends the basic AuthConfig with raw and exchanged credentials
3732
+ */
3733
+ declare class EnhancedAuthConfig {
3423
3734
  /**
3424
- * Convert ADK function declaration to OpenAI tool
3735
+ * The authentication scheme
3425
3736
  */
3426
- private functionDeclarationToOpenAiTool;
3737
+ authScheme: AuthScheme;
3427
3738
  /**
3428
- * Convert ADK role to OpenAI role format
3739
+ * Raw auth credential used to collect credentials
3740
+ * Used in auth schemes that need to exchange credentials (e.g. OAuth2, OIDC)
3429
3741
  */
3430
- private toOpenAiRole;
3742
+ rawAuthCredential?: AuthCredential;
3431
3743
  /**
3432
- * Convert OpenAI finish reason to ADK finish reason
3744
+ * Exchanged auth credential after processing
3745
+ * Filled by ADK and client working together
3433
3746
  */
3434
- private toAdkFinishReason;
3747
+ exchangedAuthCredential?: AuthCredential;
3435
3748
  /**
3436
- * Preprocess request similar to Google LLM
3749
+ * User-specified key for credential storage and retrieval
3437
3750
  */
3438
- private preprocessRequest;
3751
+ credentialKey?: string;
3439
3752
  /**
3440
- * Preprocess individual parts for OpenAI compatibility
3753
+ * Additional context properties
3441
3754
  */
3442
- private preprocessPart;
3755
+ context?: Record<string, any>;
3443
3756
  /**
3444
- * Detect content type for flow control
3445
- * This is a simplified implementation - you may need to adjust based on your specific requirements
3757
+ * Constructor for EnhancedAuthConfig
3446
3758
  */
3447
- private getContentType;
3759
+ constructor(config: {
3760
+ authScheme: AuthScheme;
3761
+ rawAuthCredential?: AuthCredential;
3762
+ exchangedAuthCredential?: AuthCredential;
3763
+ credentialKey?: string;
3764
+ context?: Record<string, any>;
3765
+ });
3448
3766
  /**
3449
- * Check if response has inline data (similar to Google LLM)
3767
+ * Generates a credential key based on auth scheme and raw credential
3768
+ * Used for saving/loading credentials from credential service
3450
3769
  */
3451
- private hasInlineData;
3770
+ private generateCredentialKey;
3452
3771
  /**
3453
- * Gets the OpenAI client
3772
+ * Gets the credential key for storage
3454
3773
  */
3455
- private get client();
3456
- }
3457
-
3458
- interface LLMClass {
3459
- new (model: string): BaseLlm;
3460
- supportedModels(): string[];
3461
- }
3462
- interface LlmModelConfig {
3463
- temperature?: number;
3464
- maxOutputTokens?: number;
3465
- topP?: number;
3466
- topK?: number;
3467
- }
3468
- interface LlmModel {
3469
- generateContent(options: {
3470
- prompt: string;
3471
- } & LlmModelConfig): Promise<LlmResponse>;
3472
- }
3473
- declare class LLMRegistry {
3474
- private static llmRegistry;
3475
- private static modelInstances;
3476
- private static logger;
3477
- static newLLM(model: string): BaseLlm;
3478
- static resolve(model: string): LLMClass | null;
3479
- static register(modelNameRegex: string, llmClass: LLMClass): void;
3480
- static registerLLM(llmClass: LLMClass): void;
3481
- static registerModel(name: string, model: LlmModel): void;
3482
- static getModel(name: string): LlmModel;
3483
- static hasModel(name: string): boolean;
3484
- static unregisterModel(name: string): void;
3485
- static getModelOrCreate(name: string): LlmModel | BaseLlm;
3486
- static clear(): void;
3487
- static clearModels(): void;
3488
- static clearClasses(): void;
3489
- static logRegisteredModels(): void;
3774
+ getCredentialKey(): string;
3490
3775
  }
3491
-
3492
3776
  /**
3493
- * Register all LLM providers
3777
+ * Arguments for the special long-running function tool used to request
3778
+ * end-user credentials
3494
3779
  */
3495
- declare function registerProviders(): void;
3496
-
3780
+ interface AuthToolArguments extends Record<string, unknown> {
3781
+ /**
3782
+ * The ID of the function call that requires authentication
3783
+ */
3784
+ function_call_id: string;
3785
+ /**
3786
+ * The authentication configuration
3787
+ */
3788
+ auth_config: AuthConfig | EnhancedAuthConfig;
3789
+ }
3497
3790
  /**
3498
- * Configuration for model built-in thinking features
3499
- * Compatible with google.genai.types.ThinkingConfig
3791
+ * Auth tool for handling credential requests
3500
3792
  */
3501
- interface ThinkingConfig {
3793
+ declare class AuthTool {
3502
3794
  /**
3503
- * Whether to include the thinking process in the response
3795
+ * Processes auth tool arguments and returns appropriate response
3504
3796
  */
3505
- includeThinking?: boolean;
3797
+ static processAuthRequest(args: AuthToolArguments): Promise<{
3798
+ status: string;
3799
+ authConfig?: AuthConfig | EnhancedAuthConfig;
3800
+ credentialKey?: string;
3801
+ }>;
3506
3802
  /**
3507
- * Additional thinking configuration options
3803
+ * Validates auth tool arguments
3508
3804
  */
3509
- [key: string]: any;
3805
+ static validateAuthArguments(args: any): args is AuthToolArguments;
3510
3806
  }
3807
+ /**
3808
+ * Creates an AuthToolArguments object with proper typing
3809
+ */
3810
+ declare function createAuthToolArguments(functionCallId: string, authConfig: AuthConfig | EnhancedAuthConfig): AuthToolArguments;
3811
+ /**
3812
+ * Type guard to check if an auth config is enhanced
3813
+ */
3814
+ declare function isEnhancedAuthConfig(config: AuthConfig | EnhancedAuthConfig): config is EnhancedAuthConfig;
3511
3815
 
3512
3816
  /**
3513
- * Authentication scheme types
3817
+ * Types of authentication credentials
3514
3818
  */
3515
- declare enum AuthSchemeType {
3516
- APIKEY = "apiKey",
3517
- HTTP = "http",
3819
+ declare enum AuthCredentialType {
3820
+ API_KEY = "api_key",
3821
+ BASIC = "basic",
3822
+ BEARER = "bearer",
3518
3823
  OAUTH2 = "oauth2",
3519
- OPENID_CONNECT = "openIdConnect"
3824
+ CUSTOM = "custom"
3520
3825
  }
3521
3826
  /**
3522
- * Base class for authentication schemes
3827
+ * Base class for authentication credentials
3523
3828
  */
3524
- declare abstract class AuthScheme {
3829
+ declare abstract class AuthCredential {
3525
3830
  /**
3526
- * The type of authentication scheme
3831
+ * Type of credential
3527
3832
  */
3528
- type: AuthSchemeType;
3529
- constructor(type: AuthSchemeType);
3530
- }
3531
- /**
3532
- * API Key authentication scheme
3533
- */
3534
- declare class ApiKeyScheme extends AuthScheme {
3833
+ type: AuthCredentialType;
3535
3834
  /**
3536
- * Where the API key is sent
3835
+ * Constructor for AuthCredential
3537
3836
  */
3538
- in: "query" | "header" | "cookie";
3837
+ constructor(type: AuthCredentialType);
3539
3838
  /**
3540
- * Name of the parameter
3839
+ * Gets the authentication token
3541
3840
  */
3542
- name: string;
3841
+ abstract getToken(): string | undefined;
3543
3842
  /**
3544
- * Description of the API key
3843
+ * Gets headers for HTTP requests
3545
3844
  */
3546
- description?: string;
3845
+ abstract getHeaders(config: AuthConfig): Record<string, string>;
3547
3846
  /**
3548
- * Constructor for ApiKeyScheme
3847
+ * Whether the token can be refreshed
3549
3848
  */
3550
- constructor(config: {
3551
- in: "query" | "header" | "cookie";
3552
- name: string;
3553
- description?: string;
3554
- });
3849
+ canRefresh(): boolean;
3850
+ /**
3851
+ * Refreshes the token
3852
+ */
3853
+ refresh(): Promise<void>;
3555
3854
  }
3556
3855
  /**
3557
- * HTTP authentication scheme
3856
+ * API Key credential
3558
3857
  */
3559
- declare class HttpScheme extends AuthScheme {
3858
+ declare class ApiKeyCredential extends AuthCredential {
3560
3859
  /**
3561
- * The HTTP authentication scheme
3860
+ * The API key
3562
3861
  */
3563
- scheme: "basic" | "bearer" | "digest" | "other";
3862
+ apiKey: string;
3564
3863
  /**
3565
- * Bearer format when scheme is 'bearer'
3864
+ * Constructor for ApiKeyCredential
3566
3865
  */
3567
- bearerFormat?: string;
3866
+ constructor(apiKey: string);
3568
3867
  /**
3569
- * Description of the scheme
3868
+ * Gets the API key as the token
3570
3869
  */
3571
- description?: string;
3870
+ getToken(): string;
3572
3871
  /**
3573
- * Constructor for HttpScheme
3872
+ * Gets headers for HTTP requests
3574
3873
  */
3575
- constructor(config: {
3576
- scheme: "basic" | "bearer" | "digest" | "other";
3577
- bearerFormat?: string;
3578
- description?: string;
3579
- });
3580
- }
3581
- /**
3582
- * OAuth flow configuration
3583
- */
3584
- interface OAuthFlow {
3585
- authorizationUrl?: string;
3586
- tokenUrl?: string;
3587
- refreshUrl?: string;
3588
- scopes: Record<string, string>;
3589
- }
3590
- /**
3591
- * OAuth flows configuration
3592
- */
3593
- interface OAuthFlows {
3594
- implicit?: OAuthFlow;
3595
- password?: OAuthFlow;
3596
- clientCredentials?: OAuthFlow;
3597
- authorizationCode?: OAuthFlow;
3874
+ getHeaders(config: AuthConfig): Record<string, string>;
3598
3875
  }
3599
3876
  /**
3600
- * OAuth2 authentication scheme
3877
+ * Basic authentication credential
3601
3878
  */
3602
- declare class OAuth2Scheme extends AuthScheme {
3879
+ declare class BasicAuthCredential extends AuthCredential {
3603
3880
  /**
3604
- * OAuth flows
3881
+ * The username
3605
3882
  */
3606
- flows: OAuthFlows;
3883
+ username: string;
3607
3884
  /**
3608
- * Description of the scheme
3885
+ * The password
3609
3886
  */
3610
- description?: string;
3887
+ password: string;
3611
3888
  /**
3612
- * Constructor for OAuth2Scheme
3889
+ * Constructor for BasicAuthCredential
3613
3890
  */
3614
- constructor(config: {
3615
- flows: OAuthFlows;
3616
- description?: string;
3617
- });
3891
+ constructor(username: string, password: string);
3892
+ /**
3893
+ * Gets the encoded basic auth token
3894
+ */
3895
+ getToken(): string;
3896
+ /**
3897
+ * Gets headers for HTTP requests
3898
+ */
3899
+ getHeaders(): Record<string, string>;
3618
3900
  }
3619
3901
  /**
3620
- * OpenID Connect authentication scheme
3902
+ * Bearer token credential
3621
3903
  */
3622
- declare class OpenIdConnectScheme extends AuthScheme {
3904
+ declare class BearerTokenCredential extends AuthCredential {
3623
3905
  /**
3624
- * OpenID Connect URL
3906
+ * The bearer token
3625
3907
  */
3626
- openIdConnectUrl: string;
3908
+ token: string;
3627
3909
  /**
3628
- * Description of the scheme
3910
+ * Constructor for BearerTokenCredential
3629
3911
  */
3630
- description?: string;
3912
+ constructor(token: string);
3631
3913
  /**
3632
- * Constructor for OpenIdConnectScheme
3914
+ * Gets the bearer token
3633
3915
  */
3634
- constructor(config: {
3635
- openIdConnectUrl: string;
3636
- description?: string;
3637
- });
3916
+ getToken(): string;
3917
+ /**
3918
+ * Gets headers for HTTP requests
3919
+ */
3920
+ getHeaders(): Record<string, string>;
3638
3921
  }
3639
-
3640
3922
  /**
3641
- * Authentication configuration for tools
3923
+ * OAuth2 token credential with refresh capability
3642
3924
  */
3643
- declare class AuthConfig {
3925
+ declare class OAuth2Credential extends AuthCredential {
3644
3926
  /**
3645
- * The authentication scheme
3927
+ * The access token
3646
3928
  */
3647
- authScheme: AuthScheme;
3929
+ accessToken: string;
3648
3930
  /**
3649
- * Additional context properties
3931
+ * The refresh token
3650
3932
  */
3651
- context?: Record<string, any>;
3933
+ refreshToken?: string;
3652
3934
  /**
3653
- * Constructor for AuthConfig
3935
+ * When the token expires
3936
+ */
3937
+ expiresAt?: Date;
3938
+ /**
3939
+ * Function to refresh the token
3940
+ */
3941
+ private refreshFunction?;
3942
+ /**
3943
+ * Constructor for OAuth2Credential
3654
3944
  */
3655
3945
  constructor(config: {
3656
- authScheme: AuthScheme;
3657
- context?: Record<string, any>;
3946
+ accessToken: string;
3947
+ refreshToken?: string;
3948
+ expiresIn?: number;
3949
+ refreshFunction?: (refreshToken: string) => Promise<{
3950
+ accessToken: string;
3951
+ refreshToken?: string;
3952
+ expiresIn?: number;
3953
+ }>;
3658
3954
  });
3955
+ /**
3956
+ * Gets the access token
3957
+ */
3958
+ getToken(): string;
3959
+ /**
3960
+ * Gets headers for HTTP requests
3961
+ */
3962
+ getHeaders(): Record<string, string>;
3963
+ /**
3964
+ * Whether the token can be refreshed
3965
+ */
3966
+ canRefresh(): boolean;
3967
+ /**
3968
+ * Whether the token is expired
3969
+ */
3970
+ isExpired(): boolean;
3971
+ /**
3972
+ * Refreshes the token
3973
+ */
3974
+ refresh(): Promise<void>;
3659
3975
  }
3660
3976
 
3661
3977
  /**
3662
- * Handler for authentication in tools
3978
+ * AI SDK integration that accepts a pre-configured LanguageModel.
3979
+ * Enables ADK to work with any provider supported by Vercel's AI SDK.
3663
3980
  */
3664
- declare class AuthHandler {
3981
+ declare class AiSdkLlm extends BaseLlm {
3982
+ private modelInstance;
3983
+ protected logger: Logger;
3984
+ private cacheManager;
3665
3985
  /**
3666
- * The authentication configuration
3986
+ * Model provider patterns for detection
3667
3987
  */
3668
- authConfig: AuthConfig;
3988
+ private static readonly PROVIDER_PATTERNS;
3669
3989
  /**
3670
- * The authentication credential
3990
+ * Constructor accepts a pre-configured LanguageModel instance
3991
+ * @param model - Pre-configured LanguageModel from provider(modelName)
3671
3992
  */
3672
- credential?: AuthCredential;
3993
+ constructor(modelInstance: LanguageModel);
3673
3994
  /**
3674
- * Constructor for AuthHandler
3995
+ * Returns empty array - following Python ADK pattern
3675
3996
  */
3676
- constructor(config: {
3677
- authConfig: AuthConfig;
3678
- credential?: AuthCredential;
3679
- });
3997
+ static supportedModels(): string[];
3680
3998
  /**
3681
- * Gets the authentication token
3999
+ * Safely extracts modelId from a LanguageModel instance
3682
4000
  */
3683
- getToken(): string | undefined;
4001
+ private getModelId;
3684
4002
  /**
3685
- * Gets headers for HTTP requests
4003
+ * Normalizes Google model ID by removing provider prefix
4004
+ * AI SDK uses "google/gemini-2.5-flash" but Google API expects "gemini-2.5-flash"
3686
4005
  */
3687
- getHeaders(): Record<string, string>;
4006
+ private normalizeGoogleModelId;
3688
4007
  /**
3689
- * Refreshes the token if necessary
4008
+ * Detects the provider of a given model
4009
+ */
4010
+ private detectModelProvider;
4011
+ /**
4012
+ * Initializes the cache manager for Google models
4013
+ * The manager lazily initializes its Google GenAI client on first use
4014
+ */
4015
+ private initializeCacheManager;
4016
+ /**
4017
+ * Handles context caching for Google models
4018
+ */
4019
+ private handleGoogleContextCaching;
4020
+ /**
4021
+ * Builds AI SDK request parameters with proper caching configuration
4022
+ */
4023
+ private buildRequestParams;
4024
+ /**
4025
+ * Logs provider-specific metadata
4026
+ */
4027
+ private logProviderMetadata;
4028
+ protected generateContentAsyncImpl(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
4029
+ /**
4030
+ * Handles streaming text generation
4031
+ */
4032
+ private handleStreamingResponse;
4033
+ /**
4034
+ * Handles non-streaming text generation
4035
+ */
4036
+ private handleNonStreamingResponse;
4037
+ /**
4038
+ * Convert ADK LlmRequest to AI SDK CoreMessage format
4039
+ */
4040
+ private convertToAiSdkMessages;
4041
+ /**
4042
+ * Transform JSON schema to use lowercase types for AI SDK compatibility
3690
4043
  */
3691
- refreshToken(): Promise<void>;
3692
- }
3693
-
3694
- /**
3695
- * Base class for LLM request processors.
3696
- */
3697
- declare abstract class BaseLlmRequestProcessor {
4044
+ private transformSchemaForAiSdk;
3698
4045
  /**
3699
- * Runs the processor on the given invocation context and LLM request.
3700
- * @param invocationContext The invocation context
3701
- * @param llmRequest The LLM request to process
3702
- * @returns An async generator yielding events
4046
+ * Convert ADK tools to AI SDK tools format
3703
4047
  */
3704
- abstract runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, unknown>;
3705
- }
3706
- /**
3707
- * Base class for LLM response processors.
3708
- */
3709
- declare abstract class BaseLlmResponseProcessor {
4048
+ private convertToAiSdkTools;
3710
4049
  /**
3711
- * Processes the LLM response.
3712
- * @param invocationContext The invocation context
3713
- * @param llmResponse The LLM response to process
3714
- * @returns An async generator yielding events
4050
+ * Convert ADK Content to AI SDK CoreMessage
3715
4051
  */
3716
- abstract runAsync(invocationContext: InvocationContext, llmResponse: LlmResponse): AsyncGenerator<Event, void, unknown>;
3717
- }
3718
-
3719
- /**
3720
- * Auth LLM request processor that handles authentication information
3721
- * to build the LLM request with credential processing
3722
- */
3723
- declare class AuthLlmRequestProcessor extends BaseLlmRequestProcessor {
4052
+ private contentToAiSdkMessage;
3724
4053
  /**
3725
- * Processes authentication information from session events
3726
- * and resumes function calls that required authentication
4054
+ * Map ADK role to AI SDK role
3727
4055
  */
3728
- runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event>;
4056
+ private mapRole;
3729
4057
  /**
3730
- * Parses and stores authentication response in session state
4058
+ * Map AI SDK finish reason to ADK finish reason
3731
4059
  */
3732
- private parseAndStoreAuthResponse;
4060
+ private mapFinishReason;
3733
4061
  }
3734
- /**
3735
- * Exported request processor instance for use in flow configurations
3736
- */
3737
- declare const requestProcessor$7: AuthLlmRequestProcessor;
3738
4062
 
3739
4063
  /**
3740
- * Enhanced auth configuration with credential handling
3741
- * This extends the basic AuthConfig with raw and exchanged credentials
4064
+ * Anthropic LLM implementation using Claude models with prompt caching support
3742
4065
  */
3743
- declare class EnhancedAuthConfig {
3744
- /**
3745
- * The authentication scheme
3746
- */
3747
- authScheme: AuthScheme;
4066
+ declare class AnthropicLlm extends BaseLlm {
4067
+ private _client?;
4068
+ protected logger: Logger;
3748
4069
  /**
3749
- * Raw auth credential used to collect credentials
3750
- * Used in auth schemes that need to exchange credentials (e.g. OAuth2, OIDC)
4070
+ * Constructor for Anthropic LLM
3751
4071
  */
3752
- rawAuthCredential?: AuthCredential;
4072
+ constructor(model?: string);
4073
+ static supportedModels(): string[];
3753
4074
  /**
3754
- * Exchanged auth credential after processing
3755
- * Filled by ADK and client working together
4075
+ * Main content generation method - handles both streaming and non-streaming
3756
4076
  */
3757
- exchangedAuthCredential?: AuthCredential;
4077
+ protected generateContentAsyncImpl(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
4078
+ private shouldEnableCache;
4079
+ private getCacheTTL;
4080
+ private createCacheControl;
4081
+ private logCachePerformance;
4082
+ connect(_llmRequest: LlmRequest): BaseLLMConnection;
3758
4083
  /**
3759
- * User-specified key for credential storage and retrieval
4084
+ * Convert Anthropic Message to ADK LlmResponse
3760
4085
  */
3761
- credentialKey?: string;
4086
+ private anthropicMessageToLlmResponse;
3762
4087
  /**
3763
- * Additional context properties
4088
+ * Convert ADK Content to Anthropic MessageParam
3764
4089
  */
3765
- context?: Record<string, any>;
4090
+ private contentToAnthropicMessage;
3766
4091
  /**
3767
- * Constructor for EnhancedAuthConfig
4092
+ * Convert ADK Part to Anthropic content block
3768
4093
  */
3769
- constructor(config: {
3770
- authScheme: AuthScheme;
3771
- rawAuthCredential?: AuthCredential;
3772
- exchangedAuthCredential?: AuthCredential;
3773
- credentialKey?: string;
3774
- context?: Record<string, any>;
3775
- });
4094
+ private partToAnthropicBlock;
3776
4095
  /**
3777
- * Generates a credential key based on auth scheme and raw credential
3778
- * Used for saving/loading credentials from credential service
4096
+ * Convert Anthropic content block to ADK Part
3779
4097
  */
3780
- private generateCredentialKey;
4098
+ private anthropicBlockToPart;
3781
4099
  /**
3782
- * Gets the credential key for storage
4100
+ * Convert ADK function declaration to Anthropic tool param
3783
4101
  */
3784
- getCredentialKey(): string;
3785
- }
3786
- /**
3787
- * Arguments for the special long-running function tool used to request
3788
- * end-user credentials
3789
- */
3790
- interface AuthToolArguments extends Record<string, unknown> {
4102
+ private functionDeclarationToAnthropicTool;
3791
4103
  /**
3792
- * The ID of the function call that requires authentication
4104
+ * Convert ADK role to Anthropic role format
3793
4105
  */
3794
- function_call_id: string;
4106
+ private toAnthropicRole;
3795
4107
  /**
3796
- * The authentication configuration
4108
+ * Convert Anthropic stop reason to ADK finish reason
3797
4109
  */
3798
- auth_config: AuthConfig | EnhancedAuthConfig;
3799
- }
3800
- /**
3801
- * Auth tool for handling credential requests
3802
- */
3803
- declare class AuthTool {
4110
+ private toAdkFinishReason;
3804
4111
  /**
3805
- * Processes auth tool arguments and returns appropriate response
4112
+ * Update type strings in schema to lowercase for Anthropic compatibility
3806
4113
  */
3807
- static processAuthRequest(args: AuthToolArguments): Promise<{
3808
- status: string;
3809
- authConfig?: AuthConfig | EnhancedAuthConfig;
3810
- credentialKey?: string;
3811
- }>;
4114
+ private updateTypeString;
3812
4115
  /**
3813
- * Validates auth tool arguments
4116
+ * Gets the Anthropic client
3814
4117
  */
3815
- static validateAuthArguments(args: any): args is AuthToolArguments;
4118
+ private get client();
4119
+ }
4120
+
4121
+ interface ContextCacheManager {
4122
+ handleContextCaching(llmRequest: LlmRequest): Promise<CacheMetadata | null>;
4123
+ populateCacheMetadataInResponse(llmResponse: LlmResponse, cacheMetadata: CacheMetadata): void;
4124
+ }
4125
+ declare class GeminiContextCacheManager implements ContextCacheManager {
4126
+ private genaiClient;
4127
+ private readonly logger;
4128
+ constructor(logger: Logger, genaiClient?: GoogleGenAI);
4129
+ getGenaiClient(): GoogleGenAI;
4130
+ handleContextCaching(llmRequest: LlmRequest): Promise<CacheMetadata | null>;
4131
+ private handleContextCachingInternal;
4132
+ private isCacheValid;
4133
+ private generateCacheFingerprint;
4134
+ private createNewCacheWithContents;
4135
+ private countCacheTokens;
4136
+ private createCache;
4137
+ cleanupCache(cacheName: string): Promise<void>;
4138
+ private applyCacheToRequest;
4139
+ populateCacheMetadataInResponse(llmResponse: LlmResponse, cacheMetadata: CacheMetadata): void;
3816
4140
  }
3817
- /**
3818
- * Creates an AuthToolArguments object with proper typing
3819
- */
3820
- declare function createAuthToolArguments(functionCallId: string, authConfig: AuthConfig | EnhancedAuthConfig): AuthToolArguments;
3821
- /**
3822
- * Type guard to check if an auth config is enhanced
3823
- */
3824
- declare function isEnhancedAuthConfig(config: AuthConfig | EnhancedAuthConfig): config is EnhancedAuthConfig;
3825
4141
 
3826
4142
  /**
3827
- * Types of authentication credentials
4143
+ * Google LLM Variant enum
3828
4144
  */
3829
- declare enum AuthCredentialType {
3830
- API_KEY = "api_key",
3831
- BASIC = "basic",
3832
- BEARER = "bearer",
3833
- OAUTH2 = "oauth2",
3834
- CUSTOM = "custom"
4145
+ declare enum GoogleLLMVariant {
4146
+ VERTEX_AI = "VERTEX_AI",
4147
+ GEMINI_API = "GEMINI_API"
3835
4148
  }
3836
4149
  /**
3837
- * Base class for authentication credentials
4150
+ * Integration for Gemini models.
3838
4151
  */
3839
- declare abstract class AuthCredential {
4152
+ declare class GoogleLlm extends BaseLlm {
4153
+ private _apiClient?;
4154
+ private _liveApiClient?;
4155
+ private _apiBackend?;
4156
+ private _trackingHeaders?;
3840
4157
  /**
3841
- * Type of credential
4158
+ * Constructor for Gemini
3842
4159
  */
3843
- type: AuthCredentialType;
4160
+ constructor(model?: string);
3844
4161
  /**
3845
- * Constructor for AuthCredential
4162
+ * Provides the list of supported models.
3846
4163
  */
3847
- constructor(type: AuthCredentialType);
4164
+ static supportedModels(): string[];
4165
+ protected generateContentAsyncImpl(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
3848
4166
  /**
3849
- * Gets the authentication token
4167
+ * Connects to the Gemini model and returns an llm connection.
3850
4168
  */
3851
- abstract getToken(): string | undefined;
4169
+ connect(_llmRequest: LlmRequest): BaseLLMConnection;
3852
4170
  /**
3853
- * Gets headers for HTTP requests
4171
+ * Convert LlmRequest contents to GoogleGenAI format
3854
4172
  */
3855
- abstract getHeaders(config: AuthConfig): Record<string, string>;
4173
+ private convertContents;
3856
4174
  /**
3857
- * Whether the token can be refreshed
4175
+ * Preprocesses the request based on the API backend.
3858
4176
  */
3859
- canRefresh(): boolean;
4177
+ private preprocessRequest;
3860
4178
  /**
3861
- * Refreshes the token
4179
+ * Sets display_name to null for the Gemini API (non-Vertex) backend.
3862
4180
  */
3863
- refresh(): Promise<void>;
3864
- }
3865
- /**
3866
- * API Key credential
3867
- */
3868
- declare class ApiKeyCredential extends AuthCredential {
4181
+ private removeDisplayNameIfPresent;
3869
4182
  /**
3870
- * The API key
4183
+ * Provides the api client.
3871
4184
  */
3872
- apiKey: string;
4185
+ get apiClient(): GoogleGenAI;
3873
4186
  /**
3874
- * Constructor for ApiKeyCredential
4187
+ * Gets the API backend type.
3875
4188
  */
3876
- constructor(apiKey: string);
4189
+ get apiBackend(): GoogleLLMVariant;
3877
4190
  /**
3878
- * Gets the API key as the token
4191
+ * Gets the tracking headers.
3879
4192
  */
3880
- getToken(): string;
4193
+ get trackingHeaders(): Record<string, string>;
3881
4194
  /**
3882
- * Gets headers for HTTP requests
4195
+ * Gets the live API version.
3883
4196
  */
3884
- getHeaders(config: AuthConfig): Record<string, string>;
4197
+ get liveApiVersion(): string;
4198
+ /**
4199
+ * Gets the live API client.
4200
+ */
4201
+ get liveApiClient(): GoogleGenAI;
4202
+ }
4203
+
4204
+ interface LLMClass {
4205
+ new (model: string): BaseLlm;
4206
+ supportedModels(): string[];
4207
+ }
4208
+ interface LlmModelConfig {
4209
+ temperature?: number;
4210
+ maxOutputTokens?: number;
4211
+ topP?: number;
4212
+ topK?: number;
4213
+ }
4214
+ interface LlmModel {
4215
+ generateContent(options: {
4216
+ prompt: string;
4217
+ } & LlmModelConfig): Promise<LlmResponse>;
3885
4218
  }
4219
+ declare class LLMRegistry {
4220
+ private static llmRegistry;
4221
+ private static modelInstances;
4222
+ private static logger;
4223
+ static newLLM(model: string): BaseLlm;
4224
+ static resolve(model: string): LLMClass | null;
4225
+ static register(modelNameRegex: string, llmClass: LLMClass): void;
4226
+ static registerLLM(llmClass: LLMClass): void;
4227
+ static registerModel(name: string, model: LlmModel): void;
4228
+ static getModel(name: string): LlmModel;
4229
+ static hasModel(name: string): boolean;
4230
+ static unregisterModel(name: string): void;
4231
+ static getModelOrCreate(name: string): LlmModel | BaseLlm;
4232
+ static clear(): void;
4233
+ static clearModels(): void;
4234
+ static clearClasses(): void;
4235
+ static logRegisteredModels(): void;
4236
+ }
4237
+
3886
4238
  /**
3887
- * Basic authentication credential
4239
+ * OpenAI LLM implementation using GPT models
4240
+ * Enhanced with comprehensive debug logging similar to Google LLM
3888
4241
  */
3889
- declare class BasicAuthCredential extends AuthCredential {
4242
+ declare class OpenAiLlm extends BaseLlm {
4243
+ private _client?;
3890
4244
  /**
3891
- * The username
4245
+ * Constructor for OpenAI LLM
3892
4246
  */
3893
- username: string;
4247
+ constructor(model?: string);
3894
4248
  /**
3895
- * The password
4249
+ * Provides the list of supported models
3896
4250
  */
3897
- password: string;
4251
+ static supportedModels(): string[];
3898
4252
  /**
3899
- * Constructor for BasicAuthCredential
4253
+ * Main content generation method - handles both streaming and non-streaming
3900
4254
  */
3901
- constructor(username: string, password: string);
4255
+ protected generateContentAsyncImpl(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void, unknown>;
3902
4256
  /**
3903
- * Gets the encoded basic auth token
4257
+ * Live connection is not supported for OpenAI models
3904
4258
  */
3905
- getToken(): string;
4259
+ connect(_llmRequest: LlmRequest): BaseLLMConnection;
3906
4260
  /**
3907
- * Gets headers for HTTP requests
4261
+ * Create LlmResponse from streaming chunk - similar to Google's LlmResponse.create
3908
4262
  */
3909
- getHeaders(): Record<string, string>;
3910
- }
3911
- /**
3912
- * Bearer token credential
3913
- */
3914
- declare class BearerTokenCredential extends AuthCredential {
4263
+ private createChunkResponse;
3915
4264
  /**
3916
- * The bearer token
4265
+ * Convert OpenAI message to ADK LlmResponse
3917
4266
  */
3918
- token: string;
4267
+ private openAiMessageToLlmResponse;
3919
4268
  /**
3920
- * Constructor for BearerTokenCredential
4269
+ * Convert ADK Content to OpenAI ChatCompletionMessage
3921
4270
  */
3922
- constructor(token: string);
4271
+ private contentToOpenAiMessage;
3923
4272
  /**
3924
- * Gets the bearer token
4273
+ * Convert ADK Part to OpenAI message content
3925
4274
  */
3926
- getToken(): string;
4275
+ private partToOpenAiContent;
3927
4276
  /**
3928
- * Gets headers for HTTP requests
4277
+ * Transform JSON schema to use lowercase types for OpenAI compatibility
3929
4278
  */
3930
- getHeaders(): Record<string, string>;
3931
- }
3932
- /**
3933
- * OAuth2 token credential with refresh capability
3934
- */
3935
- declare class OAuth2Credential extends AuthCredential {
4279
+ private transformSchemaForOpenAi;
3936
4280
  /**
3937
- * The access token
4281
+ * Convert ADK function declaration to OpenAI tool
3938
4282
  */
3939
- accessToken: string;
4283
+ private functionDeclarationToOpenAiTool;
3940
4284
  /**
3941
- * The refresh token
4285
+ * Convert ADK role to OpenAI role format
3942
4286
  */
3943
- refreshToken?: string;
4287
+ private toOpenAiRole;
3944
4288
  /**
3945
- * When the token expires
4289
+ * Convert OpenAI finish reason to ADK finish reason
3946
4290
  */
3947
- expiresAt?: Date;
4291
+ private toAdkFinishReason;
3948
4292
  /**
3949
- * Function to refresh the token
4293
+ * Preprocess request similar to Google LLM
3950
4294
  */
3951
- private refreshFunction?;
4295
+ private preprocessRequest;
3952
4296
  /**
3953
- * Constructor for OAuth2Credential
4297
+ * Preprocess individual parts for OpenAI compatibility
3954
4298
  */
3955
- constructor(config: {
3956
- accessToken: string;
3957
- refreshToken?: string;
3958
- expiresIn?: number;
3959
- refreshFunction?: (refreshToken: string) => Promise<{
3960
- accessToken: string;
3961
- refreshToken?: string;
3962
- expiresIn?: number;
3963
- }>;
3964
- });
4299
+ private preprocessPart;
3965
4300
  /**
3966
- * Gets the access token
4301
+ * Detect content type for flow control
4302
+ * This is a simplified implementation - you may need to adjust based on your specific requirements
3967
4303
  */
3968
- getToken(): string;
4304
+ private getContentType;
3969
4305
  /**
3970
- * Gets headers for HTTP requests
4306
+ * Check if response has inline data (similar to Google LLM)
3971
4307
  */
3972
- getHeaders(): Record<string, string>;
4308
+ private hasInlineData;
3973
4309
  /**
3974
- * Whether the token can be refreshed
4310
+ * Gets the OpenAI client
3975
4311
  */
3976
- canRefresh(): boolean;
4312
+ private get client();
4313
+ }
4314
+
4315
+ /**
4316
+ * Register all LLM providers
4317
+ */
4318
+ declare function registerProviders(): void;
4319
+
4320
+ /**
4321
+ * Configuration for model built-in thinking features
4322
+ * Compatible with google.genai.types.ThinkingConfig
4323
+ */
4324
+ interface ThinkingConfig {
3977
4325
  /**
3978
- * Whether the token is expired
4326
+ * Whether to include the thinking process in the response
3979
4327
  */
3980
- isExpired(): boolean;
4328
+ includeThinking?: boolean;
3981
4329
  /**
3982
- * Refreshes the token
4330
+ * Additional thinking configuration options
3983
4331
  */
3984
- refresh(): Promise<void>;
4332
+ [key: string]: any;
3985
4333
  }
3986
4334
 
3987
4335
  /**
3988
4336
  * Models module exports - consolidated to match Python structure
3989
4337
  */
3990
4338
 
3991
- type index$5_AiSdkLlm = AiSdkLlm;
3992
- declare const index$5_AiSdkLlm: typeof AiSdkLlm;
3993
- type index$5_AnthropicLlm = AnthropicLlm;
3994
- declare const index$5_AnthropicLlm: typeof AnthropicLlm;
3995
- type index$5_ApiKeyCredential = ApiKeyCredential;
3996
- declare const index$5_ApiKeyCredential: typeof ApiKeyCredential;
3997
- type index$5_ApiKeyScheme = ApiKeyScheme;
3998
- declare const index$5_ApiKeyScheme: typeof ApiKeyScheme;
3999
- type index$5_AuthConfig = AuthConfig;
4000
- declare const index$5_AuthConfig: typeof AuthConfig;
4001
- type index$5_AuthCredential = AuthCredential;
4002
- declare const index$5_AuthCredential: typeof AuthCredential;
4003
- type index$5_AuthCredentialType = AuthCredentialType;
4004
- declare const index$5_AuthCredentialType: typeof AuthCredentialType;
4005
- type index$5_AuthHandler = AuthHandler;
4006
- declare const index$5_AuthHandler: typeof AuthHandler;
4007
- type index$5_AuthScheme = AuthScheme;
4008
- declare const index$5_AuthScheme: typeof AuthScheme;
4009
- type index$5_AuthSchemeType = AuthSchemeType;
4010
- declare const index$5_AuthSchemeType: typeof AuthSchemeType;
4011
- type index$5_BaseLLMConnection = BaseLLMConnection;
4012
- declare const index$5_BaseLLMConnection: typeof BaseLLMConnection;
4013
- type index$5_BaseLlm = BaseLlm;
4014
- declare const index$5_BaseLlm: typeof BaseLlm;
4015
- type index$5_BaseMemoryService = BaseMemoryService;
4016
- type index$5_BasicAuthCredential = BasicAuthCredential;
4017
- declare const index$5_BasicAuthCredential: typeof BasicAuthCredential;
4018
- type index$5_BearerTokenCredential = BearerTokenCredential;
4019
- declare const index$5_BearerTokenCredential: typeof BearerTokenCredential;
4020
- declare const index$5_Blob: typeof Blob;
4021
- declare const index$5_Content: typeof Content;
4022
- declare const index$5_FunctionDeclaration: typeof FunctionDeclaration;
4023
- type index$5_GoogleLlm = GoogleLlm;
4024
- declare const index$5_GoogleLlm: typeof GoogleLlm;
4025
- type index$5_HttpScheme = HttpScheme;
4026
- declare const index$5_HttpScheme: typeof HttpScheme;
4027
- type index$5_LLMRegistry = LLMRegistry;
4028
- declare const index$5_LLMRegistry: typeof LLMRegistry;
4029
- type index$5_LlmModel = LlmModel;
4030
- type index$5_LlmModelConfig = LlmModelConfig;
4031
- type index$5_LlmRequest = LlmRequest;
4032
- declare const index$5_LlmRequest: typeof LlmRequest;
4033
- type index$5_LlmResponse = LlmResponse;
4034
- declare const index$5_LlmResponse: typeof LlmResponse;
4035
- type index$5_OAuth2Credential = OAuth2Credential;
4036
- declare const index$5_OAuth2Credential: typeof OAuth2Credential;
4037
- type index$5_OAuth2Scheme = OAuth2Scheme;
4038
- declare const index$5_OAuth2Scheme: typeof OAuth2Scheme;
4039
- type index$5_OAuthFlow = OAuthFlow;
4040
- type index$5_OAuthFlows = OAuthFlows;
4041
- type index$5_OpenAiLlm = OpenAiLlm;
4042
- declare const index$5_OpenAiLlm: typeof OpenAiLlm;
4043
- type index$5_OpenIdConnectScheme = OpenIdConnectScheme;
4044
- declare const index$5_OpenIdConnectScheme: typeof OpenIdConnectScheme;
4045
- type index$5_SearchMemoryResponse = SearchMemoryResponse;
4046
- type index$5_Session = Session;
4047
- type index$5_State = State;
4048
- declare const index$5_State: typeof State;
4049
- type index$5_ThinkingConfig = ThinkingConfig;
4050
- declare const index$5_registerProviders: typeof registerProviders;
4051
- declare namespace index$5 {
4052
- 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, type index$5_LlmModel as LlmModel, type index$5_LlmModelConfig as LlmModelConfig, 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 };
4339
+ type index$6_AiSdkLlm = AiSdkLlm;
4340
+ declare const index$6_AiSdkLlm: typeof AiSdkLlm;
4341
+ type index$6_AnthropicLlm = AnthropicLlm;
4342
+ declare const index$6_AnthropicLlm: typeof AnthropicLlm;
4343
+ type index$6_ApiKeyCredential = ApiKeyCredential;
4344
+ declare const index$6_ApiKeyCredential: typeof ApiKeyCredential;
4345
+ type index$6_ApiKeyScheme = ApiKeyScheme;
4346
+ declare const index$6_ApiKeyScheme: typeof ApiKeyScheme;
4347
+ type index$6_AuthConfig = AuthConfig;
4348
+ declare const index$6_AuthConfig: typeof AuthConfig;
4349
+ type index$6_AuthCredential = AuthCredential;
4350
+ declare const index$6_AuthCredential: typeof AuthCredential;
4351
+ type index$6_AuthCredentialType = AuthCredentialType;
4352
+ declare const index$6_AuthCredentialType: typeof AuthCredentialType;
4353
+ type index$6_AuthHandler = AuthHandler;
4354
+ declare const index$6_AuthHandler: typeof AuthHandler;
4355
+ type index$6_AuthScheme = AuthScheme;
4356
+ declare const index$6_AuthScheme: typeof AuthScheme;
4357
+ type index$6_AuthSchemeType = AuthSchemeType;
4358
+ declare const index$6_AuthSchemeType: typeof AuthSchemeType;
4359
+ type index$6_BaseLLMConnection = BaseLLMConnection;
4360
+ declare const index$6_BaseLLMConnection: typeof BaseLLMConnection;
4361
+ type index$6_BaseLlm = BaseLlm;
4362
+ declare const index$6_BaseLlm: typeof BaseLlm;
4363
+ type index$6_BaseMemoryService = BaseMemoryService;
4364
+ type index$6_BasicAuthCredential = BasicAuthCredential;
4365
+ declare const index$6_BasicAuthCredential: typeof BasicAuthCredential;
4366
+ type index$6_BearerTokenCredential = BearerTokenCredential;
4367
+ declare const index$6_BearerTokenCredential: typeof BearerTokenCredential;
4368
+ declare const index$6_Blob: typeof Blob;
4369
+ declare const index$6_Content: typeof Content;
4370
+ type index$6_ContextCacheManager = ContextCacheManager;
4371
+ declare const index$6_FunctionDeclaration: typeof FunctionDeclaration;
4372
+ type index$6_GeminiContextCacheManager = GeminiContextCacheManager;
4373
+ declare const index$6_GeminiContextCacheManager: typeof GeminiContextCacheManager;
4374
+ type index$6_GoogleLlm = GoogleLlm;
4375
+ declare const index$6_GoogleLlm: typeof GoogleLlm;
4376
+ type index$6_HttpScheme = HttpScheme;
4377
+ declare const index$6_HttpScheme: typeof HttpScheme;
4378
+ type index$6_LLMRegistry = LLMRegistry;
4379
+ declare const index$6_LLMRegistry: typeof LLMRegistry;
4380
+ type index$6_LlmModel = LlmModel;
4381
+ type index$6_LlmModelConfig = LlmModelConfig;
4382
+ type index$6_LlmRequest = LlmRequest;
4383
+ declare const index$6_LlmRequest: typeof LlmRequest;
4384
+ type index$6_LlmResponse = LlmResponse;
4385
+ declare const index$6_LlmResponse: typeof LlmResponse;
4386
+ type index$6_OAuth2Credential = OAuth2Credential;
4387
+ declare const index$6_OAuth2Credential: typeof OAuth2Credential;
4388
+ type index$6_OAuth2Scheme = OAuth2Scheme;
4389
+ declare const index$6_OAuth2Scheme: typeof OAuth2Scheme;
4390
+ type index$6_OAuthFlow = OAuthFlow;
4391
+ type index$6_OAuthFlows = OAuthFlows;
4392
+ type index$6_OpenAiLlm = OpenAiLlm;
4393
+ declare const index$6_OpenAiLlm: typeof OpenAiLlm;
4394
+ type index$6_OpenIdConnectScheme = OpenIdConnectScheme;
4395
+ declare const index$6_OpenIdConnectScheme: typeof OpenIdConnectScheme;
4396
+ type index$6_SearchMemoryResponse = SearchMemoryResponse;
4397
+ type index$6_Session = Session;
4398
+ type index$6_State = State;
4399
+ declare const index$6_State: typeof State;
4400
+ type index$6_ThinkingConfig = ThinkingConfig;
4401
+ declare const index$6_registerProviders: typeof registerProviders;
4402
+ declare namespace index$6 {
4403
+ 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, type index$6_ContextCacheManager as ContextCacheManager, index$6_FunctionDeclaration as FunctionDeclaration, index$6_GeminiContextCacheManager as GeminiContextCacheManager, 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 };
4053
4404
  }
4054
4405
 
4055
4406
  /**
@@ -4305,6 +4656,7 @@ declare class AgentBuilder<TOut = string, TMulti extends boolean = false> {
4305
4656
  private memoryService?;
4306
4657
  private artifactService?;
4307
4658
  private eventsCompactionConfig?;
4659
+ private contextCacheConfig?;
4308
4660
  private agentType;
4309
4661
  private existingSession?;
4310
4662
  private existingAgent?;
@@ -4526,6 +4878,7 @@ declare class AgentBuilder<TOut = string, TMulti extends boolean = false> {
4526
4878
  * @returns This builder instance for chaining
4527
4879
  */
4528
4880
  withQuickSession(options?: SessionOptions): this;
4881
+ withContextCacheConfig(config: ContextCacheConfig): this;
4529
4882
  /**
4530
4883
  * Build the agent and optionally create runner and session
4531
4884
  * @returns Built agent with optional runner and session
@@ -4707,67 +5060,71 @@ declare class SequentialAgent extends BaseAgent {
4707
5060
  protected runLiveImpl(ctx: InvocationContext): AsyncGenerator<Event, void, unknown>;
4708
5061
  }
4709
5062
 
4710
- type index$4_AfterAgentCallback = AfterAgentCallback;
4711
- type index$4_AfterModelCallback = AfterModelCallback;
4712
- type index$4_AfterToolCallback = AfterToolCallback;
4713
- type index$4_AgentBuilder<TOut = string, TMulti extends boolean = false> = AgentBuilder<TOut, TMulti>;
4714
- declare const index$4_AgentBuilder: typeof AgentBuilder;
4715
- type index$4_AgentBuilderConfig = AgentBuilderConfig;
4716
- type index$4_AgentBuilderWithSchema<T, M extends boolean = false> = AgentBuilderWithSchema<T, M>;
4717
- type index$4_AgentType = AgentType;
4718
- type index$4_BaseAgent = BaseAgent;
4719
- declare const index$4_BaseAgent: typeof BaseAgent;
4720
- type index$4_BeforeAgentCallback = BeforeAgentCallback;
4721
- type index$4_BeforeModelCallback = BeforeModelCallback;
4722
- type index$4_BeforeToolCallback = BeforeToolCallback;
4723
- type index$4_BuiltAgent<T = string, M extends boolean = false> = BuiltAgent<T, M>;
4724
- type index$4_CallbackContext = CallbackContext;
4725
- declare const index$4_CallbackContext: typeof CallbackContext;
4726
- type index$4_EnhancedRunner<T = string, M extends boolean = false> = EnhancedRunner<T, M>;
4727
- type index$4_FullMessage = FullMessage;
4728
- type index$4_InstructionProvider = InstructionProvider;
4729
- type index$4_InvocationContext = InvocationContext;
4730
- declare const index$4_InvocationContext: typeof InvocationContext;
4731
- type index$4_LangGraphAgent = LangGraphAgent;
4732
- declare const index$4_LangGraphAgent: typeof LangGraphAgent;
4733
- type index$4_LangGraphAgentConfig = LangGraphAgentConfig;
4734
- type index$4_LangGraphNode = LangGraphNode;
4735
- type index$4_LlmAgent<T extends BaseLlm = BaseLlm> = LlmAgent<T>;
4736
- declare const index$4_LlmAgent: typeof LlmAgent;
4737
- type index$4_LlmAgentConfig<T extends BaseLlm = BaseLlm> = LlmAgentConfig<T>;
4738
- type index$4_LlmCallsLimitExceededError = LlmCallsLimitExceededError;
4739
- declare const index$4_LlmCallsLimitExceededError: typeof LlmCallsLimitExceededError;
4740
- type index$4_LoopAgent = LoopAgent;
4741
- declare const index$4_LoopAgent: typeof LoopAgent;
4742
- type index$4_LoopAgentConfig = LoopAgentConfig;
4743
- type index$4_MessagePart = MessagePart;
4744
- type index$4_MultiAgentResponse = MultiAgentResponse;
4745
- type index$4_ParallelAgent = ParallelAgent;
4746
- declare const index$4_ParallelAgent: typeof ParallelAgent;
4747
- type index$4_ParallelAgentConfig = ParallelAgentConfig;
4748
- type index$4_ReadonlyContext = ReadonlyContext;
4749
- declare const index$4_ReadonlyContext: typeof ReadonlyContext;
4750
- type index$4_RunConfig = RunConfig;
4751
- declare const index$4_RunConfig: typeof RunConfig;
4752
- type index$4_RunnerAskReturn<T, M extends boolean> = RunnerAskReturn<T, M>;
4753
- type index$4_SequentialAgent = SequentialAgent;
4754
- declare const index$4_SequentialAgent: typeof SequentialAgent;
4755
- type index$4_SequentialAgentConfig = SequentialAgentConfig;
4756
- type index$4_SessionOptions = SessionOptions;
4757
- type index$4_SingleAfterModelCallback = SingleAfterModelCallback;
4758
- type index$4_SingleAfterToolCallback = SingleAfterToolCallback;
4759
- type index$4_SingleAgentCallback = SingleAgentCallback;
4760
- type index$4_SingleBeforeModelCallback = SingleBeforeModelCallback;
4761
- type index$4_SingleBeforeToolCallback = SingleBeforeToolCallback;
4762
- type index$4_StreamingMode = StreamingMode;
4763
- declare const index$4_StreamingMode: typeof StreamingMode;
4764
- type index$4_ToolUnion = ToolUnion;
4765
- type index$4_TransferContext = TransferContext;
4766
- declare const index$4_createBranchContextForSubAgent: typeof createBranchContextForSubAgent;
4767
- declare const index$4_mergeAgentRun: typeof mergeAgentRun;
4768
- declare const index$4_newInvocationContextId: typeof newInvocationContextId;
4769
- declare namespace index$4 {
4770
- 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, type index$4_MultiAgentResponse as MultiAgentResponse, index$4_ParallelAgent as ParallelAgent, type index$4_ParallelAgentConfig as ParallelAgentConfig, index$4_ReadonlyContext as ReadonlyContext, index$4_RunConfig as RunConfig, type index$4_RunnerAskReturn as RunnerAskReturn, 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, type index$4_TransferContext as TransferContext, index$4_createBranchContextForSubAgent as createBranchContextForSubAgent, index$4_mergeAgentRun as mergeAgentRun, index$4_newInvocationContextId as newInvocationContextId };
5063
+ type index$5_AfterAgentCallback = AfterAgentCallback;
5064
+ type index$5_AfterModelCallback = AfterModelCallback;
5065
+ type index$5_AfterToolCallback = AfterToolCallback;
5066
+ type index$5_AgentBuilder<TOut = string, TMulti extends boolean = false> = AgentBuilder<TOut, TMulti>;
5067
+ declare const index$5_AgentBuilder: typeof AgentBuilder;
5068
+ type index$5_AgentBuilderConfig = AgentBuilderConfig;
5069
+ type index$5_AgentBuilderWithSchema<T, M extends boolean = false> = AgentBuilderWithSchema<T, M>;
5070
+ type index$5_AgentType = AgentType;
5071
+ type index$5_BaseAgent = BaseAgent;
5072
+ declare const index$5_BaseAgent: typeof BaseAgent;
5073
+ type index$5_BeforeAgentCallback = BeforeAgentCallback;
5074
+ type index$5_BeforeModelCallback = BeforeModelCallback;
5075
+ type index$5_BeforeToolCallback = BeforeToolCallback;
5076
+ type index$5_BuiltAgent<T = string, M extends boolean = false> = BuiltAgent<T, M>;
5077
+ type index$5_CallbackContext = CallbackContext;
5078
+ declare const index$5_CallbackContext: typeof CallbackContext;
5079
+ type index$5_ContextCacheConfig = ContextCacheConfig;
5080
+ declare const index$5_ContextCacheConfig: typeof ContextCacheConfig;
5081
+ type index$5_ContextCacheConfigProps = ContextCacheConfigProps;
5082
+ type index$5_EnhancedRunner<T = string, M extends boolean = false> = EnhancedRunner<T, M>;
5083
+ type index$5_FullMessage = FullMessage;
5084
+ type index$5_InstructionProvider = InstructionProvider;
5085
+ type index$5_InvocationContext = InvocationContext;
5086
+ declare const index$5_InvocationContext: typeof InvocationContext;
5087
+ type index$5_LangGraphAgent = LangGraphAgent;
5088
+ declare const index$5_LangGraphAgent: typeof LangGraphAgent;
5089
+ type index$5_LangGraphAgentConfig = LangGraphAgentConfig;
5090
+ type index$5_LangGraphNode = LangGraphNode;
5091
+ type index$5_LlmAgent<T extends BaseLlm = BaseLlm> = LlmAgent<T>;
5092
+ declare const index$5_LlmAgent: typeof LlmAgent;
5093
+ type index$5_LlmAgentConfig<T extends BaseLlm = BaseLlm> = LlmAgentConfig<T>;
5094
+ type index$5_LlmCallsLimitExceededError = LlmCallsLimitExceededError;
5095
+ declare const index$5_LlmCallsLimitExceededError: typeof LlmCallsLimitExceededError;
5096
+ type index$5_LoopAgent = LoopAgent;
5097
+ declare const index$5_LoopAgent: typeof LoopAgent;
5098
+ type index$5_LoopAgentConfig = LoopAgentConfig;
5099
+ type index$5_MessagePart = MessagePart;
5100
+ type index$5_MultiAgentResponse = MultiAgentResponse;
5101
+ type index$5_ParallelAgent = ParallelAgent;
5102
+ declare const index$5_ParallelAgent: typeof ParallelAgent;
5103
+ type index$5_ParallelAgentConfig = ParallelAgentConfig;
5104
+ type index$5_ReadonlyContext = ReadonlyContext;
5105
+ declare const index$5_ReadonlyContext: typeof ReadonlyContext;
5106
+ type index$5_RunConfig = RunConfig;
5107
+ declare const index$5_RunConfig: typeof RunConfig;
5108
+ type index$5_RunnerAskReturn<T, M extends boolean> = RunnerAskReturn<T, M>;
5109
+ type index$5_SequentialAgent = SequentialAgent;
5110
+ declare const index$5_SequentialAgent: typeof SequentialAgent;
5111
+ type index$5_SequentialAgentConfig = SequentialAgentConfig;
5112
+ type index$5_SessionOptions = SessionOptions;
5113
+ type index$5_SingleAfterModelCallback = SingleAfterModelCallback;
5114
+ type index$5_SingleAfterToolCallback = SingleAfterToolCallback;
5115
+ type index$5_SingleAgentCallback = SingleAgentCallback;
5116
+ type index$5_SingleBeforeModelCallback = SingleBeforeModelCallback;
5117
+ type index$5_SingleBeforeToolCallback = SingleBeforeToolCallback;
5118
+ type index$5_StreamingMode = StreamingMode;
5119
+ declare const index$5_StreamingMode: typeof StreamingMode;
5120
+ type index$5_ToolUnion = ToolUnion;
5121
+ type index$5_TransferContext = TransferContext;
5122
+ declare const index$5_contextCacheConfigSchema: typeof contextCacheConfigSchema;
5123
+ declare const index$5_createBranchContextForSubAgent: typeof createBranchContextForSubAgent;
5124
+ declare const index$5_mergeAgentRun: typeof mergeAgentRun;
5125
+ declare const index$5_newInvocationContextId: typeof newInvocationContextId;
5126
+ declare namespace index$5 {
5127
+ 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, index$5_ContextCacheConfig as ContextCacheConfig, type index$5_ContextCacheConfigProps as ContextCacheConfigProps, 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, type index$5_MultiAgentResponse as MultiAgentResponse, index$5_ParallelAgent as ParallelAgent, type index$5_ParallelAgentConfig as ParallelAgentConfig, index$5_ReadonlyContext as ReadonlyContext, index$5_RunConfig as RunConfig, type index$5_RunnerAskReturn as RunnerAskReturn, 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, type index$5_TransferContext as TransferContext, index$5_contextCacheConfigSchema as contextCacheConfigSchema, index$5_createBranchContextForSubAgent as createBranchContextForSubAgent, index$5_mergeAgentRun as mergeAgentRun, index$5_newInvocationContextId as newInvocationContextId };
4771
5128
  }
4772
5129
 
4773
5130
  interface ParsedArtifactUri {
@@ -5158,46 +5515,62 @@ declare class SafetyEvaluatorV1 extends Evaluator {
5158
5515
  evaluateInvocations(actualInvocations: Invocation[], expectedInvocations: Invocation[]): Promise<EvaluationResult>;
5159
5516
  }
5160
5517
 
5161
- type index$3_AgentEvaluator = AgentEvaluator;
5162
- declare const index$3_AgentEvaluator: typeof AgentEvaluator;
5163
- type index$3_EvalCase = EvalCase;
5164
- type index$3_EvalCaseResult = EvalCaseResult;
5165
- type index$3_EvalMetric = EvalMetric;
5166
- type index$3_EvalMetricResult = EvalMetricResult;
5167
- type index$3_EvalMetricResultPerInvocation = EvalMetricResultPerInvocation;
5168
- type index$3_EvalResult = EvalResult;
5169
- declare const index$3_EvalResult: typeof EvalResult;
5170
- type index$3_EvalSet = EvalSet;
5171
- type index$3_EvalSetResult = EvalSetResult;
5172
- type index$3_EvalStatus = EvalStatus;
5173
- declare const index$3_EvalStatus: typeof EvalStatus;
5174
- type index$3_EvaluateConfig = EvaluateConfig;
5175
- type index$3_EvaluationResult = EvaluationResult;
5176
- type index$3_Evaluator = Evaluator;
5177
- declare const index$3_Evaluator: typeof Evaluator;
5178
- type index$3_FinalResponseMatchV2Evaluator = FinalResponseMatchV2Evaluator;
5179
- declare const index$3_FinalResponseMatchV2Evaluator: typeof FinalResponseMatchV2Evaluator;
5180
- type index$3_IntermediateData = IntermediateData;
5181
- type index$3_Interval = Interval;
5182
- type index$3_Invocation = Invocation;
5183
- type index$3_JudgeModelOptions = JudgeModelOptions;
5184
- type index$3_LocalEvalService = LocalEvalService;
5185
- declare const index$3_LocalEvalService: typeof LocalEvalService;
5186
- type index$3_MetricInfo = MetricInfo;
5187
- type index$3_MetricValueInfo = MetricValueInfo;
5188
- type index$3_PerInvocationResult = PerInvocationResult;
5189
- type index$3_PrebuiltMetrics = PrebuiltMetrics;
5190
- declare const index$3_PrebuiltMetrics: typeof PrebuiltMetrics;
5191
- type index$3_RougeEvaluator = RougeEvaluator;
5192
- declare const index$3_RougeEvaluator: typeof RougeEvaluator;
5193
- type index$3_SafetyEvaluatorV1 = SafetyEvaluatorV1;
5194
- declare const index$3_SafetyEvaluatorV1: typeof SafetyEvaluatorV1;
5195
- type index$3_SessionInput = SessionInput;
5196
- type index$3_TrajectoryEvaluator = TrajectoryEvaluator;
5197
- declare const index$3_TrajectoryEvaluator: typeof TrajectoryEvaluator;
5198
- declare namespace index$3 {
5199
- export { index$3_AgentEvaluator as AgentEvaluator, type index$3_EvalCase as EvalCase, type index$3_EvalCaseResult as EvalCaseResult, type index$3_EvalMetric as EvalMetric, type index$3_EvalMetricResult as EvalMetricResult, type index$3_EvalMetricResultPerInvocation as EvalMetricResultPerInvocation, index$3_EvalResult as EvalResult, type index$3_EvalSet as EvalSet, type index$3_EvalSetResult as EvalSetResult, index$3_EvalStatus as EvalStatus, type index$3_EvaluateConfig as EvaluateConfig, type index$3_EvaluationResult as EvaluationResult, index$3_Evaluator as Evaluator, index$3_FinalResponseMatchV2Evaluator as FinalResponseMatchV2Evaluator, type index$3_IntermediateData as IntermediateData, type index$3_Interval as Interval, type index$3_Invocation as Invocation, type index$3_JudgeModelOptions as JudgeModelOptions, index$3_LocalEvalService as LocalEvalService, type index$3_MetricInfo as MetricInfo, type index$3_MetricValueInfo as MetricValueInfo, type index$3_PerInvocationResult as PerInvocationResult, index$3_PrebuiltMetrics as PrebuiltMetrics, index$3_RougeEvaluator as RougeEvaluator, index$3_SafetyEvaluatorV1 as SafetyEvaluatorV1, type index$3_SessionInput as SessionInput, index$3_TrajectoryEvaluator as TrajectoryEvaluator };
5518
+ type index$4_AgentEvaluator = AgentEvaluator;
5519
+ declare const index$4_AgentEvaluator: typeof AgentEvaluator;
5520
+ type index$4_EvalCase = EvalCase;
5521
+ type index$4_EvalCaseResult = EvalCaseResult;
5522
+ type index$4_EvalMetric = EvalMetric;
5523
+ type index$4_EvalMetricResult = EvalMetricResult;
5524
+ type index$4_EvalMetricResultPerInvocation = EvalMetricResultPerInvocation;
5525
+ type index$4_EvalResult = EvalResult;
5526
+ declare const index$4_EvalResult: typeof EvalResult;
5527
+ type index$4_EvalSet = EvalSet;
5528
+ type index$4_EvalSetResult = EvalSetResult;
5529
+ type index$4_EvalStatus = EvalStatus;
5530
+ declare const index$4_EvalStatus: typeof EvalStatus;
5531
+ type index$4_EvaluateConfig = EvaluateConfig;
5532
+ type index$4_EvaluationResult = EvaluationResult;
5533
+ type index$4_Evaluator = Evaluator;
5534
+ declare const index$4_Evaluator: typeof Evaluator;
5535
+ type index$4_FinalResponseMatchV2Evaluator = FinalResponseMatchV2Evaluator;
5536
+ declare const index$4_FinalResponseMatchV2Evaluator: typeof FinalResponseMatchV2Evaluator;
5537
+ type index$4_IntermediateData = IntermediateData;
5538
+ type index$4_Interval = Interval;
5539
+ type index$4_Invocation = Invocation;
5540
+ type index$4_JudgeModelOptions = JudgeModelOptions;
5541
+ type index$4_LocalEvalService = LocalEvalService;
5542
+ declare const index$4_LocalEvalService: typeof LocalEvalService;
5543
+ type index$4_MetricInfo = MetricInfo;
5544
+ type index$4_MetricValueInfo = MetricValueInfo;
5545
+ type index$4_PerInvocationResult = PerInvocationResult;
5546
+ type index$4_PrebuiltMetrics = PrebuiltMetrics;
5547
+ declare const index$4_PrebuiltMetrics: typeof PrebuiltMetrics;
5548
+ type index$4_RougeEvaluator = RougeEvaluator;
5549
+ declare const index$4_RougeEvaluator: typeof RougeEvaluator;
5550
+ type index$4_SafetyEvaluatorV1 = SafetyEvaluatorV1;
5551
+ declare const index$4_SafetyEvaluatorV1: typeof SafetyEvaluatorV1;
5552
+ type index$4_SessionInput = SessionInput;
5553
+ type index$4_TrajectoryEvaluator = TrajectoryEvaluator;
5554
+ declare const index$4_TrajectoryEvaluator: typeof TrajectoryEvaluator;
5555
+ declare namespace index$4 {
5556
+ export { index$4_AgentEvaluator as AgentEvaluator, type index$4_EvalCase as EvalCase, type index$4_EvalCaseResult as EvalCaseResult, type index$4_EvalMetric as EvalMetric, type index$4_EvalMetricResult as EvalMetricResult, type index$4_EvalMetricResultPerInvocation as EvalMetricResultPerInvocation, index$4_EvalResult as EvalResult, type index$4_EvalSet as EvalSet, type index$4_EvalSetResult as EvalSetResult, index$4_EvalStatus as EvalStatus, type index$4_EvaluateConfig as EvaluateConfig, type index$4_EvaluationResult as EvaluationResult, index$4_Evaluator as Evaluator, index$4_FinalResponseMatchV2Evaluator as FinalResponseMatchV2Evaluator, type index$4_IntermediateData as IntermediateData, type index$4_Interval as Interval, type index$4_Invocation as Invocation, type index$4_JudgeModelOptions as JudgeModelOptions, index$4_LocalEvalService as LocalEvalService, type index$4_MetricInfo as MetricInfo, type index$4_MetricValueInfo as MetricValueInfo, type index$4_PerInvocationResult as PerInvocationResult, index$4_PrebuiltMetrics as PrebuiltMetrics, index$4_RougeEvaluator as RougeEvaluator, index$4_SafetyEvaluatorV1 as SafetyEvaluatorV1, type index$4_SessionInput as SessionInput, index$4_TrajectoryEvaluator as TrajectoryEvaluator };
5557
+ }
5558
+
5559
+ /**
5560
+ * Agent transfer request processor that enables agent transfer functionality
5561
+ * for AutoFlow by adding transfer instructions and tools to the LLM request
5562
+ */
5563
+ declare class AgentTransferLlmRequestProcessor extends BaseLlmRequestProcessor {
5564
+ /**
5565
+ * Processes agent transfer by adding transfer instructions and tools
5566
+ * if the agent has transfer targets available
5567
+ */
5568
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event>;
5200
5569
  }
5570
+ /**
5571
+ * Exported request processor instance for use in AutoFlow
5572
+ */
5573
+ declare const requestProcessor$6: AgentTransferLlmRequestProcessor;
5201
5574
 
5202
5575
  declare abstract class BaseLlmFlow {
5203
5576
  requestProcessors: Array<any>;
@@ -5224,13 +5597,8 @@ declare abstract class BaseLlmFlow {
5224
5597
  *
5225
5598
  * A single flow only considers an agent itself and tools.
5226
5599
  * No sub-agents are allowed for single flow.
5227
- *
5228
- * This matches the Python implementation's SingleFlow class.
5229
5600
  */
5230
5601
  declare class SingleFlow extends BaseLlmFlow {
5231
- /**
5232
- * Constructor for SingleFlow
5233
- */
5234
5602
  constructor();
5235
5603
  }
5236
5604
 
@@ -5269,35 +5637,25 @@ declare class BasicLlmRequestProcessor extends BaseLlmRequestProcessor {
5269
5637
  /**
5270
5638
  * Exported instance of the basic request processor
5271
5639
  */
5272
- declare const requestProcessor$6: BasicLlmRequestProcessor;
5640
+ declare const requestProcessor$5: BasicLlmRequestProcessor;
5273
5641
 
5274
5642
  /**
5275
- * Identity LLM request processor that gives the agent identity from the framework.
5276
- * This processor adds the agent's name and description to the system instructions.
5643
+ * Request processor for code execution
5277
5644
  */
5278
- declare class IdentityLlmRequestProcessor extends BaseLlmRequestProcessor {
5279
- runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, unknown>;
5645
+ declare class CodeExecutionRequestProcessor extends BaseLlmRequestProcessor {
5646
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event>;
5280
5647
  }
5281
5648
  /**
5282
- * Exported instance of the identity request processor
5283
- */
5284
- declare const requestProcessor$5: IdentityLlmRequestProcessor;
5285
-
5286
- /**
5287
- * Instructions LLM request processor that handles instructions and global instructions.
5288
- * This processor adds both global instructions (from root agent) and agent-specific instructions.
5649
+ * Response processor for code execution
5289
5650
  */
5290
- declare class InstructionsLlmRequestProcessor extends BaseLlmRequestProcessor {
5291
- runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, unknown>;
5292
- /**
5293
- * Type guard to check if agent is an LlmAgent
5294
- */
5295
- private isLlmAgent;
5651
+ declare class CodeExecutionResponseProcessor extends BaseLlmResponseProcessor {
5652
+ runAsync(invocationContext: InvocationContext, llmResponse: LlmResponse): AsyncGenerator<Event>;
5296
5653
  }
5297
5654
  /**
5298
- * Exported instance of the instructions request processor
5655
+ * Exported processor instances
5299
5656
  */
5300
- declare const requestProcessor$4: InstructionsLlmRequestProcessor;
5657
+ declare const requestProcessor$4: CodeExecutionRequestProcessor;
5658
+ declare const responseProcessor$1: CodeExecutionResponseProcessor;
5301
5659
 
5302
5660
  /**
5303
5661
  * Content LLM request processor that builds the contents for the LLM request.
@@ -5315,63 +5673,6 @@ declare class ContentLlmRequestProcessor extends BaseLlmRequestProcessor {
5315
5673
  */
5316
5674
  declare const requestProcessor$3: ContentLlmRequestProcessor;
5317
5675
 
5318
- /**
5319
- * Agent transfer request processor that enables agent transfer functionality
5320
- * for AutoFlow by adding transfer instructions and tools to the LLM request
5321
- */
5322
- declare class AgentTransferLlmRequestProcessor extends BaseLlmRequestProcessor {
5323
- /**
5324
- * Processes agent transfer by adding transfer instructions and tools
5325
- * if the agent has transfer targets available
5326
- */
5327
- runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event>;
5328
- }
5329
- /**
5330
- * Exported request processor instance for use in AutoFlow
5331
- */
5332
- declare const requestProcessor$2: AgentTransferLlmRequestProcessor;
5333
-
5334
- /**
5335
- * Request processor for Natural Language Planning
5336
- * Applies planning instructions and configurations to LLM requests
5337
- */
5338
- declare class NlPlanningRequestProcessor extends BaseLlmRequestProcessor {
5339
- runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event>;
5340
- }
5341
- /**
5342
- * Response processor for Natural Language Planning
5343
- * Processes LLM responses to handle planning content and state updates
5344
- */
5345
- declare class NlPlanningResponseProcessor extends BaseLlmResponseProcessor {
5346
- runAsync(invocationContext: InvocationContext, llmResponse: LlmResponse): AsyncGenerator<Event>;
5347
- }
5348
- /**
5349
- * Exported request processor instance for use in flow configurations
5350
- */
5351
- declare const requestProcessor$1: NlPlanningRequestProcessor;
5352
- /**
5353
- * Exported response processor instance for use in flow configurations
5354
- */
5355
- declare const responseProcessor$1: NlPlanningResponseProcessor;
5356
-
5357
- /**
5358
- * Request processor for code execution
5359
- */
5360
- declare class CodeExecutionRequestProcessor extends BaseLlmRequestProcessor {
5361
- runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event>;
5362
- }
5363
- /**
5364
- * Response processor for code execution
5365
- */
5366
- declare class CodeExecutionResponseProcessor extends BaseLlmResponseProcessor {
5367
- runAsync(invocationContext: InvocationContext, llmResponse: LlmResponse): AsyncGenerator<Event>;
5368
- }
5369
- /**
5370
- * Exported processor instances
5371
- */
5372
- declare const requestProcessor: CodeExecutionRequestProcessor;
5373
- declare const responseProcessor: CodeExecutionResponseProcessor;
5374
-
5375
5676
  declare const AF_FUNCTION_CALL_ID_PREFIX = "adk-";
5376
5677
  declare const REQUEST_EUC_FUNCTION_CALL_NAME = "adk_request_credential";
5377
5678
  /**
@@ -5407,28 +5708,79 @@ declare function handleFunctionCallsLive(invocationContext: InvocationContext, f
5407
5708
  */
5408
5709
  declare function mergeParallelFunctionResponseEvents(functionResponseEvents: Event[]): Event;
5409
5710
 
5410
- declare const index$2_AF_FUNCTION_CALL_ID_PREFIX: typeof AF_FUNCTION_CALL_ID_PREFIX;
5411
- type index$2_AutoFlow = AutoFlow;
5412
- declare const index$2_AutoFlow: typeof AutoFlow;
5413
- type index$2_BaseLlmFlow = BaseLlmFlow;
5414
- declare const index$2_BaseLlmFlow: typeof BaseLlmFlow;
5415
- type index$2_BaseLlmRequestProcessor = BaseLlmRequestProcessor;
5416
- declare const index$2_BaseLlmRequestProcessor: typeof BaseLlmRequestProcessor;
5417
- type index$2_BaseLlmResponseProcessor = BaseLlmResponseProcessor;
5418
- declare const index$2_BaseLlmResponseProcessor: typeof BaseLlmResponseProcessor;
5419
- declare const index$2_REQUEST_EUC_FUNCTION_CALL_NAME: typeof REQUEST_EUC_FUNCTION_CALL_NAME;
5420
- type index$2_SingleFlow = SingleFlow;
5421
- declare const index$2_SingleFlow: typeof SingleFlow;
5422
- declare const index$2_generateAuthEvent: typeof generateAuthEvent;
5423
- declare const index$2_generateClientFunctionCallId: typeof generateClientFunctionCallId;
5424
- declare const index$2_getLongRunningFunctionCalls: typeof getLongRunningFunctionCalls;
5425
- declare const index$2_handleFunctionCallsAsync: typeof handleFunctionCallsAsync;
5426
- declare const index$2_handleFunctionCallsLive: typeof handleFunctionCallsLive;
5427
- declare const index$2_mergeParallelFunctionResponseEvents: typeof mergeParallelFunctionResponseEvents;
5428
- declare const index$2_populateClientFunctionCallId: typeof populateClientFunctionCallId;
5429
- declare const index$2_removeClientFunctionCallId: typeof removeClientFunctionCallId;
5430
- declare namespace index$2 {
5431
- export { index$2_AF_FUNCTION_CALL_ID_PREFIX as AF_FUNCTION_CALL_ID_PREFIX, index$2_AutoFlow as AutoFlow, index$2_BaseLlmFlow as BaseLlmFlow, index$2_BaseLlmRequestProcessor as BaseLlmRequestProcessor, index$2_BaseLlmResponseProcessor as BaseLlmResponseProcessor, index$2_REQUEST_EUC_FUNCTION_CALL_NAME as REQUEST_EUC_FUNCTION_CALL_NAME, index$2_SingleFlow as SingleFlow, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, index$2_generateAuthEvent as generateAuthEvent, index$2_generateClientFunctionCallId as generateClientFunctionCallId, index$2_getLongRunningFunctionCalls as getLongRunningFunctionCalls, index$2_handleFunctionCallsAsync as handleFunctionCallsAsync, index$2_handleFunctionCallsLive as handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, requestProcessor$4 as instructionsRequestProcessor, index$2_mergeParallelFunctionResponseEvents as mergeParallelFunctionResponseEvents, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, index$2_populateClientFunctionCallId as populateClientFunctionCallId, index$2_removeClientFunctionCallId as removeClientFunctionCallId };
5711
+ /**
5712
+ * Identity LLM request processor that gives the agent identity from the framework.
5713
+ * This processor adds the agent's name and description to the system instructions.
5714
+ */
5715
+ declare class IdentityLlmRequestProcessor extends BaseLlmRequestProcessor {
5716
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, unknown>;
5717
+ }
5718
+ /**
5719
+ * Exported instance of the identity request processor
5720
+ */
5721
+ declare const requestProcessor$2: IdentityLlmRequestProcessor;
5722
+
5723
+ /**
5724
+ * Instructions LLM request processor that handles instructions and global instructions.
5725
+ * This processor adds both global instructions (from root agent) and agent-specific instructions.
5726
+ */
5727
+ declare class InstructionsLlmRequestProcessor extends BaseLlmRequestProcessor {
5728
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, unknown>;
5729
+ /**
5730
+ * Type guard to check if agent is an LlmAgent
5731
+ */
5732
+ private isLlmAgent;
5733
+ }
5734
+ /**
5735
+ * Exported instance of the instructions request processor
5736
+ */
5737
+ declare const requestProcessor$1: InstructionsLlmRequestProcessor;
5738
+
5739
+ /**
5740
+ * Request processor for Natural Language Planning
5741
+ * Applies planning instructions and configurations to LLM requests
5742
+ */
5743
+ declare class NlPlanningRequestProcessor extends BaseLlmRequestProcessor {
5744
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event>;
5745
+ }
5746
+ /**
5747
+ * Response processor for Natural Language Planning
5748
+ * Processes LLM responses to handle planning content and state updates
5749
+ */
5750
+ declare class NlPlanningResponseProcessor extends BaseLlmResponseProcessor {
5751
+ runAsync(invocationContext: InvocationContext, llmResponse: LlmResponse): AsyncGenerator<Event>;
5752
+ }
5753
+ /**
5754
+ * Exported request processor instance for use in flow configurations
5755
+ */
5756
+ declare const requestProcessor: NlPlanningRequestProcessor;
5757
+ /**
5758
+ * Exported response processor instance for use in flow configurations
5759
+ */
5760
+ declare const responseProcessor: NlPlanningResponseProcessor;
5761
+
5762
+ declare const index$3_AF_FUNCTION_CALL_ID_PREFIX: typeof AF_FUNCTION_CALL_ID_PREFIX;
5763
+ type index$3_AutoFlow = AutoFlow;
5764
+ declare const index$3_AutoFlow: typeof AutoFlow;
5765
+ type index$3_BaseLlmFlow = BaseLlmFlow;
5766
+ declare const index$3_BaseLlmFlow: typeof BaseLlmFlow;
5767
+ type index$3_BaseLlmRequestProcessor = BaseLlmRequestProcessor;
5768
+ declare const index$3_BaseLlmRequestProcessor: typeof BaseLlmRequestProcessor;
5769
+ type index$3_BaseLlmResponseProcessor = BaseLlmResponseProcessor;
5770
+ declare const index$3_BaseLlmResponseProcessor: typeof BaseLlmResponseProcessor;
5771
+ declare const index$3_REQUEST_EUC_FUNCTION_CALL_NAME: typeof REQUEST_EUC_FUNCTION_CALL_NAME;
5772
+ type index$3_SingleFlow = SingleFlow;
5773
+ declare const index$3_SingleFlow: typeof SingleFlow;
5774
+ declare const index$3_generateAuthEvent: typeof generateAuthEvent;
5775
+ declare const index$3_generateClientFunctionCallId: typeof generateClientFunctionCallId;
5776
+ declare const index$3_getLongRunningFunctionCalls: typeof getLongRunningFunctionCalls;
5777
+ declare const index$3_handleFunctionCallsAsync: typeof handleFunctionCallsAsync;
5778
+ declare const index$3_handleFunctionCallsLive: typeof handleFunctionCallsLive;
5779
+ declare const index$3_mergeParallelFunctionResponseEvents: typeof mergeParallelFunctionResponseEvents;
5780
+ declare const index$3_populateClientFunctionCallId: typeof populateClientFunctionCallId;
5781
+ declare const index$3_removeClientFunctionCallId: typeof removeClientFunctionCallId;
5782
+ declare namespace index$3 {
5783
+ export { index$3_AF_FUNCTION_CALL_ID_PREFIX as AF_FUNCTION_CALL_ID_PREFIX, index$3_AutoFlow as AutoFlow, index$3_BaseLlmFlow as BaseLlmFlow, index$3_BaseLlmRequestProcessor as BaseLlmRequestProcessor, index$3_BaseLlmResponseProcessor as BaseLlmResponseProcessor, index$3_REQUEST_EUC_FUNCTION_CALL_NAME as REQUEST_EUC_FUNCTION_CALL_NAME, index$3_SingleFlow as SingleFlow, requestProcessor$6 as agentTransferRequestProcessor, requestProcessor$5 as basicRequestProcessor, requestProcessor$4 as codeExecutionRequestProcessor, responseProcessor$1 as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, index$3_generateAuthEvent as generateAuthEvent, index$3_generateClientFunctionCallId as generateClientFunctionCallId, index$3_getLongRunningFunctionCalls as getLongRunningFunctionCalls, index$3_handleFunctionCallsAsync as handleFunctionCallsAsync, index$3_handleFunctionCallsLive as handleFunctionCallsLive, requestProcessor$2 as identityRequestProcessor, requestProcessor$1 as instructionsRequestProcessor, index$3_mergeParallelFunctionResponseEvents as mergeParallelFunctionResponseEvents, requestProcessor as nlPlanningRequestProcessor, responseProcessor as nlPlanningResponseProcessor, index$3_populateClientFunctionCallId as populateClientFunctionCallId, index$3_removeClientFunctionCallId as removeClientFunctionCallId };
5432
5784
  }
5433
5785
 
5434
5786
  /**
@@ -5510,12 +5862,12 @@ declare class VertexAiRagMemoryService implements BaseMemoryService {
5510
5862
  * Memory Services for the Agent Development Kit
5511
5863
  */
5512
5864
 
5513
- type index$1_InMemoryMemoryService = InMemoryMemoryService;
5514
- declare const index$1_InMemoryMemoryService: typeof InMemoryMemoryService;
5515
- type index$1_VertexAiRagMemoryService = VertexAiRagMemoryService;
5516
- declare const index$1_VertexAiRagMemoryService: typeof VertexAiRagMemoryService;
5517
- declare namespace index$1 {
5518
- export { index$1_InMemoryMemoryService as InMemoryMemoryService, index$1_VertexAiRagMemoryService as VertexAiRagMemoryService };
5865
+ type index$2_InMemoryMemoryService = InMemoryMemoryService;
5866
+ declare const index$2_InMemoryMemoryService: typeof InMemoryMemoryService;
5867
+ type index$2_VertexAiRagMemoryService = VertexAiRagMemoryService;
5868
+ declare const index$2_VertexAiRagMemoryService: typeof VertexAiRagMemoryService;
5869
+ declare namespace index$2 {
5870
+ export { index$2_InMemoryMemoryService as InMemoryMemoryService, index$2_VertexAiRagMemoryService as VertexAiRagMemoryService };
5519
5871
  }
5520
5872
 
5521
5873
  /**
@@ -5738,6 +6090,27 @@ declare class ReflectAndRetryToolPlugin extends BasePlugin {
5738
6090
  private _formatArgs;
5739
6091
  }
5740
6092
 
6093
+ type index$1_BasePlugin = BasePlugin;
6094
+ declare const index$1_BasePlugin: typeof BasePlugin;
6095
+ type index$1_LangfusePlugin = LangfusePlugin;
6096
+ declare const index$1_LangfusePlugin: typeof LangfusePlugin;
6097
+ type index$1_LangfusePluginOptions = LangfusePluginOptions;
6098
+ type index$1_PerToolFailuresCounter = PerToolFailuresCounter;
6099
+ type index$1_PluginCallbackName = PluginCallbackName;
6100
+ type index$1_PluginManager = PluginManager;
6101
+ declare const index$1_PluginManager: typeof PluginManager;
6102
+ declare const index$1_REFLECT_AND_RETRY_RESPONSE_TYPE: typeof REFLECT_AND_RETRY_RESPONSE_TYPE;
6103
+ type index$1_ReflectAndRetryToolPlugin = ReflectAndRetryToolPlugin;
6104
+ declare const index$1_ReflectAndRetryToolPlugin: typeof ReflectAndRetryToolPlugin;
6105
+ type index$1_ReflectAndRetryToolPluginOptions = ReflectAndRetryToolPluginOptions;
6106
+ type index$1_ToolFailureResponse = ToolFailureResponse;
6107
+ type index$1_TrackingScope = TrackingScope;
6108
+ declare const index$1_TrackingScope: typeof TrackingScope;
6109
+ declare const index$1_pluginCallbackNameSchema: typeof pluginCallbackNameSchema;
6110
+ declare namespace index$1 {
6111
+ export { index$1_BasePlugin as BasePlugin, index$1_LangfusePlugin as LangfusePlugin, type index$1_LangfusePluginOptions as LangfusePluginOptions, type index$1_PerToolFailuresCounter as PerToolFailuresCounter, type index$1_PluginCallbackName as PluginCallbackName, index$1_PluginManager as PluginManager, index$1_REFLECT_AND_RETRY_RESPONSE_TYPE as REFLECT_AND_RETRY_RESPONSE_TYPE, index$1_ReflectAndRetryToolPlugin as ReflectAndRetryToolPlugin, type index$1_ReflectAndRetryToolPluginOptions as ReflectAndRetryToolPluginOptions, type index$1_ToolFailureResponse as ToolFailureResponse, index$1_TrackingScope as TrackingScope, index$1_pluginCallbackNameSchema as pluginCallbackNameSchema };
6112
+ }
6113
+
5741
6114
  /**
5742
6115
  * An in-memory implementation of the session service.
5743
6116
  */
@@ -6035,17 +6408,22 @@ declare class Runner<T extends BaseAgent = BaseAgent> {
6035
6408
  * Configuration for event compaction.
6036
6409
  */
6037
6410
  eventsCompactionConfig?: EventsCompactionConfig;
6411
+ /**
6412
+ * The context cache config for the runner.
6413
+ */
6414
+ contextCacheConfig?: ContextCacheConfig;
6038
6415
  protected logger: Logger;
6039
6416
  /**
6040
6417
  * Initializes the Runner.
6041
6418
  */
6042
- constructor({ appName, agent, artifactService, sessionService, memoryService, eventsCompactionConfig, plugins, pluginCloseTimeout, }: {
6419
+ constructor({ appName, agent, artifactService, sessionService, memoryService, eventsCompactionConfig, contextCacheConfig, plugins, pluginCloseTimeout, }: {
6043
6420
  appName: string;
6044
6421
  agent: T;
6045
6422
  artifactService?: BaseArtifactService;
6046
6423
  sessionService: BaseSessionService;
6047
6424
  memoryService?: BaseMemoryService;
6048
6425
  eventsCompactionConfig?: EventsCompactionConfig;
6426
+ contextCacheConfig?: ContextCacheConfig;
6049
6427
  plugins?: BasePlugin[];
6050
6428
  pluginCloseTimeout?: number;
6051
6429
  });
@@ -6709,4 +7087,4 @@ declare const recordLlmCall: (dimensions: LlmMetricDimensions) => void;
6709
7087
 
6710
7088
  declare const VERSION = "0.1.0";
6711
7089
 
6712
- export { ADK_ATTRS, ADK_SYSTEM_NAME, AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, type AfterModelCallback, type AfterToolCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentBuilderWithSchema, AgentEvaluator, type AgentMetricDimensions, type AgentSpanAttributes, 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, BasePlugin, 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, DEFAULTS, DatabaseSessionService, ENV_VARS, EnhancedAuthConfig, type EnhancedLlmSpanAttributes, type EnhancedRunner, type EnhancedToolSpanAttributes, type ErrorSpanAttributes, type EvalCase, type EvalCaseResult, type EvalMetric, type EvalMetricResult, type EvalMetricResultPerInvocation, EvalResult, type EvalSet, type EvalSetResult, EvalStatus, type EvaluateConfig, index$3 as Evaluation, type EvaluationResult, Evaluator, Event, EventActions, type EventCompaction, index$7 as Events, type EventsCompactionConfig, type EventsSummarizer, ExitLoopTool, type File, FileOperationsTool, FinalResponseMatchV2Evaluator, index$2 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, LangfusePlugin, type LangfusePluginOptions, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, LlmEventSummarizer, type LlmMetricDimensions, type LlmModel, type LlmModelConfig, LlmRequest, LlmResponse, type LlmSpanAttributes, LoadArtifactsTool, LoadMemoryTool, LocalEvalService, LoopAgent, type LoopAgentConfig, METRICS, McpAbi, McpAtp, McpBamm, McpCoinGecko, McpCoinGeckoPro, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntents, McpOdos, McpPolymarket, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, McpUpbit, index$1 as Memory, type MessagePart, type MetricInfo, type MetricValueInfo, index$5 as Models, type MultiAgentResponse, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OPERATIONS, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, type ParsedArtifactUri, type PerInvocationResult, type PerToolFailuresCounter, PlanReActPlanner, type PluginCallbackName, PluginManager, PrebuiltMetrics, REFLECT_AND_RETRY_RESPONSE_TYPE, REQUEST_EUC_FUNCTION_CALL_NAME, ReadonlyContext, ReflectAndRetryToolPlugin, type ReflectAndRetryToolPluginOptions, RougeEvaluator, RunConfig, Runner, type RunnerAskReturn, SEMCONV, SafetyEvaluatorV1, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionInput, type SessionOptions, index as Sessions, type SingleAfterModelCallback, type SingleAfterToolCallback, type SingleAgentCallback, type SingleBeforeModelCallback, type SingleBeforeToolCallback, SingleFlow, State, StreamingMode, type TelemetryConfig, TelemetryService, type TelemetryStats, type ThinkingConfig, type ToolConfig, ToolContext, type ToolFailureResponse, type ToolMetricDimensions, type ToolSpanAttributes, type ToolUnion, index$6 as Tools, type TraceAgentParams, type TraceAgentTransferParams, type TraceCallbackParams, type TraceLlmParams, type TraceMemoryParams, type TracePluginParams, type TraceSessionParams, type TraceToolParams, TrackingScope, TrajectoryEvaluator, type TransferContext, TransferToAgentTool, UserInteractionTool, VERSION, VertexAiRagMemoryService, VertexAiSessionService, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$2 as agentTransferRequestProcessor, requestProcessor$6 as basicRequestProcessor, buildFunctionDeclaration, buildLlmRequestForTrace, buildLlmResponseForTrace, requestProcessor as codeExecutionRequestProcessor, responseProcessor as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, convertMcpToolToBaseTool, createAuthToolArguments, createBranchContextForSubAgent, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, createTool, extractTextFromContent, formatSpanAttributes, generateAuthEvent, generateClientFunctionCallId, getArtifactUri, getEnvironment, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$5 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$4 as instructionsRequestProcessor, isArtifactRef, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeAgentRun, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor$1 as nlPlanningRequestProcessor, responseProcessor$1 as nlPlanningResponseProcessor, normalizeJsonSchema, parseArtifactUri, pluginCallbackNameSchema, populateClientFunctionCallId, recordAgentInvocation, recordLlmCall, recordToolExecution, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, runCompactionForSlidingWindow, safeJsonStringify, shouldCaptureContent, shutdownTelemetry, telemetryService, traceAgentInvocation, traceLlmCall, traceToolCall, tracer };
7090
+ export { ADK_ATTRS, ADK_SYSTEM_NAME, AF_FUNCTION_CALL_ID_PREFIX, type AfterAgentCallback, type AfterModelCallback, type AfterToolCallback, LlmAgent as Agent, AgentBuilder, type AgentBuilderConfig, type AgentBuilderWithSchema, AgentEvaluator, type AgentMetricDimensions, type AgentSpanAttributes, 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, BasePlugin, BaseSessionService, BaseTool, BashTool, BasicAuthCredential, BearerTokenCredential, type BeforeAgentCallback, type BeforeModelCallback, type BeforeToolCallback, type BuildFunctionDeclarationOptions, type BuiltAgent, BuiltInCodeExecutor, BuiltInPlanner, CallbackContext, type CodeExecutionInput, type CodeExecutionResult, CodeExecutionUtils, CodeExecutorContext, ContextCacheConfig, type ContextCacheConfigProps, type ContextCacheManager, type CreateToolConfig, type CreateToolConfigWithSchema, type CreateToolConfigWithoutSchema, DEFAULTS, DatabaseSessionService, ENV_VARS, EditTool, EnhancedAuthConfig, type EnhancedLlmSpanAttributes, type EnhancedRunner, type EnhancedToolSpanAttributes, type ErrorSpanAttributes, type EvalCase, type EvalCaseResult, type EvalMetric, type EvalMetricResult, type EvalMetricResultPerInvocation, EvalResult, type EvalSet, type EvalSetResult, EvalStatus, type EvaluateConfig, index$4 as Evaluation, type EvaluationResult, Evaluator, Event, EventActions, type EventCompaction, index$7 as Events, type EventsCompactionConfig, type EventsSummarizer, ExitLoopTool, type File, FileOperationsTool, FinalResponseMatchV2Evaluator, index$3 as Flows, type FullMessage, FunctionTool, GcsArtifactService, GeminiContextCacheManager, type GetSessionConfig, GetUserChoiceTool, GlobTool, GoogleLlm, GoogleSearchTool, GrepTool, HttpRequestTool, HttpScheme, InMemoryArtifactService, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, type InstructionProvider, type IntermediateData, type Interval, type Invocation, InvocationContext, type JudgeModelOptions, LLMRegistry, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, LangfusePlugin, type LangfusePluginOptions, type ListSessionsResponse, LlmAgent, type LlmAgentConfig, LlmCallsLimitExceededError, LlmEventSummarizer, type LlmMetricDimensions, type LlmModel, type LlmModelConfig, LlmRequest, LlmResponse, type LlmSpanAttributes, LoadArtifactsTool, LoadMemoryTool, LocalEvalService, LoopAgent, type LoopAgentConfig, METRICS, McpAbi, McpAtp, McpBamm, McpCoinGecko, McpCoinGeckoPro, type McpConfig, McpDiscord, McpError, McpErrorType, McpFilesystem, McpFraxlend, McpGeneric, McpIqWiki, McpMemory, McpNearAgent, McpNearIntents, McpOdos, McpPolymarket, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, type McpServerConfig, McpTelegram, McpToolset, type McpTransportType, McpUpbit, index$2 as Memory, type MessagePart, type MetricInfo, type MetricValueInfo, index$6 as Models, type MultiAgentResponse, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OPERATIONS, OpenAiLlm, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, type ParsedArtifactUri, type PerInvocationResult, type PerToolFailuresCounter, PlanReActPlanner, type PluginCallbackName, PluginManager, index$1 as Plugins, PrebuiltMetrics, REFLECT_AND_RETRY_RESPONSE_TYPE, REQUEST_EUC_FUNCTION_CALL_NAME, ReadTool, ReadonlyContext, ReflectAndRetryToolPlugin, type ReflectAndRetryToolPluginOptions, RougeEvaluator, RunConfig, Runner, type RunnerAskReturn, SEMCONV, SafetyEvaluatorV1, type SamplingHandler, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionInput, type SessionOptions, index as Sessions, type SingleAfterModelCallback, type SingleAfterToolCallback, type SingleAgentCallback, type SingleBeforeModelCallback, type SingleBeforeToolCallback, SingleFlow, State, StreamingMode, type TelemetryConfig, TelemetryService, type TelemetryStats, type ThinkingConfig, type ToolConfig, ToolContext, type ToolFailureResponse, type ToolMetricDimensions, type ToolSpanAttributes, type ToolUnion, index$8 as Tools, type TraceAgentParams, type TraceAgentTransferParams, type TraceCallbackParams, type TraceLlmParams, type TraceMemoryParams, type TracePluginParams, type TraceSessionParams, type TraceToolParams, TrackingScope, TrajectoryEvaluator, type TransferContext, TransferToAgentTool, UserInteractionTool, VERSION, VertexAiRagMemoryService, VertexAiSessionService, WebFetchTool, WebSearchTool, WriteTool, _findFunctionCallEventIfLastEventIsFunctionResponse, adkToMcpToolType, requestProcessor$6 as agentTransferRequestProcessor, requestProcessor$5 as basicRequestProcessor, buildFunctionDeclaration, buildLlmRequestForTrace, buildLlmResponseForTrace, requestProcessor$4 as codeExecutionRequestProcessor, responseProcessor$1 as codeExecutionResponseProcessor, requestProcessor$3 as contentRequestProcessor, contextCacheConfigSchema, convertMcpToolToBaseTool, createAuthToolArguments, createBranchContextForSubAgent, createDatabaseSessionService, createFunctionTool, createMysqlSessionService, createPostgresSessionService, createSamplingHandler, createSqliteSessionService, createTool, extractTextFromContent, formatSpanAttributes, generateAuthEvent, generateClientFunctionCallId, getArtifactUri, getEnvironment, getLongRunningFunctionCalls, getMcpTools, handleFunctionCallsAsync, handleFunctionCallsLive, requestProcessor$2 as identityRequestProcessor, initializeTelemetry, injectSessionState, requestProcessor$1 as instructionsRequestProcessor, isArtifactRef, isEnhancedAuthConfig, jsonSchemaToDeclaration, mcpSchemaToParameters, mergeAgentRun, mergeParallelFunctionResponseEvents, newInvocationContextId, requestProcessor as nlPlanningRequestProcessor, responseProcessor as nlPlanningResponseProcessor, normalizeJsonSchema, parseArtifactUri, pluginCallbackNameSchema, populateClientFunctionCallId, recordAgentInvocation, recordLlmCall, recordToolExecution, registerProviders, removeClientFunctionCallId, requestProcessor$7 as requestProcessor, runCompactionForSlidingWindow, safeJsonStringify, shouldCaptureContent, shutdownTelemetry, telemetryService, traceAgentInvocation, traceLlmCall, traceToolCall, tracer };