@google/adk 0.2.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/dist/cjs/a2a/part_converter_utils.js +210 -0
  2. package/dist/cjs/agents/active_streaming_tool.js +1 -1
  3. package/dist/cjs/agents/base_agent.js +46 -24
  4. package/dist/cjs/agents/base_llm_processor.js +1 -1
  5. package/dist/cjs/agents/callback_context.js +5 -2
  6. package/dist/cjs/agents/content_processor_utils.js +16 -8
  7. package/dist/cjs/agents/functions.js +81 -30
  8. package/dist/cjs/agents/instructions.js +1 -1
  9. package/dist/cjs/agents/invocation_context.js +1 -1
  10. package/dist/cjs/agents/live_request_queue.js +1 -1
  11. package/dist/cjs/agents/llm_agent.js +106 -62
  12. package/dist/cjs/agents/loop_agent.js +3 -2
  13. package/dist/cjs/agents/parallel_agent.js +4 -5
  14. package/dist/cjs/agents/readonly_context.js +13 -1
  15. package/dist/cjs/agents/run_config.js +2 -1
  16. package/dist/cjs/agents/sequential_agent.js +1 -1
  17. package/dist/cjs/agents/transcription_entry.js +1 -1
  18. package/dist/cjs/artifacts/base_artifact_service.js +1 -1
  19. package/dist/cjs/artifacts/file_artifact_service.js +491 -0
  20. package/dist/cjs/artifacts/gcs_artifact_service.js +145 -58
  21. package/dist/cjs/artifacts/in_memory_artifact_service.js +72 -10
  22. package/dist/cjs/artifacts/registry.js +55 -0
  23. package/dist/cjs/auth/auth_credential.js +1 -1
  24. package/dist/cjs/auth/auth_handler.js +4 -2
  25. package/dist/cjs/auth/auth_schemes.js +1 -1
  26. package/dist/cjs/auth/auth_tool.js +1 -1
  27. package/dist/cjs/auth/credential_service/base_credential_service.js +1 -1
  28. package/dist/cjs/auth/credential_service/in_memory_credential_service.js +1 -1
  29. package/dist/cjs/auth/exchanger/base_credential_exchanger.js +1 -1
  30. package/dist/cjs/auth/exchanger/credential_exchanger_registry.js +1 -1
  31. package/dist/cjs/code_executors/base_code_executor.js +4 -2
  32. package/dist/cjs/code_executors/built_in_code_executor.js +8 -4
  33. package/dist/cjs/code_executors/code_execution_utils.js +1 -1
  34. package/dist/cjs/code_executors/code_executor_context.js +6 -6
  35. package/dist/cjs/common.js +18 -1
  36. package/dist/cjs/events/event.js +34 -7
  37. package/dist/cjs/events/event_actions.js +2 -2
  38. package/dist/cjs/events/structured_events.js +105 -0
  39. package/dist/cjs/examples/base_example_provider.js +1 -1
  40. package/dist/cjs/examples/example.js +1 -1
  41. package/dist/cjs/examples/example_util.js +1 -1
  42. package/dist/cjs/index.js +54 -83
  43. package/dist/cjs/index_web.js +1 -1
  44. package/dist/cjs/memory/base_memory_service.js +1 -1
  45. package/dist/cjs/memory/in_memory_memory_service.js +4 -2
  46. package/dist/cjs/memory/memory_entry.js +1 -1
  47. package/dist/cjs/models/apigee_llm.js +182 -0
  48. package/dist/cjs/models/base_llm.js +9 -5
  49. package/dist/cjs/models/base_llm_connection.js +1 -1
  50. package/dist/cjs/models/gemini_llm_connection.js +2 -1
  51. package/dist/cjs/models/google_llm.js +73 -54
  52. package/dist/cjs/models/llm_request.js +1 -1
  53. package/dist/cjs/models/llm_response.js +1 -1
  54. package/dist/cjs/models/registry.js +3 -1
  55. package/dist/cjs/plugins/base_plugin.js +13 -1
  56. package/dist/cjs/plugins/logging_plugin.js +51 -14
  57. package/dist/cjs/plugins/plugin_manager.js +57 -25
  58. package/dist/cjs/plugins/security_plugin.js +2 -2
  59. package/dist/cjs/runner/in_memory_runner.js +1 -1
  60. package/dist/cjs/runner/runner.js +142 -96
  61. package/dist/cjs/sessions/base_session_service.js +53 -3
  62. package/dist/cjs/sessions/database_session_service.js +364 -0
  63. package/dist/cjs/sessions/db/operations.js +114 -0
  64. package/dist/cjs/sessions/db/schema.js +204 -0
  65. package/dist/cjs/sessions/in_memory_session_service.js +60 -34
  66. package/dist/cjs/sessions/registry.js +49 -0
  67. package/dist/cjs/sessions/session.js +1 -1
  68. package/dist/cjs/sessions/state.js +1 -1
  69. package/dist/cjs/telemetry/google_cloud.js +8 -10
  70. package/dist/cjs/telemetry/setup.js +16 -8
  71. package/dist/cjs/telemetry/tracing.js +38 -16
  72. package/dist/cjs/tools/agent_tool.js +9 -5
  73. package/dist/cjs/tools/base_tool.js +5 -3
  74. package/dist/cjs/tools/base_toolset.js +1 -1
  75. package/dist/cjs/tools/forwarding_artifact_service.js +18 -2
  76. package/dist/cjs/tools/function_tool.js +2 -3
  77. package/dist/cjs/tools/google_search_tool.js +2 -3
  78. package/dist/cjs/tools/long_running_tool.js +1 -1
  79. package/dist/cjs/tools/mcp/mcp_session_manager.js +17 -11
  80. package/dist/cjs/tools/mcp/mcp_tool.js +2 -4
  81. package/dist/cjs/tools/mcp/mcp_toolset.js +2 -2
  82. package/dist/cjs/tools/tool_confirmation.js +1 -1
  83. package/dist/cjs/tools/tool_context.js +1 -1
  84. package/dist/cjs/utils/client_labels.js +1 -1
  85. package/dist/cjs/utils/env_aware_utils.js +11 -2
  86. package/dist/cjs/utils/gemini_schema_util.js +10 -5
  87. package/dist/cjs/utils/logger.js +48 -4
  88. package/dist/cjs/utils/model_name.js +1 -1
  89. package/dist/cjs/utils/object_notation_utils.js +78 -0
  90. package/dist/cjs/utils/simple_zod_to_json.js +101 -142
  91. package/dist/cjs/utils/variant_utils.js +3 -9
  92. package/dist/cjs/version.js +2 -2
  93. package/dist/esm/a2a/part_converter_utils.js +171 -0
  94. package/dist/esm/agents/base_agent.js +50 -24
  95. package/dist/esm/agents/callback_context.js +4 -1
  96. package/dist/esm/agents/content_processor_utils.js +25 -9
  97. package/dist/esm/agents/functions.js +84 -29
  98. package/dist/esm/agents/llm_agent.js +110 -62
  99. package/dist/esm/agents/loop_agent.js +2 -1
  100. package/dist/esm/agents/parallel_agent.js +3 -4
  101. package/dist/esm/agents/readonly_context.js +12 -0
  102. package/dist/esm/agents/run_config.js +1 -0
  103. package/dist/esm/artifacts/file_artifact_service.js +451 -0
  104. package/dist/esm/artifacts/gcs_artifact_service.js +144 -57
  105. package/dist/esm/artifacts/in_memory_artifact_service.js +69 -8
  106. package/dist/esm/artifacts/registry.js +28 -0
  107. package/dist/esm/auth/auth_handler.js +3 -1
  108. package/dist/esm/code_executors/base_code_executor.js +3 -1
  109. package/dist/esm/code_executors/built_in_code_executor.js +7 -3
  110. package/dist/esm/code_executors/code_executor_context.js +5 -5
  111. package/dist/esm/common.js +12 -2
  112. package/dist/esm/events/event.js +30 -5
  113. package/dist/esm/events/event_actions.js +1 -1
  114. package/dist/esm/events/structured_events.js +74 -0
  115. package/dist/esm/index.js +18 -88
  116. package/dist/esm/memory/in_memory_memory_service.js +3 -1
  117. package/dist/esm/models/apigee_llm.js +152 -0
  118. package/dist/esm/models/base_llm.js +8 -4
  119. package/dist/esm/models/gemini_llm_connection.js +1 -0
  120. package/dist/esm/models/google_llm.js +75 -53
  121. package/dist/esm/models/registry.js +2 -0
  122. package/dist/esm/plugins/base_plugin.js +12 -0
  123. package/dist/esm/plugins/logging_plugin.js +55 -14
  124. package/dist/esm/plugins/plugin_manager.js +56 -24
  125. package/dist/esm/plugins/security_plugin.js +1 -1
  126. package/dist/esm/runner/runner.js +145 -96
  127. package/dist/esm/sessions/base_session_service.js +49 -1
  128. package/dist/esm/sessions/database_session_service.js +350 -0
  129. package/dist/esm/sessions/db/operations.js +87 -0
  130. package/dist/esm/sessions/db/schema.js +172 -0
  131. package/dist/esm/sessions/in_memory_session_service.js +61 -33
  132. package/dist/esm/sessions/registry.js +25 -0
  133. package/dist/esm/telemetry/google_cloud.js +7 -9
  134. package/dist/esm/telemetry/setup.js +23 -9
  135. package/dist/esm/telemetry/tracing.js +37 -15
  136. package/dist/esm/tools/agent_tool.js +8 -4
  137. package/dist/esm/tools/base_tool.js +4 -2
  138. package/dist/esm/tools/forwarding_artifact_service.js +17 -1
  139. package/dist/esm/tools/function_tool.js +1 -2
  140. package/dist/esm/tools/google_search_tool.js +2 -5
  141. package/dist/esm/tools/long_running_tool.js +3 -1
  142. package/dist/esm/tools/mcp/mcp_session_manager.js +22 -12
  143. package/dist/esm/tools/mcp/mcp_tool.js +1 -3
  144. package/dist/esm/tools/mcp/mcp_toolset.js +1 -1
  145. package/dist/esm/utils/env_aware_utils.js +9 -1
  146. package/dist/esm/utils/gemini_schema_util.js +9 -4
  147. package/dist/esm/utils/logger.js +43 -2
  148. package/dist/esm/utils/object_notation_utils.js +47 -0
  149. package/dist/esm/utils/simple_zod_to_json.js +102 -141
  150. package/dist/esm/utils/variant_utils.js +1 -7
  151. package/dist/esm/version.js +1 -1
  152. package/dist/types/a2a/part_converter_utils.d.ts +47 -0
  153. package/dist/types/agents/base_agent.d.ts +2 -1
  154. package/dist/types/agents/callback_context.d.ts +1 -1
  155. package/dist/types/agents/llm_agent.d.ts +12 -12
  156. package/dist/types/agents/loop_agent.d.ts +1 -1
  157. package/dist/types/agents/parallel_agent.d.ts +1 -1
  158. package/dist/types/agents/readonly_context.d.ts +8 -0
  159. package/dist/types/agents/run_config.d.ts +6 -0
  160. package/dist/types/artifacts/base_artifact_service.d.ts +31 -0
  161. package/dist/types/artifacts/file_artifact_service.d.ts +43 -0
  162. package/dist/types/artifacts/gcs_artifact_service.d.ts +3 -1
  163. package/dist/types/artifacts/in_memory_artifact_service.d.ts +8 -5
  164. package/dist/types/artifacts/registry.d.ts +7 -0
  165. package/dist/types/code_executors/built_in_code_executor.d.ts +1 -1
  166. package/dist/types/code_executors/code_executor_context.d.ts +2 -4
  167. package/dist/types/common.d.ts +13 -3
  168. package/dist/types/events/event.d.ts +15 -1
  169. package/dist/types/events/event_actions.d.ts +1 -1
  170. package/dist/types/events/structured_events.d.ts +106 -0
  171. package/dist/types/index.d.ts +7 -3
  172. package/dist/types/models/apigee_llm.d.ts +59 -0
  173. package/dist/types/models/base_llm_connection.d.ts +1 -1
  174. package/dist/types/models/google_llm.d.ts +5 -2
  175. package/dist/types/models/llm_response.d.ts +1 -1
  176. package/dist/types/plugins/logging_plugin.d.ts +12 -12
  177. package/dist/types/plugins/plugin_manager.d.ts +12 -12
  178. package/dist/types/plugins/security_plugin.d.ts +1 -1
  179. package/dist/types/runner/runner.d.ts +16 -1
  180. package/dist/types/sessions/base_session_service.d.ts +20 -0
  181. package/dist/types/sessions/database_session_service.d.ts +31 -0
  182. package/dist/types/sessions/db/operations.d.ts +29 -0
  183. package/dist/types/sessions/db/schema.d.ts +45 -0
  184. package/dist/types/sessions/in_memory_session_service.d.ts +9 -6
  185. package/dist/types/sessions/registry.d.ts +7 -0
  186. package/dist/types/telemetry/setup.d.ts +1 -1
  187. package/dist/types/telemetry/tracing.d.ts +7 -6
  188. package/dist/types/tools/agent_tool.d.ts +1 -1
  189. package/dist/types/tools/base_tool.d.ts +1 -1
  190. package/dist/types/tools/base_toolset.d.ts +2 -1
  191. package/dist/types/tools/forwarding_artifact_service.d.ts +4 -2
  192. package/dist/types/tools/function_tool.d.ts +4 -3
  193. package/dist/types/tools/google_search_tool.d.ts +3 -3
  194. package/dist/types/tools/mcp/mcp_session_manager.d.ts +10 -3
  195. package/dist/types/tools/mcp/mcp_toolset.d.ts +1 -2
  196. package/dist/types/utils/env_aware_utils.d.ts +7 -0
  197. package/dist/types/utils/gemini_schema_util.d.ts +4 -12
  198. package/dist/types/utils/logger.d.ts +11 -10
  199. package/dist/types/utils/object_notation_utils.d.ts +21 -0
  200. package/dist/types/utils/simple_zod_to_json.d.ts +5 -4
  201. package/dist/types/version.d.ts +1 -1
  202. package/dist/web/a2a/part_converter_utils.js +171 -0
  203. package/dist/web/agents/base_agent.js +96 -35
  204. package/dist/web/agents/callback_context.js +4 -1
  205. package/dist/web/agents/content_processor_utils.js +25 -9
  206. package/dist/web/agents/functions.js +84 -29
  207. package/dist/web/agents/llm_agent.js +166 -83
  208. package/dist/web/agents/loop_agent.js +2 -1
  209. package/dist/web/agents/parallel_agent.js +3 -4
  210. package/dist/web/agents/readonly_context.js +12 -0
  211. package/dist/web/agents/run_config.js +2 -1
  212. package/dist/web/artifacts/file_artifact_service.js +506 -0
  213. package/dist/web/artifacts/gcs_artifact_service.js +139 -54
  214. package/dist/web/artifacts/in_memory_artifact_service.js +69 -8
  215. package/dist/web/artifacts/registry.js +28 -0
  216. package/dist/web/auth/auth_handler.js +3 -1
  217. package/dist/web/code_executors/base_code_executor.js +3 -1
  218. package/dist/web/code_executors/built_in_code_executor.js +7 -3
  219. package/dist/web/code_executors/code_executor_context.js +5 -5
  220. package/dist/web/common.js +12 -2
  221. package/dist/web/events/event.js +30 -5
  222. package/dist/web/events/event_actions.js +1 -1
  223. package/dist/web/events/structured_events.js +74 -0
  224. package/dist/web/index.js +18 -8
  225. package/dist/web/memory/in_memory_memory_service.js +3 -1
  226. package/dist/web/models/apigee_llm.js +219 -0
  227. package/dist/web/models/base_llm.js +8 -4
  228. package/dist/web/models/gemini_llm_connection.js +1 -0
  229. package/dist/web/models/google_llm.js +75 -50
  230. package/dist/web/models/registry.js +2 -0
  231. package/dist/web/plugins/base_plugin.js +12 -0
  232. package/dist/web/plugins/logging_plugin.js +55 -14
  233. package/dist/web/plugins/plugin_manager.js +56 -24
  234. package/dist/web/plugins/security_plugin.js +1 -1
  235. package/dist/web/runner/runner.js +192 -108
  236. package/dist/web/sessions/base_session_service.js +49 -1
  237. package/dist/web/sessions/database_session_service.js +368 -0
  238. package/dist/web/sessions/db/operations.js +87 -0
  239. package/dist/web/sessions/db/schema.js +172 -0
  240. package/dist/web/sessions/in_memory_session_service.js +61 -33
  241. package/dist/web/sessions/registry.js +25 -0
  242. package/dist/web/telemetry/google_cloud.js +7 -9
  243. package/dist/web/telemetry/setup.js +23 -9
  244. package/dist/web/telemetry/tracing.js +37 -15
  245. package/dist/web/tools/agent_tool.js +8 -4
  246. package/dist/web/tools/base_tool.js +4 -2
  247. package/dist/web/tools/forwarding_artifact_service.js +17 -1
  248. package/dist/web/tools/function_tool.js +1 -2
  249. package/dist/web/tools/google_search_tool.js +2 -5
  250. package/dist/web/tools/long_running_tool.js +3 -1
  251. package/dist/web/tools/mcp/mcp_session_manager.js +22 -12
  252. package/dist/web/tools/mcp/mcp_tool.js +1 -3
  253. package/dist/web/tools/mcp/mcp_toolset.js +1 -1
  254. package/dist/web/utils/env_aware_utils.js +9 -1
  255. package/dist/web/utils/gemini_schema_util.js +9 -4
  256. package/dist/web/utils/logger.js +43 -2
  257. package/dist/web/utils/object_notation_utils.js +47 -0
  258. package/dist/web/utils/simple_zod_to_json.js +102 -155
  259. package/dist/web/utils/variant_utils.js +1 -7
  260. package/dist/web/version.js +1 -1
  261. package/package.json +16 -5
  262. package/dist/cjs/index.js.map +0 -7
  263. package/dist/esm/index.js.map +0 -7
  264. package/dist/web/index.js.map +0 -7
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { DataPart as A2ADataPart, FilePart as A2AFilePart, Part as A2APart, TextPart as A2ATextPart } from '@a2a-js/sdk';
7
+ import { Part as GenAIPart } from '@google/genai';
8
+ /**
9
+ * Converts GenAI Parts to A2A Parts.
10
+ */
11
+ export declare function toA2AParts(parts: GenAIPart[], longRunningToolIDs?: string[]): A2APart[];
12
+ /**
13
+ * Converts a GenAI Part to an A2A Part.
14
+ */
15
+ export declare function toA2APart(part: GenAIPart, longRunningToolIDs?: string[]): A2APart;
16
+ /**
17
+ * Converts a GenAI Text Part to an A2A Text Part.
18
+ */
19
+ export declare function toA2ATextPart(part: GenAIPart): A2APart;
20
+ /**
21
+ * Converts a GenAI File Part to an A2A File Part.
22
+ */
23
+ export declare function toA2AFilePart(part: GenAIPart): A2APart;
24
+ /**
25
+ * Converts a GenAI Data Part to an A2A Data Part.
26
+ */
27
+ export declare function toA2ADataPart(part: GenAIPart, longRunningToolIDs?: string[]): A2APart;
28
+ /**
29
+ * Converts an A2A Part to a GenAI Part.
30
+ */
31
+ export declare function toGenAIParts(a2aParts: A2APart[]): GenAIPart[];
32
+ /**
33
+ * Converts an A2A Part to a GenAI Part.
34
+ */
35
+ export declare function toGenAIPart(a2aPart: A2APart): GenAIPart;
36
+ /**
37
+ * Converts an A2A Text Part to a GenAI Part.
38
+ */
39
+ export declare function toGenAIPartText(a2aPart: A2ATextPart): GenAIPart;
40
+ /**
41
+ * Converts an A2A File Part to a GenAI Part.
42
+ */
43
+ export declare function toGenAIPartFile(a2aPart: A2AFilePart): GenAIPart;
44
+ /**
45
+ * Converts an A2A Data Part to a GenAI Part.
46
+ */
47
+ export declare function toGenAIPartData(a2aPart: A2ADataPart): GenAIPart;
@@ -66,8 +66,9 @@ export declare abstract class BaseAgent {
66
66
  readonly description?: string;
67
67
  /**
68
68
  * Root agent of this agent.
69
+ * Computed dynamically by traversing up the parent chain.
69
70
  */
70
- readonly rootAgent: BaseAgent;
71
+ get rootAgent(): BaseAgent;
71
72
  /**
72
73
  * The parent agent of this agent.
73
74
  *
@@ -14,7 +14,7 @@ import { ReadonlyContext } from './readonly_context.js';
14
14
  export declare class CallbackContext extends ReadonlyContext {
15
15
  private readonly _state;
16
16
  readonly eventActions: EventActions;
17
- constructor({ invocationContext, eventActions }: {
17
+ constructor({ invocationContext, eventActions, }: {
18
18
  invocationContext: InvocationContext;
19
19
  eventActions?: EventActions;
20
20
  });
@@ -4,6 +4,8 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { GenerateContentConfig, Schema } from '@google/genai';
7
+ import { z as z3 } from 'zod/v3';
8
+ import { z as z4 } from 'zod/v4';
7
9
  import { BaseCodeExecutor } from '../code_executors/base_code_executor.js';
8
10
  import { Event } from '../events/event.js';
9
11
  import { BaseExampleProvider } from '../examples/base_example_provider.js';
@@ -19,6 +21,10 @@ import { BaseLlmRequestProcessor, BaseLlmResponseProcessor } from './base_llm_pr
19
21
  import { CallbackContext } from './callback_context.js';
20
22
  import { InvocationContext } from './invocation_context.js';
21
23
  import { ReadonlyContext } from './readonly_context.js';
24
+ /**
25
+ * Input/output schema type for agent.
26
+ */
27
+ export type LlmAgentSchema = z3.ZodObject<z3.ZodRawShape> | z4.ZodObject<z4.ZodRawShape> | Schema;
22
28
  /** An object that can provide an instruction string. */
23
29
  export type InstructionProvider = (context: ReadonlyContext) => string | Promise<string>;
24
30
  /**
@@ -159,15 +165,9 @@ export interface LlmAgentConfig extends BaseAgentConfig {
159
165
  */
160
166
  includeContents?: 'default' | 'none';
161
167
  /** The input schema when agent is used as a tool. */
162
- inputSchema?: Schema;
163
- /**
164
- * The output schema when agent replies.
165
- *
166
- * NOTE:
167
- * When this is set, agent can ONLY reply and CANNOT use any tools, such as
168
- * function tools, RAGs, agent transfer, etc.
169
- */
170
- outputSchema?: Schema;
168
+ inputSchema?: LlmAgentSchema;
169
+ /** The output schema when agent replies. */
170
+ outputSchema?: LlmAgentSchema;
171
171
  /**
172
172
  * The key in session state to store the output of the agent.
173
173
  *
@@ -207,7 +207,7 @@ export interface LlmAgentConfig extends BaseAgentConfig {
207
207
  }
208
208
  declare class RequestConfirmationLlmRequestProcessor extends BaseLlmRequestProcessor {
209
209
  /** Handles tool confirmation information to build the LLM request. */
210
- runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
210
+ runAsync(invocationContext: InvocationContext): AsyncGenerator<Event, void, void>;
211
211
  }
