@google/adk 2.2.1 → 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 (226) 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/agents/functions.js +199 -25
  5. package/dist/cjs/agents/instructions.js +4 -1
  6. package/dist/cjs/agents/invocation_context.js +26 -4
  7. package/dist/cjs/agents/langgraph_agent.js +152 -0
  8. package/dist/cjs/agents/llm_agent.js +175 -101
  9. package/dist/cjs/agents/processors/code_execution_request_processor.js +10 -6
  10. package/dist/cjs/agents/remote_agent.js +187 -0
  11. package/dist/cjs/artifacts/in_memory_artifact_service.js +14 -0
  12. package/dist/cjs/auth/auth_handler.js +37 -5
  13. package/dist/cjs/auth/auth_schemes.js +9 -0
  14. package/dist/cjs/cli/cli_eval.js +532 -0
  15. package/dist/cjs/cli/utils/envs.js +116 -0
  16. package/dist/cjs/cli/utils/evals.js +137 -0
  17. package/dist/cjs/cli/utils/logs.js +150 -0
  18. package/dist/cjs/code_executors/agent_engine_sandbox_code_executor.js +7 -2
  19. package/dist/cjs/code_executors/code_execution_utils.js +48 -16
  20. package/dist/cjs/code_executors/code_executor_context.js +6 -2
  21. package/dist/cjs/common.js +72 -0
  22. package/dist/cjs/context/summarizers/llm_summarizer.js +12 -10
  23. package/dist/cjs/context/token_based_context_compactor.js +2 -1
  24. package/dist/cjs/events/event.js +4 -2
  25. package/dist/cjs/examples/example_util.js +23 -2
  26. package/dist/cjs/flows/llm_flows/audio_transcriber.js +170 -0
  27. package/dist/cjs/index.js +97 -1
  28. package/dist/cjs/integrations/agent_registry/helpers.js +1 -1
  29. package/dist/cjs/models/gemini_llm_connection.js +16 -8
  30. package/dist/cjs/models/google_llm.js +13 -16
  31. package/dist/cjs/models/llm_response.js +9 -1
  32. package/dist/cjs/models/registry.js +1 -1
  33. package/dist/cjs/models/routed_llm.js +9 -8
  34. package/dist/cjs/planners/plan_re_act_planner.js +1 -1
  35. package/dist/cjs/runner/in_memory_runner.js +6 -11
  36. package/dist/cjs/runner/runner.js +105 -33
  37. package/dist/cjs/sessions/db/operations.js +1 -1
  38. package/dist/cjs/sessions/in_memory_session_service.js +3 -1
  39. package/dist/cjs/sessions/state.js +8 -4
  40. package/dist/cjs/sessions/vertex_ai_session_service.js +34 -15
  41. package/dist/cjs/telemetry/tracing.js +97 -66
  42. package/dist/cjs/tools/agent_tool.js +44 -0
  43. package/dist/cjs/tools/apihub_tool/apihub_toolset.js +142 -0
  44. package/dist/cjs/tools/apihub_tool/clients/apihub_client.js +272 -0
  45. package/dist/cjs/tools/apihub_tool/clients/secret_client.js +148 -0
  46. package/dist/cjs/tools/apihub_tool/clients/service_account.js +48 -0
  47. package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +185 -0
  48. package/dist/cjs/tools/application_integration_tool/clients/cloud_request.js +133 -0
  49. package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +603 -0
  50. package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +219 -0
  51. package/dist/cjs/tools/crewai_tool.js +132 -0
  52. package/dist/cjs/tools/example_tool.js +10 -0
  53. package/dist/cjs/tools/function_tool.js +319 -0
  54. package/dist/cjs/tools/google_api_tool/google_api_tool.js +97 -0
  55. package/dist/cjs/tools/google_api_tool/google_api_tool_set.js +226 -0
  56. package/dist/cjs/tools/google_api_tool/google_api_tool_sets.js +58 -0
  57. package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +440 -0
  58. package/dist/cjs/tools/google_api_tool/index.js +64 -0
  59. package/dist/cjs/tools/langchain_tool.js +172 -0
  60. package/dist/cjs/tools/mcp/index.js +12 -0
  61. package/dist/cjs/tools/mcp/mcp_session_manager.js +25 -0
  62. package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +1 -2
  63. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +46 -2
  64. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -1
  65. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
  66. package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +14 -2
  67. package/dist/cjs/tools/retrieval/base_retrieval_tool.js +18 -3
  68. package/dist/cjs/tools/toolbox_tool.js +108 -0
  69. package/dist/cjs/utils/env_aware_utils.js +6 -8
  70. package/dist/cjs/utils/error_utils.js +11 -11
  71. package/dist/cjs/utils/file_extension_utils.js +11 -0
  72. package/dist/cjs/utils/file_utils.js +2 -24
  73. package/dist/cjs/utils/gemini_schema_util.js +4 -1
  74. package/dist/cjs/utils/json_utils.js +49 -0
  75. package/dist/cjs/utils/live_connection_utils.js +4 -5
  76. package/dist/cjs/utils/logger_node.js +7 -1
  77. package/dist/cjs/utils/object_notation_utils.js +6 -3
  78. package/dist/cjs/utils/streaming_utils.js +12 -12
  79. package/dist/cjs/version.js +1 -1
  80. package/dist/esm/a2a/a2a_remote_agent.js +4 -1
  81. package/dist/esm/a2a/agent_card.js +103 -27
  82. package/dist/esm/a2a/agent_to_a2a.js +5 -2
  83. package/dist/esm/agents/functions.js +198 -25
  84. package/dist/esm/agents/instructions.js +4 -1
  85. package/dist/esm/agents/invocation_context.js +24 -4
  86. package/dist/esm/agents/langgraph_agent.js +123 -0
  87. package/dist/esm/agents/llm_agent.js +185 -104
  88. package/dist/esm/agents/processors/code_execution_request_processor.js +13 -8
  89. package/dist/esm/agents/remote_agent.js +164 -0
  90. package/dist/esm/artifacts/in_memory_artifact_service.js +14 -0
  91. package/dist/esm/auth/auth_handler.js +37 -5
  92. package/dist/esm/auth/auth_schemes.js +8 -0
  93. package/dist/esm/cli/cli_eval.js +510 -0
  94. package/dist/esm/cli/utils/envs.js +78 -0
  95. package/dist/esm/cli/utils/evals.js +109 -0
  96. package/dist/esm/cli/utils/logs.js +111 -0
  97. package/dist/esm/code_executors/agent_engine_sandbox_code_executor.js +7 -2
  98. package/dist/esm/code_executors/code_execution_utils.js +46 -16
  99. package/dist/esm/code_executors/code_executor_context.js +5 -2
  100. package/dist/esm/common.js +67 -3
  101. package/dist/esm/context/summarizers/llm_summarizer.js +12 -10
  102. package/dist/esm/context/token_based_context_compactor.js +2 -1
  103. package/dist/esm/events/event.js +4 -2
  104. package/dist/esm/examples/example_util.js +21 -1
  105. package/dist/esm/flows/llm_flows/audio_transcriber.js +142 -0
  106. package/dist/esm/index.js +99 -1
  107. package/dist/esm/integrations/agent_registry/helpers.js +1 -1
  108. package/dist/esm/models/gemini_llm_connection.js +16 -8
  109. package/dist/esm/models/google_llm.js +14 -17
  110. package/dist/esm/models/llm_response.js +9 -1
  111. package/dist/esm/models/registry.js +1 -1
  112. package/dist/esm/models/routed_llm.js +9 -8
  113. package/dist/esm/planners/plan_re_act_planner.js +1 -1
  114. package/dist/esm/runner/in_memory_runner.js +6 -11
  115. package/dist/esm/runner/runner.js +105 -33
  116. package/dist/esm/sessions/db/operations.js +1 -1
  117. package/dist/esm/sessions/in_memory_session_service.js +3 -1
  118. package/dist/esm/sessions/state.js +8 -4
  119. package/dist/esm/sessions/vertex_ai_session_service.js +34 -15
  120. package/dist/esm/telemetry/tracing.js +97 -66
  121. package/dist/esm/tools/agent_tool.js +44 -0
  122. package/dist/esm/tools/apihub_tool/apihub_toolset.js +106 -0
  123. package/dist/esm/tools/apihub_tool/clients/apihub_client.js +244 -0
  124. package/dist/esm/tools/apihub_tool/clients/secret_client.js +132 -0
  125. package/dist/esm/tools/apihub_tool/clients/service_account.js +21 -0
  126. package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +163 -0
  127. package/dist/esm/tools/application_integration_tool/clients/cloud_request.js +103 -0
  128. package/dist/esm/tools/application_integration_tool/clients/connections_client.js +561 -0
  129. package/dist/esm/tools/application_integration_tool/clients/integration_client.js +215 -0
  130. package/dist/esm/tools/crewai_tool.js +107 -0
  131. package/dist/esm/tools/example_tool.js +13 -1
  132. package/dist/esm/tools/function_tool.js +316 -0
  133. package/dist/esm/tools/google_api_tool/google_api_tool.js +70 -0
  134. package/dist/esm/tools/google_api_tool/google_api_tool_set.js +188 -0
  135. package/dist/esm/tools/google_api_tool/google_api_tool_sets.js +24 -0
  136. package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +393 -0
  137. package/dist/esm/tools/google_api_tool/index.js +33 -0
  138. package/dist/esm/tools/langchain_tool.js +148 -0
  139. package/dist/esm/tools/mcp/index.js +6 -0
  140. package/dist/esm/tools/mcp/mcp_session_manager.js +25 -0
  141. package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +1 -2
  142. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +50 -3
  143. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -1
  144. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
  145. package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +15 -2
  146. package/dist/esm/tools/retrieval/base_retrieval_tool.js +16 -2
  147. package/dist/esm/tools/toolbox_tool.js +80 -0
  148. package/dist/esm/utils/env_aware_utils.js +6 -8
  149. package/dist/esm/utils/error_utils.js +9 -10
  150. package/dist/esm/utils/file_extension_utils.js +11 -0
  151. package/dist/esm/utils/file_utils.js +2 -23
  152. package/dist/esm/utils/gemini_schema_util.js +4 -1
  153. package/dist/esm/utils/json_utils.js +21 -0
  154. package/dist/esm/utils/live_connection_utils.js +4 -5
  155. package/dist/esm/utils/logger_node.js +7 -1
  156. package/dist/esm/utils/object_notation_utils.js +4 -2
  157. package/dist/esm/utils/streaming_utils.js +11 -11
  158. package/dist/esm/version.js +1 -1
  159. package/dist/types/a2a/a2a_remote_agent.d.ts +9 -0
  160. package/dist/types/a2a/agent_card.d.ts +44 -1
  161. package/dist/types/a2a/agent_to_a2a.d.ts +9 -0
  162. package/dist/types/a2a/index.d.ts +1 -0
  163. package/dist/types/agents/functions.d.ts +33 -1
  164. package/dist/types/agents/invocation_context.d.ts +20 -1
  165. package/dist/types/agents/langgraph_agent.d.ts +153 -0
  166. package/dist/types/agents/remote_agent.d.ts +68 -0
  167. package/dist/types/auth/auth_handler.d.ts +28 -1
  168. package/dist/types/auth/auth_schemes.d.ts +13 -0
  169. package/dist/types/cli/cli_eval.d.ts +173 -0
  170. package/dist/types/cli/utils/envs.d.ts +23 -0
  171. package/dist/types/cli/utils/evals.d.ts +47 -0
  172. package/dist/types/cli/utils/logs.d.ts +38 -0
  173. package/dist/types/code_executors/code_execution_utils.d.ts +39 -0
  174. package/dist/types/code_executors/code_executor_context.d.ts +1 -0
  175. package/dist/types/common.d.ts +27 -4
  176. package/dist/types/events/event.d.ts +4 -0
  177. package/dist/types/examples/example_util.d.ts +17 -0
  178. package/dist/types/flows/llm_flows/audio_transcriber.d.ts +85 -0
  179. package/dist/types/index.d.ts +16 -1
  180. package/dist/types/models/gemini_llm_connection.d.ts +6 -7
  181. package/dist/types/models/routed_llm.d.ts +1 -1
  182. package/dist/types/runner/in_memory_runner.d.ts +2 -1
  183. package/dist/types/runner/runner.d.ts +34 -0
  184. package/dist/types/sessions/state.d.ts +5 -1
  185. package/dist/types/sessions/vertex_ai_session_service.d.ts +8 -0
  186. package/dist/types/skills/skill.d.ts +1 -1
  187. package/dist/types/telemetry/tracing.d.ts +4 -2
  188. package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +122 -0
  189. package/dist/types/tools/apihub_tool/clients/apihub_client.d.ts +142 -0
  190. package/dist/types/tools/apihub_tool/clients/secret_client.d.ts +55 -0
  191. package/dist/types/tools/apihub_tool/clients/service_account.d.ts +11 -0
  192. package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +86 -0
  193. package/dist/types/tools/application_integration_tool/clients/cloud_request.d.ts +53 -0
  194. package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +215 -0
  195. package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +72 -0
  196. package/dist/types/tools/crewai_tool.d.ts +85 -0
  197. package/dist/types/tools/example_tool.d.ts +10 -0
  198. package/dist/types/tools/function_tool.d.ts +32 -0
  199. package/dist/types/tools/google_api_tool/google_api_tool.d.ts +30 -0
  200. package/dist/types/tools/google_api_tool/google_api_tool_set.d.ts +78 -0
  201. package/dist/types/tools/google_api_tool/google_api_tool_sets.d.ts +33 -0
  202. package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +164 -0
  203. package/dist/types/tools/google_api_tool/index.d.ts +11 -0
  204. package/dist/types/tools/langchain_tool.d.ts +103 -0
  205. package/dist/types/tools/mcp/index.d.ts +3 -0
  206. package/dist/types/tools/mcp/mcp_session_manager.d.ts +34 -1
  207. package/dist/types/tools/mcp/mcp_toolset.d.ts +15 -0
  208. package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +19 -0
  209. package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +18 -1
  210. package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +2 -1
  211. package/dist/types/tools/retrieval/base_retrieval_tool.d.ts +15 -0
  212. package/dist/types/tools/toolbox_tool.d.ts +73 -0
  213. package/dist/types/utils/env_aware_utils.d.ts +18 -2
  214. package/dist/types/utils/error_utils.d.ts +7 -0
  215. package/dist/types/utils/file_utils.d.ts +6 -1
  216. package/dist/types/utils/gemini_schema_util.d.ts +1 -2
  217. package/dist/types/utils/json_utils.d.ts +11 -0
  218. package/dist/types/utils/object_notation_utils.d.ts +7 -0
  219. package/dist/types/utils/streaming_utils.d.ts +11 -4
  220. package/dist/types/version.d.ts +1 -1
  221. package/dist/web/index_web.js +102 -103
  222. package/dist/web/index_web.js.map +4 -4
  223. package/package.json +8 -3
  224. package/dist/cjs/models/gemini_continuation.js +0 -232
  225. package/dist/esm/models/gemini_continuation.js +0 -205
  226. package/dist/types/models/gemini_continuation.d.ts +0 -59
