@google/adk 2.2.0 → 2.3.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 (241) hide show
  1. package/dist/cjs/a2a/a2a_remote_agent.js +4 -1
  2. package/dist/cjs/a2a/agent_card.js +102 -26
  3. package/dist/cjs/a2a/agent_to_a2a.js +1 -1
  4. package/dist/cjs/a2a/event_converter_utils.js +5 -1
  5. package/dist/cjs/a2a/metadata_converter_utils.js +2 -1
  6. package/dist/cjs/agents/functions.js +199 -25
  7. package/dist/cjs/agents/instructions.js +4 -1
  8. package/dist/cjs/agents/invocation_context.js +26 -4
  9. package/dist/cjs/agents/langgraph_agent.js +152 -0
  10. package/dist/cjs/agents/llm_agent.js +175 -101
  11. package/dist/cjs/agents/processors/code_execution_request_processor.js +10 -6
  12. package/dist/cjs/agents/remote_agent.js +187 -0
  13. package/dist/cjs/artifacts/in_memory_artifact_service.js +14 -0
  14. package/dist/cjs/auth/auth_handler.js +37 -5
  15. package/dist/cjs/auth/auth_schemes.js +9 -0
  16. package/dist/cjs/cli/cli_eval.js +532 -0
  17. package/dist/cjs/cli/utils/envs.js +116 -0
  18. package/dist/cjs/cli/utils/evals.js +137 -0
  19. package/dist/cjs/cli/utils/logs.js +150 -0
  20. package/dist/cjs/code_executors/agent_engine_sandbox_code_executor.js +7 -2
  21. package/dist/cjs/code_executors/code_execution_utils.js +48 -16
  22. package/dist/cjs/code_executors/code_executor_context.js +6 -2
  23. package/dist/cjs/common.js +90 -0
  24. package/dist/cjs/context/summarizers/llm_summarizer.js +12 -10
  25. package/dist/cjs/context/token_based_context_compactor.js +2 -1
  26. package/dist/cjs/events/abort_events.js +135 -0
  27. package/dist/cjs/events/event.js +4 -2
  28. package/dist/cjs/events/internal_metadata.js +131 -0
  29. package/dist/cjs/examples/example_util.js +23 -2
  30. package/dist/cjs/flows/llm_flows/audio_transcriber.js +170 -0
  31. package/dist/cjs/index.js +97 -1
  32. package/dist/cjs/integrations/agent_registry/helpers.js +1 -1
  33. package/dist/cjs/models/gemini_llm_connection.js +16 -8
  34. package/dist/cjs/models/google_llm.js +13 -16
  35. package/dist/cjs/models/llm_response.js +9 -1
  36. package/dist/cjs/models/registry.js +1 -1
  37. package/dist/cjs/models/routed_llm.js +9 -8
  38. package/dist/cjs/planners/plan_re_act_planner.js +1 -1
  39. package/dist/cjs/plugins/debug_logging_plugin.js +653 -0
  40. package/dist/cjs/plugins/plugin_manager.js +1 -1
  41. package/dist/cjs/plugins/tool_call_integrity_plugin.js +364 -0
  42. package/dist/cjs/runner/in_memory_runner.js +6 -11
  43. package/dist/cjs/runner/runner.js +121 -35
  44. package/dist/cjs/sessions/db/operations.js +1 -1
  45. package/dist/cjs/sessions/in_memory_session_service.js +3 -1
  46. package/dist/cjs/sessions/state.js +8 -4
  47. package/dist/cjs/sessions/vertex_ai_session_service.js +34 -15
  48. package/dist/cjs/telemetry/tracing.js +97 -66
  49. package/dist/cjs/tools/agent_tool.js +44 -0
  50. package/dist/cjs/tools/apihub_tool/apihub_toolset.js +142 -0
  51. package/dist/cjs/tools/apihub_tool/clients/apihub_client.js +272 -0
  52. package/dist/cjs/tools/apihub_tool/clients/secret_client.js +148 -0
  53. package/dist/cjs/tools/apihub_tool/clients/service_account.js +48 -0
  54. package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +185 -0
  55. package/dist/cjs/tools/application_integration_tool/clients/cloud_request.js +133 -0
  56. package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +603 -0
  57. package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +219 -0
  58. package/dist/cjs/tools/crewai_tool.js +132 -0
  59. package/dist/cjs/tools/example_tool.js +10 -0
  60. package/dist/cjs/tools/function_tool.js +319 -0
  61. package/dist/cjs/tools/google_api_tool/google_api_tool.js +97 -0
  62. package/dist/cjs/tools/google_api_tool/google_api_tool_set.js +226 -0
  63. package/dist/cjs/tools/google_api_tool/google_api_tool_sets.js +58 -0
  64. package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +440 -0
  65. package/dist/cjs/tools/google_api_tool/index.js +64 -0
  66. package/dist/cjs/tools/langchain_tool.js +172 -0
  67. package/dist/cjs/tools/mcp/index.js +12 -0
  68. package/dist/cjs/tools/mcp/mcp_session_manager.js +25 -0
  69. package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +1 -2
  70. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +46 -2
  71. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -1
  72. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
  73. package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +14 -2
  74. package/dist/cjs/tools/retrieval/base_retrieval_tool.js +18 -3
  75. package/dist/cjs/tools/toolbox_tool.js +108 -0
  76. package/dist/cjs/utils/env_aware_utils.js +6 -8
  77. package/dist/cjs/utils/error_utils.js +11 -11
  78. package/dist/cjs/utils/file_extension_utils.js +11 -0
  79. package/dist/cjs/utils/file_utils.js +2 -24
  80. package/dist/cjs/utils/gemini_schema_util.js +4 -1
  81. package/dist/cjs/utils/json_utils.js +49 -0
  82. package/dist/cjs/utils/live_connection_utils.js +4 -5
  83. package/dist/cjs/utils/logger_node.js +7 -1
  84. package/dist/cjs/utils/object_notation_utils.js +6 -3
  85. package/dist/cjs/utils/streaming_utils.js +12 -12
  86. package/dist/cjs/version.js +1 -1
  87. package/dist/esm/a2a/a2a_remote_agent.js +4 -1
  88. package/dist/esm/a2a/agent_card.js +103 -27
  89. package/dist/esm/a2a/agent_to_a2a.js +5 -2
  90. package/dist/esm/a2a/event_converter_utils.js +5 -1
  91. package/dist/esm/a2a/metadata_converter_utils.js +2 -1
  92. package/dist/esm/agents/functions.js +198 -25
  93. package/dist/esm/agents/instructions.js +4 -1
  94. package/dist/esm/agents/invocation_context.js +24 -4
  95. package/dist/esm/agents/langgraph_agent.js +123 -0
  96. package/dist/esm/agents/llm_agent.js +185 -104
  97. package/dist/esm/agents/processors/code_execution_request_processor.js +13 -8
  98. package/dist/esm/agents/remote_agent.js +164 -0
  99. package/dist/esm/artifacts/in_memory_artifact_service.js +14 -0
  100. package/dist/esm/auth/auth_handler.js +37 -5
  101. package/dist/esm/auth/auth_schemes.js +8 -0
  102. package/dist/esm/cli/cli_eval.js +510 -0
  103. package/dist/esm/cli/utils/envs.js +78 -0
  104. package/dist/esm/cli/utils/evals.js +109 -0
  105. package/dist/esm/cli/utils/logs.js +111 -0
  106. package/dist/esm/code_executors/agent_engine_sandbox_code_executor.js +7 -2
  107. package/dist/esm/code_executors/code_execution_utils.js +46 -16
  108. package/dist/esm/code_executors/code_executor_context.js +5 -2
  109. package/dist/esm/common.js +87 -3
  110. package/dist/esm/context/summarizers/llm_summarizer.js +12 -10
  111. package/dist/esm/context/token_based_context_compactor.js +2 -1
  112. package/dist/esm/events/abort_events.js +110 -0
  113. package/dist/esm/events/event.js +4 -2
  114. package/dist/esm/events/internal_metadata.js +97 -0
  115. package/dist/esm/examples/example_util.js +21 -1
  116. package/dist/esm/flows/llm_flows/audio_transcriber.js +142 -0
  117. package/dist/esm/index.js +99 -1
  118. package/dist/esm/integrations/agent_registry/helpers.js +1 -1
  119. package/dist/esm/models/gemini_llm_connection.js +16 -8
  120. package/dist/esm/models/google_llm.js +14 -17
  121. package/dist/esm/models/llm_response.js +9 -1
  122. package/dist/esm/models/registry.js +1 -1
  123. package/dist/esm/models/routed_llm.js +9 -8
  124. package/dist/esm/planners/plan_re_act_planner.js +1 -1
  125. package/dist/esm/plugins/debug_logging_plugin.js +615 -0
  126. package/dist/esm/plugins/plugin_manager.js +1 -1
  127. package/dist/esm/plugins/tool_call_integrity_plugin.js +339 -0
  128. package/dist/esm/runner/in_memory_runner.js +6 -11
  129. package/dist/esm/runner/runner.js +124 -35
  130. package/dist/esm/sessions/db/operations.js +1 -1
  131. package/dist/esm/sessions/in_memory_session_service.js +3 -1
  132. package/dist/esm/sessions/state.js +8 -4
  133. package/dist/esm/sessions/vertex_ai_session_service.js +34 -15
  134. package/dist/esm/telemetry/tracing.js +97 -66
  135. package/dist/esm/tools/agent_tool.js +44 -0
  136. package/dist/esm/tools/apihub_tool/apihub_toolset.js +106 -0
  137. package/dist/esm/tools/apihub_tool/clients/apihub_client.js +244 -0
  138. package/dist/esm/tools/apihub_tool/clients/secret_client.js +132 -0
  139. package/dist/esm/tools/apihub_tool/clients/service_account.js +21 -0
  140. package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +163 -0
  141. package/dist/esm/tools/application_integration_tool/clients/cloud_request.js +103 -0
  142. package/dist/esm/tools/application_integration_tool/clients/connections_client.js +561 -0
  143. package/dist/esm/tools/application_integration_tool/clients/integration_client.js +215 -0
  144. package/dist/esm/tools/crewai_tool.js +107 -0
  145. package/dist/esm/tools/example_tool.js +13 -1
  146. package/dist/esm/tools/function_tool.js +316 -0
  147. package/dist/esm/tools/google_api_tool/google_api_tool.js +70 -0
  148. package/dist/esm/tools/google_api_tool/google_api_tool_set.js +188 -0
  149. package/dist/esm/tools/google_api_tool/google_api_tool_sets.js +24 -0
  150. package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +393 -0
  151. package/dist/esm/tools/google_api_tool/index.js +33 -0
  152. package/dist/esm/tools/langchain_tool.js +148 -0
  153. package/dist/esm/tools/mcp/index.js +6 -0
  154. package/dist/esm/tools/mcp/mcp_session_manager.js +25 -0
  155. package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +1 -2
  156. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +50 -3
  157. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -1
  158. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
  159. package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +15 -2
  160. package/dist/esm/tools/retrieval/base_retrieval_tool.js +16 -2
  161. package/dist/esm/tools/toolbox_tool.js +80 -0
  162. package/dist/esm/utils/env_aware_utils.js +6 -8
  163. package/dist/esm/utils/error_utils.js +9 -10
  164. package/dist/esm/utils/file_extension_utils.js +11 -0
  165. package/dist/esm/utils/file_utils.js +2 -23
  166. package/dist/esm/utils/gemini_schema_util.js +4 -1
  167. package/dist/esm/utils/json_utils.js +21 -0
  168. package/dist/esm/utils/live_connection_utils.js +4 -5
  169. package/dist/esm/utils/logger_node.js +7 -1
  170. package/dist/esm/utils/object_notation_utils.js +4 -2
  171. package/dist/esm/utils/streaming_utils.js +11 -11
  172. package/dist/esm/version.js +1 -1
  173. package/dist/types/a2a/a2a_remote_agent.d.ts +9 -0
  174. package/dist/types/a2a/agent_card.d.ts +44 -1
  175. package/dist/types/a2a/agent_to_a2a.d.ts +9 -0
  176. package/dist/types/a2a/index.d.ts +1 -0
  177. package/dist/types/agents/functions.d.ts +33 -1
  178. package/dist/types/agents/invocation_context.d.ts +20 -1
  179. package/dist/types/agents/langgraph_agent.d.ts +153 -0
  180. package/dist/types/agents/remote_agent.d.ts +68 -0
  181. package/dist/types/auth/auth_handler.d.ts +28 -1
  182. package/dist/types/auth/auth_schemes.d.ts +13 -0
  183. package/dist/types/cli/cli_eval.d.ts +173 -0
  184. package/dist/types/cli/utils/envs.d.ts +23 -0
  185. package/dist/types/cli/utils/evals.d.ts +47 -0
  186. package/dist/types/cli/utils/logs.d.ts +38 -0
  187. package/dist/types/code_executors/code_execution_utils.d.ts +39 -0
  188. package/dist/types/code_executors/code_executor_context.d.ts +1 -0
  189. package/dist/types/common.d.ts +30 -4
  190. package/dist/types/events/abort_events.d.ts +43 -0
  191. package/dist/types/events/event.d.ts +4 -0
  192. package/dist/types/events/internal_metadata.d.ts +78 -0
  193. package/dist/types/examples/example_util.d.ts +17 -0
  194. package/dist/types/flows/llm_flows/audio_transcriber.d.ts +85 -0
  195. package/dist/types/index.d.ts +16 -1
  196. package/dist/types/models/gemini_llm_connection.d.ts +6 -7
  197. package/dist/types/models/routed_llm.d.ts +1 -1
  198. package/dist/types/plugins/debug_logging_plugin.d.ts +157 -0
  199. package/dist/types/plugins/tool_call_integrity_plugin.d.ts +116 -0
  200. package/dist/types/runner/in_memory_runner.d.ts +2 -1
  201. package/dist/types/runner/runner.d.ts +34 -0
  202. package/dist/types/sessions/state.d.ts +5 -1
  203. package/dist/types/sessions/vertex_ai_session_service.d.ts +8 -0
  204. package/dist/types/skills/skill.d.ts +1 -1
  205. package/dist/types/telemetry/tracing.d.ts +4 -2
  206. package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +122 -0
  207. package/dist/types/tools/apihub_tool/clients/apihub_client.d.ts +142 -0
  208. package/dist/types/tools/apihub_tool/clients/secret_client.d.ts +55 -0
  209. package/dist/types/tools/apihub_tool/clients/service_account.d.ts +11 -0
  210. package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +86 -0
  211. package/dist/types/tools/application_integration_tool/clients/cloud_request.d.ts +53 -0
  212. package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +215 -0
  213. package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +72 -0
  214. package/dist/types/tools/crewai_tool.d.ts +85 -0
  215. package/dist/types/tools/example_tool.d.ts +10 -0
  216. package/dist/types/tools/function_tool.d.ts +32 -0
  217. package/dist/types/tools/google_api_tool/google_api_tool.d.ts +30 -0
  218. package/dist/types/tools/google_api_tool/google_api_tool_set.d.ts +78 -0
  219. package/dist/types/tools/google_api_tool/google_api_tool_sets.d.ts +33 -0
  220. package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +164 -0
  221. package/dist/types/tools/google_api_tool/index.d.ts +11 -0
  222. package/dist/types/tools/langchain_tool.d.ts +103 -0
  223. package/dist/types/tools/mcp/index.d.ts +3 -0
  224. package/dist/types/tools/mcp/mcp_session_manager.d.ts +34 -1
  225. package/dist/types/tools/mcp/mcp_toolset.d.ts +15 -0
  226. package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +19 -0
  227. package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +18 -1
  228. package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +2 -1
  229. package/dist/types/tools/retrieval/base_retrieval_tool.d.ts +15 -0
  230. package/dist/types/tools/toolbox_tool.d.ts +73 -0
  231. package/dist/types/utils/env_aware_utils.d.ts +18 -2
  232. package/dist/types/utils/error_utils.d.ts +7 -0
  233. package/dist/types/utils/file_utils.d.ts +6 -1
  234. package/dist/types/utils/gemini_schema_util.d.ts +1 -2
  235. package/dist/types/utils/json_utils.d.ts +11 -0
  236. package/dist/types/utils/object_notation_utils.d.ts +7 -0
  237. package/dist/types/utils/streaming_utils.d.ts +11 -4
  238. package/dist/types/version.d.ts +1 -1
  239. package/dist/web/index_web.js +105 -106
  240. package/dist/web/index_web.js.map +4 -4
  241. package/package.json +8 -3
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Content } from '@google/genai';
7
+ import { InvocationContext } from '../../agents/invocation_context.js';
8
+ /**
9
+ * Audio encoding values matching Google Cloud Speech-to-Text `AudioEncoding`.
10
+ */
11
+ export declare enum AudioEncoding {
12
+ ENCODING_UNSPECIFIED = 0,
13
+ LINEAR16 = 1
14
+ }
15
+ /**
16
+ * Configuration passed to a Speech-to-Text client `recognize` call.
17
+ */
18
+ export interface RecognitionConfig {
19
+ encoding: AudioEncoding | keyof typeof AudioEncoding | number;
20
+ sampleRateHertz: number;
21
+ languageCode: string;
22
+ }
23
+ /**
24
+ * Audio payload passed to a Speech-to-Text client `recognize` call.
25
+ */
26
+ export interface RecognitionAudio {
27
+ content: Uint8Array | string;
28
+ }
29
+ /**
30
+ * A single alternative hypothesis from a Speech-to-Text recognition result.
31
+ */
32
+ export interface SpeechRecognitionAlternative {
33
+ transcript?: string | null;
34
+ confidence?: number | null;
35
+ }
36
+ /**
37
+ * A single Speech-to-Text recognition result segment.
38
+ */
39
+ export interface SpeechRecognitionResult {
40
+ alternatives?: SpeechRecognitionAlternative[] | null;
41
+ }
42
+ /**
43
+ * Response returned by a Speech-to-Text client `recognize` call.
44
+ */
45
+ export interface RecognizeResponse {
46
+ results?: SpeechRecognitionResult[] | null;
47
+ }
48
+ /**
49
+ * Duck-typed interface compatible with `@google-cloud/speech`'s `SpeechClient`
50
+ * as well as lightweight test or browser speech recognition clients.
51
+ */
52
+ export interface SpeechClientLike {
53
+ recognize(request: {
54
+ config: RecognitionConfig;
55
+ audio: RecognitionAudio;
56
+ }): Promise<RecognizeResponse | [RecognizeResponse, ...unknown[]]> | RecognizeResponse | [RecognizeResponse, ...unknown[]];
57
+ }
58
+ /**
59
+ * Options for constructing an {@link AudioTranscriber}.
60
+ */
61
+ export interface AudioTranscriberOptions {
62
+ /**
63
+ * Pre-configured Speech-to-Text client used to transcribe bundled user audio.
64
+ */
65
+ client?: SpeechClientLike;
66
+ }
67
+ /**
68
+ * Transcribes cached audio entries in an {@link InvocationContext} into
69
+ * conversation `Content` objects.
70
+ */
71
+ export declare class AudioTranscriber {
72
+ client: SpeechClientLike;
73
+ constructor(optionsOrClient?: AudioTranscriberOptions | SpeechClientLike);
74
+ /**
75
+ * Bundles consecutive audio blobs from the same speaker in
76
+ * `invocationContext.transcriptionCache`, transcribes user audio bundles into
77
+ * text `Content` entries, preserves already-transcribed `Content`
78
+ * entries in order, clears `invocationContext.transcriptionCache`, and
79
+ * returns the resulting content list.
80
+ *
81
+ * @param invocationContext The invocation context holding `transcriptionCache`.
82
+ * @returns Ordered list of transcribed `Content` objects.
83
+ */
84
+ transcribeFile(invocationContext: InvocationContext): Promise<Content[]>;
85
+ }
@@ -20,6 +20,7 @@ export { VertexAiMemoryBankService } from './memory/vertex_ai_memory_bank_servic
20
20
  export type { VertexAiMemoryBankServiceOptions } from './memory/vertex_ai_memory_bank_service.js';