212
212
  export declare const REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR: RequestConfirmationLlmRequestProcessor;
213
213
  /**
@@ -360,9 +360,9 @@ export declare class LlmAgent extends BaseAgent {
360
360
  * @throws Error if the agent is not found.
361
361
  */
362
362
  private getAgentByName;
363
- private callLlmAsync;
363
+ protected callLlmAsync(invocationContext: InvocationContext, llmRequest: LlmRequest, modelResponseEvent: Event): AsyncGenerator<LlmResponse, void, void>;
364
364
  private handleBeforeModelCallback;
365
365
  private handleAfterModelCallback;
366
- private runAndHandleError;
366
+ protected runAndHandleError<T extends LlmResponse | Event>(responseGenerator: AsyncGenerator<T, void, void>, invocationContext: InvocationContext, llmRequest: LlmRequest, modelResponseEvent: Event): AsyncGenerator<T, void, void>;
367
367
  }
368
368
  export {};
@@ -42,6 +42,6 @@ export declare class LoopAgent extends BaseAgent {
42
42
  private readonly maxIterations;
43
43
  constructor(config: LoopAgentConfig);
44
44
  protected runAsyncImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
45
- protected runLiveImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
45
+ protected runLiveImpl(_context: InvocationContext): AsyncGenerator<Event, void, void>;
46
46
  }
