@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,72 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { JsonObject } from '../../../utils/json_utils.js';
7
+ import { ConnectorSpec } from './connections_client.js';
8
+ /** Options for {@link IntegrationClient}. */
9
+ export interface IntegrationClientOptions {
10
+ /** The Google Cloud project ID. */
11
+ project: string;
12
+ /** The Google Cloud location, such as `us-central1`. */
13
+ location: string;
14
+ /** The integration name. */
15
+ integration?: string;
16
+ /** The API trigger ID of the integration. */
17
+ trigger?: string;
18
+ /** The connection name. */
19
+ connection?: string;
20
+ /**
21
+ * Operations to expose, keyed by entity name, such as
22
+ * `{Issues: ['LIST', 'GET']}`. An empty list exposes every operation the
23
+ * entity supports.
24
+ */
25
+ entityOperations?: Record<string, string[]>;
26
+ /** Actions to expose. */
27
+ actions?: string[];
28
+ /**
29
+ * A service-account key, as a JSON string. When omitted, requests use
30
+ * Application Default Credentials.
31
+ */
32
+ serviceAccountJson?: string;
33
+ }
34
+ /**
35
+ * A client for Google Cloud Application Integration.
36
+ *
37
+ * It returns the OpenAPI spec of an integration API trigger, or builds one for
38
+ * the entity operations and actions of an Integration Connectors connection.
39
+ */
40
+ export declare class IntegrationClient {
41
+ private readonly project;
42
+ private readonly location;
43
+ private readonly integration?;
44
+ private readonly trigger?;
45
+ private readonly connection?;
46
+ private readonly entityOperations;
47
+ private readonly actions;
48
+ private readonly serviceAccountJson?;
49
+ private readonly tokenSource;
50
+ constructor(options: IntegrationClientOptions);
51
+ /**
52
+ * Fetches the OpenAPI spec Application Integration generates for the API
53
+ * trigger of the integration.
54
+ *
55
+ * @throws Error For a rejected request, a missing credential, or a response
56
+ * that carries no parseable spec.
57
+ */
58
+ getOpenApiSpecForIntegration(): Promise<JsonObject>;
59
+ /**
60
+ * Builds an OpenAPI spec for the entity operations and actions of the
61
+ * connection.
62
+ *
63
+ * Every operation becomes a POST to the `ExecuteConnection` integration,
64
+ * with a path fragment that keeps the paths distinct.
65
+ *
66
+ * @param toolName Prefix of every generated `operationId`.
67
+ * @param toolInstructions Text appended to every operation description.
68
+ * @throws Error When neither entity operations nor actions are configured,
69
+ * or an operation is not one of create, update, delete, list or get.
70
+ */
71
+ getOpenApiSpecForConnection(toolName?: string, toolInstructions?: string): Promise<ConnectorSpec>;
72
+ }
@@ -0,0 +1,85 @@
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 CrewAI tool.
12
+ */
13
+ export type CrewaiSchemaLike = SchemaLike | {
14
+ jsonSchema: () => Record<string, unknown>;
15
+ } | {
16
+ modelJsonSchema: () => Record<string, unknown>;
17
+ } | Record<string, unknown>;
18
+ /**
19
+ * Structural interface for a CrewAI tool instance.
20
+ */
21
+ export interface CrewaiToolLike {
22
+ /**
23
+ * The name of the CrewAI tool.
24
+ */
25
+ name?: string;
26
+ /**
27
+ * The description of the CrewAI tool.
28
+ */
29
+ description?: string;
30
+ /**
31
+ * Optional parameters schema for the tool.
32
+ */
33
+ argsSchema?: CrewaiSchemaLike;
34
+ /**
35
+ * Executes the CrewAI tool with the given arguments.
36
+ */
37
+ run(args: Record<string, unknown>, toolContext?: Context): unknown | Promise<unknown>;
38
+ }
39
+ /**
40
+ * Configuration options for {@link CrewaiTool}.
41
+ */
42
+ export interface CrewaiToolConfig {
43
+ /**
44
+ * The wrapped CrewAI tool instance.
45
+ */
46
+ tool: CrewaiToolLike;
47
+ /**
48
+ * Optional custom name override. When omitted or empty, defaults to
49
+ * `tool.name` with spaces replaced by underscores and lowercased.
50
+ */
51
+ name?: string;
52
+ /**
53
+ * Optional custom description override. When omitted or empty, defaults to
54
+ * `tool.description`.
55
+ */
56
+ description?: string;
57
+ }
58
+ declare const CREWAI_TOOL_SIGNATURE_SYMBOL: unique symbol;
59
+ /**
60
+ * Type guard to check if an object is an instance of {@link CrewaiTool}.
61
+ */
62
+ export declare function isCrewaiTool(obj: unknown): obj is CrewaiTool;
63
+ /**
64
+ * Wrapper class that adapts a CrewAI tool for use in ADK.
65
+ *
66
+ * If the original tool name and description are not suitable, you can override
67
+ * them in the constructor.
68
+ */
69
+ export declare class CrewaiTool extends FunctionTool<ToolInputParameters> {
70
+ /** A unique symbol to identify ADK CrewaiTool class. */
71
+ readonly [CREWAI_TOOL_SIGNATURE_SYMBOL] = true;
72
+ /**
73
+ * The wrapped CrewAI tool.
74
+ */
75
+ readonly tool: CrewaiToolLike;
76
+ constructor(toolOrConfig: CrewaiToolConfig | CrewaiToolLike, options?: {
77
+ name?: string;
78
+ description?: string;
79
+ });
80
+ /**
81
+ * Builds the `FunctionDeclaration` for the wrapped CrewAI tool.
82
+ */
83
+ _getDeclaration(): FunctionDeclaration;
84
+ }
85
+ export {};
@@ -12,9 +12,19 @@ import { BaseTool, RunAsyncToolRequest, ToolProcessLlmRequest } from './base_too
12
12
  * This tool is executed for each LLM request and is never called by the model;