21
21
  export { VertexAiRagMemoryService } from './memory/vertex_ai_rag_memory_service.js';
22
22
  export type { VertexAiRagMemoryServiceOptions } from './memory/vertex_ai_rag_memory_service.js';
23
+ export { DebugLoggingPlugin, isDebugLoggingPlugin, } from './plugins/debug_logging_plugin.js';
23
24
  export { DatabaseSessionService } from './sessions/database_session_service.js';
24
25
  export { getSessionServiceFromUri } from './sessions/registry.js';
25
26
  export { VertexAiSessionService } from './sessions/vertex_ai_session_service.js';
@@ -27,13 +28,20 @@ export type { VertexAiCreateSessionRequest, VertexAiSessionServiceOptions, } fro
27
28
  export { GCPSkillRegistry } from './skills/gcp_skill_registry.js';
28
29
  export type { GCPSkillRegistryOptions } from './skills/gcp_skill_registry.js';
29
30
  export { loadAllSkillsInDir, loadSkillFromDir, loadSkillFromZipBuffer, validateSkillDir, } from './skills/loader.js';
31
+ export { APIHubToolset, type APIHubToolsetOptions, } from './tools/apihub_tool/apihub_toolset.js';
32
+ export { APIHubClient, type APIHubApi, type APIHubApiVersion, type APIHubClientOptions, type BaseAPIHubClient, } from './tools/apihub_tool/clients/apihub_client.js';
33
+ export { SecretManagerClient, type SecretManagerClientOptions, } from './tools/apihub_tool/clients/secret_client.js';
34
+ export { ApplicationIntegrationToolset, type ApplicationIntegrationToolsetOptions, } from './tools/application_integration_tool/application_integration_toolset.js';
35
+ export { actionRequest, actionResponse, ConnectionsClient, CONNECTOR_BASE_SPEC, connectorPayload, createOperation, createOperationRequest, deleteOperation, deleteOperationRequest, executeCustomQueryRequest, getActionOperation, getOperation, getOperationRequest, listOperation, listOperationRequest, updateOperation, updateOperationRequest, type ActionSchema, type ConnectionDetails, type ConnectionsClientOptions, type ConnectorSpec, type EntityOperationOptions, type EntitySchemaAndOperations, type EntitySchemaOperationOptions, type GetActionOperationOptions, } from './tools/application_integration_tool/clients/connections_client.js';
36
+ export { IntegrationClient, type IntegrationClientOptions, } from './tools/application_integration_tool/clients/integration_client.js';
30
37
  export { LOAD_WEB_PAGE, loadWebPage } from './tools/load_web_page.js';