47
47
  export {};
@@ -32,6 +32,6 @@ export declare class ParallelAgent extends BaseAgent {
32
32
  */
33
33
  readonly [PARALLEL_AGENT_SIGNATURE_SYMBOL] = true;
34
34
  protected runAsyncImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
35
- protected runLiveImpl(context: InvocationContext): AsyncGenerator<Event, void, void>;
35
+ protected runLiveImpl(_context: InvocationContext): AsyncGenerator<Event, void, void>;
36
36
  }
37
37
  export {};
@@ -20,6 +20,14 @@ export declare class ReadonlyContext {
20
20
  * The current invocation id.
21
21
  */
22
22
  get invocationId(): string;
23
+ /**
24
+ * The user ID of the current session.
25
+ */
26
+ get userId(): string;
27
+ /**
28
+ * The ID of the current session.
29
+ */
30
+ get sessionId(): string;
23
31
  /**
24
32
  * The current agent name.
25
33
  */
@@ -72,6 +72,11 @@ export interface RunConfig {
72
72
  * - Less than or equal to 0: This allows for unbounded number of llm calls.
73
73
  */
74
74
  maxLlmCalls?: number;
75
+ /**
76
+ * If true, the agent loop will suspend on ANY tool call, allowing the client
77
+ * to intercept and execute tools (Client-Side Tool Execution).
78
+ */
79
+ pauseOnToolCalls?: boolean;
75
80
  }
76
81
  export declare function createRunConfig(params?: Partial<RunConfig>): {
77
82
  speechConfig?: SpeechConfig | undefined;
@@ -85,4 +90,5 @@ export declare function createRunConfig(params?: Partial<RunConfig>): {
85
90
  proactivity?: ProactivityConfig | undefined;
86
91
  realtimeInputConfig?: RealtimeInputConfig | undefined;
87
92
  maxLlmCalls: number;
93
+ pauseOnToolCalls: boolean;
88
94
  };
@@ -18,6 +18,10 @@ export interface SaveArtifactRequest {
18
18
  filename: string;
19
19
  /** The artifact to save. */
20
20
  artifact: Part;
21
+ /**
22
+ * Optional custom metadata to save with the artifact.
23
+ */
24
+ customMetadata?: Record<string, unknown>;
21
25
  }
22
26
  /**
23
27
  * The parameters for `loadArtifact`.
@@ -74,6 +78,19 @@ export interface ListVersionsRequest {
74
78
  /** The filename of the artifact. */
75
79
  filename: string;
76
80
  }
81
+ /**
82
+ * Metadata for a file artifact version.
83
+ */
84
+ export interface ArtifactVersion {
85
+ /** The version number. */
86
+ version: number;
87
+ /** The canonical URI of the artifact. */
88
+ canonicalUri?: string;
89
+ /** Custom metadata associated with the artifact. */
90
+ customMetadata?: Record<string, unknown>;
91
+ /** The MIME type of the artifact. */
92
+ mimeType?: string;
93
+ }
77
94
  /**
78
95
  * Interface for artifact services.
79
96
  */
@@ -124,4 +141,18 @@ export interface BaseArtifactService {
124
141
  * artifact.
125
142
  */
126
143
  listVersions(request: ListVersionsRequest): Promise<number[]>;
144
+ /**
145
+ * Lists metadata for each artifact version.
146
+ *
147
+ * @param request The request to list artifact versions.
148
+ * @return A promise that resolves to a list of artifact version metadata.
149
+ */
150
+ listArtifactVersions(request: ListVersionsRequest): Promise<ArtifactVersion[]>;
151
+ /**
152
+ * Gets metadata for a specific artifact version.
153
+ *
154
+ * @param request The request to get an artifact version.
155
+ * @return A promise that resolves to the artifact version metadata or undefined.
156
+ */
157
+ getArtifactVersion(request: LoadArtifactRequest): Promise<ArtifactVersion | undefined>;
127
158
  }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Part } from '@google/genai';