@@ -0,0 +1,164 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { OpenAPIV3 } from 'openapi-types';
7
+ /**
8
+ * Scope metadata in a Google API Discovery document.
9
+ */
10
+ export interface GoogleApiOAuth2Scope {
11
+ description?: string;
12
+ }
13
+ /**
14
+ * Parameter metadata in a Google API Discovery document.
15
+ */
16
+ export interface GoogleApiParameter {
17
+ type?: string;
18
+ description?: string;
19
+ required?: boolean;
20
+ location?: string;
21
+ format?: string;
22
+ enum?: string[];
23
+ default?: unknown;
24
+ pattern?: string;
25
+ minimum?: string;
26
+ maximum?: string;
27
+ }
28
+ /**
29
+ * Schema definition in a Google API Discovery document.
30
+ */
31
+ export interface GoogleApiSchema {
32
+ type?: string;
33
+ description?: string;
34
+ format?: string;
35
+ enum?: string[];
36
+ pattern?: string;
37
+ default?: unknown;
38
+ required?: boolean;
39
+ $ref?: string;
40
+ properties?: Record<string, GoogleApiSchema>;
41
+ items?: GoogleApiSchema;
42
+ minimum?: string;
43
+ maximum?: string;
44
+ location?: string;
45
+ }
46
+ /**
47
+ * Method definition in a Google API Discovery document.
48
+ */
49
+ export interface GoogleApiMethod {
50
+ id?: string;
51
+ path?: string;
52
+ httpMethod?: string;
53
+ description?: string;
54
+ parameters?: Record<string, GoogleApiParameter>;
55
+ request?: {
56
+ $ref?: string;
57
+ };
58
+ response?: {
59
+ $ref?: string;
60
+ };
61
+ scopes?: string[];
62
+ }
63
+ /**
64
+ * Resource definition in a Google API Discovery document.
65
+ */
66
+ export interface GoogleApiResource {
67
+ methods?: Record<string, GoogleApiMethod>;
68
+ resources?: Record<string, GoogleApiResource>;
69
+ }
70
+ /**
71
+ * Root structure of a Google API Discovery REST specification.
72
+ */
73
+ export interface GoogleApiSpec {
74
+ kind?: string;
75
+ id?: string;
76
+ name?: string;
77
+ version?: string;
78
+ title?: string;
79
+ description?: string;
80
+ documentationLink?: string;
81
+ protocol?: string;
82
+ rootUrl?: string;
83
+ servicePath?: string;
84
+ auth?: {
85
+ oauth2?: {
86
+ scopes?: Record<string, GoogleApiOAuth2Scope>;
87
+ };
88
+ };
89
+ schemas?: Record<string, GoogleApiSchema>;
90
+ resources?: Record<string, GoogleApiResource>;
91
+ methods?: Record<string, GoogleApiMethod>;
92
+ }
93
+ /**
94
+ * Converts a Google Discovery schema reference (`#Name` or `Name`) to an
95
+ * OpenAPI v3 component schema reference (`#/components/schemas/Name`).
96
+ */
97
+ export declare function normalizeGoogleSchemaRef(ref: string): string;
98
+ /**
99
+ * Populates the OpenAPI `info` and optional `externalDocs` sections from a
100
+ * Google API Discovery document.
101
+ */
102
+ export declare function convertInfo(googleApiSpec: GoogleApiSpec, openapiSpec: OpenAPIV3.Document, apiName: string, apiVersion: string): void;
103
+ /**
104
+ * Populates the OpenAPI `servers` list from the Google Discovery `rootUrl` and
105
+ * `servicePath`.
106
+ */
107
+ export declare function convertServers(googleApiSpec: GoogleApiSpec, openapiSpec: OpenAPIV3.Document, apiName: string, apiVersion: string): void;
108
+ /**
109
+ * Populates `components.securitySchemes` and top-level `security` from a
110
+ * Google API Discovery document.
111
+ */
112
+ export declare function convertSecuritySchemes(googleApiSpec: GoogleApiSpec, openapiSpec: OpenAPIV3.Document): void;
113
+ /**
114
+ * Recursively converts a Google API Discovery schema object to an OpenAPI v3
115
+ * schema or reference object.
116
+ */
117
+ export declare function convertSchemaObject(schemaDef: GoogleApiSchema): OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject;
118
+ /**
119
+ * Populates `components.schemas` from a Google API Discovery document.
120
+ */
121
+ export declare function convertSchemas(googleApiSpec: GoogleApiSpec, openapiSpec: OpenAPIV3.Document): void;
122
+ /**
123
+ * Extracts `{param}` and `{+param}` placeholder names from a URL path.
124
+ */
125
+ export declare function extractPathParameters(path: string): string[];
126
+ /**
127
+ * Converts a Google API parameter definition into an OpenAPI parameter schema.
128
+ */
129
+ export declare function convertParameterSchema(paramData: GoogleApiParameter): OpenAPIV3.SchemaObject;
130
+ /**
131
+ * Converts a Google API method definition into an OpenAPI operation object.
132
+ */
133
+ export declare function convertOperation(methodData: GoogleApiMethod, pathParams: string[]): OpenAPIV3.OperationObject;
134
+ /**
135
+ * Converts a dictionary of Google API methods into OpenAPI path operations.
136
+ */
137
+ export declare function convertMethods(methods: Record<string, GoogleApiMethod>, _resourcePath: string, openapiSpec: OpenAPIV3.Document): void;
138
+ /**
139
+ * Recursively converts nested Google API resources and their methods into
140
+ * OpenAPI paths.
141
+ */
142
+ export declare function convertResources(resources: Record<string, GoogleApiResource>, openapiSpec: OpenAPIV3.Document, parentPath?: string): void;
143
+ /**
144
+ * Converts Google API Discovery documents into OpenAPI v3.0.0 specifications.
145
+ */
146
+ export declare class GoogleApiToOpenApiConverter {
147
+ readonly apiName: string;
148
+ readonly apiVersion: string;
149
+ googleApiSpec: GoogleApiSpec | null;
150
+ openapiSpec: OpenAPIV3.Document;
151
+ constructor(apiName: string, apiVersion: string);
152
+ /**
153
+ * Fetches the Google API specification from the Google Discovery service.
154
+ */
155
+ fetchGoogleApiSpec(): Promise<void>;
156
+ /**
157
+ * Converts the Google API specification into OpenAPI v3 format.
158
+ */
159
+ convert(): Promise<OpenAPIV3.Document>;
160
+ /**
161
+ * Saves the converted OpenAPI specification to a JSON file.
162
+ */
163
+ saveOpenapiSpec(outputPath: string): void;
164
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export { GoogleApiTool, isGoogleApiTool } from './google_api_tool.js';
7
+ export { GoogleApiToolSet, isGoogleApiToolSet } from './google_api_tool_set.js';
8
+ export type { GoogleApiToolSetOptions, LoadToolSetWithOidcAuthOptions, } from './google_api_tool_set.js';
9
+ export { bigqueryToolSet, calendarToolSet, docsToolSet, gmailToolSet, sheetsToolSet, slidesToolSet, youtubeToolSet, } from './google_api_tool_sets.js';
10
+ export { GoogleApiToOpenApiConverter } from './googleapi_to_openapi_converter.js';
11
+ export type { GoogleApiMethod, GoogleApiOAuth2Scope, GoogleApiParameter, GoogleApiResource, GoogleApiSchema, GoogleApiSpec, } from './googleapi_to_openapi_converter.js';
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { FunctionDeclaration } from '@google/genai';
7
+ import { Context } from '../agents/context.js';
8
+ import { SchemaLike } from '../utils/schema.js';
9
+ import { FunctionTool, ToolInputParameters } from './function_tool.js';
10
+ /**
11
+ * Schema formats accepted on a wrapped LangChain tool.
12
+ */
13
+ export type LangchainSchemaLike = SchemaLike | {
14
+ jsonSchema: () => Record<string, unknown>;
15
+ } | {
16
+ modelJsonSchema: () => Record<string, unknown>;
17
+ } | Record<string, unknown>;
18
+ /**
19
+ * Structural interface for a LangChain tool instance.
20
+ */
21
+ export interface LangchainToolLike {
22
+ /**
23
+ * The name of the LangChain tool.
24
+ */
25
+ name?: string;
26
+ /**
27
+ * The description of the LangChain tool.
28
+ */
29
+ description?: string;
30
+ /**
31
+ * Optional parameter schema (`argsSchema`).
32
+ */
33
+ argsSchema?: LangchainSchemaLike;
34
+ /**
35
+ * Optional parameter schema (`StructuredTool.schema`).
36
+ */
37
+ schema?: LangchainSchemaLike;
38
+ /**
39
+ * Optional raw parameter properties map (`BaseTool.args`).
40
+ */
41
+ args?: Record<string, unknown>;
42
+ /**
43
+ * Executes the tool (`BaseTool._run`).
44
+ */
45
+ _run?(args: Record<string, unknown>, toolContext?: Context): unknown | Promise<unknown>;
46
+ /**
47
+ * Executes the tool (`StructuredTool._call`).
48
+ */
49
+ _call?(args: Record<string, unknown>, toolContext?: Context): unknown | Promise<unknown>;
50
+ /**
51
+ * Executes the tool (`Runnable.invoke`).
52
+ */
53
+ invoke?(args: Record<string, unknown>, toolContext?: Context): unknown | Promise<unknown>;
54
+ /**
55
+ * Executes a simple convention-based tool (`tool.run`).
56
+ */
57
+ run?(args: Record<string, unknown>, toolContext?: Context): unknown | Promise<unknown>;
58
+ }
59
+ /**
60
+ * Configuration options for {@link LangchainTool}.
61
+ */
62
+ export interface LangchainToolConfig {
63
+ /**
64
+ * The wrapped LangChain tool instance.
65
+ */
66
+ tool: LangchainToolLike;
67
+ /**
68
+ * Optional custom name override.
69
+ */
70
+ name?: string;
71
+ /**
72
+ * Optional custom description override.
73
+ */
74
+ description?: string;
75
+ }
76
+ declare const LANGCHAIN_TOOL_SIGNATURE_SYMBOL: unique symbol;
77
+ /**
78
+ * Type guard to check if an object is an instance of {@link LangchainTool}.
79
+ */
80
+ export declare function isLangchainTool(obj: unknown): obj is LangchainTool;
81
+ /**
82
+ * Wrapper class that adapts a LangChain tool for use in ADK.
83
+ *
84
+ * If the original tool name and description are not suitable, you can override
85
+ * them in the constructor.
86
+ */
87
+ export declare class LangchainTool extends FunctionTool<ToolInputParameters> {
88
+ /** A unique symbol to identify ADK LangchainTool class. */
89
+ readonly [LANGCHAIN_TOOL_SIGNATURE_SYMBOL] = true;
90
+ /**
91
+ * The wrapped LangChain tool.
92
+ */
93
+ readonly tool: LangchainToolLike;
94
+ constructor(toolOrConfig: LangchainToolConfig | LangchainToolLike, options?: {
95
+ name?: string;
96
+ description?: string;
97
+ });
98
+ /**
99
+ * Builds the `FunctionDeclaration` for the wrapped LangChain tool.
100
+ */
101
+ _getDeclaration(): FunctionDeclaration;
102
+ }
103
+ export {};
@@ -7,6 +7,9 @@
7
7
  * `@google/adk/tools/mcp` subpath: the MCP tools only, without the full ADK
8
8
  * barrel. Also re-exported from `@google/adk`.
9
9
  */
10
+ export { toGeminiSchema } from '../../utils/gemini_schema_util.js';
11
+ export type { MCPToolSchema } from '../../utils/gemini_schema_util.js';
12
+ export { genaiSchemaToJsonSchema } from '../../utils/genai_schema_to_json.js';
10
13
  export * from './load_mcp_resource_tool.js';
11
14
  export * from './mcp_session_manager.js';
12
15
  export * from './mcp_tool.js';
@@ -4,6 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
7
+ import type { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
7
8
  import type { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
8
9
  import type { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
9
10
  /**
@@ -40,10 +41,42 @@ export interface StreamableHTTPConnectionParams {
40
41
  terminateOnClose?: boolean;
41
42
  transportOptions?: StreamableHTTPClientTransportOptions;
42
43
  }
44
+ /**
45
+ * Defines the parameters for establishing a connection to an MCP server over
46
+ * the HTTP+SSE transport.
47
+ *
48
+ * Usage:
49
+ * const connectionParams: SseConnectionParams = {
50
+ * type: 'SseConnectionParams',
51
+ * url: 'http://localhost:8090/sse'
52
+ * };
53
+ */
54
+ export interface SseConnectionParams {
55
+ type: 'SseConnectionParams';
56
+ url: string;
57
+ /**
58
+ * @deprecated
59
+ * Use transportOptions.requestInit.headers instead.
60
+ * This field will be ignored if transportOptions is provided even if no headers are specified in transportOptions.
61
+ */
62
+ header?: Record<string, unknown>;
63
+ /**
64
+ * HTTP headers to send with the SSE and POST requests when
65
+ * `transportOptions.requestInit` is not provided.
66
+ */
67
+ headers?: Record<string, unknown>;
68
+ timeout?: number;
69
+ sseReadTimeout?: number;
70
+ transportOptions?: SSEClientTransportOptions;
71
+ }
72
+ /**
73
+ * Alias for {@link SseConnectionParams}.
74
+ */
75
+ export type SseServerParams = SseConnectionParams;
43
76
  /**
44
77
  * A union of all supported MCP connection parameter types.
45
78
  */
46
- export type MCPConnectionParams = StdioConnectionParams | StreamableHTTPConnectionParams;
79
+ export type MCPConnectionParams = StdioConnectionParams | SseConnectionParams | StreamableHTTPConnectionParams;
47
80
  /**
48
81
  * Manages Model Context Protocol (MCP) client sessions.
49
82
  *
@@ -8,6 +8,7 @@ import { ReadonlyContext } from '../../agents/readonly_context.js';
8
8
  import { BaseTool } from '../base_tool.js';
9
9
  import { BaseToolset, ToolPredicate } from '../base_toolset.js';
10
10
  import { MCPConnectionParams } from './mcp_session_manager.js';
11
+ export type { SseConnectionParams, SseServerParams, } from './mcp_session_manager.js';
11
12
  /**
12
13
  * A toolset that dynamically discovers and provides tools from a Model Context
13
14
  * Protocol (MCP) server.
@@ -37,6 +38,20 @@ import { MCPConnectionParams } from './mcp_session_manager.js';
37
38
  * const mcpToolset = new MCPToolset(connectionParams);
38
39
  * const tools = await mcpToolset.getTools();
39
40
  * ```
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * import {MCPToolset} from '@google/adk';
45
+ * import type {SseConnectionParams} from '@google/adk';
46
+ *
47
+ * const sseParams: SseConnectionParams = {
48
+ * type: 'SseConnectionParams',
49
+ * url: 'http://localhost:8090/sse',
50
+ * };
51
+ *
52
+ * const sseToolset = new MCPToolset(sseParams);
53
+ * const sseTools = await sseToolset.getTools();
54
+ * ```
40
55
  */
41
56
  export declare class MCPToolset extends BaseToolset {
42
57
  private readonly mcpSessionManager;
@@ -12,6 +12,25 @@ import { ApiParameter } from '../openapi_spec_parser/operation_parser.js';
12
12
  * model-supplied.
13
13
  */
14
14
  export declare const INTERNAL_AUTH_PREFIX = "_auth_prefix_vaf_";
15
+ /**
16
+ * The client settings an application registers with an OpenID Connect
17
+ * provider.
18
+ */
19
+ export interface OpenIdConfig {
20
+ /** The client ID the provider issued to the application. */
21
+ clientId: string;
22
+ /** The provider's authorization endpoint. */
23
+ authUri: string;
24
+ /** The provider's token endpoint. */
25
+ tokenUri: string;
26
+ /** The client secret the provider issued to the application. */
27
+ clientSecret: string;
28
+ /**
29
+ * Where the provider sends the user after sign-in. When unset, the provider
30
+ * uses the redirect URI registered for the client.
31
+ */
32
+ redirectUri?: string;
33
+ }
15
34
  /**
16
35
  * Applies the given credential to the request headers and URL.
17
36
  *
@@ -31,13 +31,30 @@ export type CustomCredentialExchangers = Partial<Record<AuthCredentialTypes, Bas
31
31
  * });
32
32
  */
33
33
  export declare class AutoAuthCredentialExchanger implements BaseCredentialExchanger {
34
- private exchangers;
34
+ /**
35
+ * The exchanger used for each auth credential type.
36
+ *
37
+ * By default `OAUTH2` and `OPEN_ID_CONNECT` run
38
+ * {@link OAuth2CredentialExchanger} and convert any access token with
39
+ * {@link generateAuthToken}, and `SERVICE_ACCOUNT` maps to a
40
+ * {@link ServiceAccountCredentialExchanger}, with any custom exchangers from
41
+ * the constructor merged over them. The map is live: an entry added or
42
+ * replaced after construction is used by the next {@link exchange} call.
43
+ */
44
+ readonly exchangers: Map<AuthCredentialTypes, BaseCredentialExchanger>;
35
45
  /**
36
46
  * @param customExchangers - Optional exchangers that add to or override the
37
47
  * built-in ones. The key is the auth credential type; the value is the
38
48
  * exchanger instance to use for that type.
39
49
  */
40
50
  constructor(customExchangers?: CustomCredentialExchangers);
51
+ /**
52
+ * Exchanges the credential with the exchanger registered for its type.
53
+ *
54
+ * @returns The credential unchanged, with `wasExchanged: false`, when no
55
+ * exchanger is registered for its type. Otherwise the delegate's result,
56
+ * or `null` when there is no credential at all.
57
+ */
41
58
  exchange(params: {
42
59
  authScheme?: AuthScheme;
43
60
  authCredential: AuthCredential;
@@ -71,7 +71,8 @@ export declare class ToolAuthHandler {
71
71
  static fromToolContext(context: Context, authScheme?: AuthScheme, authCredential?: AuthCredential, options?: ToolAuthHandlerOptions): ToolAuthHandler;
72
72
  prepareAuthCredentials(): Promise<AuthPreparationResult>;
73
73
  /**
74
- * Exchanges `credential`, or returns `undefined` when the exchange failed.
74
+ * Exchanges `credential`, or returns `undefined` when the exchange failed or
75
+ * produced an interactive credential that still holds no token.
75
76
  *
76
77
  * An exchange failure is transient far more often than it is fatal, so it
77
78
  * becomes a `pending` result the client can resume from rather than an
@@ -5,6 +5,18 @@
5
5
  */
6
6
  import { FunctionDeclaration } from '@google/genai';
7
7
  import { BaseTool } from '../base_tool.js';
8
+ /**
9
+ * Unique symbol to identify `BaseRetrievalTool` classes.
10
+ * Defined once and shared by all `BaseRetrievalTool` instances.
11
+ */
12
+ declare const BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL: unique symbol;
13
+ /**
14
+ * Type guard to check if an object is an instance of `BaseRetrievalTool`.
15
+ *
16
+ * @param obj The object to check.
17
+ * @returns True if the object is an instance of `BaseRetrievalTool`, false otherwise.
18
+ */
19
+ export declare function isBaseRetrievalTool(obj: unknown): obj is BaseRetrievalTool;
8
20
  /**
9
21
  * The base class for tools that answer a single natural-language query by
10
22
  * retrieving text the framework fetches itself.
@@ -17,5 +29,8 @@ import { BaseTool } from '../base_tool.js';
17
29
  * `src/google/adk/tools/retrieval/base_retrieval_tool.py` at ref `v0.1.0`.
18
30
  */
19
31
  export declare abstract class BaseRetrievalTool extends BaseTool {
32
+ /** Unique symbol to identify `BaseRetrievalTool` class. */
33
+ readonly [BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL] = true;
20
34
  _getDeclaration(): FunctionDeclaration;
21
35
  }
36
+ export {};
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { LangchainTool, LangchainToolLike } from './langchain_tool.js';
7
+ /**
8
+ * Structural interface for a Toolbox client instance.
9
+ */
10
+ export interface ToolboxClientLike {
11
+ /**
12
+ * Loads a single tool by name (camelCase convention).
13
+ */
14
+ loadTool?: (toolName: string) => LangchainToolLike;
15
+ /**
16
+ * Loads a single tool by name (snake_case convention).
17
+ */
18
+ load_tool?: (toolName: string) => LangchainToolLike;
19
+ /**
20
+ * Loads a toolset by name (camelCase convention).
21
+ */
22
+ loadToolset?: (toolsetName: string) => LangchainToolLike[];
23
+ /**
24
+ * Loads a toolset by name (snake_case convention).
25
+ */
26
+ load_toolset?: (toolsetName: string) => LangchainToolLike[];
27
+ }
28
+ /**
29
+ * Configuration options for {@link ToolboxTool}.
30
+ */
31
+ export interface ToolboxToolOptions {
32
+ /**
33
+ * The URL of the Toolbox server.
34
+ */
35
+ url?: string;
36
+ /**
37
+ * Optional pre-configured Toolbox client instance.
38
+ */
39
+ client?: ToolboxClientLike;
40
+ }
41
+ declare const TOOLBOX_TOOL_SIGNATURE_SYMBOL: unique symbol;
42
+ /**
43
+ * Type guard to check if an object is an instance of {@link ToolboxTool}.
44
+ */
45
+ export declare function isToolboxTool(obj: unknown): obj is ToolboxTool;
46
+ /**
47
+ * Provides access to Toolbox tools and toolsets wrapped as {@link LangchainTool}
48
+ * instances.
49
+ */
50
+ export declare class ToolboxTool {
51
+ /** A unique symbol to identify ADK ToolboxTool class. */
52
+ readonly [TOOLBOX_TOOL_SIGNATURE_SYMBOL] = true;
53
+ /**
54
+ * The URL of the Toolbox server, if provided.
55
+ */
56
+ readonly url?: string;
57
+ /**
58
+ * The underlying Toolbox client.
59
+ */
60
+ readonly toolboxClient: ToolboxClientLike;
61
+ constructor(urlOrOptions: string | ToolboxToolOptions);
62
+ /**
63
+ * Loads a single tool from the Toolbox client and wraps it in a
64
+ * {@link LangchainTool}.
65
+ */
66
+ getTool(toolName: string): LangchainTool;
67
+ /**
68
+ * Loads a toolset from the Toolbox client and wraps each tool in a
69
+ * {@link LangchainTool}.
70
+ */
71
+ getToolset(toolsetName: string): LangchainTool[];
72
+ }
73
+ export {};
@@ -34,15 +34,31 @@ export declare function randomUUID(): string;
34
34
  /**
35
35
  * Encodes the given string or Uint8Array to base64.
36
36
  *
37
+ * `window.btoa` is byte-oriented and throws on any code unit above `U+00FF`,
38
+ * so a string is first encoded to UTF-8 bytes. Node's `Buffer` encodes a
39
+ * string as UTF-8 too, which keeps both environments on one contract and lets
40
+ * `base64Decode` round-trip its output.
41
+ *
37
42
  * @param data The data to encode.
38
43
  * @return The base64-encoded string.
39
44
  */
40
45
  export declare function base64Encode(data: string | Uint8Array): string;
41
46
  /**
42
- * Decodes the given base64 string to a string.
47
+ * Decodes the given base64 string to UTF-8 text.
48
+ *
49
+ * `window.atob` is byte-oriented: it returns a latin1 "binary string" with one
50
+ * code unit per decoded byte, so a multi-byte UTF-8 sequence surfaces as
51
+ * mojibake. Node's `Buffer` decodes the same bytes as UTF-8, so the browser
52
+ * branch recovers the bytes from `atob` and decodes them explicitly. That keeps
53
+ * both environments on the single contract `File.content` and
54
+ * `materializeFiles` already assume.
55
+ *
56
+ * `ignoreBOM` keeps a leading byte order mark as `U+FEFF`, which is what
57
+ * `Buffer` does. `TextDecoder` strips it by default, so a spreadsheet CSV
58
+ * exported as UTF-8 with a BOM would otherwise lose a character.
43
59
  *
44
60
  * @param data The base64-encoded string.
45
- * @return The decoded string.
61
+ * @return The decoded UTF-8 string.
46
62
  */
47
63
  export declare function base64Decode(data: string): string;
48
64
  /**
@@ -3,6 +3,13 @@
3
3
  * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Returns the plain, non-recursive message for a single thrown value.
8
+ *
9
+ * Reads `.message` from any object that carries a string `message` property,
10
+ * and falls back to `String(err)` for primitives and other values.
11
+ */
12
+ export declare function getErrorMessage(err: unknown): string;
6
13
  /**
7
14
  * Formats an arbitrary thrown value into a readable, root-cause message.
8
15
  *
@@ -17,5 +17,10 @@ import { File } from '../code_executors/code_execution_utils.js';
17
17
  * @param dir The directory to materialize the files into.
18
18
  */
19
19
  export declare function materializeFiles(files: File[], dir: string): Promise<File[]>;
20
- export declare const EXTENSION_TO_MIME_TYPE: Record<string, string>;
20
+ /**
21
+ * Guesses the MIME type of a file from its extension.
22
+ * @param filePath A file name or path.
23
+ * @returns The MIME type, or 'application/octet-stream' if the extension is
24
+ * unknown or absent.
25
+ */
21
26
  export declare function guessMimeType(filePath: string): string;
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { Schema } from '@google/genai';
7
- type MCPToolSchema = {
7
+ export type MCPToolSchema = {
8
8
  type: 'object';
9
9
  properties?: Record<string, unknown>;
10
10
  required?: string[];
@@ -23,4 +23,3 @@ export declare function toGeminiSchema(mcpSchema?: MCPToolSchema): Schema | unde
23
23
  * @throws {TypeError} If the input is neither an object nor nullish.
24
24
  */
25
25
  export declare function openApiSchemaToGeminiSchema(openApiSchema?: unknown): Schema | undefined;
26
- export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /** A JSON object keyed by string. */
7
+ export type JsonObject = Record<string, unknown>;
8
+ /** Narrows an arbitrary value to a plain JSON object (non-null, non-array). */
9
+ export declare function isJsonObject(value: unknown): value is JsonObject;
10
+ /** Returns `value` when it is a JSON object, or `{}` otherwise. */
11
+ export declare function toJsonObject(value: unknown): JsonObject;
@@ -19,3 +19,10 @@ export declare function toCamelCase(obj: unknown, preserveKeys?: string[]): unkn
19
19
  * @returns The object with snake_case keys.
20
20
  */
21
21
  export declare function toSnakeCase(obj: unknown, preserveKeys?: string[]): unknown;
22
+ /**
23
+ * Converts a camelCase, PascalCase, or hyphenated key to snake_case.
24
+ *
25
+ * @param key The key to convert.
26
+ * @returns The snake_case key.
27
+ */
28
+ export declare const toSnakeCaseKey: (key: string) => string;
@@ -5,14 +5,21 @@
5
5
  */
6
6
  import { GenerateContentResponse, Part } from '@google/genai';
7
7
  import { LlmResponse } from '../models/llm_response.js';
8
+ /** Options for {@link GeminiStreamingResponseAggregator}. */
9
+ export interface GeminiStreamingResponseAggregatorOptions {
10
+ /**
11
+ * Whether to flush parts as they arrive. Defaults to the
12
+ * PROGRESSIVE_SSE_STREAMING feature flag.
13
+ */
14
+ isProgressiveMode?: boolean;
15
+ }
8
16
  /**
9
- * Aggregates partial streaming responses.
17
+ * Aggregates partial Gemini streaming responses.
10
18
  *
11
19
  * It aggregates content from partial responses, and generates LlmResponses for
12
20
  * individual (partial) model responses, as well as for aggregated content.
13
21
  */
14
- export declare class StreamingResponseAggregator {
15
- private readonly isProgressiveMode;
22
+ export declare class GeminiStreamingResponseAggregator {
16
23
  private usageMetadata?;
17
24
  private groundingMetadata?;
18
25
  private citationMetadata?;
@@ -20,7 +27,7 @@ export declare class StreamingResponseAggregator {
20
27
  private finishReason?;
21
28
  private lastThoughtSignature;
22
29
  private readonly strategy;
23
- constructor(isProgressiveMode?: boolean);
30
+ constructor({ isProgressiveMode, }?: GeminiStreamingResponseAggregatorOptions);
24
31
  processResponse(response: GenerateContentResponse): AsyncGenerator<LlmResponse, void, void>;
25
32
  close(): LlmResponse | undefined;
26
33
  }