13
13
  * it only mutates the outgoing request by appending few-shot instructions built
14
14
  * from the latest user query.
15
+ *
16
+ * The constructor checks `examples` at runtime, so a malformed value fails
17
+ * where it is supplied rather than on every later LLM request.
15
18
  */
16
19
  export declare class ExampleTool extends BaseTool {
20
+ /** The examples to add to the LLM request. */
17
21
  readonly examples: Example[] | BaseExampleProvider;
22
+ /**
23
+ * @param examples - A list of {@link Example}s, or a
24
+ * {@link BaseExampleProvider} that returns them for a query.
25
+ * @throws {InputValidationError} When `examples` is neither a
26
+ * {@link BaseExampleProvider} nor a list of well-formed examples.
27
+ */
18
28
  constructor(examples: Example[] | BaseExampleProvider);
19
29
  runAsync(_request: RunAsyncToolRequest): Promise<unknown>;
20
30
  processLlmRequest({ toolContext, llmRequest, }: ToolProcessLlmRequest): Promise<void>;
@@ -8,6 +8,8 @@ import { z as z3 } from 'zod/v3';
8
8
  import { z as z4 } from 'zod/v4';
9
9
  import { Context } from '../agents/context.js';
10
10
  import { BaseTool, RunAsyncToolRequest } from './base_tool.js';
11
+ import { InvocationContext } from '../agents/invocation_context.js';
12
+ import { SchemaLike } from '../utils/schema.js';
11
13
  /**
12
14
  * Input parameters of the function tool.
13
15
  */
@@ -59,6 +61,8 @@ export type ToolOptions<TParameters extends ToolInputParameters> = {
59
61
  name?: string;
60
62
  description: string;
61
63
  parameters?: TParameters;
64
+ /** Optional schema describing the tool's return value. */
65
+ response?: SchemaLike;
62
66
  execute: ToolExecuteFunction<TParameters>;
63
67
  isLongRunning?: boolean;
64
68
  /**
@@ -80,6 +84,14 @@ export type ToolOptions<TParameters extends ToolInputParameters> = {
80
84
  */
81
85
  requireConfirmation?: RequireConfirmation<TParameters>;
82
86
  };
87
+ /**
88
+ * The parameters for `_callLive`.
89
+ */
90
+ export interface CallLiveToolRequest {
91
+ args: Record<string, unknown>;
92
+ toolContext: Context;
93
+ invocationContext: InvocationContext;
94
+ }
83
95
  /**
84
96
  * A unique symbol to identify ADK agent classes.
85
97
  * Defined once and shared by all BaseTool instances.
@@ -114,6 +126,7 @@ export declare class FunctionTool<TParameters extends ToolInputParameters = unde
114
126
  readonly [FUNCTION_TOOL_SIGNATURE_SYMBOL] = true;
115
127
  private readonly execute;
116
128
  private readonly parameters?;
129
+ private readonly response?;
117
130
  private readonly requireConfirmation;
118
131
  /**
119
132
  * The constructor acts as the user-friendly factory.
@@ -136,6 +149,13 @@ export declare class FunctionTool<TParameters extends ToolInputParameters = unde
136
149
  * `parameters` schema rejects the arguments or `execute` throws.
137
150
  */
138
151
  runAsync(req: RunAsyncToolRequest): Promise<unknown>;
152
+ /**
153
+ * Invokes the tool in live streaming mode, injecting any active input stream
154
+ * from the invocation context and yielding items from the returned stream.
155
+ *
156
+ * @param req The live tool invocation request.
157
+ */
158
+ _callLive(req: CallLiveToolRequest): AsyncGenerator<unknown, void, void>;
139
159
  /**
140
160
  * Whether this call is gated on human approval — the static flag, or the
141
161
  * predicate evaluated against the validated arguments.
@@ -157,4 +177,16 @@ export declare class FunctionTool<TParameters extends ToolInputParameters = unde
157
177
  */
158
178
  private checkConfirmation;
159
179
  }