31
38
  export type { LoadWebPageOptions } from './tools/load_web_page.js';
32
39
  export { credentialToParam, dictToAuthScheme, INTERNAL_AUTH_PREFIX, openidDictToSchemeCredential, openidUrlToSchemeCredential, serviceAccountDictToSchemeCredential, serviceAccountSchemeCredential, tokenToSchemeCredential, } from './tools/openapi_tool/auth/auth_helpers.js';
40
+ export type { OpenIdConfig } from './tools/openapi_tool/auth/auth_helpers.js';
33
41
  export { AutoAuthCredentialExchanger } from './tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js';
34
42
  export type { CustomCredentialExchangers } from './tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js';
35
43
  export { AuthCredentialMissingError, BaseAuthCredentialExchanger, } from './tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.js';
36
- export { exchangeCredential, OAuth2BearerExchanger, } from './tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js';
44
+ export { exchangeCredential, generateAuthToken, OAuth2BearerExchanger, } from './tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js';
37
45
  export { ServiceAccountCredentialExchanger } from './tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js';
38
46
  export { createApiParameter, generateParamDoc, generateReturnDoc, getTypeHint, } from './tools/openapi_tool/common/common.js';
39
47
  export type { ApiParameterInit } from './tools/openapi_tool/common/common.js';
