@google/adk 0.3.0 → 0.5.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 (265) hide show
  1. package/dist/cjs/a2a/a2a_event.js +290 -0
  2. package/dist/cjs/a2a/event_converter_utils.js +201 -0
  3. package/dist/cjs/a2a/executor_context.js +53 -0
  4. package/dist/cjs/a2a/metadata_converter_utils.js +125 -0
  5. package/dist/cjs/a2a/part_converter_utils.js +212 -0
  6. package/dist/cjs/agents/active_streaming_tool.js +1 -1
  7. package/dist/cjs/agents/base_agent.js +6 -6
  8. package/dist/cjs/agents/content_processor_utils.js +1 -1
  9. package/dist/cjs/{tools/tool_context.js → agents/context.js} +71 -16
  10. package/dist/cjs/agents/functions.js +4 -3
  11. package/dist/cjs/agents/instructions.js +1 -1
  12. package/dist/cjs/agents/invocation_context.js +1 -1
  13. package/dist/cjs/agents/live_request_queue.js +1 -1
  14. package/dist/cjs/agents/llm_agent.js +76 -711
  15. package/dist/cjs/agents/loop_agent.js +1 -1
  16. package/dist/cjs/agents/parallel_agent.js +1 -1
  17. package/dist/cjs/agents/processors/agent_transfer_llm_request_processor.js +132 -0
  18. package/dist/cjs/agents/{base_llm_processor.js → processors/base_llm_processor.js} +1 -1
  19. package/dist/cjs/agents/processors/basic_llm_request_processor.js +68 -0
  20. package/dist/cjs/agents/processors/code_execution_request_processor.js +389 -0
  21. package/dist/cjs/agents/processors/content_request_processor.js +66 -0
  22. package/dist/cjs/agents/processors/identity_llm_request_processor.js +54 -0
  23. package/dist/cjs/agents/processors/instructions_llm_request_processor.js +85 -0
  24. package/dist/cjs/agents/processors/request_confirmation_llm_request_processor.js +165 -0
  25. package/dist/cjs/agents/readonly_context.js +13 -1
  26. package/dist/cjs/agents/run_config.js +2 -1
  27. package/dist/cjs/agents/sequential_agent.js +1 -1
  28. package/dist/cjs/agents/transcription_entry.js +1 -1
  29. package/dist/cjs/artifacts/base_artifact_service.js +1 -1
  30. package/dist/cjs/artifacts/file_artifact_service.js +491 -0
  31. package/dist/cjs/artifacts/gcs_artifact_service.js +127 -48
  32. package/dist/cjs/artifacts/in_memory_artifact_service.js +54 -6
  33. package/dist/cjs/artifacts/registry.js +55 -0
  34. package/dist/cjs/auth/auth_credential.js +1 -1
  35. package/dist/cjs/auth/auth_handler.js +1 -1
  36. package/dist/cjs/auth/auth_schemes.js +1 -1
  37. package/dist/cjs/auth/auth_tool.js +1 -1
  38. package/dist/cjs/auth/credential_service/base_credential_service.js +1 -1
  39. package/dist/cjs/auth/credential_service/in_memory_credential_service.js +1 -1
  40. package/dist/cjs/auth/exchanger/base_credential_exchanger.js +1 -1
  41. package/dist/cjs/auth/exchanger/credential_exchanger_registry.js +1 -1
  42. package/dist/cjs/code_executors/base_code_executor.js +1 -1
  43. package/dist/cjs/code_executors/built_in_code_executor.js +1 -1
  44. package/dist/cjs/code_executors/code_execution_utils.js +1 -1
  45. package/dist/cjs/code_executors/code_executor_context.js +1 -1
  46. package/dist/cjs/common.js +25 -8
  47. package/dist/cjs/events/event.js +33 -4
  48. package/dist/cjs/events/event_actions.js +2 -2
  49. package/dist/cjs/events/structured_events.js +105 -0
  50. package/dist/cjs/examples/base_example_provider.js +1 -1
  51. package/dist/cjs/examples/example.js +1 -1
  52. package/dist/cjs/examples/example_util.js +1 -1
  53. package/dist/cjs/index.js +24 -17
  54. package/dist/cjs/index.js.map +4 -4
  55. package/dist/cjs/index_web.js +1 -1
  56. package/dist/cjs/memory/base_memory_service.js +1 -1
  57. package/dist/cjs/memory/in_memory_memory_service.js +1 -1
  58. package/dist/cjs/memory/memory_entry.js +1 -1
  59. package/dist/cjs/models/apigee_llm.js +182 -0
  60. package/dist/cjs/models/base_llm.js +1 -1
  61. package/dist/cjs/models/base_llm_connection.js +1 -1
  62. package/dist/cjs/models/gemini_llm_connection.js +1 -1
  63. package/dist/cjs/models/google_llm.js +70 -51
  64. package/dist/cjs/models/llm_request.js +1 -1
  65. package/dist/cjs/models/llm_response.js +3 -1
  66. package/dist/cjs/models/registry.js +3 -1
  67. package/dist/cjs/plugins/base_plugin.js +2 -2
  68. package/dist/cjs/plugins/logging_plugin.js +1 -1
  69. package/dist/cjs/plugins/plugin_manager.js +1 -1
  70. package/dist/cjs/plugins/security_plugin.js +1 -1
  71. package/dist/cjs/runner/in_memory_runner.js +1 -1
  72. package/dist/cjs/runner/runner.js +33 -2
  73. package/dist/cjs/sessions/base_session_service.js +53 -3
  74. package/dist/cjs/sessions/database_session_service.js +367 -0
  75. package/dist/cjs/sessions/db/operations.js +126 -0
  76. package/dist/cjs/sessions/db/schema.js +204 -0
  77. package/dist/cjs/sessions/in_memory_session_service.js +24 -22
  78. package/dist/cjs/sessions/registry.js +49 -0
  79. package/dist/cjs/sessions/session.js +1 -1
  80. package/dist/cjs/sessions/state.js +1 -1
  81. package/dist/cjs/telemetry/google_cloud.js +1 -1
  82. package/dist/cjs/telemetry/setup.js +1 -1
  83. package/dist/cjs/telemetry/tracing.js +1 -1
  84. package/dist/cjs/tools/agent_tool.js +1 -1
  85. package/dist/cjs/tools/base_tool.js +4 -1
  86. package/dist/cjs/tools/base_toolset.js +14 -4
  87. package/dist/cjs/tools/exit_loop_tool.js +63 -0
  88. package/dist/cjs/tools/forwarding_artifact_service.js +17 -1
  89. package/dist/cjs/tools/function_tool.js +1 -1
  90. package/dist/cjs/tools/google_search_tool.js +1 -1
  91. package/dist/cjs/tools/long_running_tool.js +1 -1
  92. package/dist/cjs/tools/mcp/mcp_session_manager.js +1 -1
  93. package/dist/cjs/tools/mcp/mcp_tool.js +1 -1
  94. package/dist/cjs/tools/mcp/mcp_toolset.js +10 -6
  95. package/dist/cjs/tools/tool_confirmation.js +1 -1
  96. package/dist/cjs/utils/client_labels.js +1 -1
  97. package/dist/cjs/utils/env_aware_utils.js +10 -1
  98. package/dist/cjs/utils/gemini_schema_util.js +1 -1
  99. package/dist/cjs/utils/logger.js +62 -55
  100. package/dist/cjs/utils/model_name.js +1 -1
  101. package/dist/cjs/utils/object_notation_utils.js +78 -0
  102. package/dist/cjs/utils/simple_zod_to_json.js +1 -1
  103. package/dist/cjs/utils/variant_utils.js +3 -9
  104. package/dist/cjs/version.js +2 -2
  105. package/dist/esm/a2a/a2a_event.js +243 -0
  106. package/dist/esm/a2a/event_converter_utils.js +187 -0
  107. package/dist/esm/a2a/executor_context.js +23 -0
  108. package/dist/esm/a2a/metadata_converter_utils.js +90 -0
  109. package/dist/esm/a2a/part_converter_utils.js +175 -0
  110. package/dist/esm/agents/base_agent.js +5 -5
  111. package/dist/esm/{tools/tool_context.js → agents/context.js} +66 -11
  112. package/dist/esm/agents/functions.js +3 -2
  113. package/dist/esm/agents/llm_agent.js +69 -720
  114. package/dist/esm/agents/processors/agent_transfer_llm_request_processor.js +101 -0
  115. package/dist/esm/agents/processors/basic_llm_request_processor.js +37 -0
  116. package/dist/esm/agents/processors/code_execution_request_processor.js +363 -0
  117. package/dist/esm/agents/processors/content_request_processor.js +38 -0
  118. package/dist/esm/agents/processors/identity_llm_request_processor.js +23 -0
  119. package/dist/esm/agents/processors/instructions_llm_request_processor.js +54 -0
  120. package/dist/esm/agents/processors/request_confirmation_llm_request_processor.js +140 -0
  121. package/dist/esm/agents/readonly_context.js +12 -0
  122. package/dist/esm/agents/run_config.js +1 -0
  123. package/dist/esm/artifacts/file_artifact_service.js +451 -0
  124. package/dist/esm/artifacts/gcs_artifact_service.js +126 -47
  125. package/dist/esm/artifacts/in_memory_artifact_service.js +51 -4
  126. package/dist/esm/artifacts/registry.js +28 -0
  127. package/dist/esm/common.js +20 -10
  128. package/dist/esm/events/event.js +29 -2
  129. package/dist/esm/events/event_actions.js +1 -1
  130. package/dist/esm/events/structured_events.js +74 -0
  131. package/dist/esm/index.js +24 -17
  132. package/dist/esm/index.js.map +4 -4
  133. package/dist/esm/models/apigee_llm.js +152 -0
  134. package/dist/esm/models/google_llm.js +67 -49
  135. package/dist/esm/models/llm_response.js +2 -0
  136. package/dist/esm/models/registry.js +2 -0
  137. package/dist/esm/plugins/base_plugin.js +1 -1
  138. package/dist/esm/runner/runner.js +32 -1
  139. package/dist/esm/sessions/base_session_service.js +49 -1
  140. package/dist/esm/sessions/database_session_service.js +353 -0
  141. package/dist/esm/sessions/db/operations.js +111 -0
  142. package/dist/esm/sessions/db/schema.js +172 -0
  143. package/dist/esm/sessions/in_memory_session_service.js +23 -21
  144. package/dist/esm/sessions/registry.js +25 -0
  145. package/dist/esm/tools/base_tool.js +3 -0
  146. package/dist/esm/tools/base_toolset.js +11 -2
  147. package/dist/esm/tools/exit_loop_tool.js +32 -0
  148. package/dist/esm/tools/forwarding_artifact_service.js +16 -0
  149. package/dist/esm/tools/mcp/mcp_toolset.js +9 -5
  150. package/dist/esm/utils/env_aware_utils.js +8 -0
  151. package/dist/esm/utils/logger.js +51 -54
  152. package/dist/esm/utils/object_notation_utils.js +47 -0
  153. package/dist/esm/utils/variant_utils.js +1 -7
  154. package/dist/esm/version.js +1 -1
  155. package/dist/types/a2a/a2a_event.d.ts +122 -0
  156. package/dist/types/a2a/event_converter_utils.d.ts +20 -0
  157. package/dist/types/a2a/executor_context.d.ts +33 -0
  158. package/dist/types/a2a/metadata_converter_utils.d.ts +62 -0
  159. package/dist/types/a2a/part_converter_utils.d.ts +48 -0
  160. package/dist/types/agents/base_agent.d.ts +2 -2
  161. package/dist/types/{tools/tool_context.d.ts → agents/context.d.ts} +43 -8
  162. package/dist/types/agents/llm_agent.d.ts +19 -42
  163. package/dist/types/agents/processors/agent_transfer_llm_request_processor.d.ts +18 -0
  164. package/dist/types/agents/{base_llm_processor.d.ts → processors/base_llm_processor.d.ts} +4 -4
  165. package/dist/types/agents/processors/basic_llm_request_processor.d.ts +13 -0
  166. package/dist/types/agents/processors/code_execution_request_processor.d.ts +34 -0
  167. package/dist/types/agents/processors/content_request_processor.d.ts +13 -0
  168. package/dist/types/agents/processors/identity_llm_request_processor.d.ts +13 -0
  169. package/dist/types/agents/processors/instructions_llm_request_processor.d.ts +16 -0
  170. package/dist/types/agents/processors/request_confirmation_llm_request_processor.d.ts +13 -0
  171. package/dist/types/agents/readonly_context.d.ts +8 -0
  172. package/dist/types/agents/run_config.d.ts +6 -0
  173. package/dist/types/artifacts/base_artifact_service.d.ts +31 -0
  174. package/dist/types/artifacts/file_artifact_service.d.ts +43 -0
  175. package/dist/types/artifacts/gcs_artifact_service.d.ts +3 -1
  176. package/dist/types/artifacts/in_memory_artifact_service.d.ts +5 -2
  177. package/dist/types/artifacts/registry.d.ts +7 -0
  178. package/dist/types/auth/credential_service/base_credential_service.d.ts +3 -3
  179. package/dist/types/auth/credential_service/in_memory_credential_service.d.ts +3 -3
  180. package/dist/types/common.d.ts +15 -6
  181. package/dist/types/events/event.d.ts +15 -1
  182. package/dist/types/events/event_actions.d.ts +1 -1
  183. package/dist/types/events/structured_events.d.ts +106 -0
  184. package/dist/types/index.d.ts +5 -1
  185. package/dist/types/models/apigee_llm.d.ts +59 -0
  186. package/dist/types/models/google_llm.d.ts +5 -2
  187. package/dist/types/models/llm_response.d.ts +5 -1
  188. package/dist/types/plugins/base_plugin.d.ts +12 -13
  189. package/dist/types/plugins/logging_plugin.d.ts +9 -10
  190. package/dist/types/plugins/plugin_manager.d.ts +9 -10
  191. package/dist/types/plugins/security_plugin.d.ts +2 -2
  192. package/dist/types/runner/runner.d.ts +15 -0
  193. package/dist/types/sessions/base_session_service.d.ts +20 -0
  194. package/dist/types/sessions/database_session_service.d.ts +32 -0
  195. package/dist/types/sessions/db/operations.d.ts +29 -0
  196. package/dist/types/sessions/db/schema.d.ts +45 -0
  197. package/dist/types/sessions/in_memory_session_service.d.ts +4 -1
  198. package/dist/types/sessions/registry.d.ts +7 -0
  199. package/dist/types/tools/base_tool.d.ts +3 -3
  200. package/dist/types/tools/base_toolset.d.ts +12 -3
  201. package/dist/types/tools/exit_loop_tool.d.ts +24 -0
  202. package/dist/types/tools/forwarding_artifact_service.d.ts +5 -3
  203. package/dist/types/tools/function_tool.d.ts +2 -2
  204. package/dist/types/tools/mcp/mcp_toolset.d.ts +1 -1
  205. package/dist/types/utils/env_aware_utils.d.ts +7 -0
  206. package/dist/types/utils/logger.d.ts +5 -9
  207. package/dist/types/utils/object_notation_utils.d.ts +21 -0
  208. package/dist/types/version.d.ts +1 -1
  209. package/dist/web/a2a/a2a_event.js +243 -0
  210. package/dist/web/a2a/event_converter_utils.js +201 -0
  211. package/dist/web/a2a/executor_context.js +23 -0
  212. package/dist/web/a2a/metadata_converter_utils.js +107 -0
  213. package/dist/web/a2a/part_converter_utils.js +175 -0
  214. package/dist/web/agents/base_agent.js +5 -5
  215. package/dist/web/{tools/tool_context.js → agents/context.js} +66 -11
  216. package/dist/web/agents/functions.js +3 -2
  217. package/dist/web/agents/llm_agent.js +90 -717
  218. package/dist/web/agents/processors/agent_transfer_llm_request_processor.js +100 -0
  219. package/dist/web/agents/processors/basic_llm_request_processor.js +71 -0
  220. package/dist/web/agents/processors/code_execution_request_processor.js +365 -0
  221. package/dist/web/agents/processors/content_request_processor.js +56 -0
  222. package/dist/web/agents/processors/identity_llm_request_processor.js +41 -0
  223. package/dist/web/agents/processors/instructions_llm_request_processor.js +72 -0
  224. package/dist/web/agents/processors/request_confirmation_llm_request_processor.js +158 -0
  225. package/dist/web/agents/readonly_context.js +12 -0
  226. package/dist/web/agents/run_config.js +2 -1
  227. package/dist/web/artifacts/file_artifact_service.js +506 -0
  228. package/dist/web/artifacts/gcs_artifact_service.js +123 -46
  229. package/dist/web/artifacts/in_memory_artifact_service.js +51 -4
  230. package/dist/web/artifacts/registry.js +28 -0
  231. package/dist/web/common.js +20 -10
  232. package/dist/web/events/event.js +29 -2
  233. package/dist/web/events/event_actions.js +1 -1
  234. package/dist/web/events/structured_events.js +74 -0
  235. package/dist/web/index.js +7 -2
  236. package/dist/web/index.js.map +4 -4
  237. package/dist/web/models/apigee_llm.js +219 -0
  238. package/dist/web/models/google_llm.js +67 -46
  239. package/dist/web/models/llm_response.js +2 -0
  240. package/dist/web/models/registry.js +2 -0
  241. package/dist/web/plugins/base_plugin.js +1 -1
  242. package/dist/web/runner/runner.js +34 -1
  243. package/dist/web/sessions/base_session_service.js +49 -1
  244. package/dist/web/sessions/database_session_service.js +371 -0
  245. package/dist/web/sessions/db/operations.js +111 -0
  246. package/dist/web/sessions/db/schema.js +172 -0
  247. package/dist/web/sessions/in_memory_session_service.js +23 -21
  248. package/dist/web/sessions/registry.js +25 -0
  249. package/dist/web/tools/base_tool.js +3 -0
  250. package/dist/web/tools/base_toolset.js +11 -2
  251. package/dist/web/tools/exit_loop_tool.js +32 -0
  252. package/dist/web/tools/forwarding_artifact_service.js +16 -0
  253. package/dist/web/tools/mcp/mcp_toolset.js +27 -5
  254. package/dist/web/utils/env_aware_utils.js +8 -0
  255. package/dist/web/utils/logger.js +51 -54
  256. package/dist/web/utils/object_notation_utils.js +47 -0
  257. package/dist/web/utils/variant_utils.js +1 -7
  258. package/dist/web/version.js +1 -1
  259. package/package.json +13 -3
  260. package/dist/cjs/agents/callback_context.js +0 -101
  261. package/dist/esm/agents/callback_context.js +0 -71
  262. package/dist/types/agents/callback_context.d.ts +0 -42
  263. package/dist/web/agents/callback_context.js +0 -71
  264. /package/dist/esm/agents/{base_llm_processor.js → processors/base_llm_processor.js} +0 -0
  265. /package/dist/web/agents/{base_llm_processor.js → processors/base_llm_processor.js} +0 -0
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Event as AdkEvent } from '../events/event.js';
7
+ import { EventActions as AdkEventActions } from '../events/event_actions.js';
8
+ import { A2AEvent } from './a2a_event.js';
9
+ /**
10
+ * Keys for metadata that will be stored in A2A message metadata and related to ADK events.
11
+ */
12
+ export declare enum A2AMetadataKeys {
13
+ APP_NAME = "adk_app_name",
14
+ USER_ID = "adk_user_id",
15
+ SESSION_ID = "adk_session_id",
16
+ INVOCATION_ID = "adk_invocation_id",
17
+ AUTHOR = "adk_author",
18
+ BRANCH = "adk_branch",
19
+ DATA_PART_TYPE = "adk_type",
20
+ PARTIAL = "adk_partial",
21
+ ESCALATE = "adk_escalate",
22
+ TRANSFER_TO_AGENT = "adk_transfer_to_agent",
23
+ IS_LONG_RUNNING = "adk_is_long_running",
24
+ THOUGHT = "adk_thought",
25
+ ERROR_CODE = "adk_error_code",
26
+ ERROR_MESSAGE = "adk_error_message",
27
+ CITATION_METADATA = "adk_citation_metadata",
28
+ GROUNDING_METADATA = "adk_grounding_metadata",
29
+ USAGE_METADATA = "adk_usage_metadata",
30
+ CUSTOM_METADATA = "adk_custom_metadata"
31
+ }
32
+ /**
33
+ * Keys for metadata that will be stored in ADK event metadata and related to A2A messages.
34
+ */
35
+ export declare enum AdkMetadataKeys {
36
+ TASK_ID = "a2a:task_id",
37
+ CONTEXT_ID = "a2a:context_id"
38
+ }
39
+ /**
40
+ * Creates ADK Event metadata from an A2A Event.
41
+ */
42
+ export declare function getAdkEventMetadata(a2aEvent: A2AEvent): Record<string, unknown>;
43
+ /**
44
+ * Creates A2A Event metadata from an ADK Event.
45
+ */
46
+ export declare function getA2AEventMetadata(adkEvent: AdkEvent, { appName, userId, sessionId, }: {
47
+ appName: string;
48
+ userId: string;
49
+ sessionId: string;
50
+ }): Record<string, unknown>;
51
+ /**
52
+ * Creates A2A Session metadata from ADK Event invocation metadata.
53
+ */
54
+ export declare function getA2ASessionMetadata({ appName, userId, sessionId, }: {
55
+ appName: string;
56
+ userId: string;
57
+ sessionId: string;
58
+ }): Record<string, unknown>;
59
+ /**
60
+ * Creates A2A Event metadata from ADK Event actions.
61
+ */
62
+ export declare function getA2AEventMetadataFromActions(actions: AdkEventActions): Record<string, unknown>;
@@ -0,0 +1,48 @@
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, Message } from '@a2a-js/sdk';
7
+ import { Content as GenAIContent, 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
+ export declare function toGenAIContent(a2aMessage: Message): GenAIContent;
29
+ /**
30
+ * Converts an A2A Part to a GenAI Part.
31
+ */
32
+ export declare function toGenAIParts(a2aParts: A2APart[]): GenAIPart[];
33
+ /**
34
+ * Converts an A2A Part to a GenAI Part.
35
+ */
36
+ export declare function toGenAIPart(a2aPart: A2APart): GenAIPart;
37
+ /**
38
+ * Converts an A2A Text Part to a GenAI Part.
39
+ */
40
+ export declare function toGenAIPartText(a2aPart: A2ATextPart): GenAIPart;
41
+ /**
42
+ * Converts an A2A File Part to a GenAI Part.
43
+ */
44
+ export declare function toGenAIPartFile(a2aPart: A2AFilePart): GenAIPart;
45
+ /**
46
+ * Converts an A2A Data Part to a GenAI Part.
47
+ */
48
+ export declare function toGenAIPartData(a2aPart: A2ADataPart): GenAIPart;
@@ -5,12 +5,12 @@
5
5
  */
6
6
  import { Content } from '@google/genai';
7
7
  import { Event } from '../events/event.js';
8
- import { CallbackContext } from './callback_context.js';
8
+ import { Context } from './context.js';
9
9
  import { InvocationContext } from './invocation_context.js';
10
10
  /**
11
11
  * A single callback function for an agent.
12
12
  */
13
- export type SingleAgentCallback = (context: CallbackContext) => Promise<Content | undefined> | (Content | undefined);
13
+ export type SingleAgentCallback = (context: Context) => Promise<Content | undefined> | (Content | undefined);
14
14
  /**
15
15
  * Type for before agent callbacks, which can be a single callback or
16
16
  * an array of callbacks.
@@ -3,34 +3,69 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { CallbackContext } from '../agents/callback_context.js';
7
- import { InvocationContext } from '../agents/invocation_context.js';
6
+ import { Part } from '@google/genai';
8
7
  import { AuthCredential } from '../auth/auth_credential.js';
9
8
  import { AuthConfig } from '../auth/auth_tool.js';
10
9
  import { EventActions } from '../events/event_actions.js';
11
10
  import { SearchMemoryResponse } from '../memory/base_memory_service.js';
11
+ import { State } from '../sessions/state.js';
12
12
  import { ToolConfirmation } from '../tools/tool_confirmation.js';
13
- export declare class ToolContext extends CallbackContext {
13
+ import { InvocationContext } from './invocation_context.js';
14
+ import { ReadonlyContext } from './readonly_context.js';
15
+ /**
16
+ * The context of various callbacks within an agent run.
17
+ *
18
+ * This class provides the context for callbacks and tool invocations, including
19
+ * access to the invocation context, function call ID, event actions, and
20
+ * authentication response. It also provides methods for requesting credentials,
21
+ * retrieving authentication responses, loading and saving artifacts, and
22
+ * searching memory.
23
+ */
24
+ export declare class Context extends ReadonlyContext {
25
+ private readonly _state;
26
+ readonly eventActions: EventActions;
14
27
  readonly functionCallId?: string;
15
28
  toolConfirmation?: ToolConfirmation;
16
29
  /**
17
- * @param params.invocationContext The invocation context of the tool.
18
- * @param params.eventActions The event actions of the current tool call.
19
- * @param params.functionCallId The function call id of the current tool call.
30
+ * @param options The configuration options for the Context.
31
+ * @param options.invocationContext The invocation context.
32
+ * @param options.eventActions The event actions of the current call.
33
+ * @param options.functionCallId The function call id of the current tool call.
20
34
  * This id was returned in the function call event from LLM to identify a
21
35
  * function call. If LLM didn't return this id, ADK will assign one to it.
22
36
  * This id is used to map function call response to the original function
23
37
  * call.
24
- * @param params.toolConfirmation The tool confirmation of the current tool
38
+ * @param options.toolConfirmation The tool confirmation of the current tool
25
39
  * call.
26
40
  */
27
- constructor(params: {
41
+ constructor(options: {
28
42
  invocationContext: InvocationContext;
29
43
  eventActions?: EventActions;
30
44
  functionCallId?: string;
31
45
  toolConfirmation?: ToolConfirmation;
32
46
  });
47
+ /**
48
+ * The delta-aware state of the current session.
49
+ */
50
+ get state(): State;
33
51
  get actions(): EventActions;
52
+ /**
53
+ * Loads an artifact attached to the current session.
54
+ *
55
+ * @param filename The filename of the artifact.
56
+ * @param version The version of the artifact. If not provided, the latest
57
+ * version will be used.
58
+ * @return A promise that resolves to the loaded artifact.
59
+ */
60
+ loadArtifact(filename: string, version?: number): Promise<Part | undefined>;
61
+ /**
62
+ * Saves an artifact attached to the current session.
63
+ *
64
+ * @param filename The filename of the artifact.
65
+ * @param artifact The artifact to save.
66
+ * @return A promise that resolves to the version of the saved artifact.
67
+ */
68
+ saveArtifact(filename: string, artifact: Part): Promise<number>;
34
69
  requestCredential(authConfig: AuthConfig): void;
35
70
  /**
36
71
  * Gets the auth credential for the given auth config.
@@ -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';
@@ -13,12 +15,15 @@ import { LlmRequest } from '../models/llm_request.js';
13
15
  import { LlmResponse } from '../models/llm_response.js';
14
16
  import { BaseTool } from '../tools/base_tool.js';
15
17
  import { BaseToolset } from '../tools/base_toolset.js';
16
- import { ToolContext } from '../tools/tool_context.js';
18
+ import { Context } from './context.js';
17
19
  import { BaseAgent, BaseAgentConfig } from './base_agent.js';
18
- import { BaseLlmRequestProcessor, BaseLlmResponseProcessor } from './base_llm_processor.js';
19
- import { CallbackContext } from './callback_context.js';
20
+ import { BaseLlmRequestProcessor, BaseLlmResponseProcessor } from './processors/base_llm_processor.js';
20
21
  import { InvocationContext } from './invocation_context.js';
21
22
  import { ReadonlyContext } from './readonly_context.js';
23
+ /**
24
+ * Input/output schema type for agent.
25
+ */
26
+ export type LlmAgentSchema = z3.ZodObject<z3.ZodRawShape> | z4.ZodObject<z4.ZodRawShape> | Schema;
22
27
  /** An object that can provide an instruction string. */
23
28
  export type InstructionProvider = (context: ReadonlyContext) => string | Promise<string>;
24
29
  /**
@@ -30,7 +35,7 @@ export type InstructionProvider = (context: ReadonlyContext) => string | Promise
30
35
  * will be skipped and the provided content will be returned to user.
31
36
  */
32
37
  export type SingleBeforeModelCallback = (params: {
33
- context: CallbackContext;
38
+ context: Context;
34
39
  request: LlmRequest;
35
40
  }) => LlmResponse | undefined | Promise<LlmResponse | undefined>;
36
41
  /**
@@ -50,7 +55,7 @@ export type BeforeModelCallback = SingleBeforeModelCallback | SingleBeforeModelC
50
55
  * user.
51
56
  */
52
57
  export type SingleAfterModelCallback = (params: {
53
- context: CallbackContext;
58
+ context: Context;
54
59
  response: LlmResponse;
55
60
  }) => LlmResponse | undefined | Promise<LlmResponse | undefined>;
56
61
  /**
@@ -65,14 +70,14 @@ export type AfterModelCallback = SingleAfterModelCallback | SingleAfterModelCall
65
70
  *
66
71
  * @param params.tool The tool to be called.
67
72
  * @param params.args The arguments to the tool.
68
- * @param params.context ToolContext for the tool call.
73
+ * @param params.context Context for the tool call.
69
74
  * @returns The tool response. When present, the returned tool response will
70
75
  * be used and the framework will skip calling the actual tool.
71
76
  */
72
77
  export type SingleBeforeToolCallback = (params: {
73
78
  tool: BaseTool;
74
79
  args: Record<string, unknown>;
75
- context: ToolContext;
80
+ context: Context;
76
81
  }) => Record<string, unknown> | undefined | Promise<Record<string, unknown> | undefined>;
77
82
  /**
78
83
  * A single callback or a list of callbacks.
@@ -86,14 +91,14 @@ export type BeforeToolCallback = SingleBeforeToolCallback | SingleBeforeToolCall
86
91
  *
87
92
  * @param params.tool The tool to be called.
88
93
  * @param params.args The arguments to the tool.
89
- * @param params.context ToolContext for the tool call.
94
+ * @param params.context Context for the tool call.
90
95
  * @param params.response The response from the tool.
91
96
  * @returns When present, the returned record will be used as tool result.
92
97
  */
93
98
  export type SingleAfterToolCallback = (params: {
94
99
  tool: BaseTool;
95
100
  args: Record<string, unknown>;
96
- context: ToolContext;
101
+ context: Context;
97
102
  response: Record<string, unknown>;
98
103
  }) => Record<string, unknown> | undefined | Promise<Record<string, unknown> | undefined>;
99
104
  /**
@@ -159,15 +164,9 @@ export interface LlmAgentConfig extends BaseAgentConfig {
159
164
  */
160
165
  includeContents?: 'default' | 'none';
161
166
  /** 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;
167
+ inputSchema?: LlmAgentSchema;
168
+ /** The output schema when agent replies. */
169
+ outputSchema?: LlmAgentSchema;
171
170
  /**
172
171
  * The key in session state to store the output of the agent.
173
172
  *
@@ -205,28 +204,6 @@ export interface LlmAgentConfig extends BaseAgentConfig {
205
204
  */
206
205
  codeExecutor?: BaseCodeExecutor;
207
206
  }
208
- declare class RequestConfirmationLlmRequestProcessor extends BaseLlmRequestProcessor {
209
- /** Handles tool confirmation information to build the LLM request. */
210
- runAsync(invocationContext: InvocationContext): AsyncGenerator<Event, void, void>;
211
- }
212
- export declare const REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR: RequestConfirmationLlmRequestProcessor;
213
- /**
214
- * Processor for code execution responses.
215
- */
216
- declare class CodeExecutionResponseProcessor implements BaseLlmResponseProcessor {
217
- /**
218
- * Processes the LLM response asynchronously.
219
- *
220
- * @param invocationContext The invocation context
221
- * @param llmResponse The LLM response to process
222
- * @returns An async generator yielding events
223
- */
224
- runAsync(invocationContext: InvocationContext, llmResponse: LlmResponse): AsyncGenerator<Event, void, unknown>;
225
- }
226
- /**
227
- * The exported response processor instance.
228
- */
229
- export declare const responseProcessor: CodeExecutionResponseProcessor;
230
207
  /**
231
208
  * A unique symbol to identify ADK agent classes.
232
209
  * Defined once and shared by all LlmAgent instances.
@@ -360,9 +337,9 @@ export declare class LlmAgent extends BaseAgent {
360
337
  * @throws Error if the agent is not found.
361
338
  */
362
339
  private getAgentByName;
363
- private callLlmAsync;
340
+ protected callLlmAsync(invocationContext: InvocationContext, llmRequest: LlmRequest, modelResponseEvent: Event): AsyncGenerator<LlmResponse, void, void>;
364
341
  private handleBeforeModelCallback;
365
342
  private handleAfterModelCallback;
366
- private runAndHandleError;
343
+ protected runAndHandleError<T extends LlmResponse | Event>(responseGenerator: AsyncGenerator<T, void, void>, invocationContext: InvocationContext, llmRequest: LlmRequest, modelResponseEvent: Event): AsyncGenerator<T, void, void>;
367
344
  }
368
345
  export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Event } from '../../events/event.js';
7
+ import { LlmRequest } from '../../models/llm_request.js';
8
+ import { InvocationContext } from '../invocation_context.js';
9
+ import { BaseLlmRequestProcessor } from './base_llm_processor.js';
10
+ export declare class AgentTransferLlmRequestProcessor extends BaseLlmRequestProcessor {
11
+ private readonly toolName;
12
+ private readonly tool;
13
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
14
+ private buildTargetAgentsInfo;
15
+ private buildTargetAgentsInstructions;
16
+ private getTransferTargets;
17
+ }
18
+ export declare const AGENT_TRANSFER_LLM_REQUEST_PROCESSOR: AgentTransferLlmRequestProcessor;
@@ -3,10 +3,10 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { InvocationContext } from '../agents/invocation_context.js';
7
- import { Event } from '../events/event.js';
8
- import { LlmRequest } from '../models/llm_request.js';
9
- import { LlmResponse } from '../models/llm_response.js';
6
+ import { Event } from '../../events/event.js';
7
+ import { LlmRequest } from '../../models/llm_request.js';
8
+ import { LlmResponse } from '../../models/llm_response.js';
9
+ import { InvocationContext } from '../invocation_context.js';
10
10
  /**
11
11
  * Base class for LLM request processor.
12
12
  */
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Event } from '../../events/event.js';
7
+ import { LlmRequest } from '../../models/llm_request.js';
8
+ import { InvocationContext } from '../invocation_context.js';
9
+ import { BaseLlmRequestProcessor } from './base_llm_processor.js';
10
+ export declare class BasicLlmRequestProcessor extends BaseLlmRequestProcessor {
11
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
12
+ }
13
+ export declare const BASIC_LLM_REQUEST_PROCESSOR: BasicLlmRequestProcessor;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Event } from '../../events/event.js';
7
+ import { LlmRequest } from '../../models/llm_request.js';
8
+ import { LlmResponse } from '../../models/llm_response.js';
9
+ import { InvocationContext } from '../invocation_context.js';
10
+ import { BaseLlmRequestProcessor, BaseLlmResponseProcessor } from './base_llm_processor.js';
11
+ /**
12
+ * Processes code execution requests.
13
+ */
14
+ export declare class CodeExecutionRequestProcessor extends BaseLlmRequestProcessor {
15
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
16
+ }
17
+ /**
18
+ * Processor for code execution responses.
19
+ */
20
+ export declare class CodeExecutionResponseProcessor implements BaseLlmResponseProcessor {
21
+ /**
22
+ * Processes the LLM response asynchronously.
23
+ *
24
+ * @param invocationContext The invocation context
25
+ * @param llmResponse The LLM response to process
26
+ * @returns An async generator yielding events
27
+ */
28
+ runAsync(invocationContext: InvocationContext, llmResponse: LlmResponse): AsyncGenerator<Event, void, unknown>;
29
+ }
30
+ /**
31
+ * The exported response processor instance.
32
+ */
33
+ export declare const responseProcessor: CodeExecutionResponseProcessor;
34
+ export declare const CODE_EXECUTION_REQUEST_PROCESSOR: CodeExecutionRequestProcessor;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Event } from '../../events/event.js';
7
+ import { LlmRequest } from '../../models/llm_request.js';
8
+ import { InvocationContext } from '../invocation_context.js';
9
+ import { BaseLlmRequestProcessor } from './base_llm_processor.js';
10
+ export declare class ContentRequestProcessor implements BaseLlmRequestProcessor {
11
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
12
+ }
13
+ export declare const CONTENT_REQUEST_PROCESSOR: ContentRequestProcessor;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Event } from '../../events/event.js';
7
+ import { LlmRequest } from '../../models/llm_request.js';
8
+ import { InvocationContext } from '../invocation_context.js';
9
+ import { BaseLlmRequestProcessor } from './base_llm_processor.js';
10
+ export declare class IdentityLlmRequestProcessor extends BaseLlmRequestProcessor {
11
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, undefined>;
12
+ }
13
+ export declare const IDENTITY_LLM_REQUEST_PROCESSOR: IdentityLlmRequestProcessor;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Event } from '../../events/event.js';
7
+ import { LlmRequest } from '../../models/llm_request.js';
8
+ import { InvocationContext } from '../invocation_context.js';
9
+ import { BaseLlmRequestProcessor } from './base_llm_processor.js';
10
+ export declare class InstructionsLlmRequestProcessor extends BaseLlmRequestProcessor {
11
+ /**
12
+ * Handles instructions and global instructions for LLM flow.
13
+ */
14
+ runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
15
+ }
16
+ export declare const INSTRUCTIONS_LLM_REQUEST_PROCESSOR: InstructionsLlmRequestProcessor;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Event } from '../../events/event.js';
7
+ import { InvocationContext } from '../invocation_context.js';
8
+ import { BaseLlmRequestProcessor } from './base_llm_processor.js';
9
+ export declare class RequestConfirmationLlmRequestProcessor extends BaseLlmRequestProcessor {
10
+ /** Handles tool confirmation information to build the LLM request. */
11
+ runAsync(invocationContext: InvocationContext): AsyncGenerator<Event, void, void>;
12
+ }
13
+ export declare const REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR: RequestConfirmationLlmRequestProcessor;
@@ -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
16
  listArtifactKeys({ appName, userId, sessionId, }: ListArtifactKeysRequest): Promise<string[]>;
16
17
  deleteArtifact({ appName, userId, sessionId, filename, }: DeleteArtifactRequest): Promise<void>;
17
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
  }