180
+ /**
181
+ * Builds a `FunctionDeclaration` from a normalized parameter schema.
182
+ */
183
+ export declare function buildFunctionDeclarationUtil(vertexai: boolean, name: string, description: string, func: unknown, beforeParamSchema: Record<string, unknown>): FunctionDeclaration;
184
+ /**
185
+ * Builds a `FunctionDeclaration` for a LangChain tool parameter map.
186
+ */
187
+ export declare function buildFunctionDeclarationForLangchain(vertexai: boolean, name: string, description: string, func: unknown, paramSchema: Record<string, unknown>): FunctionDeclaration;
188
+ /**
189
+ * Builds a `FunctionDeclaration` for a CrewAI tool parameter schema.
190
+ */
191
+ export declare function buildFunctionDeclarationForParamsForCrewai(vertexai: boolean, name: string, description: string, func: unknown, paramSchema: Record<string, unknown>): FunctionDeclaration;
160
192
  export {};
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { FunctionDeclaration } from '@google/genai';
7
+ import { BaseTool, RunAsyncToolRequest } from '../base_tool.js';
8
+ import { RestApiTool } from '../openapi_tool/rest_api_tool.js';
9
+ declare const GOOGLE_API_TOOL_SIGNATURE_SYMBOL: unique symbol;
10
+ /**
11
+ * Type guard to check if an object is an instance of {@link GoogleApiTool}.
12
+ */
13
+ export declare function isGoogleApiTool(obj: unknown): obj is GoogleApiTool;
14
+ /**
15
+ * Wraps a {@link RestApiTool} created from a Google API specification and adds
16
+ * helper methods for configuring Google OpenID Connect credentials.
17
+ */
18
+ export declare class GoogleApiTool extends BaseTool {
19
+ readonly [GOOGLE_API_TOOL_SIGNATURE_SYMBOL] = true;
20
+ readonly restApiTool: RestApiTool;
21
+ constructor(restApiTool: RestApiTool);
22
+ _getDeclaration(): FunctionDeclaration;
23
+ runAsync(request: RunAsyncToolRequest): Promise<unknown>;
24
+ /**
25
+ * Configures OpenID Connect OAuth2 client credentials on the underlying
26
+ * {@link RestApiTool}.
27
+ */
28
+ configureAuth(clientId: string, clientSecret: string): void;
29
+ }
30
+ export {};
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { OpenAPIV3 } from 'openapi-types';
7
+ import { ReadonlyContext } from '../../agents/readonly_context.js';
8
+ import { BaseToolset, ToolPredicate } from '../base_toolset.js';
9
+ import { OpenAPIToolset } from '../openapi_tool/openapi_toolset.js';
10
+ import { RestApiTool } from '../openapi_tool/rest_api_tool.js';
11
+ import { GoogleApiTool } from './google_api_tool.js';
12
+ declare const GOOGLE_API_TOOL_SET_SIGNATURE_SYMBOL: unique symbol;
13
+ /**
14
+ * Options for constructing a {@link GoogleApiToolSet}.
15
+ */
16
+ export interface GoogleApiToolSetOptions {
17
+ apiName?: string;
18
+ apiVersion?: string;
19
+ toolFilter?: ToolPredicate | string[];
20
+ }
21
+ /**
22
+ * Options for loading an {@link OpenAPIToolset} pre-configured with Google
23
+ * OpenID Connect endpoints.
24
+ */
25
+ export interface LoadToolSetWithOidcAuthOptions {
26
+ specFile?: string;
27
+ specDict?: OpenAPIV3.Document;
28
+ scopes?: string[];
29
+ callerDir?: string;
30
+ }
31
+ /**
32
+ * Type guard to check if an object is an instance of {@link GoogleApiToolSet}.
33
+ */
34
+ export declare function isGoogleApiToolSet(obj: unknown): obj is GoogleApiToolSet;
35
+ /**
36
+ * Toolset that wraps Google Discovery API operations as {@link GoogleApiTool}
37
+ * instances configured for Google OpenID Connect authentication.
38
+ */
39
+ export declare class GoogleApiToolSet extends BaseToolset {
40
+ readonly [GOOGLE_API_TOOL_SET_SIGNATURE_SYMBOL] = true;
41
+ readonly apiName?: string;
42
+ readonly apiVersion?: string;
43
+ private tools;
44
+ private toolsLoaded;
45
+ private loadingPromise?;
46
+ private pendingAuth?;
47
+ constructor(tools?: Array<RestApiTool | GoogleApiTool>, options?: GoogleApiToolSetOptions);
48
+ private ensureToolsLoaded;
49
+ /**
50
+ * Returns all tools in the toolset matching the active `toolFilter`.
51
+ */
52
+ getTools(context?: ReadonlyContext): Promise<GoogleApiTool[]>;
53
+ /**
54
+ * Finds a tool in the toolset by name.
55
+ */
56
+ getTool(toolName: string): Promise<GoogleApiTool | undefined>;
57
+ /**
58
+ * Configures OAuth2 client ID and secret across all tools in the toolset.
59
+ */
60
+ configureAuth(clientId: string, clientSecret: string): void;
61
+ close(): Promise<void>;
62
+ /**
63
+ * Builds an {@link OpenAPIToolset} from an OpenAPI specification dictionary
64
+ * or YAML/JSON file and configures it with Google's OpenID Connect endpoints.
65
+ */
66
+ static loadToolSetWithOidcAuth(options?: LoadToolSetWithOidcAuthOptions): OpenAPIToolset;
67
+ /**
68
+ * Fetches and converts a Google API Discovery document and returns a
69
+ * {@link GoogleApiToolSet} containing its operations.
70
+ */
71
+ static loadToolSet(apiName: string, apiVersion: string): Promise<GoogleApiToolSet>;
72
+ }
73
+ /**
74
+ * Creates a lazy-loaded {@link GoogleApiToolSet} singleton without triggering
75
+ * the `@experimental` class constructor warning at module import time.
76
+ */
77
+ export declare function createLazyGoogleApiToolSet(apiName: string, apiVersion: string): GoogleApiToolSet;
78
+ export {};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Pre-configured {@link GoogleApiToolSet} for the Google Calendar v3 API.
8
+ */
9
+ export declare const calendarToolSet: import("./google_api_tool_set.js").GoogleApiToolSet;
10
+ /**
11
+ * Pre-configured {@link GoogleApiToolSet} for the Google BigQuery v2 API.
12
+ */
13
+ export declare const bigqueryToolSet: import("./google_api_tool_set.js").GoogleApiToolSet;
14
+ /**
15
+ * Pre-configured {@link GoogleApiToolSet} for the Gmail v1 API.
16
+ */
17
+ export declare const gmailToolSet: import("./google_api_tool_set.js").GoogleApiToolSet;
18
+ /**
19
+ * Pre-configured {@link GoogleApiToolSet} for the YouTube Data v3 API.
20
+ */
21
+ export declare const youtubeToolSet: import("./google_api_tool_set.js").GoogleApiToolSet;
22
+ /**
23
+ * Pre-configured {@link GoogleApiToolSet} for the Google Slides v1 API.
24
+ */
25
+ export declare const slidesToolSet: import("./google_api_tool_set.js").GoogleApiToolSet;
26
+ /**
27
+ * Pre-configured {@link GoogleApiToolSet} for the Google Sheets v4 API.
28
+ */
29
+ export declare const sheetsToolSet: import("./google_api_tool_set.js").GoogleApiToolSet;
30
+ /**
31
+ * Pre-configured {@link GoogleApiToolSet} for the Google Docs v1 API.
32
+ */
33
+ export declare const docsToolSet: import("./google_api_tool_set.js").GoogleApiToolSet;
@@ -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';