@@ -52,7 +60,14 @@ export { LoadSkillResourceTool } from './tools/skill/load_skill_resource_tool.js
52
60
  export { RunSkillInlineScriptErrorCode, RunSkillInlineScriptTool, } from './tools/skill/run_skill_inline_script_tool.js';
53
61
  export { RunSkillScriptTool } from './tools/skill/run_skill_script_tool.js';
54
62
  export { SkillToolset } from './tools/skill/skill_toolset.js';
63
+ export type { JsonObject } from './utils/json_utils.js';
55
64
  export * from './integrations/agent_registry/agent_registry.js';
56
65
  export * from './telemetry/google_cloud.js';
57
66
  export * from './telemetry/setup.js';
67
+ export * from './tools/google_api_tool/index.js';
68
+ export { DEFAULT_CRITERIA, EVAL_SESSION_ID_PREFIX, EvalStatus, getEvaluationCriteriaOrDefault, getRootAgent, MISSING_EVAL_DEPENDENCIES_MESSAGE, parseAndGetEvalsToRun, RESPONSE_EVALUATION_SCORE_KEY, RESPONSE_MATCH_SCORE_KEY, runEvals, TOOL_TRAJECTORY_SCORE_KEY, tryGetResetFunc, } from './cli/cli_eval.js';
69
+ export type { AddSessionToEvalSetRequest, EvalEntry, EvalInitialSession, EvalMetric, EvalMetricResult, EvalResult, EvalSetItem, InvocationEvalMetricResult, RunEvalRequest, RunEvalResult, RunEvalsOptions, } from './cli/cli_eval.js';
70
+ export { loadDotenvForAgent, walkToRootUntilFound } from './cli/utils/envs.js';
71
+ export { LOGGING_FORMAT, logToStderr, logToTmpFolder } from './cli/utils/logs.js';
72
+ export type { LogToTmpFolderOptions } from './cli/utils/logs.js';
58
73
  export * from './tools/mcp/index.js';