7
+ import { ArtifactVersion, BaseArtifactService, DeleteArtifactRequest, ListArtifactKeysRequest, ListVersionsRequest, LoadArtifactRequest, SaveArtifactRequest } from './base_artifact_service.js';
8
+ /**
9
+ * Service for managing artifacts stored on the local filesystem.
10
+ *
11
+ * Stores filesystem-backed artifacts beneath a configurable root directory.
12
+ *
13
+ * Storage layout matches the cloud and in-memory services:
14
+ * root/
15
+ * └── users/
16
+ * └── {userId}/
17
+ * ├── sessions/
18
+ * │ └── {sessionId}/
19
+ * │ └── artifacts/
20
+ * │ └── {artifactPath}/ // derived from filename
21
+ * │ └── versions/
22
+ * │ └── {version}/
23
+ * │ ├── {originalFilename}
24
+ * │ └── metadata.json
25
+ * └── artifacts/
26
+ * └── {artifactPath}/...
27
+ *
28
+ * Artifact paths are derived from the provided filenames: separators create
29
+ * nested directories, and path traversal is rejected to keep the layout
30
+ * portable across filesystems. `{artifactPath}` therefore mirrors the
31
+ * sanitized, scope-relative path derived from each filename.
32
+ */
33
+ export declare class FileArtifactService implements BaseArtifactService {
34
+ private readonly rootDir;
35
+ constructor(rootDirOrUri: string);
36
+ saveArtifact({ userId, sessionId, filename, artifact, customMetadata, }: SaveArtifactRequest): Promise<number>;
37
+ loadArtifact({ userId, sessionId, filename, version, }: LoadArtifactRequest): Promise<Part | undefined>;
38
+ listArtifactKeys({ userId, sessionId, }: ListArtifactKeysRequest): Promise<string[]>;
39
+ deleteArtifact({ userId, sessionId, filename, }: DeleteArtifactRequest): Promise<void>;
40
+ listVersions({ userId, sessionId, filename, }: ListVersionsRequest): Promise<number[]>;
41
+ listArtifactVersions({ userId, sessionId, filename, }: ListVersionsRequest): Promise<ArtifactVersion[]>;
42
+ getArtifactVersion({ userId, sessionId, filename, version, }: LoadArtifactRequest): Promise<ArtifactVersion | undefined>;
43
+ }
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { Part } from '@google/genai';
7
- import { BaseArtifactService, DeleteArtifactRequest, ListArtifactKeysRequest, ListVersionsRequest, LoadArtifactRequest, SaveArtifactRequest } from './base_artifact_service.js';
7
+ import { ArtifactVersion, BaseArtifactService, DeleteArtifactRequest, ListArtifactKeysRequest, ListVersionsRequest, LoadArtifactRequest, SaveArtifactRequest } from './base_artifact_service.js';
8
8
  export declare class GcsArtifactService implements BaseArtifactService {
9
9
  private readonly bucket;
10
10
  constructor(bucket: string);
@@ -13,4 +13,6 @@ export declare class GcsArtifactService implements BaseArtifactService {
13
13
  listArtifactKeys(request: ListArtifactKeysRequest): Promise<string[]>;
14
14
  deleteArtifact(request: DeleteArtifactRequest): Promise<void>;
15
15
  listVersions(request: ListVersionsRequest): Promise<number[]>;
16
+ listArtifactVersions(request: ListVersionsRequest): Promise<ArtifactVersion[]>;
17
+ getArtifactVersion(request: LoadArtifactRequest): Promise<ArtifactVersion | undefined>;
16
18
  }
@@ -4,15 +4,18 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { Part } from '@google/genai';
7
- import { BaseArtifactService, DeleteArtifactRequest, ListArtifactKeysRequest, ListVersionsRequest, LoadArtifactRequest, SaveArtifactRequest } from './base_artifact_service.js';
7
+ import { ArtifactVersion, BaseArtifactService, DeleteArtifactRequest, ListArtifactKeysRequest, ListVersionsRequest, LoadArtifactRequest, SaveArtifactRequest } from './base_artifact_service.js';
8
+ export declare function isInMemoryConnectionString(uri: string): boolean;
8
9
  /**
9
10
  * An in-memory implementation of the ArtifactService.
10
11
  */
11
12
  export declare class InMemoryArtifactService implements BaseArtifactService {
12
13
  private readonly artifacts;
13
- saveArtifact({ appName, userId, sessionId, filename, artifact, }: SaveArtifactRequest): Promise<number>;
14
+ saveArtifact({ appName, userId, sessionId, filename, artifact, customMetadata, }: SaveArtifactRequest): Promise<number>;
14
15
  loadArtifact({ appName, userId, sessionId, filename, version, }: LoadArtifactRequest): Promise<Part | undefined>;
15
- listArtifactKeys({ appName, userId, sessionId }: ListArtifactKeysRequest): Promise<string[]>;
16
- deleteArtifact({ appName, userId, sessionId, filename }: DeleteArtifactRequest): Promise<void>;
17
- listVersions({ appName, userId, sessionId, filename }: ListVersionsRequest): Promise<number[]>;
16
+ listArtifactKeys({ appName, userId, sessionId, }: ListArtifactKeysRequest): Promise<string[]>;
17
+ deleteArtifact({ appName, userId, sessionId, filename, }: DeleteArtifactRequest): Promise<void>;
18
+ listVersions({ appName, userId, sessionId, filename, }: ListVersionsRequest): Promise<number[]>;
19
+ listArtifactVersions({ appName, userId, sessionId, filename, }: ListVersionsRequest): Promise<ArtifactVersion[]>;
20
+ getArtifactVersion({ appName, userId, sessionId, filename, version, }: LoadArtifactRequest): Promise<ArtifactVersion | undefined>;
18
21
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { BaseArtifactService } from './base_artifact_service.js';
7
+ export declare function getArtifactServiceFromUri(uri: string): BaseArtifactService;
@@ -26,7 +26,7 @@ export declare function isBuiltInCodeExecutor(obj: unknown): obj is BuiltInCodeE
26
26
  export declare class BuiltInCodeExecutor extends BaseCodeExecutor {
27
27
  /** A unique symbol to identify BuiltInCodeExecutor class. */
28
28
  readonly [BUILT_IN_CODE_EXECUTOR_SIGNATURE_SYMBOL] = true;
29
- executeCode(params: ExecuteCodeParams): Promise<CodeExecutionResult>;
29
+ executeCode(_params: ExecuteCodeParams): Promise<CodeExecutionResult>;
30
30
  processLlmRequest(llmRequest: LlmRequest): void;
31
31
  }
32
32
  export {};
@@ -78,10 +78,8 @@ export declare class CodeExecutorContext {
78
78
  */
79
79
  updateCodeExecutionResult({ invocationId, code, resultStdout, resultStderr, }: UpdateCodeExecutionResultParams): void;
80
80
  /**
81
- * Gets the code executor context from the session state.
82
- * @param invocationId The session state to get the code executor context
83
- * from.
81
+ * Gets the code execution context from the session state.
84
82
  * @return The code execution context for the given invocation ID.
85
83
  */
86
- getCodeExecutionContext(invocationId: string): Record<string, unknown>;
84
+ getCodeExecutionContext(): Record<string, unknown>;
87
85
  }
@@ -15,7 +15,7 @@ export type { InvocationContextParams } from './agents/invocation_context.js';
15
15
  export { LiveRequestQueue } from './agents/live_request_queue.js';
16
16
  export type { LiveRequest } from './agents/live_request_queue.js';
17
17
  export { LlmAgent, isLlmAgent } from './agents/llm_agent.js';
18
- export type { AfterModelCallback, AfterToolCallback, BeforeModelCallback, BeforeToolCallback, InstructionProvider, LlmAgentConfig, SingleAfterModelCallback, SingleAfterToolCallback, SingleBeforeModelCallback, SingleBeforeToolCallback, ToolUnion, } from './agents/llm_agent.js';
18
+ export type { AfterModelCallback, AfterToolCallback, BeforeModelCallback, BeforeToolCallback, InstructionProvider, LlmAgentConfig, LlmAgentSchema, SingleAfterModelCallback, SingleAfterToolCallback, SingleBeforeModelCallback, SingleBeforeToolCallback, ToolUnion, } from './agents/llm_agent.js';
19
19
  export { LoopAgent, isLoopAgent } from './agents/loop_agent.js';
20
20
  export type { LoopAgentConfig } from './agents/loop_agent.js';
21
21
  export { ParallelAgent, isParallelAgent } from './agents/parallel_agent.js';
@@ -24,6 +24,7 @@ export { StreamingMode } from './agents/run_config.js';
24
24
  export type { RunConfig } from './agents/run_config.js';
25
25
  export { SequentialAgent, isSequentialAgent } from './agents/sequential_agent.js';
26
26
  export type { TranscriptionEntry } from './agents/transcription_entry.js';
27
+ export type { BaseArtifactService, DeleteArtifactRequest, ListArtifactKeysRequest, ListVersionsRequest, LoadArtifactRequest, SaveArtifactRequest, } from './artifacts/base_artifact_service.js';
27
28
  export { InMemoryArtifactService } from './artifacts/in_memory_artifact_service.js';
28
29
  export { AuthCredentialTypes } from './auth/auth_credential.js';
29
30
  export type { AuthCredential, HttpAuth, HttpCredentials, OAuth2Auth, ServiceAccount, ServiceAccountCredential, } from './auth/auth_credential.js';
@@ -38,13 +39,18 @@ export { createEvent, getFunctionCalls, getFunctionResponses, hasTrailingCodeExe
38
39
  export type { Event } from './events/event.js';
39
40
  export { createEventActions } from './events/event_actions.js';
40
41
  export type { EventActions } from './events/event_actions.js';
42
+ export { EventType, toStructuredEvents } from './events/structured_events.js';
43
+ export type { ActivityEvent, CallCodeEvent, CodeResultEvent, ContentEvent, ErrorEvent, FinishedEvent, StructuredEvent, ThoughtEvent, ToolCallEvent, ToolConfirmationEvent, ToolResultEvent, } from './events/structured_events.js';
41
44
  export { BaseExampleProvider, isBaseExampleProvider, } from './examples/base_example_provider.js';
42
45
  export type { Example } from './examples/example.js';
46
+ export type { BaseMemoryService, SearchMemoryRequest, SearchMemoryResponse, } from './memory/base_memory_service.js';
43
47
  export { InMemoryMemoryService } from './memory/in_memory_memory_service.js';
44
48
  export type { MemoryEntry } from './memory/memory_entry.js';
49
+ export { ApigeeLlm } from './models/apigee_llm.js';
50
+ export type { ApigeeLlmParams } from './models/apigee_llm.js';
45
51
  export { BaseLlm, isBaseLlm } from './models/base_llm.js';
46
52
  export type { BaseLlmConnection } from './models/base_llm_connection.js';
47
- export { Gemini } from './models/google_llm.js';
53
+ export { Gemini, geminiInitParams } from './models/google_llm.js';
48
54
  export type { GeminiParams } from './models/google_llm.js';
49
55
  export type { LlmRequest } from './models/llm_request.js';
50
56
  export type { LlmResponse } from './models/llm_response.js';
@@ -58,6 +64,8 @@ export type { BasePolicyEngine, PolicyCheckResult, ToolCallPolicyContext, } from
58
64
  export { InMemoryRunner } from './runner/in_memory_runner.js';
59
65
  export { Runner } from './runner/runner.js';
60
66
  export type { RunnerConfig } from './runner/runner.js';
67
+ export { BaseSessionService } from './sessions/base_session_service.js';
68
+ export type { AppendEventRequest, CreateSessionRequest, DeleteSessionRequest, GetSessionConfig, GetSessionRequest, ListSessionsRequest, ListSessionsResponse, } from './sessions/base_session_service.js';
61
69
  export { InMemorySessionService } from './sessions/in_memory_session_service.js';
62
70
  export { createSession } from './sessions/session.js';
63
71
  export type { Session } from './sessions/session.js';
@@ -65,6 +73,7 @@ export { State } from './sessions/state.js';
65
73
  export { AgentTool, isAgentTool } from './tools/agent_tool.js';
66
74
  export type { AgentToolConfig } from './tools/agent_tool.js';
67
75
  export { BaseTool, isBaseTool } from './tools/base_tool.js';
76
+ export type { BaseToolParams, RunAsyncToolRequest, ToolProcessLlmRequest, } from './tools/base_tool.js';
68
77
  export { BaseToolset } from './tools/base_toolset.js';
69
78
  export type { ToolPredicate } from './tools/base_toolset.js';
70
79
  export { FunctionTool, isFunctionTool } from './tools/function_tool.js';
@@ -73,7 +82,8 @@ export { GOOGLE_SEARCH, GoogleSearchTool } from './tools/google_search_tool.js';
73
82
  export { LongRunningFunctionTool } from './tools/long_running_tool.js';
74
83
  export { ToolConfirmation } from './tools/tool_confirmation.js';
75
84
  export { ToolContext } from './tools/tool_context.js';
76
- export { LogLevel, setLogLevel } from './utils/logger.js';
85
+ export { LogLevel, getLogger, setLogLevel, setLogger } from './utils/logger.js';
86
+ export type { Logger } from './utils/logger.js';
77
87
  export { isGemini2OrAbove } from './utils/model_name.js';
78
88
  export { zodObjectToSchema } from './utils/simple_zod_to_json.js';
79
89
  export { GoogleLLMVariant } from './utils/variant_utils.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { FunctionCall, FunctionResponse } from '@google/genai';
@@ -86,3 +86,17 @@ export declare function stringifyContent(event: Event): string;
86
86
  * Generates a new unique ID for the event.
87
87
  */
88
88
  export declare function createNewEventId(): string;
89
+ /**
90
+ * Transforms a snake_cased event object to a camelCased Event object.
91
+ *
92
+ * @param event The snake_cased event object.
93
+ * @returns The camelCased Event object.
94
+ */
95
+ export declare function transformToCamelCaseEvent(event: Record<string, unknown>): Event;
96
+ /**
97
+ * Transforms a camelCased event object to a snake_cased Event object.
98
+ *
99
+ * @param event The camelCased event object.
100
+ * @returns The snake_cased Event object.
101
+ */
102
+ export declare function transformToSnakeCaseEvent(event: Event): Record<string, unknown>;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { ToolConfirmation } from '../tools/tool_confirmation.js';
@@ -0,0 +1,106 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { CodeExecutionResult, ExecutableCode, FunctionCall, FunctionResponse } from '@google/genai';
7
+ import { Event } from './event.js';
8
+ /**
9
+ * The types of events that can be parsed from a raw Event.
10
+ */
11
+ export declare enum EventType {
12
+ THOUGHT = "thought",
13
+ CONTENT = "content",
14
+ TOOL_CALL = "tool_call",
15
+ TOOL_RESULT = "tool_result",
16
+ CALL_CODE = "call_code",
17
+ CODE_RESULT = "code_result",
18
+ ERROR = "error",
19
+ ACTIVITY = "activity",
20
+ TOOL_CONFIRMATION = "tool_confirmation",
21
+ FINISHED = "finished"
22
+ }
23
+ /**
24
+ * Represents a reasoning trace (thought) from the agent.
25
+ */
26
+ export interface ThoughtEvent {
27
+ type: EventType.THOUGHT;
28
+ content: string;
29
+ }
30
+ /**
31
+ * Represents partial content (text delta) intended for the user.
32
+ */
33
+ export interface ContentEvent {
34
+ type: EventType.CONTENT;
35
+ content: string;
36
+ }
37
+ /**
38
+ * Represents a request to execute a tool.
39
+ */
40
+ export interface ToolCallEvent {
41
+ type: EventType.TOOL_CALL;
42
+ call: FunctionCall;
43
+ }
44
+ /**
45
+ * Represents the result of a tool execution.
46
+ */
47
+ export interface ToolResultEvent {
48
+ type: EventType.TOOL_RESULT;
49
+ result: FunctionResponse;
50
+ }
51
+ /**
52
+ * Represents a request to execute code.
53
+ */
54
+ export interface CallCodeEvent {
55
+ type: EventType.CALL_CODE;
56
+ code: ExecutableCode;
57
+ }
58
+ /**
59
+ * Represents the result of code execution.
60
+ */
61
+ export interface CodeResultEvent {
62
+ type: EventType.CODE_RESULT;
63
+ result: CodeExecutionResult;
64
+ }
65
+ /**
66
+ * Represents a runtime error.
67
+ */
68
+ export interface ErrorEvent {
69
+ type: EventType.ERROR;
70
+ error: Error;
71
+ }
72
+ /**
73
+ * Represents a generic activity or status update.
74
+ */
75
+ export interface ActivityEvent {
76
+ type: EventType.ACTIVITY;
77
+ kind: string;
78
+ detail: Record<string, unknown>;
79
+ }
80
+ /**
81
+ * Represents a request for tool confirmation.
82
+ */
83
+ export interface ToolConfirmationEvent {
84
+ type: EventType.TOOL_CONFIRMATION;
85
+ confirmations: Record<string, unknown>;
86
+ }
87
+ /**
88
+ * Represents the final completion of the agent's task.
89
+ */
90
+ export interface FinishedEvent {
91
+ type: EventType.FINISHED;
92
+ output?: unknown;
93
+ }
94
+ /**
95
+ * A standard structured event parsed from the raw Event stream.
96
+ */
97
+ export type StructuredEvent = ThoughtEvent | ContentEvent | ToolCallEvent | ToolResultEvent | CallCodeEvent | CodeResultEvent | ErrorEvent | ActivityEvent | ToolConfirmationEvent | FinishedEvent;
98
+ /**
99
+ * Converts an internal Event to a list of structured events.
100
+ * This is an optional utility for callers who want to easily identify
101
+ * the type of event they are handling.
102
+ *
103
+ * @param event - The raw event to convert.
104
+ * @returns The structured events.
105
+ */
106
+ export declare function toStructuredEvents(event: Event): StructuredEvent[];
@@ -3,10 +3,14 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ export { FileArtifactService } from './artifacts/file_artifact_service.js';
7
+ export { GcsArtifactService } from './artifacts/gcs_artifact_service.js';
8
+ export { getArtifactServiceFromUri } from './artifacts/registry.js';
6
9
  export * from './common.js';
10
+ export { DatabaseSessionService } from './sessions/database_session_service.js';
11
+ export { getSessionServiceFromUri } from './sessions/registry.js';
12
+ export * from './telemetry/google_cloud.js';
13
+ export * from './telemetry/setup.js';
7
14
  export * from './tools/mcp/mcp_session_manager.js';
8
15
  export * from './tools/mcp/mcp_tool.js';
9
16
  export * from './tools/mcp/mcp_toolset.js';
10
- export * from './artifacts/gcs_artifact_service.js';
11
- export * from './telemetry/setup.js';
12
- export * from './telemetry/google_cloud.js';
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { HttpOptions } from '@google/genai';
7
+ import { BaseLlmConnection } from './base_llm_connection.js';
8
+ import { Gemini, GeminiParams } from './google_llm.js';
9
+ import { LlmRequest } from './llm_request.js';
10
+ import { LlmResponse } from './llm_response.js';
11
+ export interface ApigeeLlmParams extends GeminiParams {
12
+ /**
13
+ * The name of the model to use. The model string specifies the LLM provider
14
+ * (e.g., Vertex AI, Gemini), API version, and the model ID. Supported format:
15
+ * `apigee/[<provider>/][<version>/]<model_id>`
16
+ * Components:
17
+ * `provider` (optional): `vertex_ai` or `gemini`.
18
+ * `version` (optional): The API version (e.g., `v1`, `v1beta`). If not
19
+ * provided, a default version will selected based on the provider.
20
+ * `model_id` (required): The model identifier (e.g.,
21
+ * `gemini-2.5-flash`).
22
+ * Examples:
23
+ * - `apigee/gemini-2.5-flash`
24
+ * - `apigee/v1/gemini-2.5-flash`
25
+ * - `apigee/vertex_ai/gemini-2.5-flash`
26
+ * - `apigee/gemini/v1/gemini-2.5-flash`
27
+ * - `apigee/vertex_ai/v1beta/gemini-2.5-flash`
28
+ */
29
+ model: string;
30
+ /**
31
+ * The proxy URL for the provider API. If not provided, it will look for
32
+ * the APIGEE_PROXY_URL environment variable.
33
+ */
34
+ proxyUrl?: string;
35
+ /**
36
+ * API key to use. If not provided, it will look for
37
+ * the GOOGLE_GENAI_API_KEY or GEMINI_API_KEY environment variable. If gemini
38
+ * provider is selected and no key is provided, the fake key "-" will be
39
+ * used for the "x-goog-api-key" header.
40
+ */
41
+ apiKey?: string;
42
+ }
43
+ export declare class ApigeeLlm extends Gemini {
44
+ private readonly proxyUrl;
45
+ /**
46
+ * A list of model name patterns that are supported by this LLM.
47
+ *
48
+ * @returns A list of supported models.
49
+ */
50
+ static readonly supportedModels: Array<string | RegExp>;
51
+ constructor({ model, proxyUrl, apiKey, vertexai, location, project, headers, }: ApigeeLlmParams);
52
+ protected getHttpOptions(): HttpOptions;
53
+ protected getLiveHttpOptions(): HttpOptions;
54
+ private identifyApiVersion;
55
+ private _apigeeLiveApiVersion?;
56
+ get liveApiVersion(): string;
57
+ generateContentAsync(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void>;
58
+ connect(llmRequest: LlmRequest): Promise<BaseLlmConnection>;
59
+ }
@@ -3,7 +3,7 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Content, Blob } from '@google/genai';
6
+ import { Blob, Content } from '@google/genai';
7
7
  import { LlmResponse } from './llm_response.js';
8
8
  /**
9
9
  * The base class for a live model connection.