@@ -11,6 +11,7 @@ export declare class GeminiLlmConnection implements BaseLlmConnection {
11
11
  private readonly geminiSession;
12
12
  private readonly modelVersion?;
13
13
  private readonly messageQueue?;
14
+ private messageIterator?;
14
15
  constructor(geminiSession: Session, modelVersion?: string | undefined, messageQueue?: AsyncIterable<LiveServerMessage> | undefined);
15
16
  /**
16
17
  * Sends the conversation history to the gemini model.
@@ -47,15 +48,13 @@ export declare class GeminiLlmConnection implements BaseLlmConnection {
47
48
  */
48
49
  sendActivityEnd(): Promise<void>;
49
50
  /**
50
- * Builds a full text response.
51
+ * Receives the model responses for one model turn.
51
52
  *
52
- * The text should not be partial and the returned LlmResponse is not be
53
- * partial.
53
+ * The generator ends after the message that completes the turn has been
54
+ * processed, or when the server closes the connection. Call `receive()`
55
+ * again to read the next turn; it continues from the next server message.
54
56
  *
55
- * @param text The text to be included in the response.
56
- * @param isThought Whether the text is a thought.
57
- * @param groundingMetadata The grounding metadata to include.
58
- * @returns An LlmResponse containing the full text.
57
+ * @returns A generator of the LlmResponses of one model turn.
59
58
  */
60
59
  receive(): AsyncGenerator<LlmResponse, void, void>;
61
60
  /**
@@ -28,7 +28,7 @@ export declare class RoutedLlm extends BaseLlm {
28
28
  /**
29
29
  * Generates content by delegating to the selected model.
30
30
  */
31
- generateContentAsync(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void>;
31
+ generateContentAsync(llmRequest: LlmRequest, stream?: boolean, abortSignal?: AbortSignal): AsyncGenerator<LlmResponse, void>;
32
32
  /**
33
33
  * Creates a live connection to the LLM by delegating to the selected model.
34
34
  * This live connection cannot be switched mid-stream, it is tied to the model
@@ -0,0 +1,157 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Content } from '@google/genai';
7
+ import { BaseAgent } from '../agents/base_agent.js';
8
+ import { Context } from '../agents/context.js';
9
+ import { InvocationContext } from '../agents/invocation_context.js';
10
+ import { Event } from '../events/event.js';
11
+ import { LlmRequest } from '../models/llm_request.js';
12
+ import { LlmResponse } from '../models/llm_response.js';
13
+ import { BaseTool } from '../tools/base_tool.js';
14
+ import { BasePlugin } from './base_plugin.js';
15
+ declare const DEBUG_LOGGING_PLUGIN_SYMBOL: unique symbol;
16
+ /**
17
+ * Options for configuring {@link DebugLoggingPlugin}.
18
+ */
19
+ export interface DebugLoggingPluginOptions {
20
+ /**
21
+ * The name of the plugin instance.
22
+ * @defaultValue 'debug_logging_plugin'
23
+ */
24
+ name?: string;
25
+ /**
26
+ * Path to the output YAML debug file.
27
+ * @defaultValue 'adk_debug.yaml'
28
+ */
29
+ outputPath?: string;
30
+ /**
31
+ * Whether to include a session state snapshot at the end of each invocation.
32
+ * @defaultValue true
33
+ */
34
+ includeSessionState?: boolean;
35
+ /**
36
+ * Whether to include full system instructions in LLM request logs.
37
+ * @defaultValue true
38
+ */
39
+ includeSystemInstruction?: boolean;
40
+ }
41
+ /**
42
+ * A single debug log entry recorded during an invocation.
43
+ */
44
+ export interface DebugEntry {
45
+ timestamp: string;
46
+ entry_type: string;
47
+ invocation_id?: string;
48
+ agent_name?: string;
49
+ data: Record<string, unknown>;
50
+ }
51
+ /**
52
+ * Per-invocation debug state written as a YAML document.
53
+ */
54
+ export interface InvocationDebugState {
55
+ invocation_id: string;
56
+ session_id: string;
57
+ app_name: string;
58
+ user_id?: string;
59
+ start_time: string;
60
+ entries: DebugEntry[];
61
+ }
62
+ /**
63
+ * Type guard to check if an object is an instance of {@link DebugLoggingPlugin}.
64
+ */
65
+ export declare function isDebugLoggingPlugin(obj: unknown): obj is DebugLoggingPlugin;
66
+ /**
67
+ * A plugin that captures complete debug information to a YAML file.
68
+ *
69
+ * This plugin records detailed interaction data including:
70
+ * - LLM requests (model, system instruction, contents, tools)
71
+ * - LLM responses (content, usage metadata, errors)
72
+ * - Function calls with arguments
73
+ * - Function responses with results
74
+ * - Events yielded from the runner
75
+ * - Session state at the end of each invocation
76
+ *
77
+ * Each invocation is appended to the output file as a separate YAML document
78
+ * (separated by `---`). Credentials, sensitive keys, `temp:`-scoped state keys,
79
+ * and armored private key blocks are automatically redacted to `[REDACTED]`.
80
+ */
81
+ export declare class DebugLoggingPlugin extends BasePlugin {
82
+ readonly [DEBUG_LOGGING_PLUGIN_SYMBOL] = true;
83
+ readonly outputPath: string;
84
+ readonly includeSessionState: boolean;
85
+ readonly includeSystemInstruction: boolean;
86
+ private readonly invocationStates;
87
+ private warnedAboutOutputMode;
88
+ constructor(options?: DebugLoggingPluginOptions);
89
+ /**
90
+ * Exposes active invocation states for testing and inspection.
91
+ */
92
+ getInvocationState(invocationId: string): InvocationDebugState | undefined;
93
+ private getTimestamp;
94
+ /**
95
+ * Serializes a Gemini `Content` object to a dictionary for YAML output.
96
+ */
97
+ serializeContent(content: Content | null | undefined): Record<string, unknown> | null;
98
+ /**
99
+ * Safely serializes an arbitrary value to a YAML/JSON-compatible format with
100
+ * credential, sensitive key, and private key redaction.
101
+ */
102
+ safeSerialize(obj: unknown, depth?: number): unknown;
103
+ private addEntry;
104
+ onUserMessageCallback({ invocationContext, userMessage, }: {
105
+ invocationContext: InvocationContext;
106
+ userMessage: Content;
107
+ }): Promise<Content | undefined>;
108
+ beforeRunCallback({ invocationContext, }: {
109
+ invocationContext: InvocationContext;
110
+ }): Promise<Content | undefined>;
111
+ onEventCallback({ invocationContext, event, }: {
112
+ invocationContext: InvocationContext;
113
+ event: Event;
114
+ }): Promise<Event | undefined>;
115
+ afterRunCallback({ invocationContext, }: {
116
+ invocationContext: InvocationContext;
117
+ }): Promise<void>;
118
+ beforeAgentCallback({ callbackContext, }: {
119
+ agent: BaseAgent;
120
+ callbackContext: Context;
121
+ }): Promise<Content | undefined>;
122
+ afterAgentCallback({ callbackContext, }: {
123
+ agent: BaseAgent;
124
+ callbackContext: Context;
125
+ }): Promise<Content | undefined>;
126
+ beforeModelCallback({ callbackContext, llmRequest, }: {
127
+ callbackContext: Context;
128
+ llmRequest: LlmRequest;
129
+ }): Promise<LlmResponse | undefined>;
130
+ afterModelCallback({ callbackContext, llmResponse, }: {
131
+ callbackContext: Context;
132
+ llmResponse: LlmResponse;
133
+ }): Promise<LlmResponse | undefined>;
134
+ onModelErrorCallback({ callbackContext, llmRequest, error, }: {
135
+ callbackContext: Context;
136
+ llmRequest: LlmRequest;
137
+ error: Error;
138
+ }): Promise<LlmResponse | undefined>;
139
+ beforeToolCallback({ tool, toolArgs, toolContext, }: {
140
+ tool: BaseTool;
141
+ toolArgs: Record<string, unknown>;
142
+ toolContext: Context;
143
+ }): Promise<Record<string, unknown> | undefined>;
144
+ afterToolCallback({ tool, toolContext, result, }: {
145
+ tool: BaseTool;
146
+ toolArgs: Record<string, unknown>;
147
+ toolContext: Context;
148
+ result: Record<string, unknown>;
149
+ }): Promise<Record<string, unknown> | undefined>;
150
+ onToolErrorCallback({ tool, toolArgs, toolContext, error, }: {
151
+ tool: BaseTool;
152
+ toolArgs: Record<string, unknown>;
153
+ toolContext: Context;
154
+ error: Error;
155
+ }): Promise<Record<string, unknown> | undefined>;
156
+ }
157
+ export {};
@@ -0,0 +1,116 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Optional HMAC integrity check for function calls stored in the session.
8
+ *
9
+ * Mirrors adk-python's `google.adk.plugins._tool_call_integrity_plugin`.
10
+ */
11
+ import { Content } from '@google/genai';
12
+ import { Context } from '../agents/context.js';
13
+ import { InvocationContext } from '../agents/invocation_context.js';
14
+ import { Event } from '../events/event.js';
15
+ import { BaseTool } from '../tools/base_tool.js';
16
+ import { BasePlugin } from './base_plugin.js';
17
+ /** `customMetadata` key holding `{functionCallId: stamp}`. */
18
+ export declare const TOOL_CALL_HMAC_METADATA_KEY = "__adk_internal_fc_hmac";
19
+ /** A function call in the session failed its integrity check. */
20
+ export declare class ToolCallIntegrityError extends Error {
21
+ constructor(message: string);
22
+ }
23
+ /** Options for {@link ToolCallIntegrityPlugin}. */
24
+ export interface ToolCallIntegrityPluginOptions {
25
+ /**
26
+ * The HMAC key, or a list of keys during rotation. The first key stamps new
27
+ * calls; every key is accepted when verifying.
28
+ */
29
+ secretKey: Uint8Array | readonly Uint8Array[];
30
+ /**
31
+ * Log a warning instead of throwing for function calls that have no stamp,
32
+ * such as calls stored before the plugin was installed. Such calls also run,
33
+ * so this reports tampering that removes a stamp but does not prevent it. A
34
+ * stamp that is present but wrong is always rejected. Defaults to `false`.
35
+ */
36
+ allowUnstampedCalls?: boolean;
37
+ /** The plugin name. Defaults to `'tool_call_integrity'`. */
38
+ name?: string;
39
+ }
40
+ /**
41
+ * Stamps function calls and verifies them before runs and tool calls.
42
+ *
43
+ * `onEventCallback` adds `"v1:" + HMAC-SHA256(key, payload)` for each function
44
+ * call to `event.customMetadata["__adk_internal_fc_hmac"]`, and throws
45
+ * {@link ToolCallIntegrityError} for a response that repeats a call ID before
46
+ * it is stored. `beforeRunCallback` recomputes the HMAC for every function call
47
+ * with an ID in the session history, answered or not, and throws when a stamp
48
+ * is wrong, malformed, repeated or left over from a call that no longer
49
+ * matches. `beforeToolCallback` lets a tool run only when every stored copy of
50
+ * its call verifies and the tool's name and arguments match one of them; it
51
+ * always refuses a call with no ID. Unstamped calls are rejected unless
52
+ * `allowUnstampedCalls` is set, in which case they are logged.
53
+ *
54
+ * Events without function calls are ignored. Events marked as restored are not
55
+ * verified, and their function calls are never executed. ADK marks events
56
+ * restored by `adk run --replay`, and {@link prepareRestoredEvent} marks events
57
+ * that your code copies. Anyone who can write to the session store can also
58
+ * set the marker, but `beforeToolCallback` still refuses those events' calls.
59
+ *
60
+ * `PluginManager` re-throws plugin errors as a generic `Error`; the
61
+ * {@link ToolCallIntegrityError} is its `cause`.
62
+ *
63
+ * Register this plugin before other plugins. `PluginManager` stops at the first
64
+ * `onEventCallback` that returns an event, and a later plugin must not change
65
+ * function calls or replace `customMetadata`.
66
+ *
67
+ * Requires the Web Crypto API (`globalThis.crypto.subtle`), available in
68
+ * browsers and in Node.js 19 and later.
69
+ *
70
+ * Example:
71
+ * ```typescript
72
+ * const plugin = new ToolCallIntegrityPlugin({secretKey: keyBytes});
73
+ * const app = {name: 'my_app', rootAgent: agent, plugins: [plugin]};
74
+ *
75
+ * // Key rotation: stamp with the new key, accept both.
76
+ * new ToolCallIntegrityPlugin({secretKey: [newKeyBytes, oldKeyBytes]});
77
+ * ```
78
+ */
79
+ export declare class ToolCallIntegrityPlugin extends BasePlugin {
80
+ private readonly keys;
81
+ private readonly allowUnstampedCalls;
82
+ private cryptoKeys?;
83
+ /**
84
+ * @throws {Error} If `secretKey` is empty or contains a key that is not
85
+ * non-empty bytes.
86
+ */
87
+ constructor(options: ToolCallIntegrityPluginOptions);
88
+ /**
89
+ * Returns a copy with internal metadata removed and marked as restored.
90
+ *
91
+ * Use it on events that your code copies into another session, so that the
92
+ * history passes the integrity check. The copy only keeps the history: its
93
+ * function calls are never executed.
94
+ *
95
+ * @param event The event to copy. It is not modified.
96
+ * @returns The marked copy, ready to append to the new session.
97
+ */
98
+ static prepareRestoredEvent(event: Event): Event;
99
+ private getCryptoKeys;
100
+ private sign;
101
+ /** `subtle.verify` compares in constant time. */
102
+ private verify;
103
+ private unstamped;
104
+ onEventCallback({ invocationContext, event, }: {
105
+ invocationContext: InvocationContext;
106
+ event: Event;
107
+ }): Promise<Event | undefined>;
108
+ beforeRunCallback({ invocationContext, }: {
109
+ invocationContext: InvocationContext;
110
+ }): Promise<Content | undefined>;
111
+ beforeToolCallback({ tool, toolArgs, toolContext, }: {
112
+ tool: BaseTool;
113
+ toolArgs: Record<string, unknown>;
114
+ toolContext: Context;
115
+ }): Promise<Record<string, unknown> | undefined>;
116
+ }
@@ -34,7 +34,8 @@ export declare class InMemoryRunner extends Runner {
34
34
  * @param params The configuration for the runner.
35
35
  * @param params.app An optional application instance to run.
36
36
  * @param params.agent The root agent to run.
37
- * @param params.appName The application name. Defaults to `'InMemoryRunner'`.
37
+ * @param params.appName The application name. Defaults to `app.name` when
38
+ * `app` is provided, or `'InMemoryRunner'` otherwise.
38
39
  * @param params.plugins An optional list of plugins.
39
40
  * @param params.resumabilityConfig An optional resumability configuration.
40
41
  */
@@ -65,6 +65,17 @@ export interface RunnerConfig {
65
65
  * An optional resumability configuration applied to the runner.
66
66
  */
67
67
  resumabilityConfig?: ResumabilityConfig;
68
+ /**
69
+ * Whether to create the session when `runAsync` is given a session id that
70
+ * does not exist. Defaults to `false`, which reports the missing session as
71
+ * an error instead.
72
+ *
73
+ * Enabling this trades a loud failure for a silent one: a caller that
74
+ * mistypes a session id gets a new empty conversation rather than an error.
75
+ * Turn it on only where the session id is a key the caller owns and a first
76
+ * use is expected to create it.
77
+ */
78
+ autoCreateSession?: boolean;
68
79
  }
69
80
  /**
70
81
  * A unique symbol to identify ADK agent classes.
@@ -116,12 +127,20 @@ export declare class Runner {
116
127
  readonly memoryService?: BaseMemoryService;
117
128
  readonly credentialService?: BaseCredentialService;
118
129
  readonly resumabilityConfig?: ResumabilityConfig;
130
+ readonly autoCreateSession: boolean;
119
131
  /**
120
132
  * Creates a new Runner instance.
121
133
  *
122
134
  * @param input The configuration for the runner.
123
135
  */
124
136
  constructor(input: RunnerConfig);
137
+ /**
138
+ * Looks the session up, creating it first when `autoCreateSession` is set.
139
+ *
140
+ * A runner with no `appName` cannot address a session, so it falls through to
141
+ * the plain lookup rather than creating one under an undefined app name.
142
+ */
143
+ private resolveSession;
125
144
  /**
126
145
  * Runs the agent with a new, ephemeral session.
127
146
  *
@@ -171,6 +190,21 @@ export declare class Runner {
171
190
  * plugins; there is nothing to lack if there is only one loop.
172
191
  */
173
192
  private runRoot;
193
+ /**
194
+ * Runs the on_event plugin callbacks on an event and appends the result to
195
+ * the session unless it is partial.
196
+ *
197
+ * @returns The event as streamed to the caller.
198
+ */
199
+ private processAndAppendEvent;
200
+ /**
201
+ * Seals an aborted invocation in session history: answers its dangling
202
+ * function calls with error responses, or records a plain abort event when
203
+ * there is nothing to answer.
204
+ *
205
+ * @returns The synthetic events after plugin processing and persistence.
206
+ */
207
+ private synthesizeAbortEvents;
174
208
  /**
175
209
  * Saves artifacts from the message parts and replaces the inline data with
176
210
  * a file name placeholder and optional file reference.
@@ -56,6 +56,9 @@ export declare class State {
56
56
  /**
57
57
  * Returns the value of the state dict for the given key.
58
58
  *
59
+ * Only keys the state holds itself are found. Names inherited from
60
+ * `Object.prototype`, such as `toString`, are treated as missing.
61
+ *
59
62
  * @param key The key to get the value for.
60
63
  * @param defaultValue The default value to return if the key is not found.
61
64
  * @return The value of the state for the given key, or the default value if
@@ -70,7 +73,8 @@ export declare class State {
70
73
  */
71
74
  set(key: string, value: unknown): void;
72
75
  /**
73
- * Whether the state has pending delta.
76
+ * Whether the state holds the given key, either as a stored value or as a
77
+ * pending delta. Names inherited from `Object.prototype` are not keys.
74
78
  */
75
79
  has(key: string): boolean;
76
80
  /**
@@ -20,7 +20,15 @@ export declare function isVertexAiConnectionString(uri?: string): boolean;
20
20
  */
21
21
  export declare function quoteFilterLiteral(value: string): string;
22
22
  export interface VertexAiSessionServiceOptions {
23
+ /**
24
+ * Google Cloud project ID. Defaults to `process.env.GOOGLE_CLOUD_PROJECT`
25
+ * unless `expressModeApiKey` is passed.
26
+ */
23
27
  projectId?: string;
28
+ /**
29
+ * Google Cloud location. Defaults to `process.env.GOOGLE_CLOUD_LOCATION`
30
+ * unless `expressModeApiKey` is passed.
31
+ */
24
32
  location?: string;
25
33
  agentEngineId?: string;
26
34
  expressModeApiKey?: string;
@@ -15,7 +15,7 @@ export declare const FrontmatterSchema: z.ZodPreprocess<z.ZodObject<{
15
15
  compatibility: z.ZodOptional<z.ZodString>;
16
16
  'allowed-tools': z.ZodOptional<z.ZodString>;
17
17
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
18
- }, z.core.$loose>>;
18
+ }, z.core.$loose>, unknown>;
19
19
  export interface Frontmatter {
20
20
  name: string;
21
21
  description: string;
@@ -63,16 +63,18 @@ export interface TraceToolCallParams {
63
63
  tool: BaseTool;
64
64
  args: Record<string, unknown>;
65
65
  functionResponseEvent: Event;
66
+ invocationContext: InvocationContext;
66
67
  }
67
68
  /**
68
69
  * Traces tool call.
69
70
  *
70
71
  * @param params The parameters object containing tool, args, and function response event.
71
72
  */
72
- export declare function traceToolCall({ tool, args, functionResponseEvent, }: TraceToolCallParams): void;
73
+ export declare function traceToolCall({ tool, args, functionResponseEvent, invocationContext, }: TraceToolCallParams): void;
73
74
  export interface TraceMergedToolCallsParams {
74
75
  responseEventId: string;
75
76
  functionResponseEvent: Event;
77
+ invocationContext: InvocationContext;
76
78
  }
77
79
  /**
78
80
  * Traces merged tool call events.
@@ -82,7 +84,7 @@ export interface TraceMergedToolCallsParams {
82
84
  *
83
85
  * @param params The parameters object containing response event ID and function response event.
84
86
  */
85
- export declare function traceMergedToolCalls({ responseEventId, functionResponseEvent, }: TraceMergedToolCallsParams): void;
87
+ export declare function traceMergedToolCalls({ responseEventId, functionResponseEvent, invocationContext, }: TraceMergedToolCallsParams): void;
86
88
  export interface TraceCallLlmParams {
87
89
  invocationContext: InvocationContext;
88
90
  eventId: string;